/* ===== Tokens ===== */
:root {
  --bg: #0e0e0e;
  --fg: #f2f2f2;
  --muted: #8a8a8a;
  --line: #262626;
  --panel: #151515;
  --gap: clamp(12px, 2vw, 24px);
  --pad: clamp(16px, 5vw, 64px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }

/* ===== Header + dropdown nav ===== */
.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 28px;
  padding: 14px var(--pad);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.brand { font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
.nav { display: flex; align-items: center; gap: 4px clamp(16px, 2.6vw, 30px); }
.nav > a, .has-sub > a {
  display: block;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 10px 0;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); }
.nav > a[aria-current="page"], .has-sub > a[aria-current="page"] { border-bottom-color: var(--fg); }
.has-sub { position: relative; }
.has-sub > a::after { content: "\25BE"; font-size: .7em; margin-left: 6px; opacity: .6; }
.sub {
  list-style: none;
  position: absolute;
  top: 100%;
  left: -14px;
  min-width: 250px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: none;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.has-sub:hover .sub, .has-sub:focus-within .sub { display: block; }
.sub a {
  display: block;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: .9rem;
  color: var(--muted);
  text-decoration: none;
}
.sub a:hover { background: #1e1e1e; color: var(--fg); }
.menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: .9rem;
}
@media (max-width: 760px) {
  .menu-btn { display: inline-block; }
  .nav { display: none; flex-direction: column; align-items: flex-start; width: 100%; gap: 0; padding-top: 6px; }
  .nav.open { display: flex; }
  .nav > a, .has-sub > a { padding: 9px 0; }
  .has-sub > a::after { display: none; }
  .sub { display: block; position: static; background: none; border: 0; box-shadow: none; min-width: 0; padding: 0 0 6px 14px; }
  .sub a { padding: 6px 0; }
  .sub a:hover { background: none; }
}

/* ===== Footer ===== */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 24px var(--pad);
  color: var(--muted);
  font-size: .85rem;
  border-top: 1px solid var(--line);
}
.site-footer a { text-decoration: none; border-bottom: 1px solid var(--line); }
.site-footer a:hover { color: var(--fg); border-bottom-color: var(--fg); }

/* ===== Page container ===== */
.page { width: 100%; max-width: 1400px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) var(--pad); }
.page h1 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 600; letter-spacing: -.01em; margin-bottom: 8px; }
.lede { color: var(--muted); max-width: 60ch; margin-bottom: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; }
.section-head h2 { font-size: 1.25rem; font-weight: 600; }
.section-head a { color: var(--muted); font-size: .9rem; }
.section-head a:hover { color: var(--fg); }
.empty { color: var(--muted); padding: 40px 0; }

/* ===== Home hero ===== */
.hero {
  position: relative;
  height: min(76vh, 800px);
  min-height: 340px;
  overflow: hidden;
  background: linear-gradient(135deg, #1c1c1c, #2a2a2a);
}
.hero video, .hero .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.65), rgba(0,0,0,0) 55%); pointer-events: none; }
.hero-text { position: absolute; z-index: 1; left: var(--pad); bottom: var(--pad); right: calc(var(--pad) + 120px); }
.hero-text h1 { font-size: clamp(1.5rem, 4vw, 3rem); font-weight: 600; letter-spacing: -.02em; }
.sound-btn {
  position: absolute; z-index: 1; right: var(--pad); bottom: var(--pad);
  background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.4);
  border-radius: 999px; padding: 8px 16px; font-size: .85rem; cursor: pointer;
}
.sound-btn:hover { border-color: var(--fg); }
.sound-btn[hidden] { display: none; }

/* ===== Home tiles (Video / Photo) ===== */
.tiles { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 700px) { .tiles { grid-template-columns: 1fr 1fr; } }
.tile { position: relative; display: block; text-decoration: none; border-radius: 6px; overflow: hidden; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #1c1c1c, #2a2a2a); }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.7), rgba(0,0,0,0) 60%); }
.tile:hover img, .tile:focus-visible img { transform: scale(1.04); }
.tile-label { position: absolute; z-index: 1; left: 20px; bottom: 16px; }
.tile-label h2 { font-size: 1.4rem; font-weight: 600; }
.tile-label p { color: #cfcfcf; font-size: .9rem; }
.tile:focus-visible, .card:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; }

/* ===== Filter chips ===== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.filters { margin: 20px 0 28px; }
.chip {
  display: inline-block; text-decoration: none; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .875rem;
  transition: color .2s, border-color .2s;
}
.chip:hover, .chip.on { color: var(--fg); border-color: var(--fg); }
.chips.static .chip { cursor: default; }
.chips.static .chip:hover { color: var(--muted); border-color: var(--line); }

/* ===== Grid + cards ===== */
.grid {
  --max-cols: 3;
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(
    min(100%, max(280px, calc((100% - (var(--max-cols) - 1) * var(--gap)) / var(--max-cols)))), 1fr));
}
.grid.two { --max-cols: 2; }
.card { display: block; width: 100%; text-align: left; text-decoration: none; background: none; border: 0; cursor: pointer; }
.thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 4px; background: linear-gradient(135deg, #1c1c1c, #2a2a2a); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .thumb img, .card:focus-visible .thumb img { transform: scale(1.04); }
.card.video .thumb::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: rgba(0,0,0,.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M9 7l9 5-9 5z'/%3E%3C/svg%3E") center / 28px no-repeat;
  border: 1px solid rgba(255,255,255,.5);
  opacity: .9;
}
.card.video.soon { cursor: default; opacity: .6; }
.card.video.soon .thumb::after { display: none; }
.meta { display: flex; justify-content: space-between; gap: 12px; padding-top: 12px; }
.meta h2 { font-size: 1rem; font-weight: 600; }
.meta p, .meta .year { font-size: .85rem; color: var(--muted); }
.meta p { margin-top: 2px; }
.meta .year { white-space: nowrap; }
.summary { color: var(--muted); font-size: .9rem; margin-top: 6px; max-width: 60ch; }

/* ===== Photos: masonry ===== */
.photos { columns: 3 280px; column-gap: var(--gap); }
.photos button { display: block; width: 100%; margin-bottom: var(--gap); padding: 0; border: 0; background: none; cursor: zoom-in; break-inside: avoid; }
.photos img { width: 100%; height: auto; border-radius: 4px; }
.photos button:focus-visible, .stills button:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

/* ===== Project page ===== */
.player { aspect-ratio: 16 / 9; background: #000; border-radius: 4px; overflow: hidden; }
.player iframe { width: 100%; height: 100%; border: 0; }
.player.empty { display: grid; place-items: center; color: var(--muted); background: linear-gradient(135deg, #1c1c1c, #2a2a2a); padding: 0; }
.project-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 24px; margin-top: 20px; }
.project-head h1 { margin: 0; }
.project-info { color: var(--muted); }
.roles { margin-top: 12px; }
.desc { max-width: 65ch; margin-top: 16px; }
.block { margin-top: 48px; }
.block h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 14px; }
.block p { max-width: 65ch; margin-bottom: 12px; }
.stills, .bts { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); margin-top: 20px; }
.stills:empty, .bts:empty { display: none; }
.stills button, .bts button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; text-align: left; }
.stills img, .bts img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 4px; }
.bts figcaption, .bts .cap { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.pager > :last-child { text-align: right; }
.pager a { text-decoration: none; color: var(--muted); }
.pager a:hover { color: var(--fg); }

/* ===== Lightbox ===== */
dialog#lb {
  border: 0; background: transparent; width: 100%; height: 100%; max-width: 100vw; max-height: 100vh; padding: 0; color: var(--fg);
}
dialog#lb[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; }
dialog#lb::backdrop { background: rgba(0,0,0,.94); }
.lb-stage { flex: 1; width: 100%; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 56px 64px 8px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-stage .lb-video { width: min(100%, 1200px); aspect-ratio: 16 / 9; background: #000; }
.lb-stage iframe { width: 100%; height: 100%; border: 0; }
.lb-cap { padding: 8px 24px 20px; color: var(--muted); font-size: .9rem; text-align: center; min-height: 40px; }
.lb-cap a { color: var(--fg); }
.lb-btn { position: absolute; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.3); color: var(--fg); border-radius: 999px; width: 44px; height: 44px; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.lb-btn:hover { border-color: var(--fg); }
.lb-close { top: 12px; right: 16px; }
.lb-prev { left: 12px; top: 50%; margin-top: -22px; }
.lb-next { right: 12px; top: 50%; margin-top: -22px; }
.lb-btn[hidden] { display: none; }
@media (max-width: 600px) { .lb-stage { padding: 56px 8px 8px; } .lb-prev { left: 4px; } .lb-next { right: 4px; } }

/* ===== About ===== */
.about { display: grid; gap: 32px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .about { grid-template-columns: minmax(240px, 1fr) 2fr; align-items: start; } }
.portrait { position: relative; aspect-ratio: 4 / 5; border-radius: 4px; overflow: hidden; background: linear-gradient(135deg, #1c1c1c, #2a2a2a); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.about-text p { max-width: 60ch; margin-bottom: 16px; }
.skills { margin-top: 36px; display: grid; gap: 20px; }
.skill h3 { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.elsewhere { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); }
.elsewhere a { color: var(--fg); }

/* ===== Contact ===== */
.contact-email { display: inline-block; font-size: clamp(1.25rem, 3vw, 2rem); text-decoration: none; border-bottom: 1px solid var(--muted); padding-bottom: 2px; word-break: break-all; }
.contact-email:hover { border-bottom-color: var(--fg); }
.links { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 28px; }
.links a { color: var(--muted); text-decoration: none; }
.links a:hover { color: var(--fg); }
.client-note { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); max-width: 60ch; }
.client-note a { color: var(--fg); }

@media (prefers-reduced-motion: reduce) {
  .thumb img, .tile img { transition: none; }
  html { scroll-behavior: auto; }
}
