/* ═══════════════════════════════════════════════════════════
   /inside/ — "The Night Shift" scene stylesheet.
   Self-contained: uses only v7 tokens from assets/style.css.
   Rules of the house:
   - Content is visible by default. JS only adds motion.
   - Entrance pattern: JS adds html.inside-motion only after the
     observer exists. No-JS, failed-JS, and reduced-motion see the
     same complete document, simply still.
   - All motion lives behind @media (prefers-reduced-motion: no-preference).
   ═══════════════════════════════════════════════════════════ */

/* ── Page frame ── */
.page-inside main { padding-top: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Escape links: first thing on the page, always reachable */
.inside-escape {
  display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem;
  padding: 1.1rem var(--gutter) 0;
  max-width: var(--wrap); margin: 0 auto;
  font-family: var(--font-mono); font-size: 0.78rem;
}
.inside-escape a { color: var(--amber); text-decoration: none; border-bottom: 1px dashed rgba(240,192,64,0.4); padding-bottom: 1px; }
.inside-escape a:hover { border-bottom-style: solid; }

/* ── Scene rhythm ── */
.scene {
  position: relative; isolation: isolate;
  min-height: 100svh;
  display: grid; align-items: center;
  padding: clamp(4rem, 10vh, 8rem) var(--gutter);
  overflow: clip;
}
.scene-inner { max-width: 46rem; margin: 0 auto; width: 100%; min-width: 0; }
.scene-kicker {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 1.2rem;
}
.scene h1, .scene h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--step-3); line-height: 1.08; letter-spacing: -0.01em;
  margin-bottom: 1.4rem; text-wrap: balance;
}
.scene p { color: var(--text-soft); line-height: 1.7; margin-bottom: 1.1rem; max-width: var(--measure); }
.scene p strong { color: var(--text); }
.scene a { color: var(--amber); }
.scene-note { font-size: var(--step--1); color: var(--text-dim); }

/* Scene-to-scene background shifts: warm black -> deeper -> paper at the
   pass -> back to black for the turn. */
.scene-threshold { background: var(--bg); }
.scene-room { background: #0a0807; }
.scene-ask { background: var(--bg); }
.scene-move { background: #0a0807; }
.scene-cost { background: #0c0809; }
.scene-pass { background: linear-gradient(180deg, #12100c 0%, #16130d 55%, #12100c 100%); }
.scene-turn { background: #0a0807; }
.scene-doors { background: var(--bg); min-height: 80svh; }

/* Parallax backdrop layer: subtle radial warmth, transform-only motion. */
.scene-backdrop {
  position: absolute; inset: -12% 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 42% at 50% 30%, rgba(240, 192, 64, 0.05), transparent 70%),
    radial-gradient(40% 30% at 80% 75%, rgba(217, 123, 40, 0.04), transparent 70%);
  transform: translateY(var(--py, 0px));
  will-change: transform;
}

/* ── Entrance pattern (visible by default; JS opts into hiding) ── */
html.inside-motion .anim { opacity: 0; transform: translateY(22px); }
html.inside-motion .anim.inside-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  html.inside-motion .anim.inside-visible {
    transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  }
}

/* ── Scene 0 · the printer ── */
.printer {
  display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center;
  width: 100%; min-width: 0; margin: 2.4rem 0 2rem;
}
.printer-ticket {
  --perf: radial-gradient(circle at 6px 100%, transparent 4.5px, #000 5px);
  width: min(26rem, 100%); max-width: 100%; min-width: 0;
  background: var(--ticket); color: var(--ticket-ink);
  font-family: var(--font-mono);
  padding: 1.1rem 1.2rem 1.4rem;
  border-radius: var(--r-ticket) var(--r-ticket) 0 0;
  box-shadow: 0 22px 44px -20px rgba(0, 0, 0, 0.85);
  /* torn bottom edge */
  -webkit-mask: var(--perf) bottom / 12px 10px repeat-x,
                linear-gradient(#000 0 0) top / 100% calc(100% - 10px) no-repeat;
  mask: var(--perf) bottom / 12px 10px repeat-x,
        linear-gradient(#000 0 0) top / 100% calc(100% - 10px) no-repeat;
}
.printer-lines { list-style: none; }
.printer-line {
  font-size: 0.74rem; line-height: 1.65; color: var(--ticket-ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.printer-line:first-child { color: var(--ticket-ink); font-weight: 500; }
.printer-line.is-printing { border-right: 1px solid var(--ticket-ink); }
.printer-foot {
  margin-top: 0.8rem; padding-top: 0.55rem; border-top: 1px dashed var(--ticket-rule);
  display: flex; justify-content: space-between;
  font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ticket-ink-soft);
}
.threshold-greeting { font-family: var(--font-mono); color: var(--amber); font-size: 0.9rem; }

@media (prefers-reduced-motion: no-preference) {
  html.inside-motion .printer-ticket.is-live { animation: ticket-settle 0.5s var(--ease-out); }
  @keyframes ticket-settle {
    from { transform: translateY(-6px) rotate(-0.4deg); }
    to { transform: none; }
  }
}

/* ── Scene 1 · the room ── */
.room-excerpt {
  border-block: 1px solid var(--steel-edge-hot);
  padding: 0.9rem 0; font-size: var(--step--1); color: var(--text-dim);
}

/* ── Scene 2 · the ask + five pressures ── */
.ask-cluster { position: relative; margin: 2.6rem 0 2rem; }
.ask-card {
  position: relative; z-index: 2;
  max-width: 24rem; margin: 0 auto;
  background: var(--ticket); color: var(--ticket-ink);
  border-radius: var(--r-ticket);
  padding: 1.2rem 1.4rem;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
  text-align: center;
}
.ask-label {
  display: block; font-family: var(--font-mono); font-size: 0.62rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--ticket-ink-soft);
  margin-bottom: 0.5rem;
}
.ask-card h3 { font-family: var(--font-display); font-size: var(--step-1); line-height: 1.25; color: var(--ticket-ink); }
.ask-source { font-family: var(--font-mono); font-size: 0.7rem; margin-top: 0.7rem; color: var(--ticket-ink-soft); }
.ask-source a { color: var(--burn); }

.pressures { margin-top: 2.4rem; display: grid; gap: 1rem; }
.pressure {
  --pressure-color: var(--steel-edge-hot);
  background: var(--bg-raised);
  border: 1px solid var(--pressure-color);
  border-radius: var(--r-card);
  padding: 1rem 1.2rem;
}
.p-mike { --pressure-color: var(--v-mike); }
.p-beard { --pressure-color: var(--v-beard); }
.p-rocky { --pressure-color: var(--v-rocky); }
.p-sean { --pressure-color: var(--v-sean); }
.p-richie { --pressure-color: var(--v-richie); }
.pressure-behavior {
  display: block; font-style: normal; font-family: var(--font-mono);
  font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 0.5rem;
}
.pressure-line { font-size: var(--step-0); line-height: 1.55; color: var(--text); margin-bottom: 0.55rem; }
.pressure-src { font-family: var(--font-mono); font-size: 0.7rem; }
.pressure-badge {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.08em;
  color: var(--alarm); border: 1px solid var(--alarm);
  border-radius: 3px; padding: 0.15rem 0.45rem; opacity: 0.85;
}

/* Wide screens: pressures sit spatially around the ask card. */
@media (min-width: 62rem) {
  .scene-ask .scene-inner { max-width: 64rem; }
  .scene-ask .scene-kicker,
  .scene-ask h2,
  .scene-ask .scene-note { max-width: 46rem; margin-left: auto; margin-right: auto; }
  .ask-cluster { min-height: 42rem; }
  .ask-card { position: absolute; left: 50%; top: 12rem; transform: translateX(-50%); width: 22rem; margin: 0; }
  .pressures { position: absolute; inset: 0; margin: 0; }
  .pressure { position: absolute; width: 19rem; }
  .p-mike { left: 0; top: 0; }
  .p-beard { right: 0; top: 0; }
  .p-rocky { right: 0; bottom: 0; }
  .p-sean { left: 0; bottom: 0; }
  .p-richie { left: 50%; bottom: 0; transform: translateX(-50%); width: 21rem; }
  /* keep the entrance transform from fighting the layout transform */
  html.inside-motion .p-richie.anim { transform: translateX(-50%) translateY(22px); }
  html.inside-motion .p-richie.anim.inside-visible { transform: translateX(-50%); }
}

/* ── Scene 3 · the move ── */
.move-track {
  display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--amber);
  margin-top: 1.6rem;
}
.move-track span:not([aria-hidden]) {
  border: 1px solid rgba(240, 192, 64, 0.35); border-radius: 3px;
  padding: 0.3rem 0.7rem; background: var(--amber-soft);
}

/* ── Scene 4 · the cost ── */
.cost-card {
  background: var(--bg-raised);
  border: 1px solid var(--alarm);
  border-radius: var(--r-card);
  padding: 1.4rem 1.5rem; margin: 1.8rem 0;
}
.cost-what { color: var(--text); font-size: var(--step-1); line-height: 1.5; }
.cost-meaning { color: var(--text-soft); margin-top: 0.9rem; }
.cost-source { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); margin-top: 1rem; }

/* ── Scene 5 · the pass: ticket flip ── */
.pass-row { display: grid; gap: 1.4rem; justify-items: center; margin: 2rem 0; }
.ticket-flip { position: relative; width: min(24rem, 100%); }
.ticket-face {
  background: var(--ticket); color: var(--ticket-ink);
  border-radius: var(--r-ticket);
  padding: 1.2rem 1.3rem;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
}
.ticket-face .t-head {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ticket-ink-soft); margin-bottom: 0.6rem;
}
.ticket-face h3 { font-family: var(--font-display); font-size: var(--step-1); line-height: 1.25; color: var(--ticket-ink); }
.ticket-face .t-meta { font-size: 0.82rem; color: var(--ticket-ink-soft); margin-top: 0.6rem; line-height: 1.5; }
.ticket-face .t-rule { border: none; border-top: 1px dashed var(--ticket-rule); margin: 0.9rem 0; }
.ticket-face .stamp {
  display: inline-block; font-family: var(--font-mono); font-size: 0.68rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  border: 2px solid; border-radius: 4px; padding: 0.2rem 0.5rem;
  transform: rotate(-2deg);
}
.ticket-face .stamp-ok { color: #3f6b34; border-color: #3f6b34; }
.ticket-face .stamp-warn { color: var(--burn); border-color: var(--burn); }
.t-ev { font-size: 0.82rem; }
.t-ev a { color: var(--burn); }
.t-verify-label {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ticket-ink-soft); margin-top: 0.9rem;
}
.t-verify {
  display: block; margin-top: 0.4rem; padding: 0.55rem 0.7rem;
  background: rgba(36, 31, 22, 0.08); border-radius: 4px;
  font-family: var(--font-mono); font-size: 0.72rem; line-height: 1.5;
  word-break: break-all; color: var(--ticket-ink);
}
.copy-btn { display: none; }
html.js .copy-btn {
  display: inline-block; margin-top: 0.5rem;
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ticket-ink);
  border: 1px solid var(--ticket-rule); border-radius: 3px; padding: 0.3rem 0.7rem;
  min-height: 2.75rem;
}
html.js .copy-btn:hover { background: rgba(36, 31, 22, 0.1); }
.t-limits { list-style: none; margin-top: 0.4rem; }
.t-limits li {
  font-size: 0.76rem; color: var(--ticket-ink-soft); line-height: 1.5;
  padding-left: 0.9rem; position: relative;
}
.t-limits li::before { content: "·"; position: absolute; left: 0; }

/* Flip mechanics: JS only. Without JS both faces stack, fully readable. */
.flip-btn { display: none; }
html.js .flip-btn {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--amber);
  border: 1px solid rgba(240, 192, 64, 0.4); border-radius: 3px;
  padding: 0.55rem 1.1rem; min-height: 2.75rem;
}
html.js .flip-btn:hover { background: var(--amber-soft); }
html.js .ticket-flip { perspective: 1200px; min-height: 22rem; }
html.js .ticket-face {
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform 0.7s var(--ease-out);
}
html.js .ticket-back { position: absolute; inset: 0; transform: rotateY(180deg); overflow: auto; }
html.js .ticket-flip.flipped .ticket-front { transform: rotateY(-180deg); }
html.js .ticket-flip.flipped .ticket-back { transform: rotateY(0); }

.declined-weight {
  display: flex; gap: 1rem; align-items: baseline;
  max-width: 24rem; padding: 1rem 1.2rem;
  border: 1px solid var(--steel-edge); border-radius: var(--r-card);
  background: var(--bg-raised);
}
.declined-weight strong {
  font-family: var(--font-display); font-size: var(--step-3);
  color: var(--alarm); line-height: 1;
}
.declined-weight span { font-size: var(--step--1); color: var(--text-soft); line-height: 1.55; }

/* ── Scene 6 · the turn ── */
.scene-turn .scene-inner { max-width: 38rem; }
.turn-address p {
  font-size: var(--step-1); line-height: 1.65; color: var(--text);
  margin-bottom: 1.3rem;
}
.turn-address p:last-child { color: var(--amber); }

/* ── Scene 7 · doors ── */
.door-grid {
  list-style: none; display: grid; gap: 1rem; margin: 2rem 0;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
}
.door-grid a {
  display: block; height: 100%;
  background: var(--bg-raised); border: 1px solid var(--steel-edge);
  border-radius: var(--r-card); padding: 1.3rem 1.4rem;
  text-decoration: none; transition: border-color 0.25s var(--ease-out);
}
.door-grid a:hover { border-color: var(--steel-edge-hot); }
.door-grid h3 { font-family: var(--font-display); color: var(--text); font-size: var(--step-1); margin-bottom: 0.5rem; }
.door-grid p { font-size: var(--step--1); color: var(--text-soft); }
.door-grid .go {
  display: inline-block; margin-top: 0.8rem;
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--amber);
}
.privacy-note {
  font-size: 0.78rem; color: var(--text-dim); max-width: var(--measure);
  border-top: 1px solid var(--steel-edge); padding-top: 1.2rem; margin-top: 2.5rem;
}
.privacy-note code { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-soft); }

/* ── Scene index nav ── */
.scene-index {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem;
  padding: 1rem var(--gutter) 0;
  max-width: var(--wrap); margin: 0 auto;
}
.scene-index a {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-dim); text-decoration: none;
  padding: 0.3rem 0; min-width: 2.75rem; min-height: 2.75rem;
  justify-content: center;
}
.scene-index .dot {
  width: 7px; height: 7px; border-radius: 50%;
  border: 1px solid var(--text-dim); background: transparent;
}
.scene-index a[aria-current="true"] { color: var(--amber); }
.scene-index a[aria-current="true"] .dot { background: var(--amber); border-color: var(--amber); }

/* With JS the index becomes a persistent rail; no-JS keeps the inline list. */
@media (min-width: 62rem) {
  html.js .scene-index {
    position: fixed; right: 1.1rem; top: 50%; transform: translateY(-50%);
    z-index: 40; flex-direction: column; gap: 0.55rem; padding: 0;
    max-width: none;
  }
  html.js .scene-index a {
    flex-direction: row-reverse;
    justify-content: flex-start;
  }
  html.js .scene-index .lbl {
    opacity: 0; transform: translateX(-4px);
    transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
  }
  html.js .scene-index a:hover .lbl,
  html.js .scene-index a:focus-visible .lbl,
  html.js .scene-index a[aria-current="true"] .lbl { opacity: 1; transform: none; }
}
@media (max-width: 61.99rem) {
  html.js .scene-index {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    justify-content: space-between; gap: 0;
    background: rgba(13, 11, 9, 0.92); backdrop-filter: blur(6px);
    border-top: 1px solid var(--steel-edge);
    padding: 0.55rem var(--gutter); max-width: none;
  }
  /* keep the label in the a11y tree: visually clipped, not display:none */
  html.js .scene-index .lbl {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  html.js .page-inside main { padding-bottom: 3rem; }
}

/* ── Mode toggles (JS-only features; hidden without JS) ── */
.inside-modes { display: none; }
html.js .inside-modes {
  display: flex; gap: 0.5rem;
  position: fixed; left: 1rem; bottom: 1rem; z-index: 41;
}
html.js .inside-modes button {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-dim);
  border: 1px solid var(--steel-edge); border-radius: 3px;
  background: rgba(13, 11, 9, 0.85); padding: 0.4rem 0.7rem;
  min-height: 2.75rem;
}
html.js .inside-modes button[aria-pressed="true"] { color: var(--amber); border-color: rgba(240, 192, 64, 0.5); }
@media (max-width: 61.99rem) {
  html.js .inside-modes {
    top: 4.25rem; right: 1rem; bottom: auto; left: auto;
  }
}

/* ── Mobile tightening ── */
@media (max-width: 40rem) {
  .scene { min-height: auto; padding-top: 4.5rem; padding-bottom: 4.5rem; }
  .scene-threshold { min-height: 88svh; }
  .printer-ticket { width: 100%; }
  .printer-line { font-size: 0.68rem; }
  .declined-weight { flex-direction: column; gap: 0.3rem; }
}

/* ── Reduced motion: everything simply visible, in place ── */
@media (prefers-reduced-motion: reduce) {
  html.inside-motion .anim { opacity: 1; transform: none; }
  html.js .ticket-face { transition: none; }
  .scene-backdrop { transform: none; }
}
