/* Fig & Light: "A dark room. The work is the only light."
   Warm neutral dark, bone type, no accent colour. All colour comes from the frames. */

/* ------------------------------------------------------------ fonts */
@font-face {
  font-family: "Gambarino";
  src: url("../fonts/gambarino-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Switzer";
  src: url("../fonts/switzer-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Switzer";
  src: url("../fonts/switzer-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ------------------------------------------------------------ tokens */
:root {
  --bg: #100f0e;
  --bg-deep: #0a0909;
  --surface: #191715;
  --ink: #ebe6dd;
  --ink-2: #a8a297;
  --ink-3: #8b867c;
  --ink-hot: #fffdf8;

  --display: "Gambarino", Georgia, "Times New Roman", serif;
  --text: "Switzer", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* spacing scale 4/8/16/24/32/48/72/112/160 */
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 32px;
  --s6: 48px; --s7: 72px; --s8: 112px; --s9: 160px;

  --gutter: 40px;
  --header: 64px;
  --maxw: 1600px;
  --gap: 16px;
  --section-gap: var(--s9);

  color-scheme: dark;
}
@media (max-width: 1023px) { :root { --gutter: 24px; } }
@media (max-width: 999px)  { :root { --gap: 12px; } }
@media (max-width: 699px)  { :root { --gutter: 16px; --header: 56px; --section-gap: 96px; } }

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--bg);
  scrollbar-gutter: stable;          /* no layout shift when the lightbox locks scrolling */
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
html.lb-open { overflow: hidden; background: var(--bg-deep); }   /* the reserved scrollbar strip goes dark too */
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.5;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
p, h1, h2, figure, ul { margin: 0; padding: 0; }
ul { list-style: none; }
::selection { background: #3d362d; color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }

.wrap { width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; }
section[id] { scroll-margin-top: var(--header); }
.nb { white-space: nowrap; }

/* skip link: hidden until focused */
.skip {
  position: absolute; left: var(--gutter); top: 0; z-index: 30;
  padding: 10px 14px; background: var(--ink); color: var(--bg);
  font-size: 15px; font-weight: 500;
  transform: translateY(-120%);
}
.skip:focus { transform: none; }

/* ------------------------------------------------------------ header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  height: var(--header);
  background: var(--bg);
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; min-height: 44px; color: var(--ink); transition: color 150ms ease; }
.brand:hover { color: var(--ink-hot); }
.brand-mark { display: block; height: 32px; width: auto; overflow: visible; }   /* the Fig & Light logo, from the vector */
.nav { display: flex; gap: var(--s5); }
.nav a {
  font-size: 15px; color: var(--ink-2); padding: 12px 0;
  transition: color 150ms ease;
}
.nav a:hover, .nav a[aria-current] { color: var(--ink); }
@media (max-width: 699px) { .nav { gap: var(--s4); } .brand-mark { height: 28px; } }

/* ------------------------------------------------------------ 1. home
   The reel frame and the title block fill the first screen exactly.
   The wrapper is as wide as the reel; its width comes from the height left over. */
.hero {
  --name-size: clamp(40px, min(6.4vw, 10svh), 112px);
  --name-lh: 0.95;
  --hero-top: var(--s4);
  --hero-bottom: var(--s5);
  --title-gap: 28px;
  min-height: calc(100svh - var(--header));
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--hero-top) var(--gutter) var(--hero-bottom);
}
.hero-inner {
  width: min(100%, var(--maxw),
    calc((100svh - var(--header) - var(--hero-top) - var(--hero-bottom) - var(--title-gap)
          - var(--name-size) * var(--name-lh)) * 16 / 9));
  margin-inline: auto;
}
.reel {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  overflow: hidden;
}
.reel-poster { width: 100%; height: 100%; object-fit: cover; filter: brightness(.55); }
.reel-note {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s2); padding: var(--s4); text-align: center;
}
.reel-title { font-family: var(--display); font-size: clamp(32px, 3.1vw, 44px); line-height: 1.05; color: var(--ink); }
.reel-sub { font-size: 17px; color: var(--ink); }

/* upgraded state: a real reel is set in config.js */
.reel.has-video .reel-poster { filter: none; }
.reel-play {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
}
.reel-play svg { width: 76px; height: 76px; filter: drop-shadow(0 1px 2px rgba(10, 9, 9, .45)); }
.reel-play svg path { fill: currentColor; transition: fill 150ms ease; }
.reel-play-label {
  position: absolute; left: var(--s4); bottom: var(--s4);
  font-size: 17px; font-weight: 500; color: var(--ink);
  text-shadow: 0 1px 2px rgba(10, 9, 9, .55);
  transition: color 150ms ease;
}
.reel-play:hover svg path, .reel-play:hover .reel-play-label { color: var(--ink-hot); fill: var(--ink-hot); }
.reel-play:focus-visible { outline-offset: -4px; }
.reel video { width: 100%; height: 100%; background: #000; }

.title-block {
  margin-top: var(--title-gap);
  display: flex; flex-wrap: wrap; align-items: last baseline; justify-content: space-between;
  column-gap: var(--s6); row-gap: var(--s2);
}
.name {
  font-family: var(--display); font-weight: 400;
  font-size: var(--name-size); line-height: var(--name-lh);
  letter-spacing: -0.01em;
}
.role {
  font-size: clamp(17px, 1.3vw, 19px); line-height: 1.4;
  color: var(--ink-2); text-align: right;
}
.role .nb { display: block; }      /* two short right-aligned lines, the last on the name's baseline */

@media (max-width: 1023px) and (min-width: 700px) {
  .hero { --name-size: clamp(40px, min(7.4vw, 10svh), 112px); }
  .title-block { column-gap: var(--s5); }
}

/* phone: the name anchored to the bottom of the screen, the frame centred in the dark room above it */
@media (max-width: 699px) {
  .hero {
    --name-size: 22vw; --name-lh: 0.9;
    justify-content: flex-start;
    padding: var(--s3) var(--gutter) 28px;
  }
  .hero-inner { width: 100%; flex: 1; display: flex; flex-direction: column; }
  .reel { margin-top: auto; }        /* with the auto margin below, the free space splits evenly above and below the frame */
  .title-block { margin-top: auto; padding-top: var(--s5); display: block; }
  .name span { display: block; }
  .role { text-align: left; margin-top: var(--s3); font-size: 17px; }
  .role .nb { display: inline; }
  .reel-title { font-size: 30px; }
  .reel-sub { font-size: 15px; }
  .reel-play svg { width: 56px; height: 56px; }
  .reel-play-label { left: var(--s3); bottom: var(--s3); font-size: 15px; }
}

/* ------------------------------------------------------------ section heads */
.section { padding-top: var(--section-gap); }
.work { padding-top: var(--s8); }
.section-title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(44px, 7vw, 120px); line-height: 1;
  letter-spacing: -0.005em;
  margin-bottom: var(--s6);
}
@media (max-width: 699px) {
  .work { padding-top: 96px; }
  .section-title { margin-bottom: var(--s5); }
}

/* ------------------------------------------------------------ 2. work grid
   Six columns, six rows. Both tiles in a row share one image height (h-* class),
   computed from the grid's own width with container units. */
.grid {
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: var(--s6);
}
.tile {
  --col: calc((100cqw - 5 * var(--gap)) / 6);
  display: block;
  color: var(--ink);
}
.s2 { grid-column: span 2; }
.s3 { grid-column: span 3; }
.s4 { grid-column: span 4; }
.h-4w { --h: calc((4 * var(--col) + 3 * var(--gap)) * 9 / 16); }   /* 16:9 across 4 columns */
.h-3w { --h: calc((3 * var(--col) + 2 * var(--gap)) * 9 / 16); }   /* 16:9 across 3 columns */
.h-3c { --h: calc((3 * var(--col) + 2 * var(--gap)) * 720 / 1680); } /* 21:9 across 3 columns */

.frame {
  position: relative;
  height: var(--h);
  overflow: hidden;
  background: var(--surface);
}
.frame img, .frame video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: var(--pos, 50% 50%);
}
.frame video { opacity: 0; }
.frame video.on { opacity: 1; }

.tile figcaption { display: block; padding-top: 12px; }
.tile .t {
  display: block;
  font-family: var(--display); font-size: clamp(22px, 1.75vw, 28px); line-height: 1.15;
  color: var(--ink);
}
.tile .m { display: block; margin-top: var(--s1); font-size: 14px; line-height: 1.4; color: var(--ink-2); }

/* The one authored motion idea: tiles rest a little under-exposed and come up to full light.
   Only with JS (so it can also play the preview), a real pointer, and motion allowed. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .js .tile .frame {
    filter: brightness(.78) saturate(.92);
    transition: filter 350ms cubic-bezier(.2, .7, .3, 1);
  }
  .js .tile:hover .frame,
  .js .tile:focus-visible .frame,
  .js .tile.is-lit .frame { filter: brightness(1) saturate(1); }
  .js .frame video { transition: opacity 300ms ease-out; }
  .js .tile[data-type="image"] .frame img { transition: transform 1600ms cubic-bezier(.2, .7, .3, 1); }
  .js .tile[data-type="image"]:hover .frame img,
  .js .tile[data-type="image"]:focus-visible .frame img { transform: scale(1.03); }
}
.js.no-anim .tile .frame, .js.no-anim .tile .frame img { transition: none !important; }

/* phone and small tablet: one column, each piece at its own shape */
@media (max-width: 699px) {
  .grid { grid-template-columns: minmax(0, 1fr); row-gap: var(--s5); }
  .s2, .s3, .s4 { grid-column: auto; }
  .frame { height: auto; aspect-ratio: var(--ar); }
  .tile .t { font-size: 24px; }
}

/* ------------------------------------------------------------ 3. about */
.about-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--s4);
  align-items: start;
}
.portrait {
  grid-column: 1 / span 4;
  aspect-ratio: 4 / 5;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.portrait span { font-size: 14px; color: var(--ink-3); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.about-text { grid-column: 6 / span 6; max-width: 34em; }
.about-text p { font-size: clamp(19px, 1.45vw, 21px); line-height: 1.5; color: var(--ink); }
.about-text p + p { margin-top: 1em; }
.about-text .about-lead {
  font-family: var(--display); font-size: clamp(28px, 2.4vw, 36px); line-height: 1.15;
  margin-bottom: var(--s5);
}
.about-text .quiet { color: var(--ink-2); }
@media (max-width: 899px) {
  .about-grid { display: block; }
  .portrait { max-width: 320px; margin-bottom: var(--s6); }
}

/* ------------------------------------------------------------ 4. contact, end of page */
.contact .wrap:first-child { container-type: inline-size; }   /* the email is sized to this width */
.contact-lead { font-size: 20px; color: var(--ink-2); }
.email {
  display: inline-block;
  margin-top: var(--s4);
  font-family: var(--display); font-weight: 400;
  font-size: clamp(34px, 8.7cqw, 140px);   /* about 95% of the content width, one line */
  line-height: 1.12;
  padding-bottom: 0.06em;           /* room for the g descender */
  letter-spacing: -0.005em;
  white-space: nowrap;
  color: var(--ink);
  transition: color 200ms ease;
}
.email:hover { color: var(--ink-hot); }
.copy-row { margin-top: var(--s4); }
.copy {
  font-size: 15px; color: var(--ink-2);
  min-height: 44px; padding: 10px 0;
  transition: color 150ms ease;
}
.copy:hover { color: var(--ink); }
.social { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin-top: var(--s5); }
.social-item { font-size: 17px; color: var(--ink-3); display: inline-block; padding: 10px 0; }
.social li[hidden] { display: none; }
a.social-item { color: var(--ink-2); transition: color 150ms ease; }
a.social-item:hover { color: var(--ink); }
.colophon {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4);
  margin-top: var(--s8);
  padding-bottom: var(--s6);
  font-size: 14px; color: var(--ink-3);
}
.colophon a { padding: 12px 0; transition: color 150ms ease; }
.colophon a:hover { color: var(--ink); }
@media (max-width: 699px) {
  .email { font-size: 12.4vw; white-space: normal; line-height: 1.05; }
  .colophon { margin-top: var(--s7); }
}

/* ------------------------------------------------------------ lightbox */
.lightbox {
  position: fixed; inset: 0;
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--bg-deep); color: var(--ink);
  overflow-y: auto; overscroll-behavior: contain;
}
.lightbox::backdrop { background: var(--bg-deep); }
.lb-shell {
  --info-h: 136px;
  min-height: 100%;
  display: grid; grid-template-rows: var(--header) 1fr;
  padding: 0 var(--gutter);
}
.lb-top { display: flex; justify-content: flex-end; align-items: center; }
.lb-stage { display: grid; place-items: center; padding-bottom: var(--s5); min-height: 0; }
.lb-figure {
  width: min(100%, var(--mw),
    calc((100dvh - var(--header) - var(--s5) - var(--info-h)) * var(--ar)));
}
.lb-media { width: 100%; aspect-ratio: var(--ar); background: #000; }
.lb-media video, .lb-media img { width: 100%; height: 100%; object-fit: contain; }
.lb-info {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: var(--s4) var(--s5); flex-wrap: wrap;
  padding-top: 20px;
}
.lb-text { min-width: 0; flex: 1 1 22em; }
.lb-title { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 2.8vw, 40px); line-height: 1.1; }
.lb-line { margin-top: var(--s2); font-size: 17px; color: var(--ink); }
.lb-credit { margin-top: var(--s1); font-size: 14px; color: var(--ink-2); }
.lb-credit:empty { display: none; }
.lb-nav { display: flex; align-items: center; gap: var(--s4); }
.lb-count { font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; margin-right: var(--s2); }
.lb-btn {
  font-size: 15px; color: var(--ink-2);
  min-height: 44px; min-width: 44px; padding: 10px 2px;
  transition: color 150ms ease;
}
.lb-btn:hover { color: var(--ink); }

/* portrait pieces on wide screens: media left, text to its right, bottom-aligned */
@media (min-width: 900px) {
  .lightbox.is-portrait .lb-figure { width: auto; display: flex; align-items: flex-end; gap: var(--s6); }
  .lightbox.is-portrait .lb-media {
    width: auto;
    height: min(calc(100dvh - var(--header) - var(--s6)),
                calc((100vw - 2 * var(--gutter) - 400px) / var(--ar)),
                calc(var(--mw) / var(--ar)));
  }
  .lightbox.is-portrait .lb-info { flex-direction: column; align-items: flex-start; width: 340px; flex-wrap: nowrap; padding-top: 0; gap: var(--s5); }
  .lightbox.is-portrait .lb-text { flex: none; }
}

/* phone: media full width, text below, the dialog scrolls */
@media (max-width: 699px) {
  .lb-shell { --info-h: 0px; }
  .lb-stage { place-items: start stretch; }
  .lb-figure { width: 100%; }
  .lb-nav { width: 100%; justify-content: flex-end; }
}

/* opening: 180ms opacity + 8px rise on the content only. Never hides anything if it does not run. */
@media (prefers-reduced-motion: no-preference) {
  .lightbox[open] .lb-figure { animation: lb-in 180ms cubic-bezier(.2, .7, .3, 1); }
}
@keyframes lb-in { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------ print */
@media print {
  .site-header, .skip, .lightbox, .copy-row { display: none !important; }
  body, html { background: #fff; color: #000; }
  .hero { min-height: 0; }
  .js .tile .frame { filter: none !important; }
}
