@font-face {
  font-family: "Instrument Sans";
  src: url("../../fonts/violet-circuit/instrument-sans.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --surface: #08080b;
  --text: #f6f4fc;
  --muted: #beb8cb;
  --quiet: #a7a0b8;
  --violet: var(--railgrid-accent);
  --surface-rgb: 8,8,11;
  --control-surface: #14111c;
  --control-hover: #292036;
  --border: #51475f;
  --page-inset: clamp(24px, 4.6vw, 88px);
  --story-width: min(38vw, 440px);
  --progress: 0;
  font-family: "Instrument Sans", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: var(--surface);
  color: var(--text);
  scroll-behavior: smooth;
  /* Opening a recording must not rewrap copy and move its snap position. */
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #655676 #101015;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-underline-offset: 5px; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible, h1[tabindex]:focus-visible, h2[tabindex]:focus-visible { outline: 2px solid var(--violet); outline-offset: 5px; }
::selection { background: var(--violet); color: var(--railgrid-on-accent); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #101015; }
::-webkit-scrollbar-thumb { background: #655676; border-radius: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.scene-stage { position: fixed; z-index: 0; inset: 0; overflow: hidden; pointer-events: none; background: var(--surface); }
#railway-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; opacity: 0; transition: opacity .35s ease; }
#scene-fallback { position: absolute; inset: 0; overflow: hidden; opacity: 1; }
/* The centered 6:1 export spans 39 world units vertically. Match the live
   orthographic view (34 units; target at 67% width), without cover-cropping. */
#scene-fallback img { position: absolute; top: 50%; left: 67%; width: auto; max-width: none; height: calc(100% * 39 / 34); transform: translate(-50%,-50%); }
.scene-rendered #railway-canvas, .scene-ready #railway-canvas[data-variant="before"] { opacity: 1; }
/* Keep the still behind the canvas throughout its fade, then remove it. */
.scene-rendered #scene-fallback { visibility: hidden; transition: visibility 0s .35s; }
.scene-shade { position: absolute; z-index: 2; inset: 0; background: linear-gradient(90deg, var(--surface) 0%, rgba(var(--surface-rgb),.97) 15%, rgba(var(--surface-rgb),.92) calc(var(--page-inset) + var(--story-width)), rgba(var(--surface-rgb),.25) 53%, transparent 65%), linear-gradient(0deg, rgba(var(--surface-rgb),.94), transparent 23%, transparent 85%, rgba(var(--surface-rgb),.3)); }
#scene-labels { position: absolute; z-index: 3; inset: 0; }
.scene-label { position: absolute; color: #e3dcec; font-size: 12px; line-height: 1.3; letter-spacing: .02em; text-shadow: 0 2px 10px #000; transition: opacity .3s ease; white-space: nowrap; }
.scene-label::before { content: ""; display: inline-block; width: 4px; height: 4px; margin-right: 7px; vertical-align: 2px; background: var(--violet); border-radius: 50%; }
.rail-label { position: absolute; top: 0; left: 0; margin-top: -95px; padding: 10px 14px; color: #efe8ff; white-space: nowrap; font-size: 12px; line-height: 1.5; background: rgba(9,12,19,.9); }
.rail-label-line { position: absolute; left: 10px; bottom: -45px; height: 45px; width: 1px; background: #bba2ed; transform-origin: top; transform: rotate(-28deg); }
.rail-label-title { display: block; letter-spacing: .04em; font-size: 12px; }
.rail-label-detail { display: block; margin-top: 3px; color: #c5bbd9; font-size: 12px; }
.scene-callout { position: absolute; top: 0; left: 0; max-width: 170px; padding: 7px 10px; border: 1px solid #41364e; border-radius: 3px; background: rgba(12,14,21,.94); color: #ece5f5; font-size: 12px; line-height: 1.35; pointer-events: none; }
.scene-callout::after { content: ""; position: absolute; left: var(--anchor-x,12px); top: 100%; width: 1px; height: var(--anchor-height,17px); background: #bca4df; }
.scene-callout[data-moving] { border-color: #bca4df; color: #f4edff; }
.scene-callout[data-secondary] { border-color: #332f3e; background: rgba(12,14,21,.87); color: #c8bfd5; }
.scene-callout[data-secondary]::after { background: #887695; }
.scene-callout[hidden] { display: none; }

.wordmark { display: inline-flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 600; letter-spacing: -.035em; text-decoration: none; }
.brand-symbol { flex: none; color: var(--violet); }
.motion-toggle { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--muted); }
.motion-toggle:hover { color: var(--violet); }
.play-icon { display: none; }
.motion-toggle[aria-pressed="true"] .pause-icon { display: none; }
.motion-toggle[aria-pressed="true"] .play-icon { display: block; }

main { position: relative; z-index: 10; pointer-events: none; }
.chapter { display: flex; align-items: center; min-height: 110svh; padding: 130px var(--page-inset) 150px; }
.chapter-frame { width: var(--story-width); min-width: 310px; pointer-events: auto; }
.chapter-copy { width: 100%; }
h1, h2, p { margin: 0; }
h1, h2 { font-weight: 500; letter-spacing: -.035em; text-wrap: balance; }
h1 { font-size: clamp(46px, 4.55vw, 68px); line-height: 1.07; }
h2 { font-size: clamp(32px, 2.85vw, 43px); line-height: 1.1; }
.chapter-description { max-width: 43ch; margin-top: 19px; color: var(--muted); font-size: 16px; line-height: 1.57; text-wrap: pretty; }
.chapter-overview .chapter-description { max-width: 36ch; margin-top: 26px; font-size: 18px; line-height: 1.6; }
.story-link { display: inline-flex; align-items: center; gap: 14px; margin-top: 25px; padding: 9px 0; color: #e7dafa; text-decoration: none; font-size: 14px; font-weight: 500; }
.story-link svg, .primary-link svg { color: var(--violet); transition: transform .25s cubic-bezier(.16,1,.3,1); }
.story-link:hover { color: #fff; }
.story-link:hover svg { transform: translateY(3px); }
.story-link-doc:hover svg { transform: translateX(3px); }
.workflow-note { max-width: 39ch; margin-top: 22px; color: var(--quiet); font-size: 13px; line-height: 1.55; }
.railway-note { margin-top: 35px; color: #d9cbe9; font-size: 13px; line-height: 1.6; }
.final-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 25px; margin-top: 27px; }
.primary-link { display: inline-flex; align-items: center; gap: 17px; min-height: 48px; padding: 13px 17px; background: var(--violet); border-radius: 5px; color: var(--railgrid-on-accent); font-size: 14px; font-weight: 600; text-decoration: none; transition: background .2s ease; }
.primary-link svg { color: currentColor; }
.primary-link:hover { background: var(--railgrid-accent-hover); }
.primary-link:hover svg { transform: translateX(3px); }
.replay-button { padding: 10px 0; border: 0; background: transparent; color: var(--muted); font-size: 13px; text-decoration: underline; text-decoration-color: #756782; text-underline-offset: 5px; }
.replay-button:hover { color: var(--text); text-decoration-color: var(--violet); }
.prototype-note { max-width: 39ch; margin-top: 25px; color: var(--quiet); font-size: 13px; line-height: 1.55; }
.open-source-note { margin-top: 32px; padding-top: 24px; border-top: 1px solid #39313f; }
.open-source-note h3 { margin: 0 0 8px; font-size: 17px; font-weight: 500; letter-spacing: -.015em; }
.open-source-note p { max-width: 43ch; color: #bfb5ce; font-size: 13px; line-height: 1.6; }
.open-source-note a { display: inline-flex; align-items: center; gap: 8px; margin-top: 13px; color: #dec8fc; font-size: 13px; }

/* The product remains HTML, beside the focused asset rather than inside it. */
.product-proof { width: 100%; margin-top: 25px; padding: 19px 21px; border: 1px solid #3f354d; border-radius: 12px; background: #101219; color: #f0ecf7; pointer-events: auto; scrollbar-color: #655676 #101219; }
.proof-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 16px; }
.proof-heading h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.015em; line-height: 1.35; }
.proof-heading > span { color: #c0b4d0; font-size: 12px; line-height: 1.4; }
.proof-fields { margin: 0; font-size: 13px; line-height: 1.45; }
.proof-fields > div { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.25fr); align-items: baseline; gap: 13px; padding: 8px 0; border-top: 1px solid #302d39; }
.proof-fields dt { color: #bfb5ce; }
.proof-fields dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; overflow-wrap: anywhere; }
.proof-note { margin-top: 14px; color: #bfb5ce; font-size: 14px; line-height: 1.55; }
.proof-source { display: inline-flex; align-items: center; gap: 8px; margin-top: 15px; color: #e0caff; font-size: 12px; line-height: 1.5; }
.proof-source:hover { color: #fff; }
.proof-source svg { width: 12px; height: 12px; }
.proof-table-wrap { width: 100%; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 13px; line-height: 1.45; text-align: left; }
table th, table td { padding: 9px 0; border-bottom: 1px solid #302d39; font-weight: 400; vertical-align: top; }
table thead th { padding-top: 0; color: #bfb5ce; font-size: 12px; }
table td:last-child, table th:last-child { padding-left: 16px; }
.capability-table tbody th { color: #f0e8fa; font-weight: 500; }
.capability-table tbody td { color: #c4bbd2; }
.resource-heading { display: flex; align-items: center; gap: 12px; margin: 0 0 19px; color: #d7c4f4; }
.resource-heading svg { flex: none; }
.resource-heading strong { display: block; color: #f0e8fa; font-size: 15px; font-weight: 500; }
.resource-heading span { display: block; margin-top: 4px; color: #bfb5ce; font-size: 12px; }
.status-ready { color: #a9dcc6; }
.status-ready::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 7px; background: currentColor; border-radius: 50%; vertical-align: 2px; }
.proof-disclosure { margin-top: 15px; padding-top: 13px; border-top: 1px solid #39313f; font-size: 12px; line-height: 1.6; }
.proof-disclosure summary { width: fit-content; color: #d9c4fb; cursor: pointer; }
.proof-disclosure summary::marker { color: var(--violet); }
.proof-disclosure p { margin-top: 10px; color: #c8bfd6; }
.product-screenshot-link { display: block; margin-top: 13px; }
.product-screenshot-link img { display: block; width: 100%; height: auto; }
.application-preview { margin: 0; }
.application-preview a { display: block; background: #eeedf4; border-radius: 5px; overflow: hidden; }
.application-preview img { display: block; width: 100%; height: auto; }
.application-preview figcaption { margin-top: 8px; color: #c1b6cf; font-size: 12px; line-height: 1.45; }
.environment-image { margin: 0 0 15px; }
.result-summary { margin-top: 12px; padding: 10px 0; border-block: 1px solid #39313f; }
.result-summary span { display: block; color: #bfb5ce; font-size: 12px; margin-bottom: 5px; }
.result-summary code { font-size: 12px; color: #ece2f9; }
.dependency-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 15px; padding-top: 13px; border-top: 1px solid #39313f; }
.dependency-strip span { display: block; color: #bfb5ce; font-size: 12px; margin-bottom: 5px; }
.dependency-strip code { color: #ece2f9; font-size: 12px; }
.dependency-strip strong { color: #ece2f9; font-size: 12px; font-weight: 500; }
.conversation-author { display: block; margin-bottom: 4px; color: #c7bdd6; font-size: 12px; font-weight: 500; }
.conversation-request p, .conversation-result p { color: #eee7f8; font-size: 14px; line-height: 1.5; }
.conversation-request { padding: 0 0 15px; }
.tool-action { display: flex; align-items: center; gap: 9px; padding: 11px 0; border-block: 1px solid #39313f; }
.tool-indicator { flex: none; width: 6px; height: 6px; border-radius: 50%; background: #a9dcc6; }
.tool-action div { flex: 1; }
.tool-action strong { display: block; color: #e6d8f8; font-size: 12px; font-weight: 500; }
.tool-action div > span { display: block; margin-top: 3px; color: #bfb5ce; font-size: 12px; }
.action-status { color: #a9dcc6; font-size: 12px; }
.conversation-result { margin-top: 13px; }
.result-table { margin-top: 12px; font-size: 12px; }
.result-table th, .result-table td { padding: 6px 0; }
.result-table th:last-child, .result-table td:last-child { padding-left: 16px; }

.scene-state { position: fixed; z-index: 15; right: var(--page-inset); bottom: 111px; display: flex; align-items: center; gap: 8px; color: #c7bdd5; font-size: 12px; pointer-events: none; }
.state-dot { display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--violet); }
.chapter-nav { position: fixed; z-index: 30; display: grid; grid-template-columns: repeat(5,1fr); left: var(--page-inset); right: var(--page-inset); bottom: 28px; }
.nav-short { display: none; }
.chapter-track { position: absolute; z-index: -1; top: 0; left: 0; right: 0; height: 1px; background: #54465f; }
#scene-progress { display: block; width: 100%; height: 100%; background: var(--violet); transform: scaleX(var(--progress)); transform-origin: left; transition: transform .15s linear; }
.chapter-button { display: flex; flex-direction: column; align-items: center; gap: 15px; position: relative; min-height: 48px; padding: 0 10px 9px; border: 0; background: transparent; color: var(--quiet); text-align: center; text-decoration: none; font-size: 12px; line-height: 1.25; transition: color .2s ease; }
.chapter-button:first-of-type { align-items: flex-start; text-align: left; padding-left: 0; }
.chapter-button:last-child { align-items: flex-end; text-align: right; padding-right: 0; }
.chapter-node { display: block; width: 5px; height: 5px; margin-top: -2px; border-radius: 50%; background: #9887ab; transition: background .2s ease; }
.chapter-button:hover, .chapter-button.is-active, .chapter-button[aria-current="step"] { color: #f4edff; }
.chapter-button.is-active .chapter-node, .chapter-button[aria-current="step"] .chapter-node { background: var(--violet); }
.chapter-button[aria-current="step"] .chapter-node { outline: 2px solid var(--violet); outline-offset: 3px; }
.chapter-button[aria-current="step"] { font-weight: 600; }
.noscript-message { position: absolute; z-index: 20; right: var(--page-inset); top: 105px; max-width: 29ch; padding: 13px 16px; background: #20162b; color: #e5d7fa; font-size: 12px; line-height: 1.5; }

/* Every chapter is in normal document flow until the live scene is ready. */
@media (min-width: 901px) {
  .scene-ready .chapter { min-height: 110svh; padding: 0; }
  .scene-ready .chapter-final { min-height: 100svh; }
  .scene-ready .chapter-frame { position: fixed; left: var(--page-inset); top: clamp(110px,15svh,160px); bottom: 108px; display: flex; flex-direction: column; justify-content: flex-start; overflow-y: auto; padding-right: 8px; scrollbar-width: thin; visibility: hidden; opacity: 0; pointer-events: none; }
  .scene-ready[data-active-chapter="0"] [data-chapter="0"] .chapter-frame,
  .scene-ready[data-active-chapter="1"] [data-chapter="1"] .chapter-frame,
  .scene-ready[data-active-chapter="2"] [data-chapter="2"] .chapter-frame,
  .scene-ready[data-active-chapter="3"] [data-chapter="3"] .chapter-frame,
  .scene-ready[data-active-chapter="4"] [data-chapter="4"] .chapter-frame,
  .scene-ready[data-active-chapter="5"] [data-chapter="5"] .chapter-frame,
  .scene-ready[data-active-chapter="6"] [data-chapter="6"] .chapter-frame { visibility: visible; opacity: 1; pointer-events: auto; }
  .scene-ready .chapter-copy { flex: none; }
  .scene-ready .product-proof { flex: 0 1 auto; max-height: min(44svh,430px); overflow-y: auto; opacity: 1; visibility: inherit; }
  .scene-ready .chapter-overview .chapter-copy { max-width: 435px; }
  .chapter-overview h1 { font-size: clamp(46px, 4vw, 60px); }
}

.scene-clean .scene-motion,.scene-clean .marketing-header,.scene-clean #story,.scene-clean .scene-shade,.scene-clean #scene-labels,.scene-clean .chapter-nav,.scene-clean .scene-state { display: none; }
.scene-review #railway-canvas { height: 100%; transition: none; }
.scene-poster #railway-canvas { width: 3072px; height: 512px; }
.scene-review #scene-fallback { display: none; }
.scene-diagnostics { position: fixed; z-index: 80; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: #11151bf5; border: 1px solid #343b48; border-radius: 8px; font-size: 12px; white-space: nowrap; }
.scene-diagnostics label { display: flex; align-items: center; gap: 5px; }
.scene-diagnostics select,.scene-diagnostics button { font: inherit; background: #252b36; color: #eef0f5; border: 1px solid #454d5c; border-radius: 4px; padding: 7px; }
.scene-diagnostics [role="status"] { max-width: 180px; white-space: normal; }
.scene-clean .scene-diagnostics { display: none; }

@media (max-width: 1100px) and (min-width: 901px) {
  :root { --page-inset: 32px; --story-width: min(40vw,420px); }
  h1 { font-size: 48px; }
  h2 { font-size: 34px; }
  .chapter-overview .chapter-description { font-size: 17px; }
  .scene-shade { background: linear-gradient(90deg,var(--surface) 0%,rgba(var(--surface-rgb),.94) 24%,rgba(var(--surface-rgb),.75) 36%,transparent 67%),linear-gradient(0deg,var(--surface),transparent 22%); }
  .product-proof { padding: 17px; }
}

@media (max-height: 740px) and (min-width: 901px) {
  .scene-ready .chapter-frame { bottom: 98px; }
  .scene-ready .product-proof { flex-shrink: 0; max-height: none; }
  h2 { font-size: 31px; }
  .product-proof { margin-top: 18px; }
  .railway-note { margin-top: 20px; }
  .open-source-note { margin-top: 22px; padding-top: 18px; }
}

@media (max-height: 820px) and (min-width: 901px) {
  .chapter-overview h1 { font-size: clamp(36px, 6.6svh, 48px); }
  .chapter-overview .workflow-note { margin-top: 14px; }
  .chapter-overview .story-link { margin-top: 14px; }
  .chapter-overview .chapter-description { margin-top: 20px; font-size: 16px; }
}

@media (max-width: 900px) {
  :root { --page-inset: 24px; --story-width: 100%; --mobile-scene-lead: clamp(200px,32svh,320px); scroll-snap-type: y proximity; scroll-behavior: auto; }
  .wordmark { font-size: 23px; gap: 8px; }
  .brand-symbol { width: 23px; height: 23px; }
  #railway-canvas, #scene-fallback, #scene-labels { height: calc(var(--mobile-scene-lead) + 68px); }
  #scene-fallback img { left: 50%; height: 100%; }
  .scene-shade { background: linear-gradient(180deg,rgba(var(--surface-rgb),.35) 0%,transparent 110px,transparent calc(var(--mobile-scene-lead) - 70px),var(--surface) calc(var(--mobile-scene-lead) + 65px)),linear-gradient(90deg,rgba(var(--surface-rgb),.25),transparent 40%); }
  /* Oversized snap areas still allow free scrolling through long copy. */
  .chapter { display: block; min-height: 100svh; padding-top: var(--mobile-scene-lead); padding-bottom: 104px; scroll-snap-align: start; background: linear-gradient(180deg,transparent calc(var(--mobile-scene-lead) - 18px),var(--surface) calc(var(--mobile-scene-lead) + 18px)); }
  /* Page-aligned text backing: the parent chapter supplies the side gutters. */
  .chapter-frame { min-width: 0; width: 100%; max-width: 540px; margin-inline: auto; padding-top: 17px; background: transparent; }
  h1 { font-size: clamp(37px,8.7vw,55px); line-height: 1.08; }
  h2 { font-size: clamp(30px,7.4vw,44px); line-height: 1.1; }
  .chapter-description,.chapter-overview .chapter-description { margin-top: 18px; max-width: 43ch; font-size: 16px; line-height: 1.6; }
  .story-link { margin-top: 21px; font-size: 13px; }
  .workflow-note { margin-top: 17px; font-size: 12px; }
  .railway-note { margin-top: 28px; font-size: 12px; }
  .product-proof { margin-top: 26px; padding: 19px; }
  .proof-heading { margin-bottom: 16px; }
  .proof-heading h3 { font-size: 15px; }
  .proof-fields { font-size: 13px; }
  .proof-fields > div { grid-template-columns: minmax(0,1fr) minmax(0,1.2fr); gap: 10px; }
  .application-preview img { max-height: none; }
  .open-source-note { margin-top: 30px; padding-top: 22px; }
  .final-actions { gap: 16px 22px; }
  .chapter-final { padding-bottom: 104px; }
  .scene-state { right: var(--page-inset); bottom: auto; top: 77px; padding: 5px 9px; background: #080b12e6; font-size: 11px; }
  .rail-label { padding: 7px 10px; }
  .rail-label-title,.rail-label-detail { font-size: 10px; }
  .scene-callout { padding: 6px 8px; font-size: 11px; }
  .scene-callout::after { left: var(--anchor-x,10px); }
  .chapter-nav { left: var(--page-inset); right: var(--page-inset); bottom: max(17px,env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); padding: 4px 0; gap: 0; overflow: visible; background: #08080bf5; }
  .chapter-nav::-webkit-scrollbar { display: none; }
  .chapter-track { top: 4px; }
  .nav-full { display: none; }
  .nav-short { display: inline; }
  .chapter-nav::before { content: ""; position: fixed; z-index: -2; left: 0; right: 0; bottom: 0; height: 91px; background: linear-gradient(transparent,var(--surface) 22px); pointer-events: none; }
  .chapter-button { min-width: 0; min-height: 46px; gap: 12px; padding: 0 0 2px; font-size: 11px; letter-spacing: -.01em; white-space: nowrap; }
  .chapter-node { width: 4px; height: 4px; }
  .noscript-message { top: 83px; right: var(--page-inset); max-width: 26ch; font-size: 12px; }
  .scene-diagnostics { left: 16px; right: 16px; transform: none; flex-wrap: wrap; justify-content: center; gap: 10px; }
  .scene-diagnostics [role="status"] { max-width: 100%; }
}

@media (max-width: 380px) {
  :root { --page-inset: 18px; }
  .proof-heading { gap: 6px; }
  .product-proof { padding: 17px; }
  .proof-fields { font-size: 12px; }
  table { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Scene controls stay with the artwork. */
.scene-state { pointer-events: auto; }


@media (max-width: 900px) {
  .scene-state { top: 87px; padding: 0; background: transparent; }
}


/* A quiet scene control with a full touch target and no navigation chrome. */
.scene-motion { position: fixed; z-index: 15; top: 94px; right: var(--page-inset); width: 44px; height: 44px; border-radius: 4px; visibility: hidden; isolation: isolate; }
.scene-motion::before { content: ""; position: absolute; z-index: -1; inset: 6px; border-radius: 4px; background: rgba(var(--surface-rgb),.9); }
.scene-motion:hover::before, .scene-motion:focus-visible::before { background: var(--control-hover); }
.scene-ready:not(.scene-failed):not([data-story-exiting="true"]) .scene-motion { visibility: visible; }
@media (max-width: 900px) { .scene-motion { top: 87px; } }

/* Keep status available to assistive technology; show only loading/fallback. */
.scene-state { display: block; top: 96px; bottom: auto; max-width: 29ch; padding: 9px 12px; border: 1px solid #3f354d; border-radius: 4px; background: #101219; pointer-events: none; }
.scene-ready:not(.scene-failed) .scene-state { width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); padding: 0; border: 0; }
.marketing-footer { flex-wrap: wrap; }

/* The last railway view scrolls away with its section, revealing normal pages. */
.scene-stage { transform: translateY(var(--scene-exit,0px)); }
body[data-story-exiting="true"] .chapter-nav { visibility: hidden; pointer-events: none; }
body[data-story-exited="true"] #scene-labels { visibility: hidden; }
@media (min-width: 901px) {
  .scene-ready .chapter-frame { transform: translateY(var(--scene-exit,0px)); }
}
.after-story { position: relative; z-index: 20; background: var(--surface); }
.after-story #open-source { scroll-margin-top: 82px; border-top: 1px solid #292530; }
.after-story .railgrid-v2-oss-layout { width: auto; margin-inline: var(--page-inset); }
.after-story .railgrid-v2-oss { --oss-muted: #beb8cb; }
.after-story .railgrid-v2-oss-copy h2 { font-size: clamp(32px,3.8vw,52px); }
.after-story .railgrid-v2-oss-copy > p { font-size: 17px; line-height: 1.65; }
.after-story .railgrid-v2-oss-copy .oss-license { font-size: 14px; }
.after-story .railgrid-v2-oss-art text { font-family: ui-monospace,monospace; }
.after-story .railgrid-v2-oss-art-legend { font-size: 12px; }
.after-story .railgrid-v2-oss-rail { fill: none; stroke: var(--oss-dots); stroke-width: .5; }
.after-story .railgrid-v2-oss-accent-rail { fill: none; stroke: var(--oss-accent); stroke-width: .55; }
.closing-cta { display: flex; align-items: center; justify-content: space-between; gap: 48px; padding: clamp(64px,9vw,112px) var(--page-inset); border-bottom: 1px solid var(--border); scroll-margin-top: 96px; }
.closing-cta h2 { max-width: 19ch; color: var(--text); font-size: clamp(36px,4.8vw,64px); }
.closing-cta .primary-link { flex: none; }
@media (max-width: 700px) {
  .closing-cta { flex-direction: column; align-items: flex-start; gap: 28px; }
}
.marketing-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 48px; padding: 64px var(--page-inset); }
.marketing-footer p { max-width: 32ch; margin-top: 20px; font-size: 15px; line-height: 1.6; color: var(--muted); }
.marketing-footer nav { display: grid; grid-template-columns: repeat(4,auto); gap: 12px 28px; }
.marketing-footer nav a { display: block; padding-block: 8px; font-size: 14px; text-decoration: none; }
.marketing-footer nav a:hover { color: var(--violet); }
.scene-clean .after-story { display: none; }
@media (max-width: 900px) {
  .after-story #open-source { scroll-margin-top: 75px; }
  .marketing-footer { flex-direction: column; gap: 32px; padding-block: 44px; }
  .marketing-footer nav { width: 100%; grid-template-columns: repeat(2,1fr); }
}

/* Static supporting information uses one open, divided layout in every stage. */
.chapter-details { flex: none; margin-top: 24px; padding-top: 20px; border-top: 1px solid #39313f; }
.chapter-details h3 { margin: 0 0 12px; color: var(--text); font-size: 18px; font-weight: 500; line-height: 1.35; letter-spacing: -.015em; }
.chapter-details .proof-heading { margin: 0; }
.chapter-details .workflow-note, .chapter-details .proof-note { max-width: 43ch; color: var(--muted); font-size: 14px; line-height: 1.6; }
.chapter-details > .workflow-note:first-child { margin-top: 0; }
.chapter-details .story-link { margin-top: 16px; font-size: 14px; }
.detail-fields { margin: 0; font-size: 14px; line-height: 1.5; }
.detail-fields > div { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.3fr); align-items: baseline; gap: 12px; padding: 10px 0; }
.detail-fields > div + div { border-top: 1px solid #302d39; }
.detail-fields dt { color: var(--muted); }
.detail-fields dd { margin: 0; color: var(--text); text-align: right; overflow-wrap: anywhere; }
.chapter-details > .workflow-note + .detail-fields { margin-top: 16px; }
@media(max-width:600px) { .chapter-button { font-size: 12px; white-space: normal; line-height: 1.25; } }
@media(max-width:380px) { .chapter-nav { grid-template-columns: 1fr .85fr 1.2fr 1.05fr 1fr; column-gap: 4px; } .chapter-button { font-size: 11px; } }

/* Final stop: select a use case without moving the page. */
.use-case-picker { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 24px 0 0; }
.use-case-picker button { min-height: 64px; padding: 12px 8px; border: 1px solid #51475f; border-radius: 6px; background: #14111c; color: #e6ddef; font: inherit; font-size: 14px; line-height: 1.35; text-align: left; cursor: pointer; }
.use-case-picker button:hover { background: #292036; border-color: var(--violet); }
.use-case-picker button[aria-pressed="true"] { background: var(--violet); border-color: var(--violet); color: var(--railgrid-on-accent); }
.use-case-details { min-height: 156px; overflow-anchor: none; }
#use-cases { overflow-anchor: none; }
.use-case-details p { font-size: 16px; line-height: 1.6; color: var(--muted); margin: 0 0 16px; }
.use-case-details a { font-size: 14px; color: var(--violet); text-underline-offset: 4px; }
.use-case-reset { min-height: 44px; border: 0; padding: 8px 0; background: transparent; color: var(--violet); font: inherit; font-size: 14px; cursor: pointer; }
.use-case-reset:disabled { color: #9e94ac; cursor: default; }
.use-case-frame .final-actions { gap: 8px 16px; margin-top: 16px; }
@media(max-width:600px) { .use-case-picker button { font-size: 13px; } }
@media(max-width:380px) {
  .use-case-picker { gap: 6px; }
  .use-case-picker button { padding-inline: 6px; font-size: 12px; }
}

/* Recorded proof is opt-in; the selected scene remains behind the player. */
.use-case-details .recording-preview { display: flex; align-items: center; gap: 12px; margin: 16px 0; padding: 10px; border: 1px solid #51475f; border-radius: 6px; background: #14111c; text-decoration: none; }
.recording-preview:hover { border-color: var(--violet); background: #20192b; }
.recording-thumbnail { position: relative; display: block; flex: 0 0 96px; }
.recording-thumbnail img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 2px; }
.recording-thumbnail > svg { position: absolute; inset: 0; margin: auto; color: #eadfff; }
.recording-preview strong { display: block; margin-bottom: 4px; color: var(--text); font-size: 14px; font-weight: 600; }
.recording-preview .recording-caption { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; }
.recording-meta { display: grid; justify-items: end; gap: 5px; margin-left: auto; flex: none; }
.recording-duration { font-size: 12px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--muted); }
body.recording-open { overflow: hidden; }
.recording-dialog { width: min(1080px,calc(100% - 48px)); max-width: none; max-height: calc(100svh - 48px); padding: 0; border: 1px solid #51475f; border-radius: 12px; background: #101219; color: var(--text); overflow: auto; }
.recording-dialog::backdrop { background: rgba(4,5,9,.88); }
.recording-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 20px; }
.recording-header h2 { font-size: 22px; line-height: 1.3; letter-spacing: -.02em; text-wrap: balance; }
.recording-close { display: grid; place-items: center; flex: 0 0 44px; height: 44px; padding: 0; border: 1px solid #51475f; border-radius: 4px; background: transparent; color: var(--text); }
.recording-close:hover { background: #292036; border-color: var(--violet); }
.recording-dialog video { display: block; width: 100%; max-height: calc(100svh - 270px); aspect-ratio: 16 / 9; object-fit: contain; background: #050609; }
.recording-footer { padding: 18px 20px 22px; font-size: 14px; line-height: 1.5; }
.recording-footer p { max-width: 68ch; color: var(--muted); margin-bottom: 10px; }
.recording-footer a { display: inline-block; padding-block: 4px; color: var(--violet); }
.recording-footer [hidden] { display: none; }
@media(max-width:600px) {
  .recording-dialog { width: calc(100% - 24px); max-height: calc(100svh - 24px); border-radius: 8px; }
  .recording-header { padding: 12px; gap: 12px; }
  .recording-header h2 { font-size: 18px; }
  .recording-footer { padding: 14px; font-size: 13px; }
  .recording-thumbnail { flex-basis: 80px; }
}
@media(min-width:901px) and (max-height:800px) {
  /* Fit the story between the header and chapter navigation before reducing type. */
  .chapter-details { margin-top: 18px; padding-top: 16px; }
  .chapter-details h3 { margin-bottom: 10px; }
  .chapter-details .story-link { margin-top: 12px; }
  .use-case-picker { margin-top: 20px; }
  .use-case-picker button { min-height: 56px; padding-block: 8px; }
  .use-case-details .recording-preview { margin: 12px 0 0; padding: 8px; }
  .recording-thumbnail { flex-basis: 80px; }
  .use-case-frame .final-actions { margin-top: 12px; }
}


/* Daylight studio: graphite hardware and violet accents on pale surfaces. */
:root[data-study-theme="light"] {
  color-scheme: light;
  --surface: #f7f7fa;
  --surface-rgb: 247,247,250;
  --text: #20202e;
  --muted: #56556b;
  --quiet: #656078;
  --control-surface: #fff;
  --control-hover: #eeebf6;
  --border: #c4bfd2;
  scrollbar-color: #a69bbd #efedf5;
}
:root[data-study-theme="light"] ::-webkit-scrollbar-track { background: #efedf5; }
:root[data-study-theme="light"] ::-webkit-scrollbar-thumb { background: #a69bbd; }
:root[data-study-theme="light"] .brand-symbol { color: var(--violet); }
:root[data-study-theme="light"] .motion-toggle { color: var(--muted); border-color: var(--border); }
:root[data-study-theme="light"] .motion-toggle:hover { color: var(--violet); }
:root[data-study-theme="light"] .story-link { color: var(--violet); }
:root[data-study-theme="light"] .story-link:hover { color: #422080; }
:root[data-study-theme="light"] .railway-note { color: var(--muted); }
:root[data-study-theme="light"] .chapter-details,
:root[data-study-theme="light"] .detail-fields > div + div { border-color: #d7d2e2; }
:root[data-study-theme="light"] .chapter-track { background: #c4bdd1; }
:root[data-study-theme="light"] .chapter-node { background: #8a7c9e; }
:root[data-study-theme="light"] .chapter-button:hover,
:root[data-study-theme="light"] .chapter-button.is-active { color: #352250; }
:root[data-study-theme="light"] .chapter-button[aria-current="step"] .chapter-node { background: var(--violet); }
:root[data-study-theme="light"] .scene-callout,
:root[data-study-theme="light"] .scene-callout[data-secondary] { color: #3d3550; border-color: #bcb2cd; background: rgba(250,249,253,.96); }
:root[data-study-theme="light"] .scene-callout::after { background: #80659e; }
:root[data-study-theme="light"] .scene-callout[data-moving] { color: #4a287e; border-color: #815aac; }
:root[data-study-theme="light"] .scene-state,
:root[data-study-theme="light"] .noscript-message { background: #eeebf6; border-color: var(--border); color: var(--muted); }
:root[data-study-theme="light"] .use-case-picker button { background: var(--control-surface); color: var(--muted); border-color: var(--border); }
:root[data-study-theme="light"] .use-case-picker button:hover { background: var(--control-hover); border-color: var(--violet); }
:root[data-study-theme="light"] .use-case-picker button[aria-pressed="true"] { background: var(--violet); border-color: var(--violet); color: var(--railgrid-on-accent); }
:root[data-study-theme="light"] .use-case-reset:disabled { color: var(--quiet); }
:root[data-study-theme="light"] .use-case-details .recording-preview { background: var(--control-surface); border-color: var(--border); }
:root[data-study-theme="light"] .use-case-details .recording-preview:hover { background: var(--control-hover); border-color: var(--violet); }
:root[data-study-theme="light"] .recording-dialog { background: var(--surface); border-color: var(--border); }
:root[data-study-theme="light"] .recording-close { border-color: var(--border); }
:root[data-study-theme="light"] .recording-close:hover { background: var(--control-hover); border-color: var(--violet); }
:root[data-study-theme="light"] .after-story #open-source { border-color: #dedbe7; }
:root[data-study-theme="light"] .after-story .railgrid-v2-oss { --oss-muted: #565975; }
@media (max-width:900px) {
  :root[data-study-theme="light"] .chapter-nav { background: rgba(var(--surface-rgb),.96); }
}
