/* ---------- Fonts (self-hosted) ---------- */
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-200.woff2") format("woff2");
  font-weight: 200;
  font-display: swap;
}

/* ---------- Tokens: Gallery dark ---------- */
:root {
  --bg: #0f0f10;
  --surface: #18181b;
  --fg: #ededea;
  --mute: #9a9a96;
  --line: #26262a;
  --font-body: "Inter", system-ui, sans-serif;
  --font-label: "JetBrains Mono", ui-monospace, monospace;
  --radius: 6px;
  --gutter: 16px;
  --max: 1280px;
  color-scheme: dark;
}
@media (min-width: 760px) { :root { --gutter: 32px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; margin: 0; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.label {
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 400;
}
.placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 90% at 70% 30%, #2a2a30 0%, var(--surface) 60%);
  color: var(--mute);
  font: 12px var(--font-label);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .15s, background-color .15s;
}
.btn:hover { border-color: var(--mute); }
.btn--primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn--primary:hover { background: #fff; border-color: #fff; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
}
/* Blur lives on a pseudo-element so the header itself doesn't become a containing block for fixed children */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.02em; text-decoration: none; }
.wordmark img { width: auto; height: 28px; transition: transform .3s ease; }
.wordmark:hover img { transform: rotate(-8deg); }
.site-nav { display: flex; gap: 24px; font-size: 14px; }
.site-nav a { color: var(--mute); text-decoration: none; transition: color .15s; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--fg); }
.site-nav .ext { font-size: .85em; margin-left: 3px; }
/* Three links fit inline on phones too, so there's no menu button */
@media (max-width: 420px) {
  .header-inner { gap: 12px; }
  .wordmark { gap: 8px; font-size: 15px; }
  .site-nav { gap: 16px; font-size: 13px; }
}

.nda-banner {
  background: #2a2412;
  color: #e8d49a;
  font-size: 13px;
  text-align: center;
  padding: 8px var(--gutter);
  border-bottom: 1px solid #3d3519;
}

/* ---------- NDA password page (/access/) ---------- */
.access { padding-block: 64px 96px; max-width: calc(480px + 2 * var(--gutter)); margin-inline: auto; }
.access h1 { font-size: clamp(28px, 4vw, 40px); }
.access > p { color: var(--mute); margin: 16px 0 0; }
.access-form { margin-top: 32px; }
.access-form .label { display: block; margin-bottom: 8px; }
.access-row { display: flex; gap: 8px; }
.access-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
}
.access-row input:focus-visible { outline-offset: 1px; border-color: var(--mute); }
.access-row .btn { cursor: pointer; font-family: inherit; }
.access-error { color: #e8a39a; font-size: 14px; margin: 12px 0 0; }
.access .access-help { font-size: 14px; margin-top: 32px; }
@media (max-width: 759px) { .access { padding-block: 40px 64px; } }

/* ---------- Home hero background ---------- */
/* Dimmed render behind the intro only, darkened on the text side and faded into the page at the bottom */
.home-hero { position: relative; isolation: isolate; overflow-x: clip; } /* clip the scaled image sideways; the fade still spills down */
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 -80px;
  z-index: -1;
  pointer-events: none; /* the fade extends over the filter chips below; let clicks through */
  background:
    linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 55%, transparent) 55%, transparent 100%),
    url("/assets/img/background.webp") center 70% / cover no-repeat;
  opacity: .8;
  filter: blur(3px);
  transform: scale(1.02); /* hides the soft edges the blur creates */
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
  mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
.home-hero .intro { padding-block: 112px 56px; }
@media (max-width: 759px) {
  .home-hero::before { background-position: 70% 70%; }
  .home-hero .intro { padding-block: 72px 40px; }
}

/* ---------- Home intro ---------- */
.intro { padding-block: 64px 24px; }
.intro h1 { font-size: clamp(32px, 5vw, 56px); max-width: 18ch; }
.intro p { color: var(--mute); max-width: 52ch; margin: 16px 0 0; font-size: 17px; }
.headline { font-size: clamp(36px, 6.4vw, 72px); max-width: none; line-height: 1.05; }
.headline span { display: block; }
.headline-dev {
  font-family: var(--font-label);
  font-weight: 200;
  letter-spacing: -0.04em;
  color: #c9c9c5;
  margin-top: .08em;
}
.headline .caret {
  display: inline-block;
  width: .5em;
  height: .09em;
  margin-left: .12em;
  background: currentColor;
  vertical-align: baseline;
  animation: caret 1.1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .headline .caret { animation: none; } }
.intro--compact { padding-block: 48px 8px; }
.intro--compact h1 { font-size: clamp(28px, 4vw, 40px); }
@media (max-width: 759px) { .intro { padding-block: 40px 16px; } }

/* ---------- Filter chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; padding-block: 16px 28px; }
.chip {
  font: 13px var(--font-label);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 18px;
  border: 1px solid #3a3a40;
  border-radius: 99px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(6px);
  color: #c4c4bf;
  text-decoration: none;
  transition: border-color .15s, color .15s, background-color .15s;
}
.chip:hover { color: var(--fg); border-color: #6a6a68; background: #222226; }
.chip[aria-current="page"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }

/* ---------- Grid & cards ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px 20px;
  padding-bottom: 80px;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .grid:not(.is-filtered) .card--featured { grid-column: span 2; grid-row: span 2; }
  .grid:not(.is-filtered) .card--featured .card-media { aspect-ratio: auto; flex: 1; }
}
/* Clips the sideways slide when switching filters, without creating a scroll container */
.grid-stage {
  min-height: 320px;            /* room to swipe even when a filter has few or no projects */
  overflow-x: clip;
  touch-action: pan-y;          /* vertical swipes scroll the page; horizontal ones switch filters */
  -webkit-user-select: none;
  user-select: none;
}
.grid-stage.is-dragging { cursor: grabbing; }
.grid-stage.is-dragging .card { cursor: grabbing; pointer-events: none; }
.card { display: flex; flex-direction: column; text-decoration: none; }
.card-media {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.card-media :is(img, video) { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-media :is(img, video) { transform: scale(1.03); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 12px; }
.card-title { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; }
.card-summary { margin: 2px 0 0; font-size: 14px; color: var(--mute); }
.empty { color: var(--mute); padding-bottom: 80px; }

/* Locked card for NDA work: no imagery, just a lock on a faint diagonal texture */
.locked-media {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--mute);
  border: 1px solid var(--line);
  background:
    radial-gradient(80% 70% at 50% 45%, #232327 0%, transparent 70%),
    repeating-linear-gradient(135deg, transparent 0 14px, rgb(255 255 255 / .025) 14px 15px),
    var(--surface);
  transition: border-color .2s, color .2s;
}
.card--locked:hover .locked-media { border-color: #4a4a50; color: var(--fg); }
.card-cta { margin-top: 8px; font-size: 14px; font-weight: 500; color: var(--fg); }
.card--locked:hover .card-cta { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Project page ---------- */
.project-hero { max-width: 1600px; margin-inline: auto; }
.project-hero img, .project-hero .placeholder { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.project-hero .video { position: relative; aspect-ratio: 16 / 9; }
.project-hero iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.hero-clip { position: relative; aspect-ratio: 16 / 9; background: var(--surface) var(--hero) center / cover no-repeat; }
.hero-clip video { position: absolute; inset: 0; margin: auto; height: 100%; width: auto; max-width: 100%; }
@media (max-width: 759px) { .hero-clip--tall { aspect-ratio: 4 / 5; } } /* taller on phones so a portrait clip isn't tiny */
.hero-framed { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface); }
.hero-framed::before { content: ""; position: absolute; inset: -40px; background: var(--hero) center / cover; filter: blur(40px) brightness(.55); }
.project-hero .hero-framed img { position: relative; width: auto; height: 100%; max-width: 100%; margin-inline: auto; display: block; aspect-ratio: auto; object-fit: contain; }

.crumb { display: inline-block; margin-bottom: 10px; color: var(--mute); text-decoration: none; }
.crumb:hover { color: var(--fg); }
.parts { margin-top: 48px; }
.parts > h2 { margin: 0 0 16px; }

.project-header { display: grid; gap: 32px; padding-block: 40px; }
@media (min-width: 900px) { .project-header { grid-template-columns: 2fr 1fr; gap: 64px; } }
.project-header h1 { font-size: clamp(30px, 4vw, 44px); display: flex; align-items: center; gap: 16px; }
.project-icon { width: 1.1em; height: 1.1em; border-radius: 22%; flex: none; }
.lede { color: var(--mute); font-size: 18px; margin: 12px 0 0; max-width: 55ch; }
.meta { margin: 0; font-size: 14px; }
.meta dt { margin-top: 12px; }
.meta dt:first-child { margin-top: 0; }
.meta dd { margin: 2px 0 0; }
.meta-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px !important; }
@media (min-width: 900px) { .meta { border-left: 1px solid var(--line); padding-left: 32px; } }

.project-body { display: grid; gap: 40px; padding-bottom: 64px; }
.prose { max-width: 68ch; color: #cfcfcb; }
.prose h2, .prose h3 { color: var(--fg); margin: 1.6em 0 .4em; font-size: 20px; }
.prose p { margin: 0 0 1em; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.tags li { font: 12px var(--font-label); padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--mute); }

.gallery { display: grid; gap: 16px; }
@media (min-width: 760px) { .gallery { grid-template-columns: 1fr 1fr; } .gallery .wide { grid-column: 1 / -1; } }
.gallery figure { margin: 0; }
.gallery img { width: 100%; border-radius: var(--radius); background: var(--surface); }
.gallery { align-items: start; }
/* Square or tall images shown full width would outgrow the screen: cap them and centre */
.gallery .wide img { width: auto; max-width: 100%; max-height: 85vh; margin-inline: auto; }
.gallery .zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  border-radius: var(--radius);
}
.gallery .zoom img { transition: filter .2s; }
.gallery .zoom:hover img { filter: brightness(1.08); }

/* ---------- Lightbox ---------- */
.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(10 10 11 / .95);
  color: var(--fg);
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
}
.lightbox[open] { animation: lb-in .2s ease-out; }
.lightbox::backdrop { background: transparent; }
@keyframes lb-in { from { opacity: 0; } }
html:has(.lightbox[open]) { overflow: hidden; }

.lb-figure {
  margin: 0;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 56px 72px 48px;
}
.lb-media {
  max-width: 100%;
  max-height: calc(100dvh - 160px);
  width: auto;
  height: auto;
  border-radius: var(--radius);
  user-select: none;
}
.lb-caption { font-size: 14px; color: var(--mute); text-align: center; max-width: 70ch; }

.lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #3a3a40;
  border-radius: 99px;
  background: rgb(24 24 27 / .8);
  color: var(--fg);
  font: 400 24px/1 var(--font-body);
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.lb-btn:hover { background: #2a2a2e; border-color: #6a6a68; }
.lb-close { top: 16px; right: 16px; }
.lb-prev, .lb-next { top: 50%; translate: 0 -50%; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-count { position: absolute; top: 28px; left: 50%; translate: -50% 0; }
.lightbox.is-single :is(.lb-prev, .lb-next, .lb-count) { display: none; }

@media (max-width: 759px) {
  .lb-figure { padding: 64px 12px 32px; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; translate: none; }
  .lb-media { max-height: calc(100dvh - 200px); }
}
@media (prefers-reduced-motion: reduce) { .lightbox[open] { animation: none; } }

/* Looping clips: tall phone captures sit centred over a blurred copy of their poster */
.clip-frame {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
}
.clip-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--poster) center / cover no-repeat;
  filter: blur(40px) brightness(.45);
  transform: scale(1.15);
}
.clip-frame video { display: block; max-width: 100%; max-height: 80vh; width: auto; margin-inline: auto; }
.clip-frame video.is-zoomable { cursor: zoom-in; transition: filter .2s; }
.clip-frame video.is-zoomable:hover { filter: brightness(1.08); }
.gallery figcaption { font-size: 13px; color: var(--mute); margin-top: 8px; }

.cta {
  display: block;
  padding: 40px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: border-color .15s;
}
.cta .label { display: block; margin-bottom: 8px; }
.cta:hover { border-color: var(--mute); }

.prev-next { display: flex; justify-content: space-between; gap: 16px; padding-block: 32px 64px; border-top: 1px solid var(--line); }
.prev-next a { text-decoration: none; font-weight: 500; }
.prev-next a:last-child { text-align: right; }
.prev-next .label { display: block; margin-bottom: 4px; }

/* ---------- About ---------- */
.about { display: grid; gap: 48px; padding-block: 64px 96px; }
@media (min-width: 900px) { .about { grid-template-columns: 2fr 1fr; gap: 80px; } }
.about h1 { font-size: clamp(32px, 4vw, 48px); margin-bottom: 24px; }
.about-h { font-size: 20px; margin: 48px 0 16px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; max-width: 68ch; }
.timeline .label { display: block; margin-bottom: 2px; }
.timeline b { font-weight: 500; }
.timeline p { margin: 4px 0 0; color: var(--mute); font-size: 15px; }
.about-side { align-self: start; }
@media (min-width: 900px) { .about-side { position: sticky; top: 92px; } }
.about-side h2 { margin-bottom: 4px; }
.about-side p { margin: 0 0 24px; }
.about-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); font-size: 14px; color: var(--mute); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding-block: 28px; }
.footer-links, .footer-meta { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer a { text-decoration: none; transition: color .15s; }
.site-footer a:hover { color: var(--fg); }
