/* CORRIDOR v2 — THE CARTESIAN RE-CHOREOGRAPHY. Minimal. Two states. No
   scaffolding chrome, no placebo layer (cut this pass). */
:root {
  --bg: #000;
  --fg: #e8e2d4;
  --amber: #ffb000;
  --dim: rgba(232, 226, 212, 0.45);
  --line: rgba(255, 176, 0, 0.28);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  color: var(--fg);
  font: 15px/1.75 ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100dvh; display: grid; }
.state {
  grid-area: 1 / 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: clamp(20px, 6vw, 64px);
  max-width: 68ch;
  margin: 0 auto;
  width: 100%;
}
[hidden] { display: none !important; }

/* ── STATE A: extractor ─────────────────────────────────────────── */
.say {
  white-space: pre-wrap;
  font-size: clamp(15px, 2.1vw, 17px);
  letter-spacing: 0.01em;
}
.say p { margin: 0 0 1.1em; }
.say .glow { color: var(--amber); }
.say strong, .say b { color: var(--amber); font-weight: 600; }
.say.dim { color: var(--dim); }

/* ── ARRIVAL SCOPE — opening screen only, 2026-09-22 fold fix ───────────────
   The four-paragraph consent+question text (promptV2.js CONSENT_LINE +
   OPENING_QUESTION) is long enough to push BEGIN below the fold on short
   mobile viewports. `.arrival` is added to #extractor only while that text
   is showing (public/v2.js boot()/submit()) — every later roast/cycle bubble
   reuses the same #say/#composer elements without this class, so their
   spacing is untouched. Values sit at the stated legibility floor
   (line-height 1.3; font-size is untouched — already at its own 15px floor
   on these viewports via the existing clamp()) — see the fold-fix report for
   why this does not fully clear iPhone SE / small Android and what that
   implies. */
.state.arrival { padding-top: 12px; padding-bottom: 12px; }
.state.arrival .say { line-height: 1.3; }
.state.arrival .say p { margin: 0 0 0.4em; }
.state.arrival .composer { margin-top: 14px; gap: 8px; }
.state.arrival textarea { min-height: 56px; }
.state.arrival .btn { padding: 9px 20px; }

/* ── ARRIVAL SCROLL CUE — fold close-out, 2026-09-22 ────────────────────────
   CSS alone couldn't fully clear BEGIN on iPhone SE / small Android without
   breaching the floors above. Operator's ruling: accept the residual scroll,
   signal it. Created/destroyed by public/v2.js (initArrivalScrollCue /
   teardownArrivalScrollCue) — shown only while #send hasn't scrolled into
   view yet, via IntersectionObserver, so it never appears at all on a
   viewport where BEGIN already fits. Fixed to the viewport, not the content
   column, since the arrival content is taller than the screen when it shows. */
.arrival-scroll-cue {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  color: var(--amber);
  font-size: 20px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  animation: arrival-scroll-cue-bob 1.8s ease-in-out infinite;
}
.arrival-scroll-cue.visible { opacity: 0.55; }
@keyframes arrival-scroll-cue-bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 6px); }
}
@media (prefers-reduced-motion: reduce) {
  .arrival-scroll-cue { animation: none; }
}

.composer { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
textarea {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg);
  font: inherit;
  padding: 12px 14px;
  resize: vertical;
  min-height: 96px;
  outline: none;
}
textarea:focus { border-color: var(--amber); }

.btn {
  align-self: flex-start;
  background: var(--amber);
  color: #000;
  border: 1px solid var(--amber);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 10px 20px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.ghost { background: transparent; color: var(--amber); }
.btn.ghost:hover { background: rgba(255, 176, 0, 0.08); }

.end-actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.share-note { flex-basis: 100%; margin: 6px 0 0; color: var(--dim); font-size: 12.5px; }
.share-note a { color: var(--amber); }

/* END-STATE "B" (2026-09-29): the kept line, the visitor's own link, Copy
   link + confirmation. The old share-chooser styles are retired with it. */
.kept-line { flex-basis: 100%; margin: 0; color: var(--amber); }
.case-link-line { flex-basis: 100%; margin: 0; color: var(--dim); font-size: 12.5px; }
.case-link { color: var(--amber); word-break: break-all; user-select: all; }
.copied-note { color: var(--amber); font-size: 12.5px; }
.share-line { flex-basis: 100%; margin: 10px 0 0; color: var(--fg, #e8e2d4); line-height: 1.6; }

.retry { margin-top: 28px; display: flex; flex-direction: column; gap: 12px; }
.retry-line { margin: 0; color: var(--amber); }

/* ── STATE B: cutaway (placeholder) ─────────────────────────────── */
#cutaway {
  background: #000;
  align-items: center;
  justify-content: center;
}
.cut-mark {
  color: rgba(255, 176, 0, 0.5);
  font-size: 22px;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { .cut-mark { animation: none; opacity: 0.4; } }

/* The book link in the Chief's redirect line. */
.say a.book-link { color: var(--amber); }

/* ── THE FILM LAYER (2026-10-01) ─────────────────────────────────────
   A portrait clip, framed as a document on the dark desk: full-bleed on a
   phone, a bordered 9:16 panel centred on a wide screen (never stretched). */
.film { align-items: center; justify-content: center; gap: 18px; }
.film-frame {
  container-type: inline-size;
  position: relative;
  width: min(100%, calc(86dvh * 9 / 16));
  aspect-ratio: 9 / 16;
  background: #000;
  border: 1px solid var(--line);
}
.film-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.film-hud {
  position: absolute; top: 10px; right: 12px;
  display: flex; gap: 12px; align-items: center;
  font-size: 11.5px; letter-spacing: 0.14em; color: var(--amber);
  text-shadow: 0 1px 3px #000;
}
.film-review { opacity: 0.85; animation: pulse 2.4s ease-in-out infinite; }
.film-count { min-width: 2ch; text-align: right; font-weight: 600; }
.film-skip, .film-play {
  position: absolute;
  background: rgba(0, 0, 0, 0.62);
  color: var(--amber);
  border: 1px solid var(--line);
  font: inherit; font-size: 12.5px; letter-spacing: 0.08em;
  padding: 8px 12px; cursor: pointer;
}
.film-skip { right: 12px; bottom: 12px; opacity: 0.7; }
.film-play { left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 26px; padding: 14px 22px; }
.final-invite { flex-basis: 100%; margin-top: 18px; }
.final-invite-line { margin: 0 0 10px; color: var(--dim); }
@media (prefers-reduced-motion: reduce) { .film-review { animation: none; } }

/* ── SOUND: ONE MASTER (2026-10-01) ──────────────────────────────────
   Beside BEGIN on the arrival screen; after BEGIN the same button docks to
   the top-left corner (the film's HUD owns top-right) for the whole session. */
.sound-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; color: var(--dim); font-size: 13px; }
.sound-master {
  background: rgba(0, 0, 0, 0.62); color: var(--amber);
  border: 1px solid var(--line);
  font: inherit; font-size: 12px; letter-spacing: 0.08em;
  padding: 6px 10px; cursor: pointer; white-space: nowrap;
}
.sound-master[aria-pressed="false"] { color: var(--dim); }
.sound-master.docked { position: fixed; top: 10px; left: 12px; z-index: 50; opacity: 0.8; }
/* Keep the first line of every reply clear of the docked control (2026-10-06:
   it sat over "I am the Chief"). */
body.sound-docked #extractor { padding-top: max(60px, clamp(20px, 6vw, 64px)); }
.state.arrival + .sound-row, .state.arrival .sound-row { margin-top: 8px; }
/* ARRIVAL START (2026-10-07): step one on the screen, between the demand and
   the input. Before the first tap the button is an INVITATION — amber,
   outlined, the most obvious thing after the text; after it, a compact state
   with a live pulse so "is the sound on?" never needs asking. */
.sound-row { justify-content: flex-start; flex-wrap: wrap; row-gap: 6px; }
.sound-master.invite {
  color: var(--amber); border: 1px solid var(--amber);
  font-size: 13px; padding: 10px 16px; letter-spacing: 0.1em;
}
.sound-master.invite:hover, .sound-master.invite:focus-visible { background: rgba(255, 176, 0, 0.12); }
.sound-master.live::after {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px;
  border-radius: 50%; background: var(--amber); vertical-align: middle;
  animation: sound-live 1.6s ease-in-out infinite;
}
.sound-master.live[aria-pressed="false"]::after { display: none; }
@keyframes sound-live { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sound-master.live::after { animation: none; } }
.sound-line { flex-basis: 100%; }   /* always its own row: no layout jump on the tap */
/* One height in both states (no jump), and a full 44 px tap target. */
.sound-row .sound-master { min-height: 44px; }
.sound-line.next { color: var(--fg, #e8e2d0); }
/* BEGIN waits its turn (operator, 2026-10-07): outlined until the sound is
   decided (or the visitor starts on the sentence), so the sound invitation is
   the one loud first action. Still plainly live — full-opacity amber text and
   border, a pointer, a hover — never the greyed disabled look. */
.btn.waiting { background: transparent; color: var(--amber); }
.btn.waiting:hover, .btn.waiting:focus-visible { background: rgba(255, 176, 0, 0.12); filter: none; }
#send { transition: background-color 0.25s ease, color 0.25s ease; }
@media (prefers-reduced-motion: reduce) { #send { transition: none; } }

/* ── THE FINAL FILM: credit roll + ending (2026-10-01) ───────────────
   The roll is the Ministry's voice (the site monospace) with one line in the
   book's voice (IBM Plex Serif, self-hosted, SIL OFL). Sized to the frame's
   width (container units) so the longest credit fits on a phone. A soft dark
   band keeps it legible over any footage. Its position is set from the
   video's clock in v2.js. */
@font-face { font-family: "IBM Plex Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-serif-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-serif-latin-400-italic.woff2") format("woff2"); }
.credits {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,0.15), rgba(0,0,0,0.5) 22%, rgba(0,0,0,0.5) 78%, rgba(0,0,0,0.15));
}
.credits-roll {
  position: absolute; left: 0; right: 0; top: 0;
  padding: 0 5cqw; text-align: center;
  color: var(--fg); font-size: clamp(13px, 4.2cqw, 20px); line-height: 1.85; letter-spacing: 0.05em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  will-change: transform;
}
.cr-gap { height: 1.6em; }
.cr-break { height: 5.5em; }
.cr-line { font-weight: 600; text-wrap: balance; }
/* Stacked, as in film credits: the role small and dim, the name below it. A
   two-column layout wrapped mid-phrase on a phone. */
.cr-credit { display: flex; flex-direction: column; align-items: center; margin: 0.55em 0; }
.cr-label { color: var(--dim); font-size: 0.78em; letter-spacing: 0.1em; line-height: 1.5; }
.cr-value { color: var(--amber); line-height: 1.5; }
.cr-serif {
  font-family: "IBM Plex Serif", Georgia, serif; font-weight: 400; letter-spacing: 0.01em;
  font-size: 1.12em; color: var(--fg);
}
/* The ending: the book link is the hero, centred where the footage's doorway
   light lands (about 48% down), a large tap target; BACK TO YOUR FILE quiet below. */
.film-end {
  position: absolute; left: 0; right: 0; top: 48%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4cqw;
  padding: 0 7cqw;
}
.film-end.arrive { animation: end-arrive 900ms ease-out both; }
@keyframes end-arrive { from { opacity: 0; transform: translateY(calc(-50% + 10px)); } to { opacity: 1; transform: translateY(-50%); } }
.book-hero {
  display: block; width: 100%; box-sizing: border-box; text-align: center; text-decoration: none;
  padding: 6cqw 4cqw; min-height: 56px;
  background: rgba(0, 0, 0, 0.62); color: var(--amber);
  border: 1px solid var(--amber);
  font-size: clamp(14px, 4.6cqw, 24px); font-weight: 700; letter-spacing: 0.05em; line-height: 1.3; white-space: nowrap;
  text-shadow: 0 1px 3px #000; box-shadow: 0 0 28px rgba(255, 176, 0, 0.18);
}
.book-hero:hover, .book-hero:focus-visible { background: rgba(255, 176, 0, 0.12); outline: none; }
.film-back {
  background: none; border: none; color: var(--dim); cursor: pointer;
  font: inherit; font-size: clamp(11px, 3cqw, 13px); letter-spacing: 0.08em; padding: 10px 14px;
  text-decoration: underline; text-underline-offset: 3px; text-shadow: 0 1px 3px #000;
}
.film-back:hover { color: var(--fg); }
/* The film invitation arrives AFTER the share, not stacked under it. */
.final-invite.arrive { animation: invite-arrive 700ms ease-out both; }
@keyframes invite-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .film-end.arrive, .final-invite.arrive { animation: none; } }
