:root {
  color-scheme: light;
  --paper: #f2f6f8;
  --ink: #0d202e;
  --muted: #354d5b;
  --line: #a7bbc6;
  --teal: #23695f;
  --violet: #345568;
  --mono: 'DM Mono', 'Courier New', monospace;
  --serif: 'Instrument Serif', Georgia, serif;
  --gutter: clamp(25px, 6vw, 112px);
  --header: 72px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: 'DM Sans', Inter, Arial, sans-serif; overflow-x: clip; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; }
::selection { color: var(--ink); background: #cdece1; }
.mono { font-family: var(--mono); letter-spacing: .065em; }

.site-header {
  position: fixed;
  z-index: 5;
  inset: 0 0 auto;
  height: var(--header);
  padding-inline: var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: rgba(249, 252, 253, .79);
  border-bottom: 1px solid rgba(155, 179, 185, .28);
  backdrop-filter: blur(12px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 700; font-size: 16px; letter-spacing: .21em; }
.brand-mark {
  position: relative;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid #426577;
  border-radius: 50%;
  background: #061321;
  box-shadow: 0 2px 8px #0c24362b;
}
.brand-mark img { position: absolute; width: 196%; max-width: none; height: auto; top: 50%; left: 50%; transform: translate(-50%, -41.4%); }
.main-nav, .header-actions { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 39px); }
.main-nav a, .sound-toggle { color: var(--muted); font-size: 13px; }
.main-nav a:hover, .main-nav a[aria-current] { color: var(--teal); text-decoration: underline; text-underline-offset: 6px; }
.header-actions { gap: 17px; }
.language-switch { display: flex; align-items: center; color: #536975; font-size: 10px; letter-spacing: .035em; }
.language-switch button { min-width: 27px; min-height: 32px; padding: 3px; border: 0; background: transparent; }
.language-switch button:hover, .language-switch button[aria-pressed='true'] { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.header-cta {
  white-space: nowrap;
  border: 1px solid #a7c9c1;
  border-radius: 100px;
  padding: 9px 13px;
  color: #284c50;
  font-size: 12px;
  font-weight: 600;
}
.header-cta .arrow { margin-left: 5px; }
.header-cta:hover { background: #e4f3ef; }
.sound-toggle { display: flex; align-items: center; gap: 7px; background: transparent; border: 0; padding: 6px 0; white-space: nowrap; }
.sound-glyph { height: 12px; display: inline-flex; align-items: center; gap: 2px; }
.sound-glyph i { width: 1px; height: 40%; background: currentColor; }
.sound-glyph i:nth-child(2), .sound-glyph i:nth-child(3) { height: 86%; }
.sound-toggle[aria-pressed='true'] { color: var(--teal); }

.story { position: relative; isolation: isolate; background: #e9f1f5; }
.scene-dock { position: sticky; top: 0; height: 0; z-index: -1; pointer-events: none; }
.scene-dock::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 100svh;
  background: linear-gradient(100deg, #f7fafb 2%, #f3f8fac9 37%, #eaf3f63d 67%, #eff6f91a), url('./caustics.jpg') 58% 52% / cover no-repeat;
}
#scene { position: absolute; inset: 0 0 auto; width: 100%; height: 100svh; display: block; }
.section {
  position: relative;
  padding: calc(var(--header) + 98px) var(--gutter) 75px;
  min-height: 100svh;
}
.story .section {
  display: block;
  padding-top: calc(var(--header) + 30px);
}
.story .section-rail {
  position: static;
  width: calc(46vw - var(--gutter));
  margin-bottom: 40px;
}
.section-rail {
  position: absolute;
  top: calc(var(--header) + 30px);
  left: var(--gutter);
  right: 54%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  color: var(--muted);
  font-size: 10px;
}
.section-rail span:first-child { color: var(--teal); font-weight: 500; }
.section-rail span:first-child::before { content: ''; display: inline-block; width: 19px; height: 1px; background: currentColor; vertical-align: middle; margin-right: 11px; }
.hero-content { max-width: 56%; }
.hero h1, .display, .final-title { font-family: var(--serif); font-weight: 400; line-height: .9; letter-spacing: -.035em; }
.hero h1 { font-size: clamp(76px, 8vw, 156px); }
.display { font-size: clamp(60px, 5.4vw, 113px); }
.hero h1 em, .display em, .final-title em {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--violet);
  letter-spacing: -.043em;
}
.hero-deck, .section-copy, .final-deck {
  margin-top: 25px;
  max-width: 38ch;
  color: var(--muted);
  line-height: 1.62;
  font-size: clamp(15px, 1.19vw, 20px);
}
.hero-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin-top: 27px; }
.solid-action { display: inline-flex; align-items: center; justify-content: center; gap: 20px; border-radius: 100px; padding: 13px 18px; background: #0d2637; color: #fff; font-weight: 600; font-size: 13px; }
.solid-action:hover { background: #25526a; }
.text-action { color: var(--teal); font-size: 13px; font-weight: 600; }
.text-action:hover { text-decoration: underline; text-underline-offset: 4px; }
.scroll-instruction { position: absolute; left: var(--gutter); bottom: 30px; color: var(--muted); font-size: 10px; display: flex; gap: 10px; align-items: center; }
.scroll-instruction > [aria-hidden] { display: grid; place-content: center; border: 1px solid var(--line); border-radius: 50%; width: 24px; height: 24px; color: var(--teal); font-size: 15px; }
.chapter-copy { width: min(55%, 840px); }
.rule-list { list-style: none; padding: 0; margin-top: 29px; margin-bottom: 0; max-width: 460px; border-bottom: 1px solid var(--line); }
.rule-row { display: flex; align-items: baseline; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.rule-count { color: var(--teal); font-size: 10px; }
.rule-row div { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rule-row strong { font-size: 14px; min-width: 64px; }
.rule-row div span { color: var(--muted); font-size: 13px; }

.replay-console {
  width: min(49%, 565px);
  margin-top: 25px;
  border: 1px solid #b9ced6;
  border-radius: 15px;
  background: linear-gradient(125deg, #fcffffe8, #eaf3f7cf);
  box-shadow: inset 0 1px 0 #fff, 0 20px 38px #25485a1c;
  overflow: hidden;
}
.console-header, .console-detail-top, .evidence-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.console-header { padding: 11px 15px; border-bottom: 1px solid var(--line); color: #375765; font-size: 9px; }
.console-signal { font-weight: 500; }
.live-dot, .status-dot {
  display: inline-block;
  background: #5bb799;
  box-shadow: 0 0 0 2px #5bb79922;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: .09em;
}
.copy-button { border: 0; background: transparent; padding: 4px; color: var(--teal); font-size: 9px; white-space: nowrap; }
.copy-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.console-main { display: grid; grid-template-columns: minmax(120px, .74fr) minmax(0, 1.6fr); }
.console-left { padding: 14px; border-right: 1px solid var(--line); }
.console-metadata { color: var(--muted); font-size: 8px; line-height: 1.6; }
.timeline { display: grid; gap: 3px; margin-top: 12px; }
.timeline-step { display: flex; align-items: center; gap: 7px; text-align: left; padding: 8px 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-size: 11px; }
.timeline-step:hover, .timeline-step[aria-selected='true'] { background: #eaf3f4; border-color: #c9dde0; }
.timeline-dot, .flow-key li::before { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: var(--signal, #4eaa89); }
.timeline-step:nth-child(2), .flow-key li:nth-child(2) { --signal: #628ec7; }
.timeline-step:nth-child(3), .flow-key li:nth-child(3) { --signal: #9774c4; }
.timeline-step:nth-child(4), .flow-key li:nth-child(4) { --signal: #cf9153; }
.timeline-time { margin-left: auto; font-size: 8px; color: var(--muted); }
.console-right:focus-visible { outline-offset: -3px; }
.console-right { padding: 13px 16px 10px; }
.console-detail-top { color: #486776; font-size: 8px; margin-bottom: 12px; }
.console-detail-top span:last-child { white-space: nowrap; }
.console-right h3 { font-size: 19px; line-height: 1.14; letter-spacing: -.035em; margin-bottom: 7px; }
.console-right > p { color: var(--muted); font-size: 12px; line-height: 1.51; min-height: 57px; margin-bottom: 11px; }
.evidence-row { color: var(--muted); border-top: 1px solid var(--line); padding: 8px 0; font-size: 8px; }
.evidence-row span:nth-child(2) { color: var(--teal); }
.status-value { font-size: 10px; }
.flow-key { display: flex; flex-wrap: wrap; gap: 10px 19px; list-style: none; margin: 27px 0 0; padding: 0; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.flow-key li { display: inline-flex; align-items: center; gap: 6px; }
.flow-key li::before { content: ''; }

.fabric-capabilities { width: min(100%, 460px); margin: 25px 0 0; border-bottom: 1px solid var(--line); }
.fabric-capabilities div { display: grid; grid-template-columns: 102px 1fr; gap: 12px; padding-block: 11px; border-top: 1px solid var(--line); }
.fabric-capabilities dt { color: var(--ink); font-weight: 600; font-size: 14px; }
.fabric-capabilities dd { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.final-section { min-height: auto; padding: 90px var(--gutter) 110px; display: grid; place-items: center; text-align: center; background: linear-gradient(145deg, #f8fbfc, #dceaf0); }
.final-title { font-size: clamp(56px, 7.7vw, 135px); }
.final-deck { margin-inline: auto; }
.final-action { margin-top: 24px; }
.footer { padding: 36px var(--gutter); display: grid; grid-template-columns: 1fr 1fr; gap: 19px; }
.footer-logo { justify-self: start; }
.footer > p { color: var(--teal); text-align: right; font: italic 24px/1 var(--serif); }
.footer-links, .footer-bottom { grid-column: 1 / -1; display: flex; gap: 12px 22px; flex-wrap: wrap; color: var(--muted); font-size: 9px; }
.footer-links a:hover { text-decoration: underline; }
.footer-bottom { justify-content: space-between; border-top: 1px solid var(--line); padding-top: 15px; }
.no-canvas .scene-dock { display: none; }

@media (max-width: 1020px) {
  .timeline-time { display: none; }
  .main-nav { gap: 14px; }
  .console-main { grid-template-columns: minmax(96px, .73fr) minmax(0, 1.6fr); }
  .console-left { padding-inline: 8px; }
  .replay-console { width: min(53%, 470px); }
}

@media (max-width: 900px) {
  .site-header { gap: 12px; }
  .main-nav { gap: 10px; }
  .header-actions { gap: 8px; }
  .main-nav a, .sound-toggle { font-size: 11px; }
}

@media (max-width: 760px) {
  :root { --header: 59px; --gutter: 22px; --art: clamp(165px, 32svh, 292px); }
  .site-header { gap: 9px; }
  .brand { font-size: 13px; gap: 7px; }
  .brand-mark { width: 26px; height: 26px; }
  .main-nav { display: none; }
  .header-actions { gap: 8px; }
  .header-cta { font-size: 10px; padding: 7px 8px; }
  .sound-toggle { font-size: 10px; }
  .scene-dock { top: var(--header); height: var(--art); margin-bottom: calc(-1 * var(--art)); z-index: 2; }
  #scene, .scene-dock::before { height: var(--art); }
  .scene-dock::before { background: linear-gradient(#eff7fa40, #edf4f878 74%, #e9f1f5), url('./caustics.jpg') center / cover; }
  .story .section { min-height: 0; padding-top: 3px; padding-bottom: 44px; }
  .story .section:not(.hero) { scroll-margin-top: calc(var(--header) + var(--art)); }
  .story .hero { padding-top: calc(var(--header) + var(--art) + 3px); }
  .story .section-rail { width: 100%; font-size: 9px; padding-bottom: 11px; }
  .section-rail span:first-child::before { width: 13px; margin-right: 7px; }
  .section-rail span:nth-child(2) { text-align: right; }
  .hero-content, .chapter-copy { width: 100%; max-width: 490px; }
  .hero h1 { font-size: clamp(54px, 15vw, 90px); }
  .display { font-size: clamp(46px, 12.4vw, 80px); }
  .hero-deck, .section-copy { margin-top: 16px; }
  .hero-buttons { gap: 14px; margin-top: 20px; }
  .solid-action { padding: 11px 14px; gap: 9px; }
  .scroll-instruction { position: static; margin-top: 27px; font-size: 8px; }
  .scroll-instruction > [aria-hidden] { width: 20px; height: 20px; }
  .rule-list { margin-top: 19px; }
  .replay-console { width: min(100%, 520px); margin-top: 20px; }
  .console-main { grid-template-columns: minmax(100px, .65fr) minmax(0, 1.5fr); }
  .console-right { padding-inline: 10px; }
  .console-right h3 { font-size: 17px; }
  .console-right > p { font-size: 11px; }
  .fabric-capabilities { margin-top: 20px; }
  .final-section { padding-block: 56px 65px; }
  .no-canvas { --art: 0px; }
  :is(a, button):focus-visible { scroll-margin-top: calc(var(--header) + var(--art) + 12px); }
  .site-header :is(a, button):focus-visible { scroll-margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media (max-width: 520px) {
  .site-header { padding-inline: clamp(12px, 4vw, 22px); }
  .sound-toggle { min-width: 26px; min-height: 32px; justify-content: center; }
  #soundLabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

@media (max-width: 365px) {
  .site-header, .header-actions { gap: 5px; }
  .brand { letter-spacing: .15em; }
  .header-cta .arrow { display: none; }
  .language-switch button { min-width: 24px; }
}
