/* The demo as a story (/demo/story/): one scene at a time, in the look of
   the Night Desk stage demo. Builds on styles.css (fonts, tokens, buttons,
   forms) and demo.css (everything demo.js draws). Classes here start st-. */

:root { --st-gutter: clamp(16px, 3vw, 56px); --good: #2f6b4f; }

html, body.st-body { height: 100%; }
body.st-body {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
  height: 100vh; height: 100dvh; overflow: hidden;
  font-size: clamp(17px, 1.15vw, 21px); line-height: 1.45;
}
.st-body :focus-visible, .st-body .build-form input:focus-visible, .st-body .build-form textarea:focus-visible {
  outline: 2px solid var(--red); outline-offset: 2px;
}

.st-mono { font-family: var(--mono); font-size: 13px; }
.st-muted { color: var(--muted); }
.st-label { font-family: var(--mono); font-size: clamp(12px, .8vw, 14px); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.st-stack { display: flex; flex-direction: column; gap: clamp(16px, 1.6vw, 28px); min-width: 0; }
.st-btns { display: flex; flex-wrap: wrap; gap: 12px; }
.st-note { font-size: .88em; color: var(--muted); line-height: 1.5; max-width: 44ch; }

/* ---------- Top bar ---------- */
.st-top {
  display: flex; justify-content: space-between; align-items: center; gap: 16px 24px;
  padding: 14px var(--st-gutter); border-bottom: 1px solid var(--ink); background: var(--paper);
}
.st-progress-wrap { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.st-progress-wrap::-webkit-scrollbar { display: none; }
.st-progress { display: flex; border-left: 1px solid var(--ink); width: max-content; }
.st-progress li { border: 1px solid var(--ink); border-left: 0; }
.st-progress a {
  display: block; padding: 8px 13px; font-family: var(--mono); font-size: 13px;
  color: var(--muted); text-decoration: none; white-space: nowrap;
}
.st-progress a:hover { color: var(--ink); background: rgba(0, 0, 0, .04); }
.st-progress a.is-done { color: var(--ink); }
.st-progress a.is-done::after { content: ' ✓'; color: var(--good); }
.st-progress a[aria-current="step"] { background: var(--ink); color: var(--paper); }
.st-progress a[aria-current="step"]::after { color: var(--paper); }

.st-status { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.st-dot { flex: none; width: 10px; height: 10px; border: 1.5px solid var(--muted); }
.st-status.is-ready .st-dot { background: var(--good); border-color: var(--good); }
.st-status.is-failed { color: var(--red); }
.st-status.is-failed .st-dot { background: var(--red); border-color: var(--red); }

/* ---------- Scenes ---------- */
.st-main { position: relative; min-height: 0; }
.st-scene { position: absolute; inset: 0; overflow: auto; padding: clamp(28px, 5vh, 72px) var(--st-gutter) 48px; }
/* One scene at a time; until the script runs (or without it), the first. */
.st-scene { display: none; }
.st-scene.is-on, .st-body:not(.st-js) #start { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .st-scene.is-on { animation: st-enter .35s ease-out both; }
  @keyframes st-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
.st-noscript { padding: 32px var(--st-gutter); font-size: 19px; }

.st-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(28px, 4vw, 80px); align-items: start; max-width: 1600px; margin: 0 auto; }
.st-split--head { grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); }
.st-title-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(28px, 4vw, 80px); align-items: center; max-width: 1600px; margin: 0 auto; min-height: 100%; }
.st-wide { max-width: 1600px; margin: 0 auto; }

.st-display { font-size: clamp(56px, 8vw, 140px); line-height: .92; letter-spacing: -.035em; font-weight: 400; }
.st-statement { font-size: clamp(36px, 4.2vw, 76px); line-height: 1.04; letter-spacing: -.028em; font-weight: 400; text-wrap: balance; }
.st-statement em { font-style: italic; }
.st-lede { font-size: clamp(19px, 1.45vw, 26px); line-height: 1.4; max-width: 34ch; }
.st-lede--wide { max-width: 60ch; }
.st-lede:empty, .st-note:empty { display: none; }
.st-art { margin: 0; }
.st-art img { display: block; width: 100%; height: auto; }

.st-person { display: flex; gap: 16px; align-items: center; padding-top: 20px; border-top: 1px solid var(--ink); }
.st-avatar { flex: none; width: 56px; height: 56px; display: grid; place-items: center; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 14px; }
.st-person-name { font-size: 1.3em; line-height: 1.1; }

/* The device or tool on the right */
.st-panel { border: 1px solid var(--ink); padding: clamp(18px, 1.8vw, 32px); display: flex; flex-direction: column; gap: 18px; background: var(--paper); min-width: 0; }
.st-panel-head { display: flex; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: 13px; color: var(--muted); padding-bottom: 12px; border-bottom: 1px solid var(--rule-light); }

/* Before you start */
.st-reset { color: var(--ink); }
.st-reset.dm-reset--warn { color: var(--red); }
.st-servers { color: var(--ink); }
.st-servers .dm-server--ok::before { background: var(--good); }
.st-servers .dm-server--bad::before { background: var(--red); }
.st-rules { font-size: 17px; }

/* Passes, as on stage: a large grid of squares */
.st-passes.dm-passes { max-width: none; gap: 8px; }
.st-passes.dm-passes span { border-width: 1.5px; }
@media (prefers-reduced-motion: no-preference) {
  .st-passes span.on { animation: st-pop .25s ease-out both; }
  @keyframes st-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Twelve words, larger */
.st-panel .dm-words { font-size: 17px; }

/* What the server knows */
.st-verdict { font-size: 20px; }
.st-explain { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.st-explain-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 28px; }
.st-explain-grid li { border-top: 1px solid var(--ink); padding-top: 12px; font-size: .9em; line-height: 1.45; }
.st-explain-grid b { display: block; margin-bottom: 4px; font-family: var(--mono); font-size: 13px; font-weight: 400; color: var(--red); }

/* Move */
.st-route { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); padding-bottom: 12px; border-bottom: 1px solid var(--rule-light); }
.st-arrow { font-size: 2em; color: var(--red); }

/* In person */
.st-big-note { font-size: .95em; line-height: 1.5; border-left: 3px solid var(--red); padding-left: 16px; max-width: 40ch; }
.st-big-note b { font-weight: 600; }
.st-body .build-form input.st-field-big { font-family: var(--serif); font-size: clamp(26px, 2.4vw, 44px); padding: 8px 16px; color: var(--ink); letter-spacing: -.01em; }

/* Next */
.st-takeaways { display: flex; flex-direction: column; border-top: 1px solid var(--ink); }
.st-takeaways li { padding: 16px 0; border-bottom: 1px solid var(--ink); font-size: clamp(20px, 1.8vw, 32px); line-height: 1.2; letter-spacing: -.015em; }

/* ---------- Bottom bar ---------- */
.st-bottom {
  display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap;
  padding: 10px var(--st-gutter); border-top: 1px solid var(--ink); background: var(--paper);
  font-family: var(--mono); font-size: 13px;
}
.st-nav { display: flex; align-items: center; gap: 16px; }
.st-next.btn { padding: 9px 16px; font-size: 13px; }
.st-link { border: 0; background: none; padding: 0; cursor: pointer; font-family: var(--mono); font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.st-link:hover { color: var(--ink); }
.st-link:disabled { opacity: .4; cursor: default; text-decoration: none; }
.st-link--red { color: var(--red); }
.st-reset #dm-start-over-confirm { display: inline-flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.st-reset #dm-start-over-confirm[hidden] { display: none; }
.st-body:not(.st-js) .st-nav, .st-body:not(.st-js) .st-keys { display: none; }

/* ---------- Narrow screens ---------- */
@media (max-width: 1100px) {
  .st-top { flex-wrap: wrap; }
  .st-progress-wrap { order: 3; flex: 1 1 100%; }
  .st-explain-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; }
}
@media (max-width: 900px) {
  .st-split, .st-split--head, .st-title-grid { grid-template-columns: minmax(0, 1fr); }
  .st-title-grid { min-height: 0; }
  .st-art { order: -1; }
}
@media (max-width: 760px) {
  .st-top { padding-top: 10px; padding-bottom: 10px; gap: 10px 16px; }
  .st-logo { gap: 8px; }
  .st-logo .logo-mark { width: 34px; height: 34px; margin-bottom: 6px; padding-top: 16px; font-size: 54px; }
  .st-logo .logo-text { font-size: 19px; }
  .st-status { white-space: normal; font-size: 12px; }
  .st-keys { display: none; }
  .st-bottom { justify-content: space-between; }
  .st-explain-grid { grid-template-columns: minmax(0, 1fr); }
  .st-route { grid-template-columns: minmax(0, 1fr); }
  .st-arrow { transform: rotate(90deg); justify-self: start; }
  .st-scene { padding-top: 24px; }
}

/* ---------- Larger small text (demo.css sizes are set for a long page) ---------- */
.st-body .dm-legend, .st-body .dm-hint, .st-body .dm-kv dt, .st-body .build-form label { font-size: 14px; }
.st-body .dm-note, .st-body .dm-status, .st-body .dm-checklist, .st-body .build-form .check-row,
.st-body .dm-servers, .st-body .dm-reset, .st-body .dm-qr figcaption, .st-body .dm-suffix { font-size: 15px; }
.st-body .build-form input, .st-body .build-form textarea, .st-body .dm-pre { font-size: 15px; }
.st-body .dm-kv { font-size: 17px; }
.st-body .dm-kv dd.dm-mono, .st-body .dm-route .dm-mono { font-size: 14px; }
.st-body .dm-checklist li::before { top: 4px; }
.st-body .dm-list, .st-body .dm-checks, .st-body .dm-words { font-size: 17px; }
.st-body .dm-happened > p, .st-body .dm-linked > p, .st-body .dm-answers dd, .st-body .dm-proof-parts { font-size: 18px; }
.st-body .build-form .dm-choice { font-size: 18px; }
.st-body .btn { font-size: 15px; }
.st-body .dm-btn-small { font-size: 14px; }
.st-label { font-size: clamp(13px, .9vw, 15px); }
.st-mono, .st-panel-head, .st-status, .st-progress a { font-size: 14px; }
.st-note { font-size: .95em; }

/* ---------- Back and Next: hard to miss ---------- */
.st-bottom { padding-top: 12px; padding-bottom: 12px; font-size: 14px; }
.st-nav { gap: 12px; }
.st-body .st-back.btn { padding: 12px 20px; font-size: 15px; }
.st-body .st-back.btn:disabled { visibility: hidden; }
.st-body .st-next.btn { padding: 12px 26px; font-size: 16px; background: var(--red); border-color: var(--red); color: #fff; }
.st-body .st-next.btn:hover { background: var(--ink); border-color: var(--ink); }
.st-link, .st-keys { font-size: 14px; }

/* The same Next at the end of every scene, where reading stops */
.st-scene-next { max-width: 1600px; margin: clamp(32px, 5vh, 64px) auto 0; padding-top: 20px; border-top: 1px solid var(--ink); display: flex; justify-content: flex-end; }
.st-body .st-scene-next .btn { padding: 14px 28px; font-size: 17px; background: var(--red); border-color: var(--red); color: #fff; }
.st-body .st-scene-next .btn:hover { background: var(--ink); border-color: var(--ink); }
@media (max-width: 760px) {
  .st-body .st-next.btn { padding: 12px 18px; }
  .st-body .st-back.btn { padding: 12px 14px; }
  .st-scene-next { justify-content: stretch; }
  .st-scene-next .btn { flex: 1; text-align: center; }
}
