/* Castix Stream storefront template.
   Philosophy: a repertory cinema's printed programme — warm paper, ink, one tenant accent;
   the signature is the timecode strip (HH:MM:SS:FF) that labels every title like a film can.
   It never uses glass, gradient blobs or neon; corners stay square; motion lives on focus only.
   Variance 5 · Motion 3 · Density 6. Every colour below is a tenant token (set from /v1/tenant). */
:root {
  --bg: #f3eee4; --surface: #fbf8f2; --ink: #1d1a1c; --muted: #6c655c; --line: #d8cfbf;
  --accent: #1f5e4a; --accent-ink: #f3eee4; --player-bg: #0e0d0c;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: "Avenir Next", "Segoe UI", "Helvetica Neue", "Noto Sans", "Vazirmatn", Tahoma, sans-serif;
  --font-mono: "SF Mono", "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
  --radius: 2px; --gutter: clamp(16px, 4vw, 56px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font-body); min-height: 100dvh; display: flex; flex-direction: column; }
body::before { /* paper grain, fixed and inert */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, header, footer, .demo-ribbon { position: relative; z-index: 1; }
main { flex: 1; outline: none; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; inset-inline-start: 8px; top: -40px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 10; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ── masthead ── */
.masthead { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; padding: 18px var(--gutter); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 22px; height: 22px; background: var(--accent); border-radius: 50%; box-shadow: inset 0 0 0 5px var(--bg), 0 0 0 1px var(--accent); }
.brand-name { font: 600 22px/1 var(--font-display); letter-spacing: -.01em; white-space: nowrap; }
.nav { display: flex; gap: 22px; justify-content: center; }
.nav a { text-decoration: none; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a[aria-current="page"], .nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }
.tools { display: flex; gap: 8px; }
.select { font: inherit; font-size: 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; }
.demo-ribbon { background: var(--ink); color: var(--bg); font-size: 13px; padding: 8px var(--gutter); display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.demo-ribbon a { color: var(--bg); }
@media (max-width: 760px) {
  .masthead { grid-template-columns: 1fr auto; }
  .nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow-x: auto; }
}

/* ── type ── */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; line-height: 1.05; margin: 0; text-wrap: balance; }
.eyebrow { font: 500 12px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tc { font: 500 12px/1 var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.muted { color: var(--muted); }

/* ── hero: the featured title on a film-can label ── */
.hero { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 64px); padding: clamp(28px, 5vw, 72px) var(--gutter) 40px; align-items: end; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 5.6rem); max-width: 14ch; }
.hero .synopsis { font-size: 18px; max-width: 58ch; margin: 18px 0 26px; color: color-mix(in srgb, var(--ink) 82%, var(--bg)); }
.hero-art { position: relative; aspect-ratio: 16 / 10; background: var(--ink); overflow: hidden; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.9) contrast(1.02); }
.strip { display: flex; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin-top: 18px; flex-wrap: wrap; }
.strip span + span::before { content: "│"; margin-inline-end: 14px; color: var(--line); }
.sprockets { position: absolute; inset-inline: 0; height: 14px; background: repeating-linear-gradient(90deg, transparent 0 10px, color-mix(in srgb, var(--bg) 85%, transparent) 10px 18px); opacity: .9; }
.sprockets.top { top: 6px; } .sprockets.bottom { bottom: 6px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } .hero-art { order: -1; } }

/* ── buttons ── */
.btn { display: inline-flex; align-items: center; gap: 10px; font: 600 15px/1 var(--font-body); padding: 14px 22px; border-radius: var(--radius); border: 1px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; transition: transform .12s ease, background .12s ease; min-height: 44px; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn[disabled] { opacity: .5; cursor: progress; }
.btn .tri { width: 0; height: 0; border-block: 6px solid transparent; border-inline-start: 10px solid currentColor; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── rails ── */
.rail { padding: 18px 0 8px; }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 var(--gutter); margin-bottom: 14px; }
.rail-head h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); text-transform: capitalize; }
.rail-track { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(150px, 16vw, 210px); gap: 18px; overflow-x: auto; padding: 4px var(--gutter) 18px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.card { scroll-snap-align: start; text-decoration: none; display: block; }
.card .poster { aspect-ratio: 2 / 3; background: color-mix(in srgb, var(--ink) 10%, var(--bg)); overflow: hidden; border: 1px solid var(--line); position: relative; }
.card .poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s cubic-bezier(.2, .7, .2, 1); }
.card:focus-visible .poster img, .card:hover .poster img { transform: scale(1.04); }
.card .label { padding: 10px 0 0; }
.card .label b { display: block; font: 600 16px/1.25 var(--font-display); }
.badge { position: absolute; inset-block-start: 8px; inset-inline-start: 8px; background: var(--bg); color: var(--ink); font: 600 11px/1 var(--font-mono); letter-spacing: .08em; padding: 5px 6px; text-transform: uppercase; }
.badge.live { background: #b3261e; color: #fff; }
.skeleton { background: linear-gradient(90deg, var(--line), color-mix(in srgb, var(--line) 50%, var(--bg)), var(--line)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── detail ── */
.detail { display: grid; grid-template-columns: minmax(200px, 320px) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); padding: 40px var(--gutter); }
.detail h1 { font-size: clamp(2.2rem, 5vw, 4.4rem); }
.detail .poster { aspect-ratio: 2 / 3; background: var(--ink); }
.detail .poster img { width: 100%; height: 100%; object-fit: cover; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 22px 0; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.paywall { border: 1px solid var(--ink); padding: 20px; margin-top: 22px; max-width: 640px; background: var(--surface); }
.offers { display: grid; gap: 10px; margin-top: 14px; }
.offer { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.episodes { margin-top: 28px; border-top: 1px solid var(--ink); }
.episode { display: grid; grid-template-columns: 80px 1fr auto; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: center; }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; } .detail .poster { max-width: 220px; } }

/* ── watch ── */
.theatre { background: var(--player-bg); color: #ece6da; min-height: calc(100dvh - 140px); display: grid; grid-template-rows: auto 1fr auto; }
.theatre-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px var(--gutter); gap: 16px; }
.theatre-bar a { color: #ece6da; }
.screen { position: relative; display: grid; place-items: center; padding: 0 var(--gutter); }
.screen video { width: 100%; max-height: 76dvh; background: #000; aspect-ratio: 16 / 9; }
.overlay-code { position: absolute; font: 600 12px/1 var(--font-mono); color: rgba(255, 255, 255, .28); pointer-events: none; transition: inset 1.2s ease; user-select: none; }
.ad-chip { position: absolute; inset-block-start: 14px; inset-inline-end: calc(var(--gutter) + 14px); background: #f3d36b; color: #111; font: 700 12px/1 var(--font-mono); padding: 6px 8px; display: none; }
.stats { font: 12px/1.6 var(--font-mono); display: flex; gap: 22px; flex-wrap: wrap; padding: 12px var(--gutter) 18px; color: #b9b2a6; border-top: 1px solid #2a2724; }
.stats b { color: #ece6da; font-weight: 600; }
.notice { padding: 40px var(--gutter); max-width: 720px; }
.notice h2 { font-size: 28px; margin-bottom: 10px; }

/* ── forms & account ── */
.panel { padding: 40px var(--gutter); display: grid; gap: 32px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
.section h2 { font-size: 26px; margin-bottom: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field input, .field select { font: inherit; padding: 11px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius); min-height: 44px; }
.field input[aria-invalid="true"] { border-color: #b3261e; }
.err { color: #9b2018; font-size: 14px; min-height: 1.2em; }
.list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.empty { border: 1px dashed var(--line); padding: 22px; color: var(--muted); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0; border: 1px solid var(--ink); margin: 32px var(--gutter); }
.plan { padding: 26px; border-inline-end: 1px solid var(--line); display: grid; gap: 12px; align-content: start; background: var(--surface); }
.plan:last-child { border-inline-end: 0; }
.plan .price { font: 600 36px/1 var(--font-display); }
.plan ul { padding-inline-start: 18px; margin: 0; color: var(--muted); font-size: 15px; }
.colophon { padding: 28px var(--gutter); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); margin-top: 40px; }
.toast { position: fixed; inset-block-end: 20px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 16px; z-index: 20; font-size: 14px; max-width: calc(100vw - 32px); }
[dir="rtl"] .toast { transform: translateX(50%); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* TV sign-in approval */
.activate { max-width: 560px; margin: 48px auto; padding: 0 var(--gutter); }
.activate form { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; }
.activate #uc { font: 600 28px/1 var(--font-mono); letter-spacing: .14em; padding: 12px 14px; border: 1px solid var(--ink); background: var(--surface); width: 9.5em; text-transform: uppercase; }
.activate .row-btns { display: flex; gap: 10px; }
