/* ───────────────────────── Tokens ───────────────────────── */
:root {
  --bg: #0e0e0d;
  --surface: #181816;
  --surface-2: #22221f;
  --text: #ecebe7;
  --muted: #8d8b85;
  --faint: #5b5a55;
  --line: #2a2a27;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;

  --gutter: clamp(16px, 4vw, 56px);
  --max: 1680px;
  --gap: clamp(10px, 1.2vw, 18px);
  --row: 360px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--text); color: var(--bg); }

:focus-visible { outline: 1px solid var(--text); outline-offset: 3px; }

.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  padding: 8px 14px; background: var(--text); color: var(--bg);
}
.skip:focus { left: 8px; }

main { outline: none; min-height: 70vh; }

/* ───────────────────────── Header ───────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--gutter);
  transition: background .3s, border-color .3s;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: rgba(14, 14, 13, .82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.brand { font-weight: 500; letter-spacing: -.01em; }
.nav { display: flex; gap: clamp(18px, 3vw, 36px); }
.nav a, .link {
  color: var(--muted);
  transition: color .2s;
}
.nav a:hover, .nav a.active, .link:hover { color: var(--text); }

/* ───────────────────────── Shared ───────────────────────── */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.eyebrow {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}

.section { padding-block: clamp(72px, 10vw, 140px) 0; scroll-margin-top: 40px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 20px; margin-bottom: clamp(24px, 3vw, 36px);
  border-bottom: 1px solid var(--line);
}
.section-head h2 {
  margin: 0;
  font: 400 clamp(28px, 3vw, 40px)/1.1 var(--serif);
  letter-spacing: -.01em;
}

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ───────────────────────── Hero ───────────────────────── */
.hero { padding-block: clamp(48px, 8vw, 120px) clamp(8px, 2vw, 24px); }
.hero .eyebrow { margin-bottom: 28px; }
.hero h1 {
  margin: 0; max-width: 17ch;
  font: 400 clamp(44px, 7.4vw, 116px)/.98 var(--serif);
  letter-spacing: -.02em;
}
.hero h1 em { color: var(--muted); }
.hero p {
  max-width: 46ch; margin: clamp(24px, 3vw, 40px) 0 0;
  font-size: clamp(16px, 1.3vw, 19px); color: var(--muted);
}


/* ───────────────────────── Justified grid ─────────────────────────
   Each card grows in proportion to its aspect ratio, so every row is
   filled edge to edge while artwork keeps (close to) its true shape. */
.grid { display: flex; flex-wrap: wrap; gap: var(--gap); }
.grid::after { content: ""; flex-grow: 999999; }

.card {
  flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--row));
  min-width: 0;
}
.card.hero-card { flex-basis: 100%; }
.card.hero-card .frame { aspect-ratio: 2.39; }

.frame {
  position: relative; overflow: hidden;
  aspect-ratio: var(--r);
  background: var(--surface);
}
.frame img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0;
  transition: opacity .8s var(--ease), transform 1.2s var(--ease), filter .6s;
}
.frame img.loaded { opacity: 1; }
.card:hover .frame img { transform: scale(1.025); }
.grid:hover .card:not(:hover) .frame img.loaded { filter: brightness(.72) saturate(.85); }

/* Titles stay out of the way: revealed on hover, a quiet label on touch. */
.card { position: relative; }
.card-meta {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-size: 14px;
}
.card-meta .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta .m { color: rgba(236, 235, 231, .7); white-space: nowrap; font-size: 13px; font-variant-numeric: tabular-nums; }

@media (hover: hover) {
  .card-meta {
    position: absolute; inset: auto 0 0 0;
    padding: 40px 18px 14px;
    background: linear-gradient(to top, rgba(0, 0, 0, .6), transparent);
    opacity: 0; transform: translateY(6px);
    transition: opacity .4s var(--ease), transform .5s var(--ease);
    pointer-events: none;
  }
  .card:hover .card-meta, .card:focus-visible .card-meta { opacity: 1; transform: none; }
}
@media (hover: none) {
  .card-meta { padding-top: 8px; font-size: 13px; color: var(--muted); }
  .card-meta .m { display: none; }
  .grid { row-gap: calc(var(--gap) * 2); }
}

.grid.small { --row: 210px; }
@media (hover: hover) { .grid.small .card-meta { font-size: 13px; padding: 32px 14px 10px; } }


/* ───────────────────────── About / Contact ───────────────────────── */
.about-text {
  max-width: 30ch; margin: 0;
  font: 400 clamp(26px, 2.8vw, 42px)/1.2 var(--serif);
  letter-spacing: -.01em;
}
.about-tools { margin: clamp(24px, 3vw, 36px) 0 0; color: var(--muted); font-size: 14px; }
.about-tools span { white-space: nowrap; }
.about.with-reel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(28px, 5vw, 80px); align-items: center; }
.reel { margin: 0; }
.reel figcaption { padding-top: 10px; font-size: 13px; color: var(--muted); }
@media (max-width: 820px) { .about.with-reel { grid-template-columns: 1fr; } }

.contact { padding-bottom: clamp(40px, 6vw, 80px); }
.contact-big {
  display: inline-block; margin: 8px 0 40px;
  font: 400 clamp(44px, 8vw, 128px)/1 var(--serif);
  letter-spacing: -.02em;
}
.contact-big em { color: var(--muted); transition: color .3s; }
.contact-big:hover em { color: var(--text); }
.contact-links { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.contact-links a { color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 2px; transition: color .2s, border-color .2s; }
.contact-links a:hover { color: var(--text); border-color: var(--text); }
.contact-links a::after { content: " ↗"; font-size: .85em; }

/* ───────────────────────── Project page ───────────────────────── */
.project-top { padding-block: clamp(32px, 6vw, 72px) clamp(32px, 4vw, 56px); }
.back { display: inline-flex; gap: 8px; color: var(--muted); font-size: 14px; margin-bottom: clamp(32px, 5vw, 64px); transition: color .2s; }
.back:hover { color: var(--text); }

.project-head h1 {
  margin: 12px 0 0;
  font: 400 clamp(44px, 6.4vw, 104px)/.98 var(--serif);
  letter-spacing: -.02em;
}

.project-head {
  display: grid; gap: 24px clamp(28px, 5vw, 80px);
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: end;
}

/* Description: collapsed to three lines with a soft fade until expanded. */
.project-desc { font-size: 15px; line-height: 1.7; }
.project-desc p { margin: 0 0 .9em; color: var(--muted); max-width: 62ch; }
.project-desc p:last-child { margin-bottom: 0; }
.project-desc.collapsed {
  max-height: calc(1.7em * 3); overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
  mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
.desc-toggle {
  margin-top: 10px; padding: 0;
  font-size: 13px; color: var(--text);
  border-bottom: 1px solid var(--faint);
  transition: border-color .2s;
}
.desc-toggle:hover { border-color: var(--text); }
.project-desc a.inline { color: var(--text); border-bottom: 1px solid var(--faint); transition: border-color .2s; overflow-wrap: anywhere; }
.project-desc a.inline:hover { border-color: var(--text); }

.meta {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px;
  margin-top: clamp(36px, 4vw, 56px); padding-top: 20px; border-top: 1px solid var(--line);
}
.meta dt { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.meta dd { margin: 0; font-size: 14px; }
.meta:not(:has(div)) { display: none; }

.media { display: grid; gap: clamp(16px, 2.4vw, 40px); padding-bottom: clamp(48px, 8vw, 120px); }
.media figure { margin: 0; }
.media .frame { aspect-ratio: var(--r); cursor: zoom-in; }
.media .frame img { object-fit: contain; }
.media .clip { cursor: pointer; }
.clip video { display: block; width: 100%; height: 100%; object-fit: contain; }

/* Clip controls: quiet bar, visible on hover/focus, while paused, and always on touch. */
.vc {
  position: absolute; inset: auto 0 0 0;
  display: flex; align-items: center; gap: 14px;
  padding: 36px 16px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, .55), transparent);
  color: var(--text);
  opacity: 0; transition: opacity .3s;
  cursor: default;
}
.clip:hover .vc, .clip:focus-within .vc, .clip.paused .vc { opacity: 1; }
@media (hover: none) { .vc { opacity: 1; } }

.vc button { display: grid; place-items: center; width: 28px; height: 28px; flex: none; opacity: .85; transition: opacity .2s; }
.vc button:hover { opacity: 1; }
.vc svg { width: 15px; height: 15px; }

.vc-bar { position: relative; flex: 1; height: 20px; cursor: pointer; touch-action: none; }
.vc-bar::before, .vc-fill { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; border-radius: 2px; }
.vc-bar::before { background: rgba(236, 235, 231, .25); }
.vc-fill { background: var(--text); transform: scaleX(0); transform-origin: left; }
.vc-bar:hover::before, .vc-bar:hover .vc-fill { height: 4px; margin-top: -2px; }

.vc-time { font-size: 12px; font-variant-numeric: tabular-nums; color: rgba(236, 235, 231, .8); min-width: 3ch; }

/* Films (longer pieces with sound) wait behind a centred play button. */
.vc-big {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(236, 235, 231, .92); color: var(--bg);
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s var(--ease);
}
.vc-big svg { width: 20px; height: 20px; margin-left: 3px; }
.clip.film.paused .vc-big { opacity: 1; pointer-events: auto; }
.vc-big:hover { transform: scale(1.06); }

.clip:fullscreen { background: #000; }
.clip:fullscreen video { object-fit: contain; }
.media figure.tall .frame { width: min(100%, calc(92vh * var(--r))); margin: 0 auto; }
.media figure.tall figcaption { text-align: center; }
.media figcaption { padding-top: 10px; font-size: 13px; color: var(--muted); }

/* Video / embed facades */
.embed { position: relative; aspect-ratio: 16 / 9; background: var(--surface) center / cover no-repeat; overflow: hidden; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embed-btn {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: linear-gradient(to top, rgba(0,0,0,.45), rgba(0,0,0,.1));
  transition: background .3s;
}
.embed-btn:hover { background: rgba(0,0,0,.25); }
.embed-btn span {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 999px;
  background: rgba(236, 235, 231, .92); color: var(--bg);
  font-size: 14px; font-weight: 500;
  transition: transform .3s var(--ease);
}
.embed-btn:hover span { transform: scale(1.05); }
.embed-btn span::before { content: ""; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent currentColor; }

.next {
  display: block; position: relative; overflow: hidden;
  border-top: 1px solid var(--line);
  padding: clamp(40px, 6vw, 80px) 0;
}
.next-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: center; }
.next h2 { margin: 10px 0 0; font: 400 clamp(36px, 5vw, 80px)/1 var(--serif); letter-spacing: -.02em; transition: transform .6s var(--ease); }
.next:hover h2 { transform: translateX(10px); }
.next .frame { aspect-ratio: 16 / 9; }
.next:hover .frame img { transform: scale(1.03); }

/* ───────────────────────── Lightbox ───────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: grid; grid-template-columns: 72px minmax(0, 1fr) 72px; align-items: center;
  background: rgba(8, 8, 7, .97);
  animation: fade .25s ease;
}
.lightbox[hidden] { display: none; }
.lb-stage { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 0 24px; }
.lb-stage img { max-width: 100%; max-height: calc(100dvh - 120px); object-fit: contain; }
.lb-stage figcaption { margin-top: 14px; color: var(--muted); font-size: 13px; min-height: 1.2em; text-align: center; }
.lightbox button { height: 100%; font-size: 22px; color: var(--muted); transition: color .2s; }
.lightbox button:hover { color: var(--text); }
.lb-close { position: absolute; top: 0; right: 0; height: auto !important; padding: 18px 24px; font-size: 18px !important; }
.lb-count { position: absolute; top: 20px; left: 24px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

@keyframes fade { from { opacity: 0; } }

/* ───────────────────────── Footer ───────────────────────── */
.site-footer {
  display: flex; justify-content: space-between; gap: 16px;
  max-width: var(--max); margin: 0 auto;
  padding: 28px var(--gutter) 36px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}
.site-footer a:hover { color: var(--text); }

/* ───────────────────────── Responsive ───────────────────────── */
@media (max-width: 1100px) {
  :root { --row: 280px; }
  .grid.small { --row: 180px; }
}

@media (max-width: 820px) {
  .project-head, .next-inner { grid-template-columns: 1fr; }
  .project-head { align-items: start; }
  .meta { grid-template-columns: 1fr 1fr; }
  .lightbox { grid-template-columns: 44px minmax(0, 1fr) 44px; }
}

@media (max-width: 600px) {
  body { font-size: 15px; }
  .card { flex-basis: 100%; }
  .card .frame { aspect-ratio: clamp(1, var(--r), 1.78); }
  .card.hero-card .frame { aspect-ratio: 1.2; }
  .grid.small .card { flex-basis: calc(50% - var(--gap) / 2); }
  .grid.small .card .frame { aspect-ratio: 1; }
  .site-header { padding-top: 16px; padding-bottom: 16px; }
  .nav { gap: 18px; }
}

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

/* Project without media yet */
.frame-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 13px; }
