/* Stop Here (Lab 02). Self-contained: tokens, base, header, CTA, and the film engine
   rules forked from One Take (Lab 01). Default = static article (still + caption per
   scene); html[data-film] = enhanced (fixed canvas, tall scenes, holds). Only film.js sets
   that attribute. Logical properties throughout; direction-bound rules carry [dir="rtl"] twins. */

:root {
  --ink: #1A1814;
  --cream: #F5F2EC;
  --rust: #8B3A2A;
  --stone: #9E9890;
  --max: 1120px;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Courier Prime", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@font-face { font-family: "Courier Prime"; src: url("fonts/CourierPrime-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("fonts/CourierPrime-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cream); }

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  background: var(--cream);
  color: var(--ink);
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { inset-inline-start: 0.75rem; top: 0.75rem; }

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem var(--pad);
  background: linear-gradient(180deg, rgba(26, 24, 20, 0.92), rgba(26, 24, 20, 0));
  pointer-events: none;
}
.site-header a { pointer-events: auto; text-decoration: none; }
.logo { font-family: var(--mono); font-size: 0.9rem; letter-spacing: 0.02em; }
.site-nav { display: flex; gap: 0.7rem; font-size: 0.72rem; }
.site-nav a { color: var(--stone); }
.site-nav a:hover { color: var(--cream); }

.cta {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.7rem 1.4rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--rust);
  border: 1px solid var(--rust);
  text-decoration: none;
}
.cta:hover { background: var(--ink); border-color: var(--cream); }

.site-footer {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin-inline: auto;
  padding: 2rem var(--pad) 3rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--stone);
}

.site-footer p { margin: 0; }

/* Legal links, same row as the root site's footer. This page has its own
   stylesheet, so the rule from the root site.css does not reach it. */
.site-footer .footer-links {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
}

.site-footer .footer-links a {
  color: var(--stone);
  text-decoration: none;
}

.site-footer .footer-links a:hover {
  color: var(--cream);
  text-decoration: underline;
}

/* ---------- static article (default) ---------- */
.film { position: relative; }
.film-screen, .film-progress { display: none; }
.scene { max-width: var(--max); margin-inline: auto; padding: 3rem var(--pad) 1rem; }
.scene--hold { padding-block-start: calc(6rem + env(safe-area-inset-top, 0px)); }
.scene-poster { inline-size: 100%; block-size: auto; border: 1px solid rgba(158, 152, 144, 0.25); }
.twin {
  margin: 0.9rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
  text-align: start;
}
/* The per-scene copy is a .twin too, so html[data-film] .twin below hides it
   off-canvas once the film takes over. With the film off it is body text, not
   the uppercase mono caption the headline twin uses. */
.twin--body {
  margin: 0.5rem 0 0;
  font-family: var(--font);
  font-size: 0.95rem;
  letter-spacing: normal;
  text-transform: none;
  line-height: 1.6;
  max-width: 60ch;
}
.scene-copy { text-align: start; }
.film-play { display: none; }
.film-credits { margin: 1.5rem 0 0; font-family: var(--mono); font-size: 0.78rem; line-height: 1.6; color: var(--stone); max-width: 46ch; }
.scene--credits { padding-block-end: 3rem; }

/* ---------- enhanced (set by film.js only) ---------- */
html[data-film] .film-screen { display: block; position: fixed; inset: 0; z-index: 0; background: var(--ink); }
html[data-film] .film-screen canvas { display: block; inline-size: 100%; block-size: 100%; }
html[data-film] .film { z-index: 1; }
html[data-film] .scene { max-width: none; margin: 0; padding: 0; min-height: 260vh; }
html[data-film] .scene--hold { min-height: 120vh; }
html[data-film] .scene--credits { min-height: 300vh; }
html[data-film] .scene-poster { display: none; }
/* The headline is in the picture; its text twin stays for readers and search, off-canvas but in flow. */
html[data-film] .twin {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  margin: 0;
}
html[data-film] .scene-copy {
  position: sticky;
  isolation: isolate;
  top: 0;
  block-size: 100vh;
  block-size: 100dvh;
  max-width: var(--max);
  margin-inline: auto;
  padding: 0 var(--pad) calc(3.25rem + env(safe-area-inset-bottom, 0px));
  display: grid;
  align-content: end;
  justify-items: start;
}
/* Scrim so the closing copy reads over any frame; the film is bright, the copy is stone. */
html[data-film] .scene-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(26, 24, 20, 0) 35%, rgba(26, 24, 20, 0.82) 100%);
  opacity: 0;
  transition: opacity 0.6s ease;
}
html[data-film] .scene-copy.is-on::before { opacity: 1; }
html[data-film] .scene-copy > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html[data-film] .scene-copy > :nth-child(2) { transition-delay: 0.15s; }
html[data-film] .scene-copy.is-on > * { opacity: 1; transform: none; }
html[data-film] .scene-copy .cta { margin-top: 0; }

html[data-film] .film-progress { display: block; position: fixed; inset-block-start: 0; inset-inline: 0; block-size: 2px; z-index: 60; pointer-events: none; }
.film-progress-bar { position: absolute; inset: 0; background: var(--rust); transform: scaleX(0); transform-origin: 0 50%; }
[dir="rtl"] .film-progress-bar { transform-origin: 100% 50%; }
.film-counter {
  position: fixed;
  inset-block-end: calc(1.4rem + env(safe-area-inset-bottom, 0px));
  inset-inline-end: var(--pad);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--stone);
}
/* Hands-free control. Leaves on the press, springs back when the pass stops.
   Hidden on the closing scene so it never sits on the credits copy. */
html[data-film] .film-play {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  position: fixed;
  inset-block-end: calc(1.3rem + env(safe-area-inset-bottom, 0px));
  inset-inline: 0;
  inline-size: max-content;
  margin-inline: auto;
  z-index: 60;
  padding: 0.55rem 1.15rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream);
  background: rgba(26, 24, 20, 0.55);
  border: 1px solid rgba(245, 242, 236, 0.32);
  border-radius: 999px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: opacity 0.5s ease, transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1),
              background-color 0.3s ease, border-color 0.3s ease;
}
html[data-film] .film-play:hover { background: var(--rust); border-color: var(--rust); }
html[data-film] .film-play:focus-visible { outline: 2px solid var(--cream); outline-offset: 3px; }
.film-play-tri {
  inline-size: 0;
  block-size: 0;
  border-block: 5px solid transparent;
  border-inline-start: 8px solid currentColor;
  border-inline-end: 0;
}
/* Both hidden states are the same picture; only .is-off carries the press flourish. */
html[data-film] .film-play.is-off,
html[data-film] .film-play.is-end {
  opacity: 0;
  transform: translateY(10px) scale(0.94);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
html[data-film] .film-play.is-off::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--cream);
  border-radius: inherit;
  pointer-events: none;
  animation: film-play-ring 0.62s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes film-play-ring {
  from { opacity: 0.7; transform: scale(1); }
  to { opacity: 0; transform: scale(1.5); }
}

@media (max-width: 767px) {
  html[data-film] .scene { min-height: 220vh; }
  .film-counter { font-size: 0.66rem; }
}
