/* Night Shift Lockdown — code portal
   Palette tokens from Illustrator Brief v1.5 §2. Mobile first. */

:root {
  --ink: #0B0B0D;
  --tungsten: #F4B860;
  --emergency: #C8202B;
  --crt: #3EDB7A;
  --paper: #E8E2D4;
  --dust: #B9C2CC;
  --blood: #5A1A1A;
  --panel: #141417;
  --panel-edge: #26262b;
  --text: var(--paper);
  --muted: #9aa0a8;
  --font-display: "Big Shoulders Stencil Display", "Impact", "Arial Narrow Bold", sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --gutter: 16px;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { background: var(--ink); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* The one warm light, from the top */
.light {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 50% -8%, rgba(244,184,96,.55), rgba(244,184,96,.12) 45%, transparent 70%),
    radial-gradient(ellipse 120% 60% at 50% 110%, rgba(0,0,0,.6), transparent 60%);
}
.light::after {
  /* light-fall texture: faint scanlines so the dark feels like a surface */
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

/* Emergency strobe: only when body.alert, only without reduced motion */
.strobe { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: var(--emergency); opacity: 0; }
body.alert .strobe { animation: strobe 1.2s steps(1, end) infinite; }
@keyframes strobe { 0%, 46% { opacity: 0; } 50%, 58% { opacity: .18; } 62%, 100% { opacity: 0; } }
body.alert .app { animation: shake .35s linear infinite; }
@keyframes shake {
  0% { transform: translate(0,0); } 25% { transform: translate(-2px,1px); }
  50% { transform: translate(2px,-1px); } 75% { transform: translate(-1px,-2px); } 100% { transform: translate(1px,2px); }
}
@media (prefers-reduced-motion: reduce) {
  body.alert .strobe, body.alert .app { animation: none; }
  body.alert .strobe { opacity: .12; } /* steady, not flashing */
  * { transition: none !important; }
}

.app {
  position: relative; z-index: 1;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) var(--gutter) 24px;
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
}
.screen[hidden] { display: none; }
.screen { display: flex; flex-direction: column; gap: 18px; }

/* --- Type --- */
.eyebrow {
  margin: 0; font-family: var(--font-mono); font-size: 13px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--crt);
}
.title {
  margin: 0; font-family: var(--font-display); font-weight: 900;
  font-size: clamp(64px, 19vw, 118px); line-height: .86; letter-spacing: .01em;
  text-transform: uppercase; color: var(--tungsten);
  text-shadow: 0 0 28px rgba(244,184,96,.35), 0 2px 0 #000;
}
.lead { margin: 0; font-size: 18px; max-width: 34ch; }
.warn { margin: 0; color: var(--dust); font-size: 15px; max-width: 40ch; }
.fine { margin: 0; color: var(--muted); font-size: 13px; }
.label { display: block; font-size: 14px; color: var(--dust); margin: 0 0 6px; }
.opt { color: var(--muted); font-weight: 400; }
.help { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

/* --- Buttons --- */
.btn {
  appearance: none; border: 0; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: .08em; text-transform: uppercase;
  padding: 14px 28px; border-radius: var(--radius);
  min-height: 56px; width: 100%;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--tungsten); color: var(--ink);
  box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 0 32px rgba(244,184,96,.35);
}
.btn-primary:hover { background: #ffc877; }
.btn-ghost { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 2px var(--panel-edge); font-size: 20px; }
.btn-ghost:hover { box-shadow: inset 0 0 0 2px var(--dust); }
.btn-icon {
  appearance: none; border: 0; background: transparent; color: var(--dust); cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
}
.btn-icon[aria-pressed="true"] { color: var(--emergency); }
.btn-icon[aria-pressed="true"] svg { opacity: .55; }

:where(button, input, a, [tabindex]):focus-visible {
  outline: 3px solid var(--crt); outline-offset: 3px;
}

/* --- HUD --- */
.hud { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hud-label { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.dots { display: inline-flex; gap: 8px; margin-top: 4px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--panel-edge); box-shadow: inset 0 0 0 1px #000; }
.dot.on { background: var(--crt); box-shadow: 0 0 10px rgba(62,219,122,.7); }
.hud-timer { text-align: center; }
.clock {
  display: block; font-family: var(--font-mono); font-size: 34px; font-weight: 500; line-height: 1;
  color: var(--crt); text-shadow: 0 0 12px rgba(62,219,122,.6); font-variant-numeric: tabular-nums; min-width: 2.2ch;
}
.clock.low { color: var(--emergency); text-shadow: 0 0 14px rgba(200,32,43,.8); }

/* --- Keypad panel --- */
.panel {
  background: linear-gradient(180deg, #1a1a1e, var(--panel));
  border: 1px solid var(--panel-edge);
  border-top-color: #3a3a40;
  border-radius: 10px;
  padding: 22px 18px 20px;
  box-shadow: 0 30px 60px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.04);
}
.plate {
  margin: 0 0 4px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.panel-title {
  margin: 0 0 18px; font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1; letter-spacing: .04em; text-transform: uppercase; color: var(--paper);
}
.code-form { display: flex; flex-direction: column; }
.code-input {
  width: 100%; font-family: var(--font-mono); font-size: 44px; letter-spacing: .35em; text-align: center;
  color: var(--crt); background: #060607; border: 1px solid #000; border-radius: var(--radius);
  padding: 14px 8px 14px calc(8px + .35em); min-height: 76px;
  box-shadow: inset 0 2px 12px rgba(0,0,0,.9), 0 0 0 1px var(--panel-edge);
  caret-color: var(--crt);
}
.code-input::placeholder { color: #2a4a36; letter-spacing: .35em; }
.code-input:focus { outline: none; box-shadow: inset 0 2px 12px rgba(0,0,0,.9), 0 0 0 2px var(--crt); }
.code-input[aria-invalid="true"] { box-shadow: inset 0 2px 12px rgba(0,0,0,.9), 0 0 0 2px var(--emergency); }
#btn-enter { margin-top: 14px; }

.sys {
  margin: 14px 0 0; min-height: 1.5em; font-family: var(--font-mono); font-size: 15px; color: var(--crt);
}
.sys.err { color: var(--emergency); }

/* --- Result / terminal --- */
.result-title {
  margin: 0; font-family: var(--font-mono); font-size: 12px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted);
}
.terminal {
  background: #060607; border: 1px solid var(--panel-edge); border-radius: 10px;
  padding: 20px 18px; font-size: 17px; line-height: 1.6; color: var(--paper);
  box-shadow: inset 0 0 40px rgba(0,0,0,.8);
}
.terminal p { margin: 0 0 1em; }
.terminal p:last-child { margin-bottom: 0; }
.terminal strong { font-family: var(--font-mono); color: var(--crt); letter-spacing: .06em; }
.terminal.denied strong { color: var(--emergency); }
.terminal em { color: var(--dust); }
.terminal .vol { display: block; margin-top: 1.4em; font-family: var(--font-display); font-weight: 900; font-size: 28px; letter-spacing: .04em; text-transform: uppercase; color: var(--tungsten); }

/* --- Email form --- */
.email-form { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--panel-edge); padding-top: 18px; }
.email-form[hidden] { display: none; }
.email-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1; letter-spacing: .04em; text-transform: uppercase; color: var(--tungsten); }
.email-lead { margin: 0 0 6px; color: var(--dust); }
.text-input {
  width: 100%; font: inherit; font-size: 17px; color: var(--paper); background: #060607;
  border: 1px solid var(--panel-edge); border-radius: var(--radius); padding: 12px 14px; min-height: 48px;
}
.text-input:focus { outline: none; border-color: var(--crt); box-shadow: 0 0 0 1px var(--crt); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--dust); margin: 2px 0; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--crt); flex: none; }
#btn-subscribe { margin-top: 8px; }
.result-actions { display: flex; flex-direction: column; gap: 10px; }
.result-actions .btn[hidden] { display: none; }

.credit {
  position: relative; z-index: 1; margin: 0; padding: 0 var(--gutter) 20px; text-align: center;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: #5c6168;
}

/* --- Desktop --- */
@media (min-width: 720px) {
  body { font-size: 18px; }
  .app { padding-top: 48px; }
  .title { font-size: 128px; }
  .btn { width: auto; min-width: 220px; align-self: flex-start; }
  .code-form { align-items: stretch; }
  #btn-enter { align-self: stretch; }
  .panel { padding: 28px 28px 24px; }
  .terminal { padding: 28px; font-size: 18px; }
  .result-actions { flex-direction: row; }
}

/* --- Series landing page and "no such channel" --- */
.vol-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.vol-link {
  display: flex; flex-direction: column; gap: 2px; text-decoration: none;
  background: linear-gradient(180deg, #1a1a1e, var(--panel)); border: 1px solid var(--panel-edge); border-top-color: #3a3a40;
  border-radius: 10px; padding: 16px 18px; color: var(--paper);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.vol-link:hover { border-color: var(--tungsten); box-shadow: 0 0 24px rgba(244,184,96,.18); }
.vol-num { font-family: var(--font-mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--crt); }
.vol-name { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1.05; letter-spacing: .03em; text-transform: uppercase; color: var(--tungsten); }
.vol-go { font-size: 14px; color: var(--dust); }

/* --- Keypad art (per volume, set in /vN/theme.css). Solid black if it fails to load. --- */
.hero {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0;
  background-color: var(--ink); background-repeat: no-repeat; background-size: cover; background-position: 72% 35%;
  transition: opacity .8s ease;
}
.hero::after { /* keep the left and bottom dark so the panel and buttons stay readable */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(11,11,13,.92) 0%, rgba(11,11,13,.55) 45%, rgba(11,11,13,.25) 100%),
              linear-gradient(0deg, rgba(11,11,13,.95) 0%, rgba(11,11,13,0) 55%);
}
body[data-screen="keypad"] .hero { opacity: .85; }
@media (max-width: 719px) { .hero { background-position: 68% 20%; } }

/* --- Mute button: fixed, on every screen once the reader has pressed START --- */
#btn-mute {
  position: fixed; z-index: 3; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right));
  background: rgba(11,11,13,.6); backdrop-filter: blur(4px);
}
body[data-screen="intro"] #btn-mute { display: none; }
.hud { padding-right: 48px; }
/* Tries and clock sit over the art: give them their own dark plate so they stay readable. */
.hud { background: rgba(11,11,13,.62); backdrop-filter: blur(3px); border-radius: 8px; padding: 8px 52px 8px 12px; }
