:root {
  color-scheme: dark;
  --black: #050505;
  --panel: #111113;
  --white: #f5f5f2;
  --muted: #9a9a96;
  --line: rgba(255,255,255,.16);
  --soft-line: rgba(255,255,255,.08);
  --sans: "Inter", sans-serif;
  --mono: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--black); scroll-behavior: smooth; }
body { margin: 0; background: var(--black); color: var(--white); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body::selection { background: var(--white); color: var(--black); }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img, video { display: block; max-width: 100%; }
.noise { position: fixed; z-index: 100; inset: 0; pointer-events: none; opacity: .018; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

.glass-header { position: fixed; z-index: 50; top: 16px; left: 50%; width: min(1040px, calc(100% - 32px)); height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 20px; transform: translateX(-50%); border: 1px solid rgba(255,255,255,.27); border-radius: 20px; background: rgba(5,5,5,.55); box-shadow: inset 0 1px rgba(255,255,255,.12), 0 18px 55px rgba(0,0,0,.28); }
.brand { min-width: 150px; height: 100%; display: flex; align-items: center; }
.brand img { width: 144px; max-height: 48px; object-fit: contain; object-position: left center; }
.brand-text, .footer-brand { color: var(--white); font: 700 14px var(--mono); letter-spacing: .13em; text-transform: uppercase; }
.site-nav { display: flex; align-items: center; gap: 2px; }
.site-nav a { padding: 12px 14px; border-radius: 11px; color: #aaa; font: 500 10px/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.site-nav a:hover, .site-nav a.active { background: rgba(255,255,255,.1); color: white; }
.mobile-menu { position: relative; display: none; }
.menu-toggle { width: 42px; height: 42px; border: 0; border-radius: 11px; background: rgba(255,255,255,.1); cursor: pointer; list-style: none; }
.menu-toggle span { display: block; width: 17px; height: 1px; margin: 5px auto; background: white; transition: .2s; }
body.menu-open { overflow: hidden; }

#page { min-height: 60svh; overflow: hidden; outline: none; }
.page-loader { min-height: 70svh; display: grid; place-content: center; grid-auto-flow: column; gap: 6px; }
.page-loader span, .admin-loading span { width: 5px; height: 5px; border-radius: 50%; background: white; animation: pulse 1s infinite alternate; }
.page-loader span:nth-child(2) { animation-delay: .2s; }
.page-loader span:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { to { opacity: .2; transform: translateY(-4px); } }
.reveal { animation: reveal .45s both; animation-delay: var(--delay, 0ms); }
@keyframes reveal { from { opacity: 0; transform: translateY(14px); } }

.kicker { margin: 0 0 18px; color: #969691; font: 500 10px/1.5 var(--mono); letter-spacing: .11em; text-transform: uppercase; }
.hero { position: relative; isolation: isolate; min-height: 74svh; display: flex; align-items: center; padding: 145px max(6vw, 28px) 80px; border-bottom: 1px solid var(--soft-line); background: #050505 url("./codeink-hero-v1.jpg") center / cover no-repeat; }
.hero::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, rgba(5,5,5,.97) 0%, rgba(5,5,5,.88) 30%, rgba(5,5,5,.48) 52%, rgba(5,5,5,.08) 78%), linear-gradient(0deg, rgba(5,5,5,.62), transparent 48%, rgba(5,5,5,.28)); }
.hero-copy { position: relative; z-index: 1; width: min(100%, 500px); }
.hero h1, .page-intro h1, .admin-view-title h1, .admin-welcome h1 { max-width: 500px; margin: 0; font-size: clamp(46px, 6.5vw, 72px); line-height: .98; letter-spacing: -.055em; font-weight: 600; text-wrap: balance; }
.hero .lede { max-width: 500px; margin: 24px 0 0; color: #aaa; font-size: 16px; line-height: 1.65; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: 0 19px; border: 1px solid transparent; border-radius: 8px; font: 500 10px var(--mono); letter-spacing: .04em; text-transform: uppercase; cursor: pointer; }
.button--light { background: var(--white); color: var(--black); }
.button--line { border-color: var(--line); background: rgba(255,255,255,.02); color: var(--white); }
.button:hover { opacity: .82; }

.page-intro { min-height: 330px; display: flex; flex-direction: column; justify-content: flex-end; padding: 150px max(6vw, 28px) 58px; border-bottom: 1px solid var(--soft-line); }
.portfolio-page { padding: 48px max(6vw, 28px) 90px; }
.portfolio-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 1.8vw, 24px); }
.work-card { margin: 0; overflow: hidden; background: #101010; }
.work-card img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; filter: grayscale(1); transition: filter .25s, transform .35s; }
.work-card:hover img { filter: grayscale(.15); transform: scale(1.01); }
.empty-state { margin: 0; color: var(--muted); font: 11px var(--mono); }

.about-page { width: min(1100px, calc(100% - 56px)); display: grid; grid-template-columns: minmax(260px, 430px) minmax(260px, 500px); gap: clamp(40px, 7vw, 100px); align-items: start; margin: 0 max(6vw, 28px); padding: 64px 0 96px; }
.about-photo { margin: 0; overflow: hidden; background: #101010; }
.about-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center top; filter: grayscale(1); }
.about-copy p { margin: 0 0 24px; color: #c2c2be; font-size: clamp(18px, 2.1vw, 25px); line-height: 1.6; letter-spacing: -.015em; }

.social-page { min-height: 420px; display: grid; grid-template-columns: minmax(260px, 420px) minmax(220px, 420px); gap: clamp(36px, 8vw, 120px); align-items: center; padding: 64px max(6vw, 28px) 96px; }
.social-media { overflow: hidden; border: 1px solid var(--soft-line); border-radius: 22px; background: #111; }
.social-media img, .social-media video { width: 100%; max-height: 660px; aspect-ratio: 4 / 5; object-fit: cover; }
.social-actions { max-width: 420px; }
.social-actions > p { margin: 0 0 28px; color: var(--muted); line-height: 1.6; }
.social-links { display: flex; gap: 18px; }
.social-links a { min-width: 92px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.social-links strong { max-width: 130px; overflow: hidden; font: 500 10px var(--mono); text-overflow: ellipsis; }
.social-icon { width: 58px; height: 58px; display: grid; place-content: center; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.04); }
.social-icon svg { width: 26px; height: 26px; fill: var(--white); }
.social-icon svg rect, .social-icon svg circle { fill: none; stroke: var(--white); stroke-width: 1.8; }
.social-icon svg .fill { fill: var(--white); stroke: none; }

.contact-page { min-height: 420px; display: grid; grid-template-columns: 180px minmax(260px, 500px); gap: clamp(40px, 9vw, 130px); align-items: start; padding: 64px max(6vw, 28px) 96px; }
.contact-details { max-width: 500px; border-top: 1px solid var(--line); }
.contact-details > div { padding: 20px 0; border-bottom: 1px solid var(--line); }
.contact-details span { display: block; margin-bottom: 8px; color: #777; font: 9px var(--mono); text-transform: uppercase; }
.contact-details p, .contact-details a { margin: 0; overflow-wrap: anywhere; font-size: 15px; }

.map-footer { min-height: 460px; display: grid; grid-template-columns: minmax(280px, .7fr) 1.3fr; border-top: 1px solid var(--line); background: #080808; }
.map-footer__copy { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 64px max(5vw, 52px); border-right: 1px solid var(--line); }
.map-footer__copy h2 { max-width: 500px; margin: 0; font-size: clamp(42px, 5vw, 64px); line-height: 1; letter-spacing: -.055em; font-weight: 600; }
.map-address { width: 100%; max-width: 340px; margin: 28px 0 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.map-address p { margin: 0; color: #c5c5c0; font-size: 14px; line-height: 1.55; }
.map-footer__frame { position: relative; min-height: 460px; overflow: hidden; background: #0d0d0d; touch-action: none; }
.map-footer__frame iframe { width: 100%; height: 100%; min-height: 460px; border: 0; pointer-events: none; filter: grayscale(1) invert(.91) contrast(1.35) brightness(.72); opacity: .82; }
.map-footer__frame::after { content: ""; position: absolute; z-index: 2; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.2), transparent 18%); pointer-events: auto; }
.site-footer { min-height: 92px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; padding: 28px max(6vw, 28px); border-top: 1px solid var(--soft-line); color: #777; font: 9px var(--mono); text-transform: uppercase; }
.site-footer img { width: 132px; max-height: 48px; object-fit: contain; object-position: left center; opacity: .78; }
.site-footer p { margin: 0; }
.site-footer a { justify-self: end; color: #aaa; }
.error-state { min-height: 70svh; display: grid; place-content: center; gap: 20px; padding: 30px; text-align: center; }
.error-state h1 { max-width: 500px; margin: 0; font-size: 46px; }

/* Admin */
html[data-app="admin"], html[data-app="admin"] body { min-height: 100%; background: #0a0a0c; }
html[data-app="admin"] body { background: radial-gradient(circle at 50% -10%, #242428, #0a0a0c 34%); }
.auth-shell { min-height: 100svh; display: grid; place-content: center; padding: 28px 18px; }
.auth-brand { width: min(100%, 430px); display: flex; justify-content: space-between; margin: 0 auto 18px; color: #777; font: 10px var(--mono); text-transform: uppercase; }
.auth-brand strong { color: white; letter-spacing: .12em; }
.auth-card { width: min(100%, 430px); padding: 34px; border: 1px solid rgba(255,255,255,.18); border-radius: 27px; background: rgba(24,24,27,.8); box-shadow: inset 0 1px rgba(255,255,255,.1), 0 30px 100px #000; }
.auth-card h1 { max-width: 500px; margin: 0 0 28px; font-size: 42px; letter-spacing: -.05em; }
.auth-card label { display: block; }
.auth-card label span, .admin-field > span { display: block; margin-bottom: 8px; color: #888; font: 9px var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.auth-card input, .admin-field input, .admin-field textarea { width: 100%; border: 1px solid #353539; border-radius: 12px; outline: 0; background: #0c0c0e; color: white; }
.auth-card input { height: 54px; padding: 0 15px; }
.auth-card input:focus, .admin-field input:focus, .admin-field textarea:focus { border-color: #777; box-shadow: 0 0 0 4px rgba(255,255,255,.05); }
.form-error { min-height: 17px; margin: 12px 0 0; color: #ff9898; font-size: 12px; }
.back-site { display: block; margin-top: 20px; color: #888; font: 10px var(--mono); text-align: center; text-transform: uppercase; }
.admin-primary { min-height: 48px; display: inline-flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--white); color: #080808; font: 600 10px var(--mono); text-transform: uppercase; cursor: pointer; }
.auth-card .admin-primary { width: 100%; margin-top: 14px; }
.admin-primary:disabled { opacity: .5; cursor: wait; }
.admin-primary span { font-size: 16px; }

.admin-header { position: sticky; z-index: 20; top: 12px; width: min(1040px, calc(100% - 24px)); height: 66px; display: flex; align-items: center; justify-content: space-between; margin: 12px auto 0; padding: 0 17px; border: 1px solid rgba(255,255,255,.19); border-radius: 20px; background: rgba(14,14,16,.8); box-shadow: inset 0 1px rgba(255,255,255,.1), 0 18px 55px rgba(0,0,0,.22); }
.admin-header > div { display: flex; align-items: center; gap: 13px; }
.admin-header img { width: 124px; max-height: 44px; object-fit: contain; }
.admin-header span { color: #666; font: 9px var(--mono); text-transform: uppercase; }
.admin-header a, .admin-header button { border: 0; background: none; color: #aaa; font: 9px var(--mono); text-transform: uppercase; cursor: pointer; }
.admin-wordmark { font: 700 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.admin-main { width: min(980px, calc(100% - 28px)); min-height: calc(100svh - 100px); margin: auto; padding: 64px 0 90px; }
.admin-welcome { padding: 15px 4px 40px; }
.admin-welcome h1, .admin-view-title h1 { font-size: clamp(42px, 6vw, 58px); }
.shortcut-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.shortcut-grid button { min-height: 106px; display: flex; align-items: center; gap: 15px; padding: 17px; border: 1px solid rgba(255,255,255,.14); border-radius: 24px; background: linear-gradient(145deg,rgba(255,255,255,.09),rgba(255,255,255,.025)); color: white; text-align: left; box-shadow: inset 0 1px rgba(255,255,255,.1); cursor: pointer; }
.shortcut-grid button:hover { border-color: #555; transform: translateY(-1px); }
.shortcut-grid i { width: 60px; height: 60px; display: grid; flex: 0 0 auto; place-content: center; border-radius: 17px; background: var(--white); color: #050505; font: 600 17px var(--mono); font-style: normal; }
.shortcut-grid span { display: flex; flex-direction: column; gap: 5px; }
.shortcut-grid strong { font-size: 15px; }
.shortcut-grid small { color: #808080; font-size: 11px; }
.shortcut-grid b { margin-left: auto; color: #888; font-size: 25px; font-weight: 300; }
.admin-view-title { display: flex; align-items: center; gap: 18px; padding: 8px 2px 32px; }
.admin-view-title .kicker { margin-bottom: 7px; }
.admin-back { width: 48px; height: 48px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.05); color: white; font-size: 30px; cursor: pointer; }
.admin-panel { padding: clamp(20px, 4vw, 36px); border: 1px solid rgba(255,255,255,.13); border-radius: 26px; background: rgba(18,18,21,.76); box-shadow: inset 0 1px rgba(255,255,255,.08); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.admin-field { display: block; }
.admin-field input { height: 52px; padding: 0 14px; }
.admin-field textarea { min-height: 112px; padding: 14px; resize: vertical; line-height: 1.55; }
.admin-field small, .compact-upload small, .upload-zone small { display: block; margin-top: 7px; color: #707070; font-size: 10px; }
.content-form > .admin-primary, .nested-form > .admin-primary { margin-top: 22px; }
.upload-zone { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: end; }
.upload-zone input[type="file"], .compact-upload input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.upload-zone > label[for="portfolio-file"] { min-height: 180px; display: flex; grid-row: span 2; flex-direction: column; align-items: center; justify-content: center; padding: 22px; border: 1px dashed #48484c; border-radius: 20px; text-align: center; cursor: pointer; }
.upload-zone > label[for="portfolio-file"] > span { margin-bottom: 8px; font-size: 30px; font-weight: 200; }
.upload-zone > label[for="portfolio-file"] b { margin-top: 12px; color: #aaa; font: 9px var(--mono); text-transform: uppercase; }
.admin-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 28px; }
.admin-gallery figure { position: relative; margin: 0; overflow: hidden; border-radius: 13px; background: #090909; }
.admin-gallery img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.admin-gallery button { position: absolute; top: 7px; right: 7px; width: 29px; height: 29px; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; background: rgba(0,0,0,.72); color: white; font-size: 18px; cursor: pointer; }
.admin-empty { grid-column: 1 / -1; color: #888; }
.media-manager { display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: 30px; align-items: center; }
.media-preview { overflow: hidden; border-radius: 20px; background: #080808; }
.media-preview img, .media-preview video { width: 100%; max-height: 520px; aspect-ratio: 4 / 5; object-fit: cover; }
.media-preview--empty { min-height: 300px; display: grid; place-content: center; color: #777; font: 10px var(--mono); text-transform: uppercase; }
.compact-upload { display: flex; flex-direction: column; gap: 12px; }
.compact-upload label { display: flex; flex-direction: column; padding: 20px; border: 1px dashed #46464a; border-radius: 16px; cursor: pointer; }
.nested-form { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--soft-line); }
.brand-panel { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 35px; align-items: center; }
.logo-preview { min-height: 170px; display: grid; place-content: center; padding: 25px; border-radius: 18px; background: #050505; }
.logo-preview img { width: min(240px, 100%); max-height: 100px; object-fit: contain; }
.logo-preview span { color: #777; font: 9px var(--mono); text-transform: uppercase; }
.admin-toast { position: fixed; z-index: 100; left: 50%; bottom: 26px; padding: 13px 18px; transform: translate(-50%, 18px); border: 1px solid #4a4a4a; border-radius: 13px; background: var(--white); color: #080808; opacity: 0; box-shadow: 0 20px 70px #000; font: 10px var(--mono); transition: .22s; }
.admin-toast.error { background: #451717; color: #ffdada; }
.admin-toast.show { opacity: 1; transform: translate(-50%, 0); }
.admin-loading { min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: 16px; color: #777; font: 9px var(--mono); text-transform: uppercase; }

@media (max-width: 800px) {
  .glass-header { top: 9px; width: calc(100% - 18px); height: 62px; padding-left: 16px; border-radius: 18px; }
  .brand { min-width: 128px; }
  .brand img { width: 124px; }
  .site-nav { display: none; }
  .mobile-menu { display: block; }
  .menu-toggle { display: block; }
  .mobile-nav { position: absolute; z-index: 2; top: calc(100% + 10px); right: 0; width: min(360px, calc(100vw - 18px)); display: flex; flex-direction: column; gap: 3px; padding: 10px; border: 1px solid var(--line); border-radius: 18px; background: rgba(7,7,7,.98); box-shadow: 0 24px 70px rgba(0,0,0,.55); }
  .mobile-menu:not(.open) .mobile-nav { display: none; }
  .mobile-nav a { padding: 16px; border-radius: 10px; color: #aaa; font: 500 11px/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; }
  .mobile-nav a.active { background: rgba(255,255,255,.1); color: white; }
  .mobile-menu.open .menu-toggle span:first-child { transform: translateY(3px) rotate(45deg); }
  .mobile-menu.open .menu-toggle span:last-child { transform: translateY(-3px) rotate(-45deg); }
  .hero { min-height: 68svh; padding-top: 120px; background-position: 58% center; }
  .hero::before { background: linear-gradient(90deg, rgba(5,5,5,.96) 0%, rgba(5,5,5,.82) 54%, rgba(5,5,5,.32)), linear-gradient(0deg, rgba(5,5,5,.7), transparent 56%, rgba(5,5,5,.32)); }
  .hero h1, .page-intro h1 { font-size: clamp(42px, 13vw, 58px); }
  .page-intro { min-height: 260px; padding-top: 120px; padding-bottom: 42px; }
  .portfolio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .about-page { width: calc(100% - 56px); grid-template-columns: 1fr; gap: 36px; }
  .about-photo { width: min(100%, 430px); }
  .social-page, .contact-page { grid-template-columns: 1fr; }
  .social-media { width: min(100%, 420px); }
  .map-footer { grid-template-columns: 1fr; }
  .map-footer__copy { padding: 58px 28px; border-right: 0; border-bottom: 1px solid var(--line); }
  .map-footer__frame, .map-footer__frame iframe { min-height: 390px; }
  .site-footer { grid-template-columns: 1fr auto; }
  .site-footer p { display: none; }
  .admin-header { height: 60px; }
  .admin-header span, .admin-header button { display: none; }
  .admin-main { padding-top: 48px; }
  .shortcut-grid { grid-template-columns: 1fr; }
  .shortcut-grid button { min-height: 92px; }
  .form-grid, .upload-zone, .media-manager, .brand-panel { grid-template-columns: 1fr; }
  .upload-zone > label[for="portfolio-file"] { grid-row: auto; }
  .admin-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .portfolio-grid { grid-template-columns: 1fr; }
  .portfolio-page { padding-left: 18px; padding-right: 18px; }
  .admin-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-panel { border-radius: 21px; }
  .auth-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
