@font-face {
  font-family: "Archivo";
  src: url("font/archivo-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --bg: #000;
  --fg: #f1efe9;
  --dim: #a3a19b;
  --margin: clamp(16px, 2.2vw, 32px);
  --gap: clamp(8px, 1.1vw, 16px);
}

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

html { background: var(--bg); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.45 "Archivo", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img, iframe { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; font-weight: inherit; }

:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

.display {
  font-stretch: 125%;
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: .96;
}

.skip {
  position: fixed; top: 8px; left: 8px; z-index: 30;
  padding: .5rem .75rem; background: var(--fg); color: var(--bg);
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Header: inverts over whatever frame is behind it */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: calc(var(--margin) * .8) var(--margin);
  color: #fff;
  text-shadow: 0 0 14px rgba(0, 0, 0, .55);
  font-weight: 500;
}
.site-header::before {
  content: ""; position: absolute; z-index: -1; inset: 0 0 auto 0; height: 210%;
  background: linear-gradient(to bottom,
    #000 0%, #000 38%, rgba(0, 0, 0, .82) 54%, rgba(0, 0, 0, .45) 72%, rgba(0, 0, 0, .14) 88%, rgba(0, 0, 0, 0) 100%);
  opacity: 0; pointer-events: none;
  transition: opacity .3s linear;
}
.header-solid .site-header::before { opacity: 1; }
.site-header nav { display: flex; gap: 1.5rem; }
.site-header a:hover { text-decoration: underline; text-underline-offset: .2em; }
.brand { transition: opacity .2s linear; }
.at-top .brand { opacity: 0; pointer-events: none; }

/* Opening and full-screen works: each frame slides over the one before */
.frame {
  position: sticky; top: 0;
  display: block;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background: #000;
}
.frame img, .slide img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.frame .cut { z-index: 1; }

.opening h1 {
  position: absolute; z-index: 2;
  left: var(--margin); right: var(--margin); bottom: calc(var(--margin) * .6);
  color: #fff;
  font-size: calc((100vw - 2 * var(--margin)) / 8.5);
  white-space: nowrap;
}
.frame::before, .slide::before {
  content: ""; position: absolute; z-index: 1; inset: 0 0 auto 0; height: 22%;
  background: linear-gradient(to bottom, rgba(0,0,0,.4), rgba(0,0,0,0));
  pointer-events: none;
}
.opening::after, .work-frame::after {
  content: ""; position: absolute; z-index: 1; inset: auto 0 0 0; height: 45%;
  background: linear-gradient(to top, rgba(0,0,0,.62), rgba(0,0,0,0));
  pointer-events: none;
}
.js .final { visibility: hidden; }
.ready .final { visibility: visible; }

.caption {
  position: absolute; z-index: 2;
  left: var(--margin); right: var(--margin); bottom: var(--margin);
  display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem;
  color: #fff;
}
.caption h2 { font-size: clamp(2.1rem, 5.6vw, 6.25rem); max-width: 16em; }
.caption p { margin-top: .75rem; font-weight: 500; }
.caption .go {
  flex: none;
  display: inline-flex; align-items: center; gap: .55em;
  padding: .6em 1em;
  background: #fff; color: #000;
  font-size: clamp(1.15rem, 1.9vw, 1.75rem); font-weight: 600; line-height: 1;
}
.slide:hover .go { background: var(--fg); }
.tri { width: .72em; height: .86em; fill: currentColor; flex: none; }
.work-frame:focus-visible { outline-offset: -6px; }

/* Main works: one full-screen stage, moved sideways */
.work-anchor { height: 0; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; background: #000; }
.stage-track {
  display: flex; height: 100%;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.stage-track::-webkit-scrollbar { display: none; }
.slide {
  position: relative; display: block; flex: 0 0 100%;
  overflow: hidden; background: #000;
  scroll-snap-align: start; scroll-snap-stop: always;
}
.slide .caption { bottom: calc(var(--margin) + 4rem); }
.slide:focus-visible { outline-offset: -6px; }

.stage-tabs {
  position: absolute; z-index: 3;
  left: var(--margin); right: var(--margin); bottom: calc(var(--margin) * .6);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap);
}
.stage-tabs button {
  appearance: none; background: none; border: 0;
  border-top: 2px solid rgba(255, 255, 255, .4);
  padding: .7rem 0 .5rem;
  color: rgba(255, 255, 255, .78);
  font: inherit; font-weight: 500; text-align: left;
  text-shadow: 0 0 14px rgba(0, 0, 0, .6);
  cursor: pointer;
}
.stage-tabs button:hover, .stage-tabs button[aria-current="true"] { color: #fff; border-top-color: #fff; }

/* Square works */
main > section, .page-section { position: relative; background: var(--bg); padding: clamp(5rem, 11vw, 10rem) var(--margin) 0; }

.section-title { font-size: clamp(2.4rem, 7.4vw, 8rem); margin-bottom: clamp(1.75rem, 4vw, 3.5rem); }

.grid {
  display: flex; gap: var(--gap);
  margin-inline: calc(var(--margin) * -1);
  padding-inline: var(--margin);
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--margin);
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.grid::-webkit-scrollbar { display: none; }
/* Four and a bit per row, so the next one shows when a row has more */
.square {
  flex: 0 0 calc((100vw - 2 * var(--margin) - 4 * var(--gap)) / 4.3);
  scroll-snap-align: start;
}
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.split > .section-title { margin: 0; }
.split .grid { margin-inline: 0 calc(var(--margin) * -1); padding-inline: 0 var(--margin); justify-content: flex-end; }

.row-nav {
  position: absolute; right: var(--margin); top: clamp(5rem, 11vw, 10rem);
  display: flex; gap: .25rem;
  margin-top: clamp(.5rem, 1.8vw, 2rem);
}
.row-nav button {
  appearance: none; display: grid; place-items: center;
  width: 3.25rem; height: 3.25rem;
  background: none; border: 0; color: var(--fg);
  cursor: pointer;
}
.row-nav button:disabled { opacity: .28; cursor: default; }
.row-nav svg { width: 1.9rem; height: 1.9rem; fill: none; stroke: currentColor; stroke-width: 1.5; }
.row-nav button:not(:disabled):hover svg { stroke-width: 2.25; }

.thumb { position: relative; display: block; }
.square img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.thumb-word {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: clamp(2rem, 4.4vw, 4.5rem);
  opacity: 0;
}
.square-text {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  margin-top: .7rem;
}
.square-text h3 { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.action { flex: none; font-weight: 500; text-decoration: underline; text-underline-offset: .2em; }
@media (hover: hover) {
  .square img { transition: filter .15s linear; }
  .thumb-word { transition: opacity .15s linear; }
  .square:hover img, .square:focus-visible img { filter: brightness(.5); }
  .square:hover .thumb-word, .square:focus-visible .thumb-word { opacity: 1; }
}
.square h3 { font-weight: 500; line-height: 1.25; }
.square p { color: var(--dim); }
.square:hover h3 { text-decoration: underline; text-underline-offset: .2em; }

/* Video player */
html:has(.player[open]) { overflow: hidden; }
.player {
  position: fixed; inset: 0;
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; border: 0; padding: var(--margin);
  background: #000; color: var(--fg);
}
.player[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 1rem; }
.player::backdrop { background: #000; }
.player-bar { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; }
.player-bar form { margin: 0; }
.player-title { font-stretch: 125%; font-weight: 500; letter-spacing: -.02em; font-size: clamp(1.1rem, 1.9vw, 1.75rem); line-height: 1.1; }
.player-close {
  appearance: none; border: 0; padding: .6em 1em;
  background: #fff; color: #000;
  font: inherit; font-weight: 600; cursor: pointer;
}
.player-stage { display: grid; place-items: center; min-height: 0; }
.player-stage iframe { display: block; border: 0; background: #111; }
.player-stage .wide { width: min(100%, calc((100svh - 10rem) * 16 / 9)); aspect-ratio: 16 / 9; }
.player-stage .tall { width: min(100%, 440px); height: 100%; background: #fff; }
.player-out { justify-self: start; color: var(--dim); text-decoration: underline; text-underline-offset: .2em; }
.player-out:hover { color: var(--fg); }

/* About */
.about-grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 2rem var(--gap); align-items: end;
}
.about-grid img { grid-column: 1 / span 5; width: 100%; height: auto; }
.about-text { grid-column: 7 / -1; font-size: clamp(1.2rem, 2vw, 1.9rem); line-height: 1.28; letter-spacing: -.012em; }
.about-text p + p { margin-top: .9em; }

/* Contact and footer */
.email {
  display: block;
  font-size: calc((100vw - 2 * var(--margin)) / 14.25);
  white-space: nowrap;
}
.email:hover { text-decoration: underline; text-decoration-thickness: .04em; text-underline-offset: .12em; }

.site-footer {
  position: relative; background: var(--bg);
  display: flex; justify-content: space-between; gap: 1.5rem;
  padding: clamp(4rem, 8vw, 7rem) var(--margin) var(--margin);
  font-weight: 500;
}
.site-footer div { display: flex; gap: 1.5rem; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: .2em; }

/* Project page */
.project-title { font-size: clamp(2.5rem, 7.4vw, 8rem); }
.project-intro {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2rem var(--gap);
}
.project-intro h2 { grid-column: 1 / span 5; font-size: clamp(1.9rem, 3.6vw, 3.75rem); line-height: 1.02; }
.project-intro div { grid-column: 7 / -1; font-size: clamp(1.05rem, 1.35vw, 1.3rem); max-width: 34em; }
.project-intro p + p { margin-top: 1em; }

.films { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3rem var(--gap); align-items: start; }
.film:nth-child(1) { grid-column: 1 / span 7; }
.film:nth-child(2) { grid-column: 9 / -1; }
.film-player { position: relative; background: #111; }
.film-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.film h3 { margin-top: 1rem; font-weight: 500; font-size: 1.15rem; }
.film p { margin-top: .4rem; color: var(--dim); max-width: 34em; }

.stills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.stills img { width: 100%; height: auto; }
.stills--tall img { aspect-ratio: 4 / 5; object-fit: cover; }

.credits { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0 var(--gap); margin: 0; }
.credits div { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; padding: .45rem 0; }
.credits dt { grid-column: 1 / span 5; color: var(--dim); }
.credits dd { grid-column: 7 / -1; margin: 0; font-weight: 500; }

/* When the full titles no longer fit, the tabs become plain markers: the title is already on the frame */
@media (max-width: 1100px) {
  .stage-tabs button { height: 2.75rem; padding: 0; }
  .stage-tabs button span {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .slide .caption { bottom: calc(var(--margin) + 2.75rem); }
}

@media (max-width: 900px) {
  .square { flex: 0 0 clamp(220px, 62vw, 320px); }
  .row-nav { display: none; }
  .split { display: block; }
  .split > .section-title { margin-bottom: clamp(1.75rem, 4vw, 3.5rem); }
  .split .grid { margin-inline: calc(var(--margin) * -1); padding-inline: var(--margin); justify-content: flex-start; }
  .square-text { display: block; }
  .square-text .action { display: inline-block; margin-top: .2rem; }
  .about-grid img { grid-column: 1 / span 9; }
  .about-text { grid-column: 1 / -1; }
  .project-intro h2, .project-intro div { grid-column: 1 / -1; }
  .film:nth-child(1) { grid-column: 1 / -1; }
  .film:nth-child(2) { grid-column: 1 / span 9; }
  .stills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .credits dt { grid-column: 1 / span 6; }
  .credits dd { grid-column: 7 / -1; }
}

@media (max-aspect-ratio: 1/1) {
  .opening h1 { font-size: 19.5vw; white-space: normal; }
  .final { object-position: 30% 50%; }
  .caption { display: block; }
  .caption .go { margin-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .square img, .thumb-word, .site-header::before { transition: none; }
  .brand { transition: none; }
}
