/* ============================================================================
   500x — THE SCHOOL · scroll film
   ----------------------------------------------------------------------------
   One rig, eight movements. Each movement is a tall track with a sticky pin;
   scroll position inside the track is normalised to t = 0..1 and every beat is
   a function of t. Nothing here is per-movement except the tokens each one
   sets on its own section.

   The previz scenes grew two different rigs (#stage vs #pin, and two different
   ways of computing t). This is the merge: the self-locating progress from the
   scene-01/02/03 lineage, and the pure render(t) contract from scene-04/05.
   ========================================================================== */

:root {
  --film-vh-per-sec: 21;          /* the runtime budget's constant */
  --ink: #f4f4f0;
  --ink-soft: rgba(255, 255, 255, 0.72);
  --ink-faint: rgba(255, 255, 255, 0.46);
  --display: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --rail-w: 190px;
}

/* ---------------------------------------------------------------- the rig */

.mv { position: relative; }
.mv-track { position: relative; }
.mv-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--mv-bg, #08080a);
}

/* The camera sits between the pin and the cover box, so a movement can dolly
   or push without disturbing the cover geometry underneath it. Identity
   transform when a movement does not use it. */
.mv-cam {
  position: absolute;
  inset: 0;
  overflow: hidden;
  will-change: transform;
}

/* Cover box: fills the viewport at the plate's own aspect ratio, so the
   composite registers to the artwork rather than to the window. */
.mv-box {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: max(100vw, calc(100vh * var(--ar, 1.7778)));
  aspect-ratio: var(--ar-css, 16 / 9);
}
.mv-box > img,
.mv-box > video,
.mv-box > canvas { width: 100%; height: 100%; object-fit: cover; display: block; }

.mv-plate { position: absolute; inset: 0; }
.mv-plate img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ------------------------------------------------------------- furniture */

.mv-grain {
  position: absolute;
  inset: -50%;
  pointer-events: none;
  opacity: var(--grain, 0.12);
  mix-blend-mode: overlay;
  z-index: 6;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
}
.mv-vig {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  background: radial-gradient(ellipse 84% 76% at 48% 50%,
              transparent 42%, var(--vig, rgba(0, 0, 0, 0.66)) 100%);
}
/* The card scrim is a 96deg wedge under the type. Per-movement base colour,
   because a berry world and a steel world need different darks. */
.mv-scrim {
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(96deg,
    rgba(var(--scrim-rgb, 4 6 12) / 0.94) 0%,
    rgba(var(--scrim-rgb, 4 6 12) / 0.84) 26%,
    rgba(var(--scrim-rgb, 4 6 12) / 0.30) 50%,
    rgba(var(--scrim-rgb, 4 6 12) / 0) var(--scrim-reach, 66%));
}

/* ------------------------------------------------------ the project card */
/* One slot, every movement. previz had four variants of this; the engine
   drives opacity and the per-line stagger, the tokens do the rest. */

.mv-card {
  position: absolute;
  left: 6vw;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  max-width: min(38vw, 540px);
  opacity: 0;
  pointer-events: none;
}
.mv-card .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 22px;
}
.mv-card .mark {
  font-family: var(--mark-font, var(--display));
  font-weight: var(--mark-weight, 700);
  color: #fff;
  font-size: var(--mark-size, clamp(44px, 6.4vw, 104px));
  line-height: 0.92;
  letter-spacing: -0.035em;
  margin: 0;
}
.mv-card img.mark { width: min(76%, 340px); height: auto; display: block; }
.mv-card .sub {
  font-family: var(--sub-font, var(--display));
  font-size: clamp(16px, 1.9vw, 26px);
  color: var(--sub-color, var(--ink-soft));
  margin: 12px 0 0;
}
.mv-card .lines {
  margin: 26px 0 0;
  font-size: clamp(13px, 1.1vw, 17px);
  line-height: 1.62;
  color: var(--ink-soft);
  max-width: 34ch;
}
.mv-card .lines span { display: block; will-change: opacity, transform; }
.mv-card .lines span + span { margin-top: 0.5em; }
.mv-card .cta { margin-top: 30px; pointer-events: auto; opacity: 0; will-change: opacity, transform; }
.mv-card .cta a {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  text-decoration: none;
  padding: 14px 24px;
  border-radius: var(--cta-radius, 3px);
  background: var(--cta-bg, #f4f4f0);
  color: var(--cta-ink, #0a0a0a);
  border: 1px solid var(--cta-bg, #f4f4f0);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.mv-card .cta a:hover { transform: translateX(4px); }
.mv-card.outline .cta a { background: transparent; color: var(--cta-ink, #f4f4f0); border-color: var(--cta-line, rgba(255,255,255,0.42)); }

/* A movement whose plates are not shot yet says so, rather than pretending.
   Bottom-LEFT: the skip control owns the bottom-right corner. */
.mv-wip {
  position: absolute;
  left: 6vw;
  bottom: 5vh;
  z-index: 5;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 8px 15px;
  backdrop-filter: blur(6px);
}
/* The holding plate for an unshot movement: registration grid + colour world,
   so it reads as a frame reserved rather than a frame missing. */
.mv-holding {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 88px),
    radial-gradient(ellipse 70% 60% at 50% 50%, var(--hold-1, #1a1a22), var(--hold-2, #08080a) 78%);
}
.mv-holding::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 8vmin; height: 8vmin;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}

/* --------------------------------------------------------- film chrome */

.film-rail {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.film-rail.on { opacity: 1; pointer-events: auto; }
.film-rail a {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color 0.25s ease;
}
.film-rail .lbl { opacity: 0; transform: translateX(6px); transition: opacity 0.25s, transform 0.25s; }
.film-rail a:hover .lbl,
.film-rail a[aria-current="true"] .lbl { opacity: 1; transform: none; }
.film-rail .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.26);
  transition: background 0.25s ease, transform 0.25s ease;
  flex: 0 0 auto;
}
.film-rail a[aria-current="true"] { color: var(--ink); }
.film-rail a[aria-current="true"] .dot { background: var(--ink); transform: scale(1.5); }

.film-skip {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 11px 18px;
  background: rgba(8, 8, 10, 0.6);
  backdrop-filter: blur(8px);
  transition: color 0.25s, border-color 0.25s, opacity 0.4s;
}
.film-skip:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.5); }
.film-skip.gone { opacity: 0; pointer-events: none; }

.film-progress {
  position: fixed;
  left: 0; top: 0;
  height: 2px;
  width: 0;
  z-index: 70;
  background: var(--ink);
  opacity: 0.7;
  pointer-events: none;
}

@media (max-width: 1000px) {
  .film-rail { display: none; }
  .mv-card { left: 7vw; max-width: 82vw; }
  .mv-card .lines { max-width: 40ch; }
}

/* ------------------------------------------------------- reduced motion */
/* Not a degraded fallback: the film becomes an editorial gallery of its own
   hold frames, which is the thing the film was carrying anyway. */
@media (prefers-reduced-motion: reduce) {
  .mv-track { height: auto !important; }
  .mv-pin { position: relative; height: auto; min-height: 78vh; }
  .mv-cam { position: relative; inset: auto; }
  .mv-box { position: relative; left: auto; top: auto; transform: none; width: 100%; }
  .mv-card { position: relative; left: auto; top: auto; transform: none;
             opacity: 1 !important; max-width: 62ch; padding: 44px 6vw 64px; }
  .mv-card .lines span, .mv-card .cta { opacity: 1 !important; transform: none !important; }
  .mv-scrim { opacity: 0.5 !important; }
  .mv-grain { display: none; }
  .film-rail, .film-skip, .film-progress { display: none; }
}

/* Space Grotesk ships no italic, so a UA-default <em> renders as a
   synthesised oblique. Emphasis is tone here, never slant. */
em { font-style: normal; }
