/* =====================================================================
   MOTION-001 — THE INTERVAL
   A digital motion study. No WebGL, no canvas, no animation library.

   Ground rules of the visual system:
   - The page is PAPER. The photographs are PLATES printed onto it.
     Every dark rectangle is an object on a light surface, never a
     "background image" the type floats over.
   - Vermilion is a registration mark, not decoration. It appears on the
     live frame index and the interval callout. Nowhere else.
   - Motion is rationed. Most of this page never moves.
   ===================================================================== */

:root {
  --paper: #e7e3da;
  --paper-deep: #dcd7cb;
  --ink: #14130f;
  --ink-soft: rgba(20, 19, 15, 0.58);
  --ink-faint: rgba(20, 19, 15, 0.22);
  --plate: #0b0c0e;
  --mark: #b8402a;

  --display: "Fraunces", Georgia, serif;
  --body: "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --t-display: clamp(3.4rem, 12vw, 12rem);
  --t-h2: clamp(1.9rem, 4.4vw, 3.9rem);
  --t-lead: clamp(1.05rem, 1.55vw, 1.4rem);
  --t-body: clamp(0.92rem, 1vw, 1rem);
  --t-micro: 0.67rem;

  --gutter: clamp(20px, 5vw, 96px);
  --rule: 1px solid var(--ink-faint);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--t-body);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }

/* ---------- shared type ---------- */
.micro {
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.mark { color: var(--mark); }

.measure { max-width: 39ch; }
.measure-wide { max-width: 46ch; }

/* ---------- masthead ---------- */
.masthead {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gutter);
  mix-blend-mode: difference;
  color: #f4f1e8;
  pointer-events: none;
}
.masthead span { font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.19em; text-transform: uppercase; }
.masthead .masthead__mid { opacity: 0.7; }

@media (max-width: 720px) {
  .masthead .masthead__mid { display: none; }
}

/* =====================================================================
   ACT 0 — OPENING. Deliberately still.
   The display title crosses the plate edge and inverts itself there via
   difference blending: one composition, not type stacked on an image.
   ===================================================================== */
/* Sized so the entire opening composition resolves inside one viewport —
   a masthead spread, not a block that happens to get sliced by the fold. */
.opening {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: clamp(80px, 10vh, 124px) var(--gutter) clamp(34px, 5vh, 60px);
}

.opening__grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0 clamp(12px, 2vw, 28px);
  align-items: start;
}

.opening__plate {
  grid-column: 4 / 13;
  grid-row: 1;
  position: relative;
  background: var(--plate);
  aspect-ratio: 16 / 9;
  max-height: 56vh;
  overflow: hidden;
}
.opening__plate img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 42% 50%;
}

.opening__title {
  grid-column: 1 / 11;
  grid-row: 1;
  align-self: end;
  margin-top: clamp(70px, 14vw, 200px);
  position: relative;
  z-index: 5;
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-display);
  line-height: 0.84;
  letter-spacing: -0.035em;
  color: #ffffff;
  mix-blend-mode: difference;
  pointer-events: none;
}

.opening__foot {
  grid-column: 1 / 5;
  grid-row: 2;
  padding-top: clamp(28px, 4vw, 54px);
}
.opening__foot .standfirst {
  font-size: var(--t-lead);
  line-height: 1.5;
  margin-top: 14px;
}

.opening__index {
  grid-column: 10 / 13;
  grid-row: 2;
  padding-top: clamp(28px, 4vw, 54px);
  text-align: right;
}

@media (max-width: 860px) {
  .opening { min-height: 0; }
  .opening__plate { grid-column: 1 / 13; aspect-ratio: 4 / 3; max-height: none; }
  .opening__title { grid-column: 1 / 13; margin-top: clamp(120px, 42vw, 300px); }
  /* Explicit rows: without these the foot and the index both land in row 2
     and print on top of each other. */
  .opening__foot { grid-column: 1 / 13; grid-row: 2; text-align: left; }
  .opening__index {
    grid-column: 1 / 13;
    grid-row: 3;
    text-align: left;
    margin-top: clamp(26px, 6vw, 40px);
    padding-top: 14px;
    border-top: var(--rule);
  }
  .opening__index .micro { line-height: 2; }
}

/* ---------- scroll cue ---------- */
.cue {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(22px, 3.4vh, 42px);
}
.cue__line {
  width: 54px;
  height: 1px;
  background: var(--ink);
  transform-origin: left;
}

/* =====================================================================
   ACT 1 — THE THESIS. Type only. Nothing else on screen.
   ===================================================================== */
.thesis {
  padding: clamp(110px, 22vh, 260px) var(--gutter);
  border-top: var(--rule);
}
.thesis__inner { max-width: 1180px; }
.thesis p {
  font-family: var(--display);
  font-weight: 500;
  font-size: var(--t-h2);
  line-height: 1.16;
  letter-spacing: -0.018em;
  text-wrap: balance;
}
.thesis p + p { margin-top: 1em; }
.thesis__note {
  margin-top: clamp(40px, 6vw, 80px);
  padding-top: 20px;
  border-top: var(--rule);
  max-width: 42ch;
}
.thesis__note p { font-family: var(--body); font-size: var(--t-body); font-weight: 400; line-height: 1.62; letter-spacing: 0; color: var(--ink-soft); }

/* =====================================================================
   ACT 2 — THE SEQUENCE. The scroll is the shutter.
   ===================================================================== */
.sequence {
  position: relative;
  /* Scroll distance for the scrub. JS never touches this — pure CSS length. */
  height: 460vh;
  background: var(--paper);
}

.sequence__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(10px, 1.6vh, 22px);
  padding: clamp(52px, 7vh, 78px) var(--gutter) clamp(24px, 4vh, 42px);
}

.sequence__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  border-bottom: var(--rule);
  padding-bottom: 10px;
}

.sequence__stage {
  position: relative;
  background: var(--plate);
  overflow: hidden;
  min-height: 0;
}
.sequence__stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 42% 50%;
  opacity: 0;
}
/* No transition, by design. A shutter does not crossfade — and instant
   swaps keep 29 stacked images off the compositor entirely. */
.sequence__stage img.is-on { opacity: 1; }

.sequence__foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

.counter {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--mark);
  font-variant-numeric: tabular-nums;
}
.counter sub {
  font-size: 0.28em;
  vertical-align: baseline;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  margin-left: 0.5em;
  bottom: 0;
}

/* Marks the suspension plates — the piece noticing its own subject at the
   one moment the whole argument is about. */
.apex {
  display: block;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mark);
  border-left: 2px solid var(--mark);
  padding-left: 9px;
}
.apex[hidden] { display: none; }

.interval-readout { text-align: right; max-width: 30ch; }
.interval-readout strong {
  display: block;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.94rem;
  letter-spacing: 0.02em;
  color: var(--mark);
  margin-bottom: 3px;
}

/* Progress rule: the only continuously-moving element in the whole piece. */
.scrubline {
  position: relative;
  height: 1px;
  background: var(--ink-faint);
}
.scrubline__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--ink);
}

@media (max-width: 720px) {
  .sequence { height: 380vh; }
  .sequence__foot { flex-direction: column; align-items: flex-start; gap: 10px; }
  .interval-readout { text-align: left; }
}

/* =====================================================================
   ACT 3 — IMPACT. The one violent entrance in the piece.
   ===================================================================== */
/* Exactly one viewport: bottom-aligned content in a taller section would
   sit below the fold at the moment the section snaps into view. */
.impact {
  position: relative;
  min-height: 100vh;
  background: var(--plate);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: var(--gutter);
}
.impact__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
}
.impact__bg::after { content: ""; }
.impact__veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11, 12, 14, 0.92) 0%, rgba(11, 12, 14, 0.15) 55%, rgba(11, 12, 14, 0.4) 100%);
}
.impact__body { position: relative; z-index: 2; color: var(--paper); width: 100%; }
.impact__rule {
  height: 2px;
  background: var(--mark);
  width: 100%;
  margin-bottom: clamp(18px, 3vw, 34px);
  transform: scaleX(0);
  transform-origin: left;
}
.impact h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.6rem, 8.6vw, 8.2rem);
  line-height: 0.9;
  letter-spacing: -0.035em;
  max-width: 16ch;
}
.impact__sub {
  margin-top: clamp(16px, 2.4vw, 30px);
  color: rgba(231, 227, 218, 0.72);
  max-width: 44ch;
}

/* =====================================================================
   ACT 4 — THE HELD INTERVAL. Nothing here moves. That is the point.
   ===================================================================== */
.held {
  min-height: 118vh;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  text-align: center;
}
/* Wide and unhurried. This is the rest beat — a cramped column would read
   as an accident rather than as held silence. */
.held__inner { max-width: min(88vw, 780px); }
.held p {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.5rem, 3vw, 2.6rem);
  line-height: 1.24;
  letter-spacing: -0.015em;
}
.held .micro { display: block; margin-bottom: clamp(22px, 4vw, 44px); }

/* =====================================================================
   ACT 5 — THE PLATE. The whole action at once, after you lived it
   one frame at a time. A Muybridge plate, numbered.
   ===================================================================== */
.plate-grid { padding: clamp(70px, 12vh, 140px) var(--gutter) clamp(60px, 9vh, 110px); border-top: var(--rule); }

.plate-grid__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  margin-bottom: clamp(26px, 4vw, 46px);
  border-bottom: var(--rule);
}
.plate-grid__head h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-h2);
  letter-spacing: -0.025em;
  line-height: 1;
}

.plates {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(6px, 0.9vw, 14px);
}
.plates figure {
  position: relative;
  background: var(--plate);
  overflow: hidden;
  aspect-ratio: 16 / 11;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (hover: hover) {
  .plates figure:hover { transform: translateY(-4px); }
  .plates figure:hover figcaption { color: var(--paper); }
}
.plates figcaption { transition: color 0.35s ease; }
.plates img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 42% 50%;
  transform: scale(1.001);
}
.plates figcaption {
  position: absolute;
  left: 6px;
  bottom: 4px;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: rgba(231, 227, 218, 0.5);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) { .plates { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 560px) { .plates { grid-template-columns: repeat(3, 1fr); } }

/* =====================================================================
   COLOPHON
   ===================================================================== */
.colophon {
  padding: clamp(60px, 9vh, 110px) var(--gutter) clamp(70px, 11vh, 130px);
  border-top: var(--rule);
}
.colophon__grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(20px, 3vw, 40px);
}
.colophon__lead { grid-column: 1 / 6; }
.colophon__lead h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  letter-spacing: -0.025em;
  line-height: 1.04;
}
.colophon__note {
  margin-top: clamp(18px, 2.4vw, 30px);
  max-width: 36ch;
  color: var(--ink-soft);
}
.colophon dl { grid-column: 7 / 13; display: grid; gap: 0; }
.colophon dl > div {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 16px;
  padding: 11px 0;
  border-top: var(--rule);
}
.colophon dl > div:last-child { border-bottom: var(--rule); }
.colophon dt { font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); padding-top: 3px; }
.colophon dd { font-size: 0.88rem; line-height: 1.55; }

.colophon__back {
  grid-column: 1 / 13;
  margin-top: clamp(34px, 5vw, 60px);
  padding-top: 18px;
  border-top: var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.colophon__back a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--ink-faint); padding-bottom: 2px; }
.colophon__back a:hover { border-bottom-color: var(--ink); }

@media (max-width: 860px) {
  .colophon__lead, .colophon dl { grid-column: 1 / 13; }
  .colophon dl { margin-top: 26px; }
  .colophon dl > div { grid-template-columns: 1fr; gap: 2px; }
}

/* =====================================================================
   MOTION — rationed, and only when scripting is on.

   Everything above is fully visible with JavaScript disabled. These
   rules are the ONLY things that hide content, and they are gated so a
   no-JS visitor never meets a page of invisible blocks.
   ===================================================================== */
@media (scripting: enabled) {
  .reveal { opacity: 0; transform: translateY(16px); }
  .reveal.is-in {
    opacity: 1;
    transform: none;
    transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .reveal.is-in.d1 { transition-delay: 0.08s; }
  .reveal.is-in.d2 { transition-delay: 0.16s; }

  .cue__line { transform: scaleX(0); }
  .cue.is-in .cue__line { transform: scaleX(1); transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1) 0.3s; }

  /* The violent one. Short, hard, slightly overshooting — and it happens
     exactly once, after a long stretch of calm paper. */
  .impact h2, .impact__sub { opacity: 0; transform: translateY(38px); }
  .impact.is-hit h2 {
    opacity: 1; transform: none;
    transition: opacity 0.26s linear, transform 0.42s cubic-bezier(0.16, 1.02, 0.3, 1);
  }
  .impact.is-hit .impact__sub {
    opacity: 1; transform: none;
    transition: opacity 0.4s linear 0.16s, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.16s;
  }
  .impact.is-hit .impact__rule { transform: scaleX(1); transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
  .impact__bg { transform: scale(1.06); }
  .impact.is-hit .impact__bg { transform: scale(1); transition: transform 1.4s cubic-bezier(0.22, 1, 0.36, 1); }

  /* The plate prints in, fast, like a contact sheet coming up. */
  .plates figure { opacity: 0; }
  .plates figure.is-in { opacity: 1; transition: opacity 0.5s ease; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.is-in,
  .impact h2, .impact__sub, .impact.is-hit h2, .impact.is-hit .impact__sub,
  .plates figure, .plates figure.is-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .impact__bg, .impact.is-hit .impact__bg { transform: none !important; transition: none !important; }
  .impact__rule, .impact.is-hit .impact__rule { transform: scaleX(1) !important; transition: none !important; }
  .cue__line, .cue.is-in .cue__line { transform: scaleX(1) !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
