/* Shell v2 layout. Structure only: colours, fonts and finish come from
   tokens.css and skin.css, linked by each page in the order
   tokens.css → stage.css → skin.css. Read-only for prototype builders. */

* { box-sizing: border-box; }
.stage-root [hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-ui); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
button { font: inherit; color: inherit; }

/* Rows: header, stage and narrative. Fixed navigation is reserved in bottom padding. */
.stage-root {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: var(--space-3);
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-5) var(--space-5);
  min-height: 100vh;
}

/* Top: title + the questions it answers on the left, small tools on the right */
.st-top { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; }
.st-title { margin: 0; }
.st-tools { display: flex; gap: var(--space-2); align-items: center; }
.st-renderers { display: inline-flex; }

/* Stage: the picture dominates */
.st-stage-wrap { position: relative; height: clamp(420px, 62vh, 720px); overflow: hidden; }
.st-stage, .st-overlay { position: absolute; inset: 0; }
.st-overlay { pointer-events: none; }
.st-overlay > * { pointer-events: auto; }
.st-stage > svg, .st-stage > canvas, .st-overlay > svg { display: block; width: 100%; height: 100%; }
.st-badges { position: absolute; left: var(--space-3); bottom: var(--space-3); display: flex; gap: var(--space-2); flex-wrap: wrap; pointer-events: none; }
.st-explore { position: absolute; right: var(--space-3); top: var(--space-3); display: flex; gap: var(--space-2); align-items: center; }
.st-toast { position: absolute; left: 50%; top: var(--space-3); transform: translateX(-50%); }

/* Narrative: caption on the left, controls on the right */
.st-narrative { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-5); align-items: start; }
.st-narrative:has(.st-dock[hidden]) { grid-template-columns: minmax(0, 1fr); }
.st-text { min-height: 4.4em; }
.st-caption { margin: 0; max-width: 62ch; }
.st-dock { display: flex; flex-direction: column; gap: var(--space-3); }
.st-control[hidden], .st-dock[hidden] { display: none; }
.st-control-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.st-control input[type=range] { width: 100%; }
.st-control-toggle { display: flex; justify-content: space-between; align-items: center; }
.st-choice { display: flex; flex-wrap: wrap; gap: 4px; }
.st-hint { margin: 4px 0 0; }

/* Navigation: prev / play / next, then a segmented progress bar */
.st-nav { display: flex; align-items: center; gap: var(--space-2); position: fixed; bottom: 0; background: var(--bg); z-index: 4; }
.st-progress { display: flex; gap: 4px; flex: 1; min-width: 0; }
.st-seg-step { position: relative; flex: 1 1 0; min-width: 10px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; }
.st-seg-label { display: block; }
.st-seg-step::before { content: ''; position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: var(--track); }
.st-fill { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: var(--track-fill); transform-origin: left center; transform: scaleX(0); }
.st-count { font-variant-numeric: tabular-nums; min-width: 3.5em; text-align: right; }

/* Tooltip for hot spots (elements with data-tip) */
.st-tip { position: absolute; z-index: 5; pointer-events: none; max-width: 240px; }
.st-tip-title { display: block; }
[data-tip] { cursor: help; }
[data-tip]:focus { outline: none; }

@media (max-width: 760px) {
  .stage-root { padding: var(--space-3) 16px var(--space-4); gap: var(--space-2); }
  .st-stage-wrap { height: clamp(340px, 54vh, 560px); }
  .st-narrative { grid-template-columns: 1fr; gap: var(--space-3); }
  .st-text { min-height: 0; }
  .st-nav { padding-bottom: var(--space-2); }
}
