/* Story (package D, .st- prefix): hero extras (C1), story layout in scrolly and stepper modes (C2), figure internals
   for C3-C7, the "Show the work" drawer and the act list. The hero card itself is laid out by B's .ld- classes. */

/* ---------- shared bits ---------- */
.st-linkbtn { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; color: var(--accent);
  font: inherit; text-align: left; text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: from-font; cursor: pointer; }
.st-linkbtn:hover { text-decoration-thickness: 2px; }
.st-sub { margin: 22px 0 8px; color: var(--muted); font: 500 .75rem/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.st-sub small { font: 400 .8125rem/1.3 var(--font-text); letter-spacing: 0; text-transform: none; }
.st-tk { display: inline-block; flex: none; fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.st-tk-flag { stroke: var(--st-likely); }
.st-tk-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0 0; color: var(--ink-2); font-size: .8125rem; }
.st-tk-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- C1 hero extras ---------- */
.st-a-more { display: none; min-width: 44px; justify-content: center; }
html.vt-sector .st-answer { view-transition-name: st-hero; }
@media (max-width: 559.98px) {
  .st-a-more { display: inline-flex; }
  .st-answer.st-open .ld-a-who { display: inline; }
  .st-answer.st-open .ld-l-sub { display: flex; }
  .st-answer.st-open .ld-a-stats { display: block; }
}
/* evidence strip returned by Acme.story.strip(id) for other sections */
.st-strip { display: flex; gap: 2px; width: 100%; height: 10px; }
.st-strip i, .st-k { display: block; height: 100%; border-radius: 2px; }
.st-s-v { background: var(--st-verified); }
.st-s-l { background: repeating-linear-gradient(45deg, var(--st-likely) 0 2px, transparent 2px 6px); box-shadow: inset 0 0 0 1.5px var(--st-likely); }
.st-s-n { border: 1.5px dotted var(--muted); background: transparent; }
.st-strip-legend { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 8px 0 0; color: var(--ink-2); font-size: .8125rem; }
.st-strip-legend span { display: inline-flex; align-items: center; gap: 6px; }
.st-k { display: inline-block; width: 12px; height: 8px; }

/* ---------- C2 story layout ---------- */
.st-before:empty, .st-after:empty { display: none; }
.st-before { margin: 6px 0 4px; }
.st-after { margin-top: 18px; }
[data-st-mode] .st-inline { margin-top: 16px; }
.st-pn { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.st-pn-step { margin-top: 24px; padding-top: 16px; border-top: var(--rule-w) solid var(--rule); }
.st-tab-n { color: var(--muted); font: 500 .75rem/1 var(--font-mono); }
/* the selected chip sits on --accent-wash, where --muted drops under 4.5:1 in Sage */
[aria-selected="true"] > .st-tab-n, [aria-current] > .st-tab-n { color: var(--ink-2); }
/* 44px targets for the small buttons inside the story (.btn-sm is 40px on fine pointers) */
.st-agree, .st-pn-step .btn, .st-log-ctl .btn, .st-sheet-ctl .btn { min-height: 44px; }
/* stepper (phones, tablets, short screens, zoom) */
.st-tabs { display: flex; gap: 2px; margin: 0 0 20px; overflow-x: auto; border-bottom: var(--rule-w) solid var(--rule); scrollbar-width: none; }
.st-tabs::-webkit-scrollbar { display: none; }
.st-tabs [role="tab"] { display: inline-flex; flex: none; align-items: center; gap: 6px; min-height: 44px; margin-bottom: calc(-1 * var(--rule-w)); padding: 0 12px;
  border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ink-2); font: 500 .9375rem/1.2 var(--font-text); cursor: pointer; }
/* the row scrolls, so an outside focus ring would be clipped: draw it inside the tab */
.st-tabs [role="tab"]:focus-visible { outline-offset: -3px; }
[data-theme="contrast"] .st-tabs [role="tab"]:focus-visible { outline-offset: -4px; }
/* phones: all five steps fit in one row (343px at 375) so no label is cut */
@media (max-width: 479.98px) {
  .st-tabs { gap: 0; }
  .st-tabs [role="tab"] { flex: 1 1 auto; justify-content: center; gap: 3px; padding: 0 5px; font-size: .8125rem; }
  .st-tabs .st-tab-n { font-size: .6875rem; }
}
.st-tabs [aria-selected="true"] { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
[data-st-mode="stepper"] .st-stage { display: none; }
[data-st-mode="stepper"] .st-step { max-width: 820px; }
[data-st-mode="scrolly"] .st-inline, [data-st-mode="scrolly"] .st-pn-step { display: none; }
/* scrolly (>=1024 x 800): one pinned figure */
[data-st-mode="scrolly"] { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; column-gap: 32px; }
[data-st-mode="scrolly"] .st-step { min-height: 70vh; padding: 9vh 0 9vh 18px; border-left: 2px solid var(--rule); }
[data-st-mode="scrolly"] .st-step.st-on { border-left-color: var(--accent); }
/* run-out: the last step is tall enough that the pinned stage (72px + its height) still fits while that step is centred */
[data-st-mode="scrolly"] .st-step:last-child { min-height: calc(100svh - 40px); }
[data-st-mode="scrolly"] .st-stage { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 6px; height: calc(100svh - 96px); max-height: 900px; }
.st-stage:focus-visible { outline-offset: 4px; }
.st-rail { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.st-rail button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1px solid transparent; border-radius: var(--radius-pill);
  background: none; color: var(--ink-2); font: 500 .875rem/1 var(--font-text); cursor: pointer; }
.st-rail button:hover { border-color: var(--rule); }
.st-rail button[aria-current] { border-color: var(--accent); background: var(--accent-wash); color: var(--ink); font-weight: 600; }
.st-stage-top { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; }
.st-pn-stage { flex: none; flex-wrap: nowrap; gap: 6px; }
.st-arrow { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--axis); border-radius: var(--radius-pill); background: var(--surface);
  color: var(--ink); font: 600 1.125rem/1 var(--font-text); cursor: pointer; }
.st-arrow:disabled { border-color: var(--rule); color: var(--muted); cursor: default; }
.st-stage-fig { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 2px; }
.st-stage-fig:focus-visible { outline-offset: -2px; }
.st-stage-fig .fig { padding: 12px 16px 12px; }
.st-stage-fig .fig-tabs { margin: 4px 0 6px; }
/* pinned plate: "Fig. N" sits on the title's line, to give the chart the height */
.st-stage-fig .vz-fig { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: baseline; }
.st-stage-fig .vz-fig > * { grid-column: 1 / -1; }
.st-stage-fig .vz-fig > .vz-num { grid-column: 1; margin: 0; }
.st-stage-fig .vz-fig > .vz-num + .vz-title { grid-column: 2; }
.st-stage-fig .vz-legend { margin-bottom: 6px; }
.st-stage-fig .fig > figcaption { margin-top: 8px; }
.st-tail { height: 1px; }
/* the figure is taller than the stage: fade the bottom edge until the end is in view */
.st-stage { position: relative; }
.st-stage.st-more::after { content: ""; position: absolute; right: 2px; bottom: 0; left: 2px; height: 40px; border-radius: 0 0 var(--radius-l) var(--radius-l); pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--surface)); }
/* skip-style links between a step's text and the pinned figure (scrolly only; visible on focus) */
.st-jump { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.st-jump:focus { position: static; display: inline-flex; align-items: center; width: auto; height: auto; min-height: 44px; margin-top: 12px; padding: 0 14px; overflow: visible; clip-path: none;
  border: 1px solid var(--accent); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); font: 600 .875rem/1.2 var(--font-text); cursor: pointer; }
.st-back:focus { position: absolute; bottom: 8px; left: 8px; z-index: 31; margin: 0; box-shadow: var(--shadow-pop); }
[data-st-mode="stepper"] .st-jump { display: none; }

/* ---------- C3 one word, three answers ---------- */
.st-sys { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.st-sys li { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border: 1px solid var(--rule); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--muted); font-size: .8125rem; line-height: 1.3; }
.st-sys li.st-sys-on { border-color: var(--axis); color: var(--ink); font-weight: 600; }
.st-sys small { color: var(--muted); font-size: .6875rem; font-weight: 400; }
.st-lock { fill: none; stroke: currentColor; stroke-width: 1.3; }
.st-prompt { margin: 0 0 14px; font-family: var(--font-display); font-size: 1.125rem; line-height: 1.35; font-variation-settings: "SOFT" 0; }
.st-prompt-k { display: block; margin-bottom: 2px; color: var(--muted); font: 500 .6875rem/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.st-sem { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.st-sem-row { display: grid; gap: 4px; }
.st-sem-head { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-size: .9375rem; }
.st-sem-sys, .st-sem-val { font-weight: 600; }
.st-sem-bar { position: relative; height: 12px; border-radius: 3px; background: var(--grid); }
.st-sem-fill, .st-sem-gap { position: absolute; top: 0; bottom: 0; left: 0; transition: width .5s cubic-bezier(.2,.7,.2,1), left .5s cubic-bezier(.2,.7,.2,1); }
.st-sem-fill { border-radius: 3px; background: var(--series-1); opacity: .7; }
.st-sem-gap.st-under { background: repeating-linear-gradient(45deg, var(--neg) 0 2px, transparent 2px 6px); box-shadow: inset 0 0 0 1px var(--neg); }
.st-sem-gap.st-over { background: repeating-linear-gradient(45deg, var(--axis) 0 2px, transparent 2px 6px); box-shadow: inset 0 0 0 1px var(--axis); }
.st-sem-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink); }
.st-sem-what { margin: 0; color: var(--muted); font-size: .8125rem; }
.st-sem-note { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 0; color: var(--ink); font-size: .875rem; }
.st-sem-note:empty { display: none; }
.st-sem-cap { margin: 10px 0 0; color: var(--muted); font-size: .8125rem; }
.st-sem-ctl { margin: 12px 0 0; }
.st-def { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--radius-m); background: var(--accent-wash); color: var(--ink); font-size: .9375rem; line-height: 1.5;
  animation: st-rise .24s cubic-bezier(.2,.7,.2,1); }
.st-def em { display: block; margin-top: 4px; color: var(--ink-2); font-size: .875rem; font-style: normal; }
@keyframes st-rise { from { opacity: 0; transform: translateY(8px); } }
/* polite refusal: chat style, chips only */
.st-ref { display: grid; gap: 8px; max-width: 520px; padding: 14px; border-radius: var(--radius-m); background: var(--surface-2); }
.st-ref-k { margin: 0; color: var(--muted); font: 500 .6875rem/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.st-bub { max-width: 36ch; margin: 0; padding: 8px 12px; border-radius: 12px; font-size: .9375rem; line-height: 1.4; }
.st-bub-q { justify-self: end; border-bottom-right-radius: 4px; background: var(--accent); color: var(--accent-ink); }
.st-bub-a { justify-self: start; border: 1px solid var(--rule); border-bottom-left-radius: 4px; background: var(--surface); color: var(--ink); }
.st-ref-chips, .st-guess-chips, .st-fu { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.st-ref-chips .chip, .st-guess-chips .chip { white-space: normal; text-align: left; }

/* ---------- C4 session log ---------- */
.st-log { padding: 0 14px 12px; border-radius: var(--radius-m); background: var(--surface-2); }
.st-log summary { display: flex; align-items: center; min-height: 44px; font-weight: 600; cursor: pointer; }
.st-log-h { margin: 0 0 8px; color: var(--muted); font-size: .8125rem; }
.st-log-lines { margin: 0; padding: 0; list-style: none; color: var(--ink); font: 400 .8125rem/1.55 var(--font-mono); }
.st-log-lines li { display: grid; grid-template-columns: 3.4em 12px minmax(0, 1fr); align-items: start; gap: 8px; }
.st-log-lines .st-tk { margin-top: 4px; }
.st-log-t { color: var(--muted); }
.st-log-lines li.st-log-off { visibility: hidden; }
.st-log-ctl { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.st-clarify { margin-top: 12px; }
.st-clarify-a { margin: 8px 0 0; color: var(--ink-2); }

/* ---------- C5 bridge, guess, driver list, drawer ---------- */
.st-dots { display: flex; flex-wrap: wrap; gap: 0 14px; margin: 0 0 4px; }
.st-dots button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--ink-2);
  font: 500 .8125rem/1.2 var(--font-text); cursor: pointer; }
.st-dots button::before { content: ""; box-sizing: border-box; width: 10px; height: 10px; border: 1.5px solid var(--axis); border-radius: 50%; }
.st-dots button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.st-dots button[aria-pressed="true"]::before { border-color: var(--ink); background: var(--ink); }
.st-br-ext { display: none; margin: 4px 0 16px; }
[data-st-mode="scrolly"] .st-br-ext { display: block; }
.st-br-ext .st-recon { margin-top: 4px; }
.st-recon { margin: 10px 0 0; color: var(--ink-2); font-size: .875rem; line-height: 1.45; }
.st-recon strong { color: var(--ink); }
.st-guess { padding: 12px 14px; border: 1px dashed var(--axis); border-radius: var(--radius-m); }
.st-guess-q { margin: 0 0 8px; font-weight: 600; }
.st-guess-open { margin: 0; }
.st-guess-r { margin: 0; padding: 10px 14px; border-radius: var(--radius-m); background: var(--surface-2); }
.st-drivers, .st-ruled, .st-inv, .st-act { margin: 0; padding: 0; list-style: none; }
.st-drivers { border-top: var(--rule-w) solid var(--rule); }
.st-drivers li { border-bottom: var(--rule-w) solid var(--rule); }
.st-drv { display: grid; gap: 2px; width: 100%; min-height: 44px; padding: 10px 8px; border: 0; border-radius: var(--radius-s); background: none; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; }
.st-drv:hover { background: var(--surface-2); }
.st-drv-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.st-drv-v { font-weight: 600; }
.st-drv-l { font-size: .9375rem; font-weight: 600; }
.st-drv-e { color: var(--ink-2); font-size: .8125rem; }
.st-ruled { display: grid; gap: 6px; font-size: .875rem; }
.st-ruled small, .st-inv small { color: var(--muted); font-size: .8125rem; }
.st-drawer { padding: 0; border: var(--rule-w) solid var(--rule); background: var(--raised); color: var(--ink); box-shadow: var(--shadow-pop); overflow: auto; overscroll-behavior: contain; }
/* starts below the rail row (story.js sets --st-dw-top) so the rail and Prev/Next stay usable */
.st-drawer.st-dw-side { position: absolute; inset: var(--st-dw-top, 56px) 0 0 auto; z-index: 30; width: min(380px, 100%); height: auto; max-height: none; margin: 0; border-radius: var(--radius-l); }
.st-drawer.st-dw-sheet { position: fixed; inset: auto 0 0 0; width: 100%; max-width: 100%; max-height: 85svh; margin: 0; border-radius: var(--radius-l) var(--radius-l) 0 0; }
.st-drawer::backdrop { background: rgba(0, 0, 0, .35); }
@media (min-width: 760px) { .st-drawer.st-dw-sheet { inset: 0 0 0 auto; width: 420px; height: 100%; max-height: 100%; border-radius: var(--radius-l) 0 0 var(--radius-l); } }
.st-dw-in { padding: 18px 20px 20px; }
.st-dw-head { position: relative; padding-right: 44px; }
.st-dw-head .kicker { margin: 0 0 6px; }
.st-dw-title { margin: 0; font-size: 1.375rem; }
.st-dw-meta { display: flex; align-items: center; gap: 10px; margin: 6px 0 0; }
.st-dw-v { font-size: 1.125rem; font-weight: 600; }
.st-dw-close { position: absolute; top: -8px; right: -10px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--radius-m);
  background: none; color: var(--ink-2); cursor: pointer; }
.st-dw-close:hover { background: var(--surface-2); }
.st-dw-close svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; }
.st-dw-dl { margin: 10px 0 0; }
.st-dw-dl dt { margin: 14px 0 4px; color: var(--muted); font: 500 .6875rem/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.st-dw-dl dd { margin: 0; font-size: .9375rem; line-height: 1.5; }
.st-dw-chip { display: inline-block; padding: 3px 10px; border: 1px solid var(--rule); border-radius: var(--radius-pill); background: var(--surface); font-size: .8125rem; }
.st-dw-rows { display: flex; align-items: flex-start; gap: 8px; }
.st-dw-rows .st-tk { margin-top: 5px; }
.st-dw-logic { margin: 0; padding-left: 1.3em; }
.st-sql summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-size: .875rem; font-weight: 600; cursor: pointer; }
.st-sql pre { margin: 2px 0 0; padding: 10px 12px; overflow-x: auto; border-radius: var(--radius-s); background: var(--surface-2); color: var(--ink); font: 400 .75rem/1.5 var(--font-mono); }
.st-sql-n { margin: 4px 0 0; color: var(--muted); font-size: .75rem; }

/* ---------- C6 levers and view toggle ---------- */
.st-levers { display: grid; gap: 8px; margin: 2px 0 10px; }
.st-lever { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 14px; border: 1px solid var(--rule); border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink); font: 500 .9375rem/1.35 var(--font-text); text-align: left; cursor: pointer; }
.st-lever::before { content: ""; box-sizing: border-box; flex: none; width: 16px; height: 16px; margin-top: 1px; border: 1.5px solid var(--axis); border-radius: 4px; }
.st-lever:hover { border-color: var(--axis); }
.st-lever[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--accent); }
.st-lever[aria-pressed="true"]::before { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2.5px var(--accent-wash); }
.st-lever-out { margin: 0 0 6px; }
.st-allon { margin: 6px 0 0; }
.st-seg { display: inline-flex; margin: 0 0 10px; padding: 2px; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--surface-2); }
.st-seg button { min-height: 44px; padding: 0 14px; border: 0; border-radius: var(--radius-s); background: none; color: var(--ink-2); font: 500 .875rem/1 var(--font-text); cursor: pointer; }
.st-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--rule); }

/* ---------- C7 act ---------- */
.st-act { margin-top: 6px; }
.st-act-row { display: grid; grid-template-areas: "n t v" ". s s"; grid-template-columns: 1.5em minmax(0, 1fr) auto; align-items: baseline; gap: 4px 10px;
  padding: 10px 0; border-top: var(--rule-w) solid var(--rule); }
.st-act-n { grid-area: n; color: var(--muted); font: 500 .75rem/1.4 var(--font-mono); }
.st-act-t { grid-area: t; }
.st-act-t small, .st-act-v small { display: block; color: var(--muted); font-size: .8125rem; font-weight: 400; }
.st-act-v { grid-area: v; font-weight: 600; text-align: right; white-space: nowrap; }
.st-act-s { grid-area: s; }
@media (min-width: 560px) { .st-act-row { grid-template-areas: "n t v s"; grid-template-columns: 1.5em minmax(0, 1fr) auto 7.25em; } }
.st-foot { margin: 8px 0 0; color: var(--muted); font-size: .8125rem; }
.st-inv { display: grid; gap: 6px; }
.st-inv li { display: flex; align-items: baseline; gap: 8px; }
.st-actfig > .stamp { margin: 14px 0 0; }
.st-fu-panel { margin-top: 12px; }
.st-na { color: var(--muted); font-size: .8125rem; }
.st-sheet { padding: 16px 18px; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--surface); }
.st-sheet-h { margin: 0 0 8px; color: var(--muted); font: 500 .75rem/1.4 var(--font-mono); }
.st-sheet-t { margin: 0; font-family: var(--font-display); font-size: 1rem; line-height: 1.55; font-variation-settings: "SOFT" 0; }
.st-sheet-ctl { margin: 12px 0 0; }
.st-sheet-ta { width: 100%; min-height: 9em; margin-top: 8px; padding: 8px; border: 1px solid var(--axis); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); font: .875rem/1.5 var(--font-text); }
.st-calib { margin: 20px 0 12px; color: var(--ink-2); }
.st-cta { margin: 0; }
@media (forced-colors: active) { .st-sem-fill, .st-sem-mark, .st-lever[aria-pressed="true"]::before, .st-dots button[aria-pressed="true"]::before { background: CanvasText; } }
