/* ==========================================================================
   Popcorn — design tokens, reset, typography, primitives
   Loaded first on every page. Nothing here knows about a specific page.
   ========================================================================== */

:root {
  /* ── Surfaces ───────────────────────────────────────────────────────────
     A single dark ladder. Elevation is expressed by surface, not by borders. */
  --bg: #08080a;
  --surface-1: #101013;   /* cards, panels */
  --surface-2: #17171c;   /* hover, inputs, wells */
  --surface-3: #1f1f26;   /* menus, modals, popovers */
  --surface-scrim: rgba(8, 8, 10, .78);

  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .14);

  /* ── Text ───────────────────────────────────────────────────────────── */
  --text: #f5f5f3;
  --text-dim: #a3a3ab;
  --text-mute: #6d6d78;

  /* ── Brand ──────────────────────────────────────────────────────────── */
  --accent: #ffc83d;              /* butter / marquee gold */
  --accent-hover: #ffd766;
  --curtain: #e63946;                 /* theatre-seat red */
  --accent-ink: #0b0b0c;              /* text/icon sitting on --accent */
  --accent-soft: rgba(255, 200, 61, .14);

  /* ── Status ─────────────────────────────────────────────────────────── */
  --ok: #43d17a;
  --warn: #ffb443;
  --danger: #ff5a4d;
  --danger-soft: rgba(255, 90, 77, .12);

  /* ── Radii ──────────────────────────────────────────────────────────── */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* ── Space (4px base) ───────────────────────────────────────────────── */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  /* ── Type ───────────────────────────────────────────────────────────── */
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --t-display: clamp(2.25rem, 5.2vw, 4.25rem);   /* hero title */
  --t-h1: clamp(1.75rem, 3.4vw, 2.75rem);        /* page title */
  --t-h2: clamp(1.3rem, 2vw, 1.65rem);           /* section title */
  --t-h3: 1.0625rem;                             /* card / panel title */
  --t-body: .9375rem;
  --t-sm: .8125rem;
  --t-xs: .75rem;
  --t-micro: .6875rem;

  /* ── Elevation ──────────────────────────────────────────────────────── */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, .55);
  --shadow-3: 0 28px 70px rgba(0, 0, 0, .7);

  /* ── Motion ─────────────────────────────────────────────────────────── */
  --ease: cubic-bezier(.2, .7, .3, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 340ms;

  /* ── Layout ─────────────────────────────────────────────────────────── */
  --gutter: clamp(16px, 4vw, 56px);
  --max-w: 1560px;
  --header-h: 68px;
  --tabbar-h: 62px;
  --poster-w: clamp(132px, 15.5vw, 184px);   /* row card width */
}

/* ── Reset ─────────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

img, video, svg { display: block; max-width: 100%; }
img { height: auto; }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

[hidden] { display: none !important; }

/* ── Typography primitives ─────────────────────────────────────────────── */

.t-display { font-size: var(--t-display); font-weight: 800; letter-spacing: -.035em; line-height: 1.02; }
.t-h1 { font-size: var(--t-h1); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.t-h2 { font-size: var(--t-h2); font-weight: 700; letter-spacing: -.022em; line-height: 1.2; }
.t-h3 { font-size: var(--t-h3); font-weight: 700; letter-spacing: -.015em; }
.t-body { font-size: var(--t-body); }
.t-sm { font-size: var(--t-sm); }
.t-xs { font-size: var(--t-xs); }

.t-dim { color: var(--text-dim); }
.t-mute { color: var(--text-mute); }
.t-mono {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: .02em;
}

/* Small uppercase label used for section eyebrows and metadata keys. */
.t-label {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--text-mute);
}

/* Multi-line truncation. */
.clamp-1, .clamp-2, .clamp-3, .clamp-4 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }
.clamp-4 { -webkit-line-clamp: 4; }

/* ── Layout primitives ─────────────────────────────────────────────────── */

.shell {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Full-bleed row: content aligns to .shell but scrolls past the right edge. */
.bleed {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
}

.stack { display: flex; flex-direction: column; }
.row-flex { display: flex; align-items: center; }
.gap-1 { gap: var(--s1); } .gap-2 { gap: var(--s2); } .gap-3 { gap: var(--s3); }
.gap-4 { gap: var(--s4); } .gap-5 { gap: var(--s5); } .gap-6 { gap: var(--s6); }
.spacer { flex: 1; }

/* ── Focus & accessibility ─────────────────────────────────────────────── */

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}
/* Elements with their own radius shouldn't get a mismatched outline. */
.card:focus-visible, .btn:focus-visible, .input:focus-visible { outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Keyboard escape hatch past the nav. */
.skip-link {
  position: fixed;
  top: var(--s3); left: var(--s3);
  z-index: 200;
  padding: var(--s3) var(--s4);
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--r-sm);
  font-weight: 700;
  transform: translateY(-200%);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ── Scrollbars ────────────────────────────────────────────────────────── */

* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.16) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .14);
  border-radius: var(--r-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .26); background-clip: content-box; }

/* ── Film grain ────────────────────────────────────────────────────────── */

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}
