/* ==========================================================================
   THE PORTFOLIO VIDEO — the button that leads to it (the header's; on a phone,
   the hero's) and its own page, /reel (components/sections/PortfolioReel.tsx)
   ========================================================================== */

/* ---------- The menu's two buttons: More work lit — the way into the work, by place — and the portfolio video's,
   quieter beside it, where the header has room for it ---------- */

.site-nav { align-items: center; }

/* More work: lit in the accent's pale gold everywhere; from 700 px a button — the accent's outline and tint, filled
   while its part of the page is on the screen (the menu's underline is the other links') */
.site-nav a.site-nav__more { color: var(--accent-soft); }
@media (min-width: 700px) {
  .site-nav a.site-nav__more {
    margin: -9px 0;                         /* (the menu's line keeps its height) */
    padding: 9px 13px 9px 14px;
    border: 1px solid color-mix(in srgb, var(--accent) 72%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 13%, transparent);
    color: var(--fg);
    letter-spacing: 0.22em;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition:
      background-color var(--dur) var(--ease-out),
      border-color var(--dur) var(--ease-out),
      color var(--dur-fast) ease,
      scale var(--dur-fast) var(--ease-out);
  }
  .site-nav a.site-nav__more::after { inset: -6px -4px; height: auto; background: none; transform: none; transition: none; }   /* (a finger's size around it, no underline) */
  .site-nav a.site-nav__more.is-active,
  .site-nav a.site-nav__more:focus-visible { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-ink); }
  .site-nav a.site-nav__more:active { scale: 0.97; }
}
@media (min-width: 700px) and (hover: hover) {
  .site-nav a.site-nav__more:hover { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-ink); }
}

/* The portfolio video's button: a fine outline, the player's triangle in the accent — there, not calling */
.site-nav a.site-nav__reel,
.hero__reel {
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(235, 233, 228, 0.3);
  border-radius: 999px;
  background: none;
  color: rgba(235, 233, 228, 0.82);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out),
    color var(--dur-fast) ease,
    scale var(--dur-fast) var(--ease-out);
}

/* (the play triangle, as the film player's own) */
.site-nav a.site-nav__reel::before,
.hero__reel::before {
  content: "";
  flex: none;
  border-style: solid;
  border-width: 0.4em 0 0.4em 0.66em;
  border-color: transparent transparent transparent var(--accent);
  transition: border-color var(--dur) var(--ease-out);
}

.site-nav a.site-nav__reel {
  display: none;                          /* (a phone: the hero's, below) */
  margin: -9px 0;                         /* (the menu's line keeps its height) */
  padding: 9px 15px 9px 14px;
}
/* (no underline; in its place a finger's size around the button) */
.site-nav a.site-nav__reel::after {
  inset: -6px -4px;
  height: auto;
  background: none;
  transform: none;
  transition: none;
}

@media (min-width: 700px) {
  .site-nav a.site-nav__reel { display: inline-flex; }
}

/* (on its own page: filled — where the visitor is; reached with the keyboard or pointed at: its outline and words lit) */
.site-nav a.site-nav__reel[aria-current="page"] {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--accent-ink);
}
.site-nav a.site-nav__reel[aria-current="page"]::before { border-left-color: var(--accent-ink); }
.site-nav a.site-nav__reel:focus-visible,
.hero__reel:focus-visible { border-color: rgba(235, 233, 228, 0.7); color: var(--fg); }

@media (hover: hover) {
  .site-nav a.site-nav__reel:not([aria-current="page"]):hover,
  .hero__reel:hover { border-color: rgba(235, 233, 228, 0.7); color: var(--fg); }
}

.site-nav a.site-nav__reel:active,
.hero__reel:active { scale: 0.97; }

/* A phone: under the roles, in the hero — it comes in with them and goes as they do (lib/page/hero.ts) */
[data-hero-sub] { position: relative; }

.hero__reel {
  position: absolute;
  left: 50%;
  top: calc(100% + clamp(22px, 4svh, 36px));
  translate: -50% 0;
  display: inline-flex;
  min-height: 44px;
  padding: 0 20px 0 18px;
  /* (over the film's own frames, bright ones too: the page's dark under its words) */
  background: rgba(20, 21, 23, 0.5);
  opacity: 0;
  transition:
    opacity 1.4s var(--ease-out) 1s,
    background-color var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out),
    color var(--dur-fast) ease,
    scale var(--dur-fast) var(--ease-out);
}
.is-loaded .hero__reel,
html:not(.js) .hero__reel { opacity: 1; }

@media (min-width: 700px) {
  .hero__reel { display: none; }
}

/* A small phone on its side: narrower than that, but its hero is taller than the screen — the hero's button would rest
   below the fold and be gone by the first stop. The header's, then, closer set (the name still docks beside it) */
@media (max-width: 699px) and (orientation: landscape) and (max-height: 500px) {
  .site-nav { gap: 12px; }
  .site-nav a { letter-spacing: 0.18em; }
  .site-nav a.site-nav__reel { display: inline-flex; gap: 7px; padding: 9px 11px 9px 10px; letter-spacing: 0.12em; }
  .hero__reel { display: none; }
}

/* ---------- Its page: the name in the header (no hero title docks here) ---------- */

.site-brand {
  font-size: var(--brand-size);
  font-weight: 400;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--fg);
  transition: opacity var(--dur-fast) ease;
}
@media (hover: hover) { .site-brand:hover { opacity: 0.7; } }
@media (max-width: 760px) { .site-brand { letter-spacing: 0.1em; } }

/* ---------- Its page: the film, and the frames from it beside it ---------- */

.reel {
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--header-h) + clamp(22px, 4.5svh, 44px)) var(--gutter) clamp(40px, 7svh, 84px);
}

/* The film (16:9) takes the width that leaves its stills, stacked beside it, exactly its own height — each the film's
   frames' own shape (--shape: width ÷ height, read from the first still at build; 16:9 until there is one), --g
   between them: with n stills of shape s, film = (W − g + s · g · (n − 1)/n) / (1 + 9s/16n). And the whole no wider
   than lets it all show on one screen (the film's height + 336 px of page). */
.reel__inner {
  --g: clamp(10px, 1.1vw, 16px);
  --stills: 4;
  --shape: 1.7778;
  --beside: calc(1 + var(--shape) * 9 / 16 / var(--stills));
  display: grid;
  grid-template-columns:
    calc((100% - var(--g) + var(--g) * var(--shape) * (var(--stills) - 1) / var(--stills)) / var(--beside))
    minmax(0, 1fr);
  column-gap: var(--g);
  width: 100%;
  max-width: min(var(--max-width), max(620px, calc((100vh - 336px) * 16 / 9 * var(--beside))));
  max-width: min(var(--max-width), max(620px, calc((100svh - 336px) * 16 / 9 * var(--beside))));
  margin-inline: auto;
}

/* (no stills: the film alone, as wide as one screen shows whole) */
.reel__inner--solo {
  grid-template-columns: minmax(0, 1fr);
  max-width: min(var(--max-width), max(620px, calc((100vh - 336px) * 16 / 9)));
  max-width: min(var(--max-width), max(620px, calc((100svh - 336px) * 16 / 9)));
}

.reel__head,
.reel__player,
.reel__stills li,
.reel__more {
  animation: reel-in 0.8s var(--ease-out) var(--d, 0s) both;
}
/* (from all but nothing: what first paints at exactly 0 a browser leaves out of the page's largest paint — which is
   the film's cover) */
@keyframes reel-in {
  from { opacity: 0.001; transform: translateY(26px); }
}

.reel__head {
  grid-column: 1 / -1;
  margin-bottom: clamp(18px, 3.2svh, 30px);
}

.reel__title {
  margin-top: clamp(12px, 2svh, 20px);
  font-size: clamp(2rem, min(4.3vw, 7.6svh), 4.5rem);
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--fg);
}

/* The player: the film's cover, clearly playable (as the documentary's) */
.reel__player {
  position: relative;
  display: block;
  align-self: start;
  scroll-margin-top: calc(var(--header-h) + 24px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-frame);
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.reel__player picture { display: contents; }

.reel__media,
.reel__still img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel__media { transition: transform var(--dur-slow) var(--ease-out); }

/* (shade along the bottom, so the play control always reads) */
.reel__player::after {
  content: "";
  position: absolute;
  inset: 40% 0 0 0;
  background: linear-gradient(to top, rgba(18, 19, 21, 0.66), transparent);
  pointer-events: none;
}

.reel__player .film__play { left: clamp(16px, 2vw, 30px); bottom: clamp(14px, 2vw, 28px); }
.reel__player .film__play-icon { width: clamp(46px, 3.8vw, 64px); }
/* (a cover not there yet names its file at the top: the play control has the bottom) */
.reel__player.is-missing::before { top: clamp(14px, 1.8vw, 24px); bottom: auto; }

/* No film link yet (data-video is the player's own word for it — the site editor's link arrives there): no play
   control, and a line that says so, once the editor's changes are in */
.reel__player[data-video=""] { cursor: default; }
.reel__player[data-video=""] .film__play { display: none; }
.reel__player:not([data-video=""]) .reel__soon { display: none; }

.reel__soon {
  position: absolute;
  left: clamp(16px, 2vw, 30px);
  bottom: clamp(16px, 2vw, 30px);
  z-index: 1;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--soon);                    /* ("coming soon", the site's one red: base.css) */
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}
.reel.is-settled .reel__soon,
html:not(.js) .reel__soon { opacity: 1; }

@media (hover: hover) {
  .reel__player:not([data-video=""]):hover .reel__media { transform: scale(1.025); }
  .reel__player:not([data-video=""]):hover .film__play-icon { background: var(--accent-fill); border-color: var(--accent-fill); box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 14%, transparent); }
  .reel__player:not([data-video=""]):hover .film__play-icon::after { border-left-color: var(--accent-ink); }
}
.reel__player:focus-visible { outline-offset: -6px; }
.reel__player:not([data-video=""]):focus-visible .film__play-icon { background: var(--accent-fill); border-color: var(--accent-fill); }
.reel__player:not([data-video=""]):focus-visible .film__play-icon::after { border-left-color: var(--accent-ink); }
.reel__player:not([data-video=""]):active { scale: 0.985; }

/* The stills: frames from the film, stacked beside it */
.reel__stills {
  display: grid;
  align-content: start;
  gap: var(--g);
}

.reel__still {
  position: relative;
  aspect-ratio: var(--shape, 1.7778);
  overflow: hidden;
  background: var(--bg-frame);
}
/* (a still not there yet: "Coming soon" in its middle, over its file's name — as a journey's frames say it) */
.reel__still.is-missing::after {
  content: "Coming soon";
  position: absolute;
  inset: 0 0 34% 0;                      /* (above its file's name, at the frame's foot) */
  display: grid;
  place-items: center;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--soon);
  pointer-events: none;
}

.reel__more {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 14px clamp(28px, 4vw, 56px);
  max-width: none;
  margin-top: clamp(20px, 3.4svh, 34px);
}
.reel__more .text-link { margin-top: 0; }

/* ---------- A phone (and a tablet held upright): the film edge to edge, its stills two by two under it ---------- */

@media (max-width: 760px), (max-aspect-ratio: 4/5) {
  .reel__inner { display: block; max-width: none; }
  /* (the roles on one line down to the narrowest phone — smaller there, as the hero's own are) */
  .reel__facts { font-size: min(0.6875rem, 2.75vw); letter-spacing: 0.2em; }
  .reel__facts span + span::before { width: 14px; margin: 0 0.8em 0 0.6em; }
  .reel__player { margin-inline: calc(var(--gutter) * -1); }
  .reel__stills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: var(--g);
  }
  .reel__more { margin-top: 28px; }
}

/* ---------- Under the film: who, in two sentences, and the work's credits (for someone with a minute) ---------- */

.reel__about {
  grid-column: 1 / -1;
  display: grid;
  /* (side by side where each has 26rem; one under the other where the page is held narrower — a low, wide screen) */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  gap: 40px clamp(28px, 5vw, 96px);
  margin-top: clamp(40px, 7svh, 84px);
  padding-top: clamp(26px, 4svh, 44px);
  border-top: 1px solid var(--line);
  animation: reel-in 0.8s var(--ease-out) var(--d, 0s) both;
}

.reel__summary {
  margin-top: 18px;
  max-width: 34em;
  font-size: clamp(1.0625rem, 1.3vw, 1.3125rem);
  font-weight: 300;
  line-height: 1.5;
  color: var(--fg);
}

.reel__reach {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 22px;
  font-size: 0.9375rem;
  font-weight: 300;
}
.reel__reach a {
  padding-bottom: 3px;
  color: var(--fg);
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 100% 1px no-repeat;
  overflow-wrap: anywhere;
}

.reel__works { margin-top: 18px; border-top: 1px solid var(--line); }

.reel__work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 24px;
  align-items: baseline;
  padding: 16px 0 17px;
  border-bottom: 1px solid var(--line);
}
.reel__work > * { grid-column: 1; max-width: none; }

.reel__work-title {
  font-size: clamp(1.0625rem, 1.45vw, 1.4375rem);
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: var(--fg);
}
.reel__work-sub { color: var(--fg-muted); }
.reel__work-sub::before { content: "· "; color: var(--fg-dim); }

.reel__work-facts {
  display: flex;
  flex-wrap: wrap;                       /* (each fact whole, on to a second line where the column is narrow) */
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.reel__work-facts span { white-space: nowrap; }
.reel__work-facts span + span::before { content: "·"; margin-inline: 0.7em; }

.reel__work-credit { font-size: 0.9375rem; font-weight: 300; }
/* (a role not known yet: no line for it) */
.reel__work-credit:empty { display: none; }

.reel__work > .reel__work-watch {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--fg);
}
.reel__work-watch span { color: var(--accent); transition: transform var(--dur) var(--ease-out); }
@media (hover: hover) { .reel__work-watch:hover span { transform: translateX(6px); } }

@media (max-width: 760px), (max-aspect-ratio: 4/5) {
  .reel__about { margin-top: 44px; }
  .reel__work { grid-template-columns: minmax(0, 1fr); }
  .reel__work > .reel__work-watch { grid-column: 1; grid-row: auto; }
}
