/* ============================================================================
   Bottleneck Engine v2 — component styles
   Reads tokens.css. Dark-first; [data-theme=paper] flips to the print artifact.
   ============================================================================ */

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 420;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
h1, h2, h3, p, ul, ol, figure, table { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; }

/* Keyboard focus: a visible brass ring on every interactive control. The
   composer row draws its own focus-within ring, so the textarea inside it
   suppresses the default (avoids a double ring). */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 5px;
}
.composer textarea:focus-visible { outline: none; }
::selection { background: var(--brass-wash); color: var(--brass-bright); }

/* Visually-hidden but available to assistive tech (live-region announcer). */
.sr-only {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Thin, on-brand scrollbars — the default OS scrollbar reads white on dark. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
[data-theme="paper"] * { scrollbar-color: var(--border-strong) transparent; }

/* Atmosphere: faint grain (≤2%) + no dead flatness. Pure CSS, no asset. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="paper"] body::before { display: none; }

/* ---------- View router ---------- */
.view { position: relative; z-index: 1; min-height: 100dvh; }
.view[hidden] { display: none; }

/* ---------- Type scale ---------- */
.display-xl {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 4rem);
  font-weight: 340;
  font-variation-settings: 'opsz' 144;
  letter-spacing: -0.02em;
  line-height: 1.02;
}
.display-l {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 380;
  font-variation-settings: 'opsz' 96;
  letter-spacing: -0.015em;
  line-height: 1.08;
}
.kicker, .label {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Shared primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-weight: 600; font-size: 0.9375rem; letter-spacing: 0.01em;
  padding: 0 var(--sp-5); height: 48px; border-radius: var(--r-sm);
  transition: transform var(--d-instant) var(--ease-out),
              box-shadow var(--d-fast) var(--ease-out),
              background var(--d-fast) var(--ease-out),
              opacity var(--d-fast) var(--ease-out);
  will-change: transform;
}
.btn-primary {
  background: var(--brass); color: var(--text-on-brass);
  box-shadow: var(--edge-top), 0 1px 0 rgba(0,0,0,0.4);
}
.btn-primary:hover { background: var(--brass-bright); box-shadow: var(--glow-brass); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }
.btn-ghost {
  background: var(--bg-overlay); color: var(--text-secondary);
  border: 1px solid var(--border-default); box-shadow: var(--edge-top);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--border-strong); }
.btn-ghost:active { transform: scale(0.98); }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  box-shadow: var(--edge-top), var(--shadow-sm);
}

/* ---------- Masthead ---------- */
.masthead {
  display: flex; align-items: center; gap: var(--sp-3);
}
.mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(160deg, var(--bg-raised), var(--bg-inset));
  border: 1px solid var(--brass-line);
  box-shadow: var(--edge-top);
  font-family: var(--font-display); font-weight: 500; font-size: 1rem;
  color: var(--brass);
  font-variation-settings: 'opsz' 40;
}
.mark.lg { width: 40px; height: 40px; font-size: 1.35rem; border-radius: 10px; }
.wordmark {
  font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em;
  color: var(--text-primary);
}
.wordmark small { color: var(--text-tertiary); font-weight: 450; }

/* ============================================================================
   SCREEN 1 — Landing (Bottleneck Engine AI — the instrument, powered up)
   Premium AI-platform language: centered, prompt/console-forward, spacious.
   Refs: v0/ChatGPT composer-as-hero, Linear/Claude craft + restraint.
   ============================================================================ */
.landing {
  display: flex; flex-direction: column; align-items: center;
  min-height: 100dvh; padding: var(--sp-6) var(--sp-5) var(--sp-7);
  text-align: center;
}
.landing-topbar {
  width: 100%; max-width: 1080px;
  display: flex; align-items: center; justify-content: space-between;
}
.ai-badge {
  display: inline-block; margin-left: 7px; padding: 1px 6px 0;
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 600;
  letter-spacing: 0.08em; color: var(--signal);
  border: 1px solid var(--signal-line); border-radius: var(--r-xs);
  background: var(--signal-wash); vertical-align: 2px;
}
/* live status pill — the "system is online" AI signal */
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.04em;
  color: var(--text-tertiary);
  padding: 4px 10px 4px 9px; border-radius: var(--r-full);
  border: 1px solid var(--border-subtle); background: var(--bg-surface);
  box-shadow: var(--edge-top);
}
.status-pill .dot, .aic-status .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--signal);
  box-shadow: 0 0 0 0 var(--signal); animation: live-pulse 2.4s var(--ease-in-out) infinite;
}
@keyframes live-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(86,199,214,0.45); opacity: 1; }
  50%     { box-shadow: 0 0 0 5px rgba(86,199,214,0); opacity: 0.7; }
}

.landing-main {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  width: 100%; max-width: 780px; padding: var(--sp-6) 0 var(--sp-7);
  position: relative;
}
/* atmosphere: one soft brass glow behind the headline + a cool wash under the
   console. ≤8% alpha, no gradient slop — color as a scalpel. */
.landing-main::before {
  content: ''; position: absolute; z-index: -1;
  top: -2%; left: 50%; transform: translateX(-50%);
  width: 760px; height: 460px; max-width: 120%;
  background: radial-gradient(ellipse at center, rgba(212,162,76,0.11), transparent 66%);
  filter: blur(10px); pointer-events: none;
}

.lp-eyebrow {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.22em; color: var(--signal);
  margin-bottom: var(--sp-5);
}
.lp-hero {
  margin: 0 auto var(--sp-5); max-width: 16ch;
  text-wrap: balance; text-align: center;
}
.lp-hero em { font-style: normal; color: var(--brass); }
.lp-lede {
  font-size: 1.11rem; line-height: 1.55; color: var(--text-secondary);
  letter-spacing: 0.1px; max-width: 40ch; margin: 0 auto var(--sp-6);
}
.lp-lede strong { color: var(--brass); font-weight: 500; }

/* ---- The AI console (prompt/ignition centerpiece) ---- */
.ai-console {
  width: 100%; max-width: 560px; margin: 0 auto; text-align: left;
  background: linear-gradient(180deg, var(--bg-raised), var(--bg-surface));
  border: 1px solid var(--border-default); border-radius: var(--r-lg);
  box-shadow: var(--edge-top), var(--shadow-lg);
  padding: var(--sp-4) var(--sp-4) var(--sp-4);
  position: relative;
}
.ai-console::after {
  content: ''; position: absolute; inset: -1px; border-radius: var(--r-lg);
  pointer-events: none; z-index: -1;
  background: radial-gradient(120% 100% at 50% 0%, rgba(86,199,214,0.10), transparent 60%);
}
.aic-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 2px var(--sp-3); border-bottom: 1px solid var(--border-subtle);
}
.aic-brand {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-weight: 600; font-size: 0.82rem; letter-spacing: -0.01em; color: var(--text-secondary);
}
.mark.sm { width: 22px; height: 22px; font-size: 0.78rem; border-radius: 6px; }
.aic-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em; color: var(--signal);
}
/* the AI "thinking" output line — typewriter, cyan */
.aic-typeline {
  display: flex; align-items: baseline; gap: 6px;
  min-height: 1.55em; padding: var(--sp-4) 2px var(--sp-4);
  font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.5;
  color: var(--signal-bright);
}
.aic-typeline .caret { color: var(--signal-dim); font-weight: 700; }
.aic-typeline #type-text { color: var(--signal-bright); opacity: 0.92; }
.type-cursor {
  display: inline-block; width: 7px; height: 1.05em; transform: translateY(2px);
  background: var(--signal); margin-left: 1px; border-radius: 1px;
  animation: caret-blink 1.05s steps(2) infinite;
}

/* ignition = the access gate, framed as a prompt composer */
.ignition {
  background: var(--bg-inset); border: 1px solid var(--border-default);
  border-radius: var(--r-md); box-shadow: inset 0 1px 2px rgba(0,0,0,0.35);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  transition: border-color var(--d-fast) var(--ease-out), box-shadow var(--d-fast) var(--ease-out);
}
.ignition:focus-within { border-color: var(--border-focus); box-shadow: var(--glow-brass); }
.ignition input {
  width: 100%; height: 32px; padding: 0; margin-bottom: var(--sp-2);
  background: transparent; color: var(--text-primary);
  border: none; outline: none; font-size: 1rem; letter-spacing: 0.1px;
}
.ignition input::placeholder { color: var(--text-faint); }
.ignition input:focus-visible { outline: none; }
.ignition.err { border-color: var(--leak-line); }
.ignition-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.ignition-hint {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.02em;
  color: var(--text-tertiary); line-height: 1.3;
}
.btn.do-it { height: 44px; padding: 0 var(--sp-5); font-size: 1rem; flex: none; }
.btn.do-it svg { transition: transform var(--d-base) var(--ease-out); }
.btn.do-it:hover svg { transform: translateX(3px); }
/* decline-nudge: pulse the primary to draw the eye back to it */
.btn.do-it.nudge { animation: doit-nudge 1.5s var(--ease-out) 2; }
@keyframes doit-nudge {
  0%,100% { box-shadow: var(--edge-top), 0 1px 0 rgba(0,0,0,0.4); }
  40%     { box-shadow: var(--glow-brass); transform: translateY(-1px); }
}

.gate-error {
  min-height: 1.1em; margin: var(--sp-3) 2px 0; font-size: 0.8125rem; color: var(--leak);
}

/* decline — the cheeky pattern-interrupt */
.decline-wrap { margin-top: var(--sp-4); }
.decline {
  font-family: var(--font-ui); font-size: 0.875rem; color: var(--text-tertiary);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
  text-decoration: underline; text-decoration-color: var(--border-strong);
  text-underline-offset: 3px; transition: color var(--d-fast) var(--ease-out);
}
.decline:hover { color: var(--text-secondary); text-decoration-color: var(--text-faint); }
.decline.spent { color: var(--brass); text-decoration-color: var(--brass-line); }

/* ---- How it works (3 steps) ---- */
.howit {
  list-style: none; padding: 0; margin: var(--sp-8) auto 0;
  max-width: 620px; width: 100%; text-align: left;
  display: grid; gap: var(--sp-2);
}
.howit-step {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-4);
  border-top: 1px solid var(--border-subtle);
}
.howit-step:first-child { border-top: none; }
.step-num {
  flex: none; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600;
  color: var(--signal); letter-spacing: 0.02em; padding-top: 2px;
  min-width: 22px;
}
.step-body { font-size: 0.94rem; line-height: 1.55; color: var(--text-secondary); }
.step-body b { color: var(--text-primary); font-weight: 600; }

.lp-trust {
  margin: var(--sp-8) auto 0; font-size: 0.8125rem; color: var(--text-tertiary);
  letter-spacing: 0.1px;
}
.landing-foot {
  width: 100%; max-width: 1080px; margin-top: var(--sp-8);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3);
  padding-top: var(--sp-6); border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem; color: var(--text-tertiary); text-align: left;
}

/* ---- Landing responsive ---- */
@media (max-width: 560px) {
  .landing { padding: var(--sp-5) var(--sp-4) var(--sp-6); }
  .landing-main { padding: var(--sp-7) 0 var(--sp-6); }
  .lp-hero { max-width: 100%; }
  .ignition-foot { flex-direction: column; align-items: stretch; gap: var(--sp-3); }
  .ignition-hint { text-align: center; order: 2; }
  .btn.do-it { width: 100%; order: 1; }
  .howit-step { padding: var(--sp-4) var(--sp-2); }
  .landing-foot { flex-direction: column; }
}

/* ============================================================================
   SCREEN 2 — The Consultation (interview console)
   ============================================================================ */
.console { display: flex; flex-direction: column; min-height: 100dvh; }
.console-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10,11,13,0.72); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.console-topbar .brand { display: flex; align-items: center; gap: var(--sp-3); font-weight: 600; font-size: 0.9rem; }
.phase-spine { display: flex; align-items: center; gap: var(--sp-3); }
.phase-dots { display: flex; gap: var(--sp-2); }
.phase-dots .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border-strong);
  transition: background var(--d-base) var(--ease-out), box-shadow var(--d-base) var(--ease-out);
}
.phase-dots .dot.done { background: var(--signal-dim); }
.phase-dots .dot.active { background: var(--signal); box-shadow: 0 0 10px var(--signal); }
.progress-counter { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-tertiary); }

.console-body {
  flex: 1; display: grid; grid-template-columns: 1fr 320px;
  max-width: 1160px; width: 100%; margin: 0 auto;
}
.stage {
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--sp-8) var(--sp-7); min-height: 60dvh; position: relative;
}
.rail {
  border-left: 1px solid var(--border-subtle);
  padding: var(--sp-7) var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-6);
  background: linear-gradient(180deg, rgba(255,255,255,0.008), transparent);
}

/* history strip (recedes) */
.history {
  display: flex; flex-direction: column; gap: var(--sp-2);
  margin-bottom: var(--sp-6); max-height: 148px; overflow-y: auto;
  mask-image: linear-gradient(180deg, transparent, #000 40px);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 40px);
}
.history:empty { display: none; }
.history .h-item { font-size: 0.8125rem; line-height: 1.5; }
.history .h-q { color: var(--text-faint); }
.history .h-a { color: var(--text-tertiary); padding-left: var(--sp-4); position: relative; }
.history .h-a::before {
  content: ''; position: absolute; left: 4px; top: 7px; bottom: 7px; width: 2px;
  border-radius: 2px; background: var(--brass-line);
}

/* thinking status (cyan shimmer) */
.thinking {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: 0.8125rem; color: var(--signal); min-height: 20px;
  margin-bottom: var(--sp-4);
}
.thinking[hidden] { display: none; }
.thinking .pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--signal);
  animation: pulse-dot 1.4s var(--ease-in-out) infinite;
}
.thinking .txt {
  background: linear-gradient(90deg, var(--signal-dim) 0%, var(--signal-bright) 50%, var(--signal-dim) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 2.2s linear infinite;
}
@keyframes pulse-dot { 0%,100% { opacity: 0.35; transform: scale(0.8);} 50% { opacity: 1; transform: scale(1);} }
@keyframes shimmer { to { background-position: -200% 0; } }

/* the question (hero of the screen) */
.question {
  font-family: var(--font-ui); font-weight: 420;
  font-size: clamp(1.25rem, 2.6vw, 1.65rem); line-height: 1.4;
  letter-spacing: 0.1px; color: var(--text-primary);
  max-width: 22em; min-height: 2.4em;
}
.question .caret {
  display: inline-block; width: 2px; height: 1.05em; margin-left: 2px;
  vertical-align: -0.14em; background: var(--brass);
  animation: caret-blink 1s steps(2) infinite;
}
@keyframes caret-blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }

/* recoverable stream error, shown in place of the question */
.question .turn-error { color: var(--leak); }

/* graceful end-of-session card (message cap) */
.soft-stop { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-5); max-width: 24em; }
.soft-stop p {
  font-family: var(--font-ui); font-weight: 420;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem); line-height: 1.4; color: var(--text-primary);
}

/* composer */
.composer {
  margin-top: var(--sp-6); max-width: 34em;
}
.composer-row {
  display: flex; align-items: flex-end; gap: var(--sp-3);
  background: var(--bg-overlay); border: 1px solid var(--border-default);
  border-radius: var(--r-md); box-shadow: var(--edge-top);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
  transition: border-color var(--d-fast) var(--ease-out), box-shadow var(--d-fast) var(--ease-out);
}
.composer-row:focus-within { border-color: var(--border-focus); box-shadow: var(--glow-brass); }
.composer textarea {
  flex: 1; resize: none; border: none; background: none; outline: none;
  padding: var(--sp-3) 0; max-height: 140px; line-height: 1.5; font-size: 1rem;
}
.composer textarea::placeholder { color: var(--text-faint); }
.composer .mic {
  flex: none; width: 40px; height: 40px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
}
.composer .mic:hover { color: var(--text-secondary); }
.composer .send {
  flex: none; width: 44px; height: 44px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--brass); color: var(--text-on-brass);
  box-shadow: var(--edge-top); transition: transform var(--d-instant), background var(--d-fast), opacity var(--d-fast);
}
.composer .send:hover { background: var(--brass-bright); }
.composer .send:active { transform: scale(0.94); }
.composer .send:disabled { opacity: 0.4; cursor: default; }
.composer-hint { margin-top: var(--sp-3); font-size: 0.75rem; color: var(--text-tertiary); }
.composer-hint.err { color: var(--leak); }

/* signals rail */
.rail-h {
  font-size: 0.625rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--text-tertiary);
  display: flex; align-items: center; gap: var(--sp-2);
}
.rail-h::after { content: ''; flex: 1; height: 1px; background: var(--border-subtle); }
.signals { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.signals-empty { font-size: 0.8125rem; color: var(--text-faint); line-height: 1.5; }
.signal-chip {
  border: 1px solid var(--signal-line); background: var(--signal-wash);
  border-radius: var(--r-sm); padding: var(--sp-3);
  box-shadow: var(--edge-top);
  animation: chip-lock var(--d-slow) var(--ease-spring) both;
}
@keyframes chip-lock {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.signal-chip .k {
  font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--signal); margin-bottom: 3px;
}
.signal-chip .v {
  font-family: var(--font-mono); font-size: 1rem; font-weight: 500;
  color: var(--text-primary); font-variant-numeric: tabular-nums;
}
.phase-list { list-style: none; padding: 0; display: grid; gap: var(--sp-3); margin-top: var(--sp-3); }
.phase-list li {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: 0.8125rem; color: var(--text-faint);
  transition: color var(--d-base) var(--ease-out);
}
.phase-list li .ic { width: 15px; height: 15px; flex: none; opacity: 0.5; }
.phase-list li.done { color: var(--text-tertiary); }
.phase-list li.done .ic { color: var(--fixed); opacity: 1; }
.phase-list li.active { color: var(--text-primary); }
.phase-list li.active .ic { color: var(--signal); opacity: 1; }

/* ============================================================================
   SCREEN 3 — Building sequence (overlay)
   ============================================================================ */
.building {
  position: fixed; inset: 0; z-index: 40;
  background: radial-gradient(ellipse at 50% 35%, #0d0f13, var(--bg-base) 70%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--sp-6); text-align: center; gap: var(--sp-5);
}
.building[hidden] { display: none; }
.building .b-kicker {
  font-size: 0.6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--signal); opacity: 0; animation: fade-in var(--d-slow) var(--ease-out) forwards;
}
.building .b-stage { min-height: 240px; display: grid; place-items: center; width: 100%; max-width: 560px; }
.b-step { display: none; flex-direction: column; align-items: center; gap: var(--sp-4); width: 100%; }
.b-step.on { display: flex; }
.b-evidence { display: flex; flex-direction: column; gap: var(--sp-2); width: 100%; }
.b-quote {
  font-family: var(--font-display); font-size: 1.05rem; font-style: normal;
  font-variation-settings: 'opsz' 40; color: var(--text-secondary);
  padding: var(--sp-2) var(--sp-4); border-left: 2px solid var(--signal);
  text-align: left; opacity: 0;
}
.b-quote.lock { animation: chip-lock var(--d-slow) var(--ease-spring) forwards; }
.b-cost-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-tertiary); }
.b-cost {
  font-family: var(--font-display); font-weight: 340; font-variation-settings: 'opsz' 144;
  font-size: clamp(3rem, 9vw, 5rem); color: var(--leak); letter-spacing: -0.02em; line-height: 1;
  text-shadow: 0 0 48px rgba(224,108,94,0.28);
}
.b-progress {
  width: 200px; height: 3px; border-radius: 2px; background: var(--border-subtle); overflow: hidden;
}
.b-progress .fill { height: 100%; width: 0; background: var(--signal); transition: width var(--d-slower) var(--ease-out); }

/* ============================================================================
   SCREEN 4 — Diagnosis artifact
   ============================================================================ */
.artifact-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.artifact-toolbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10,11,13,0.78); backdrop-filter: blur(12px);
}
[data-theme="paper"] .artifact-toolbar { background: rgba(251,250,247,0.85); }
.artifact-toolbar .brand { display: flex; align-items: center; gap: var(--sp-3); font-weight: 600; font-size: 0.9rem; }
.toolbar-actions { display: flex; gap: var(--sp-3); }
.toolbar-actions .btn { height: 38px; font-size: 0.8125rem; padding: 0 var(--sp-4); }

.artifact {
  width: 100%; max-width: 760px; margin: 0 auto; padding: var(--sp-8) var(--sp-5) var(--sp-9);
  flex: 1;
}
.doc-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4);
  padding-bottom: var(--sp-4); border-bottom: 1px solid var(--brass-line); margin-bottom: var(--sp-7);
}
.doc-head .doc-brand { font-family: var(--font-display); font-size: 1.15rem; font-variation-settings: 'opsz'40; }
.doc-head .doc-brand small { display: block; font-family: var(--font-ui); font-size: 0.7rem; letter-spacing: 0.06em; color: var(--text-tertiary); text-transform: uppercase; margin-top: 3px; }
.doc-meta { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-tertiary); text-align: right; line-height: 1.7; }

.a-title { margin-bottom: var(--sp-3); }
.a-prepared { font-size: 0.875rem; color: var(--text-tertiary); margin-bottom: var(--sp-7); max-width: 46em; }

.a-section { margin-bottom: var(--sp-7); }
.a-section > .kicker { display: block; margin-bottom: var(--sp-4); }

.verdict {
  font-family: var(--font-display); font-size: clamp(1.5rem, 3.4vw, 2rem);
  font-variation-settings: 'opsz' 60; font-weight: 400; line-height: 1.22;
  letter-spacing: -0.01em; color: var(--text-primary);
}
.verdict .said {
  display: block; margin-top: var(--sp-4);
  font-family: var(--font-ui); font-size: 0.95rem; font-weight: 420; letter-spacing: 0.1px;
  color: var(--text-tertiary);
}
.verdict .said q { color: var(--text-secondary); font-style: italic; }

.evidence { list-style: none; padding: 0; display: grid; gap: var(--sp-4); }
.evidence li {
  font-family: var(--font-display); font-variation-settings: 'opsz' 40;
  font-size: 1.05rem; line-height: 1.5; color: var(--text-secondary);
  padding-left: var(--sp-5); border-left: 2px solid var(--brass-line);
  hanging-punctuation: first;
}

/* cost of inaction */
.cost {
  display: grid; grid-template-columns: 1fr 260px; gap: var(--sp-6);
  align-items: start;
}
.ledger {
  background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--r-md);
  box-shadow: var(--edge-top); overflow: hidden;
}
.ledger table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 0.82rem; }
.ledger td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.ledger tr:last-child td { border-bottom: none; }
.ledger td:first-child { color: var(--text-secondary); }
.ledger td:last-child { color: var(--text-primary); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ledger td em { font-style: normal; color: var(--brass); font-size: 0.92em; }
.ledger .assume td:first-child { color: var(--text-tertiary); }
.math-note { margin-top: var(--sp-4); font-size: 0.82rem; color: var(--text-tertiary); line-height: 1.55; font-family: var(--font-mono); }

.cost-figure {
  background: var(--leak-wash); border: 1px solid var(--leak-line); border-radius: var(--r-md);
  padding: var(--sp-6) var(--sp-5); text-align: center; box-shadow: var(--edge-top);
}
.cost-figure .amt {
  font-family: var(--font-display); font-variation-settings: 'opsz' 144; font-weight: 340;
  font-size: clamp(2.4rem, 7vw, 3.2rem); color: var(--leak); letter-spacing: -0.02em; line-height: 1;
}
.cost-figure .lbl { font-size: 0.8rem; color: var(--text-secondary); margin-top: var(--sp-3); }
.cost-figure .floor { font-size: 0.72rem; color: var(--text-tertiary); margin-top: var(--sp-3); line-height: 1.4; }
/* leak visual: bucket losing water */
.leak-viz { margin-top: var(--sp-4); }

/* system diagram */
.diagram-wrap { background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--r-md); box-shadow: var(--edge-top); padding: var(--sp-6) var(--sp-4); overflow-x: auto; }
.diagram-caption { margin-top: var(--sp-4); font-size: 0.92rem; color: var(--text-secondary); line-height: 1.55; }

/* build scope */
.scope {
  border: 1px solid var(--border-subtle); border-radius: var(--r-md);
  background: var(--bg-surface); box-shadow: var(--edge-top); padding: var(--sp-5);
}
.scope ul { list-style: none; padding: 0; display: grid; gap: var(--sp-3); }
.scope li { display: flex; gap: var(--sp-3); font-size: 0.9375rem; color: var(--text-secondary); }
.scope li b { color: var(--text-primary); font-weight: 600; }
.scope .ic { flex: none; width: 16px; height: 16px; margin-top: 3px; color: var(--fixed); }
.scope .foot { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--border-subtle); font-size: 0.85rem; color: var(--text-tertiary); }

/* honesty block */
.honest {
  border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  padding: var(--sp-5); background: var(--bg-surface);
  font-size: 0.95rem; line-height: 1.6; color: var(--text-secondary);
}
.honest b { color: var(--text-primary); }
.honest.secondary { border-style: solid; border-color: var(--brass-line); background: var(--brass-wash); margin-top: var(--sp-4); }

/* next steps */
.next-steps { list-style: none; padding: 0; display: grid; gap: var(--sp-4); counter-reset: n; }
.next-steps li { display: flex; gap: var(--sp-4); font-size: 0.9375rem; color: var(--text-secondary); line-height: 1.5; }
.next-steps li b { color: var(--text-primary); }
.next-steps li::before {
  counter-increment: n; content: counter(n);
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--brass); border: 1px solid var(--brass-line); background: var(--brass-wash);
}

/* ============================================================================
   SCREEN 5 — Booking console
   ============================================================================ */
.booking { margin-top: var(--sp-7); }
.booking-frame {
  border: 1px solid var(--border-default); border-radius: var(--r-lg);
  background: var(--bg-surface); box-shadow: var(--edge-top), var(--shadow-md); overflow: hidden;
}
.booking-frame .frame-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, var(--brass-wash), transparent);
}
.booking-frame .frame-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brass); box-shadow: 0 0 8px var(--brass-line); }
.booking-frame .frame-head .t { font-weight: 600; font-size: 0.85rem; }
.booking-frame .frame-head .t small { color: var(--text-tertiary); font-weight: 450; }
.booking-lead {
  padding: var(--sp-6) var(--sp-5) var(--sp-4);
  font-size: 1.05rem; line-height: 1.55; color: var(--text-secondary); text-align: center;
}
.booking-lead b { color: var(--text-primary); }
.booking-embed { position: relative; min-height: 640px; background: #fff; }
.booking-embed iframe { display: block; width: 100%; min-height: 640px; border: none; }
.booking-skeleton {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--bg-inset); color: var(--text-tertiary); font-size: 0.85rem; gap: var(--sp-3);
}
.booking-skeleton[hidden] { display: none; }
.booking-skeleton .spin {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--brass);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.booking-fallback { text-align: center; font-size: 0.82rem; color: var(--text-tertiary); margin-top: var(--sp-4); }
.booking-fallback a { color: var(--brass); }

/* The booking section renders as a light "paper console" island inside the dark
   artifact (data-theme="paper" re-scopes the tokens for this subtree). The
   third-party calendar is light-styled, so seating it on paper turns a stark
   white seam into an intentional, premium inset — the same paper the owner
   keeps when they Save/print. */
.booking[data-theme="paper"] {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: var(--sp-3);
  box-shadow: 0 32px 80px -28px rgba(0,0,0,0.75), var(--edge-top);
  color: var(--ink);
}
.booking[data-theme="paper"] .booking-frame {
  border-color: var(--line);
  box-shadow: none;
  border-radius: var(--r-lg);
}
.booking[data-theme="paper"] .booking-lead { color: var(--ink); }
.booking[data-theme="paper"] .booking-lead b { color: var(--ink); }
.booking[data-theme="paper"] .booking-embed,
.booking[data-theme="paper"] .booking-skeleton { background: #fff; }
.booking[data-theme="paper"] .frame-head { background: linear-gradient(180deg, var(--brass-wash), transparent); }
.booking[data-theme="paper"] .frame-head .t { color: var(--ink); }
/* When the whole artifact is already paper (Save/print preview), drop the island
   treatment so it doesn't read as a card-on-paper. */
[data-theme="paper"] .booking[data-theme="paper"] {
  background: transparent; border: none; box-shadow: none; padding: 0;
}

/* booking widget load-failure fallback (never a blank panel) */
.booking-skeleton.failed { flex-direction: column; padding: var(--sp-6); text-align: center; }
.booking-skeleton.failed a { color: var(--brass); font-weight: 600; }
.booking-skeleton.failed .retry { color: var(--text-tertiary); font-size: 0.78rem; }
.booking[data-theme="paper"] .booking-skeleton.failed a { color: var(--brass); }
.booking[data-theme="paper"] .booking-skeleton.failed span { color: var(--ink-muted); }

/* degraded diagnosis (JSON unparseable) — plain readable prose, still premium */
.degraded-body {
  border: 1px solid var(--border-subtle); border-radius: var(--r-md);
  background: var(--bg-surface); box-shadow: var(--edge-top);
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
}
.degraded-body p {
  font-size: 1.02rem; line-height: 1.6; color: var(--text-secondary); margin-bottom: var(--sp-4);
}
.degraded-body p:first-child { color: var(--text-primary); }

.doc-foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3);
  margin-top: var(--sp-8); padding-top: var(--sp-5); border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem; color: var(--text-tertiary); font-family: var(--font-mono);
}

/* ---------- reveal utility (stagger on load) ---------- */
.reveal { opacity: 0; transform: translateY(10px); }
.reveal.in { animation: reveal-up var(--d-slow) var(--ease-out) forwards; }
@keyframes reveal-up { to { opacity: 1; transform: none; } }
@keyframes fade-in { to { opacity: 1; } }

/* ---------- diagram node/arrow (SVG-adjacent HTML variant used for print) ---------- */

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 880px) {
  .console-body { grid-template-columns: 1fr; }
  .rail {
    border-left: none; border-top: 1px solid var(--border-subtle);
    flex-direction: row; flex-wrap: wrap; gap: var(--sp-4); padding: var(--sp-5);
    order: 2;
  }
  .rail .rail-block { flex: 1; min-width: 150px; }
  .stage { order: 1; padding: var(--sp-6) var(--sp-5); min-height: auto; }
  .cost { grid-template-columns: 1fr; }
  .cost-figure { order: -1; }
}
@media (max-width: 560px) {
  .gate-row { flex-direction: column; }
  .gate-row .btn { width: 100%; }
  .doc-head { flex-direction: column; gap: var(--sp-3); }
  .doc-meta { text-align: left; }
  .artifact { padding: var(--sp-6) var(--sp-4) var(--sp-8); }
  .stage { padding: var(--sp-5) var(--sp-4); }
  .landing { padding: var(--sp-5) var(--sp-4) var(--sp-6); }
  .toolbar-actions .btn span.lbl { display: none; }
}

/* ============================================================================
   Print — the paper artifact
   ============================================================================ */
@media print {
  .artifact-toolbar, .booking, .doc-foot .no-print { display: none !important; }
  body { background: #fff; }
  body::before { display: none; }
  .artifact { max-width: 100%; padding: 0; }
  .a-section { break-inside: avoid; }
  .cost-figure, .diagram-wrap, .ledger, .scope, .honest { box-shadow: none; }
}
