@font-face {
  font-family: Geist;
  src: url("./assets/geist.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("./assets/instrument-serif-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f6f5ed;
  --card: #fffef8;
  --ink: #172c25;
  --muted: #52645a;
  --line: #d9ded0;
  --accent: #d6f493;
  --green: #2c614a;
  --pine: #102c24;
  --light-text: #edf7e8;
  --light-muted: #b2c8ba;
  --radius: 18px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-family: Geist, system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select, input[type="checkbox"], input[type="color"], input[type="range"] { cursor: pointer; }
button { color: inherit; }
a { color: inherit; }
button:disabled { cursor: default; opacity: .48; }
:focus-visible { outline: 2px solid #4c8b64; outline-offset: 4px; }
[hidden] { display: none !important; }
.shell { width: min(1240px, calc(100% - 96px)); margin-inline: auto; }
.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link:focus { position: fixed; z-index: 10; background: var(--accent); padding: 12px; left: 12px; top: 12px; }

.site-header { border-bottom: 1px solid #dddfd5; }
.header-inner { min-height: 76px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; justify-self: start; text-decoration: none; font-size: 24px; font-weight: 760; letter-spacing: -.07em; line-height: .93; }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .01em; }
.top-nav { display: flex; align-items: center; gap: 3px; padding: 4px; border: 1px solid #dfe3d7; border-radius: 99px; background: #eeefe6; }
.top-nav a { display: flex; gap: 8px; align-items: center; border-radius: 99px; text-decoration: none; white-space: nowrap; padding: 8px 15px; color: var(--muted); font-size: 13px; font-weight: 650; }
.top-nav a span { font: 10px var(--mono); opacity: .75; }
.top-nav a:hover { color: var(--ink); background: #e4eadb; }
.top-nav a[aria-current] { background: var(--pine); color: #f5faed; }
.top-nav a[aria-current] span { color: var(--accent); opacity: 1; }
.header-source { justify-self: end; font-size: 13px; font-weight: 650; text-decoration: none; }
.header-source span { margin-left: 4px; color: var(--green); }
.header-source:hover { text-decoration: underline; }

.hero { padding: 34px 0 24px; }
.eyebrow { margin: 0; font: 650 11px/1.4 var(--mono); letter-spacing: .13em; color: #476452; }
.eyebrow .status-dot { margin-right: 6px; }
.eyebrow > span[aria-hidden="true"]:not(.status-dot) { margin-inline: 3px; }
.status-dot { display: inline-block; width: 7px; height: 7px; background: #72a36a; border-radius: 50%; vertical-align: 1px; }
.hero h1 { margin: 7px 0 10px; font-size: clamp(52px, 6.9vw, 100px); font-weight: 650; letter-spacing: -.074em; line-height: .98; }
.hero h1 em { font: italic 400 1.13em/.8 "Instrument Serif", Georgia, serif; letter-spacing: -.04em; color: #31654d; white-space: nowrap; }
.hero > p:last-child { margin: 0; font-size: clamp(15px, 1.4vw, 18px); line-height: 1.55; color: var(--muted); max-width: 930px; }

.experience { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, 1fr); gap: 16px; align-items: stretch; scroll-margin-top: 14px; }
.simulation { position: relative; isolation: isolate; overflow: hidden; color: var(--light-text); background: #112e26; border-radius: var(--radius); min-width: 0; display: flex; flex-direction: column; }
.simulation::before { content: ""; position: absolute; z-index: -1; inset: 0; background: radial-gradient(ellipse at 47% 43%, #2a503b 0%, transparent 68%), radial-gradient(circle, #9fc5a32c 1px, transparent 1.4px); background-size: 100% 100%, 21px 21px; background-position: center; }
.sim-top, .sim-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sim-top { padding: 20px 23px 0; }
.sim-label { color: var(--light-muted); font: 600 10px/1.3 var(--mono); letter-spacing: .14em; display: flex; align-items: center; gap: 8px; }
.sim-label .status-dot { background: var(--accent); box-shadow: 0 0 10px #c6f98260; }
.sim-count { white-space: nowrap; color: var(--accent); background: #c5f5a012; border: 1px solid #a6c89f3c; border-radius: 6px; padding: 6px 8px; font: 12px var(--mono); }
.sim-count span { color: var(--light-muted); font-size: 10px; }
.scene { display: block; width: 100%; min-height: 0; max-height: 404px; aspect-ratio: 660 / 384; margin: auto 0; }
.scene .point-target { cursor: pointer; }
.sim-bottom { padding: 0 23px 13px; color: var(--light-muted); font: 11px/1.45 var(--mono); }
#sim-time { white-space: nowrap; color: #d8e9ce; }
.transport { min-height: 65px; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid #ccebc827; background: #0d241dbb; }
.transport button, .playback { border-radius: 8px; height: 39px; }
.transport button:focus-visible, .transport select:focus-visible, .transport input:focus-visible { outline-color: var(--accent); }
.play-button { display: inline-flex; align-items: center; gap: 7px; padding: 0 12px 0 9px; color: #172c25; background: var(--accent); border: 1px solid transparent; font-size: 13px; font-weight: 700; }
.play-button:hover, .button.primary:hover { background: #e3ffac; }
.icon-button { display: inline-grid; place-items: center; width: 39px; border: 1px solid #9bbc9d54; background: transparent; color: var(--light-text); flex-shrink: 0; }
.step-button { border: 1px solid #9bbc9d54; background: transparent; color: var(--light-text); padding: 0 10px; font-size: 12px; }
.icon-button:hover, .step-button:hover, .playback:hover { background: #d2edca1a; }
.timeline-wrap { flex: 1 1 auto; display: flex; align-items: center; gap: 9px; min-width: 0; }
.timeline-wrap input { width: 100%; min-width: 30px; accent-color: var(--accent); margin: 0; }
.timeline-wrap span { color: var(--light-muted); font: 10px var(--mono); white-space: nowrap; }
.playback { margin-left: auto; border: 1px solid #9bbc9d54; background: transparent; color: var(--light-text); padding: 0 7px; font-size: 12px; }
.playback option { color: var(--ink); background: var(--card); }

.lesson, .lab-controls { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); min-width: 0; }
.lesson { padding: clamp(24px, 3.15vw, 43px); display: flex; flex-direction: column; }
.lesson-top { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.lesson-index { display: grid; place-items: center; width: 31px; height: 31px; flex-shrink: 0; background: #e6efd9; color: #2e563e; border-radius: 7px; font: 650 11px var(--mono); }
.lesson h2 { margin: 0 0 15px; font-size: clamp(33px, 4.15vw, 59px); line-height: .98; letter-spacing: -.075em; font-weight: 650; }
.lesson p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }
.lesson-extra { margin: 20px 0; }
.lesson .callout { display: flex; align-items: flex-start; gap: 9px; border-left: 2px solid #8db76e; padding: 9px 0 9px 12px; font-size: 13px; }
.callout span { color: var(--green); }
.lesson .formula { background: #eaf0e0; color: #254934; border-radius: 9px; padding: 9px 11px; margin-bottom: 8px; font: 600 13px/1.4 var(--mono); }
.lesson .micro { font-size: 12px; }
.lesson .micro + .micro { margin-top: 5px; }
.lesson-actions { margin-top: auto; display: flex; align-items: flex-start; gap: 10px 13px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; border-radius: 8px; padding: 9px 13px; text-decoration: none; font-size: 13px; font-weight: 700; line-height: 1.2; border: 1px solid transparent; }
.button.primary { background: var(--accent); color: var(--ink); }
.button.primary span { font-size: 17px; line-height: 1; }
.button.light { background: #eff3e8; color: var(--ink); border-color: #d9e3d3; }
.button.light:hover { background: #e7efd9; }
.button.small { min-height: 33px; padding: 6px 9px; font-size: 12px; }
.text-button { background: none; border: 0; padding: 10px 0; min-height: 39px; text-decoration: underline; text-underline-offset: 3px; color: var(--green); font-size: 12px; font-weight: 650; }
.stage-rail { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 13px; }
.stage-link { min-width: 0; display: flex; align-items: flex-start; text-align: left; gap: 9px; border: 1px solid transparent; background: transparent; padding: 11px 10px; border-radius: 9px; font-size: 13px; font-weight: 700; }
.stage-link > span:first-child { color: var(--green); font: 650 10px/1.65 var(--mono); }
.stage-link small { display: block; color: var(--muted); margin-top: 3px; font-size: 11px; font-weight: 500; }
.stage-link:hover { background: #edf1e6; }
.stage-link[aria-current] { background: #e8efdc; border-color: #dce5d3; }

.experience[data-mode="laboratorio"] .simulation { align-self: start; position: sticky; top: 14px; }
.lab-controls { padding: 20px; }
.lab-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.lab-heading h2, .readout-heading h2, .context-intro h2, .source-section h2 { font-size: clamp(30px, 3.4vw, 47px); line-height: 1; letter-spacing: -.065em; font-weight: 650; margin: 3px 0 0; }
.presets { display: flex; flex-wrap: wrap; gap: 5px; margin: 14px 0 8px; }
.presets button { background: transparent; border: 1px solid var(--line); font-size: 11px; font-weight: 700; border-radius: 99px; padding: 6px 9px; }
.presets button:hover { background: #edf2e3; }
.presets button[aria-pressed="true"] { background: var(--pine); color: var(--light-text); border-color: var(--pine); }
.preset-note, .control-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.preset-note { min-height: 2.9em; }
.control-note { margin-top: 10px; }
.control-tabs { display: flex; gap: 6px; margin: 15px 0 11px; border-bottom: 1px solid var(--line); }
.control-tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 7px 9px; font-size: 13px; font-weight: 700; color: var(--muted); }
.control-tabs button[aria-selected="true"] { border-bottom-color: #4d8b64; color: var(--ink); }
.fields { display: grid; gap: 5px; }
.field { display: grid; grid-template-columns: minmax(111px, 1fr) minmax(43px, .85fr) 65px 22px; gap: 7px; align-items: center; min-height: 32px; }
.field label { font-size: 12px; font-weight: 620; }
.field input[type="range"] { width: 100%; margin: 0; accent-color: #407955; }
.field input[type="number"] { width: 100%; height: 28px; padding: 2px 3px 2px 5px; background: #f6f8f0; color: var(--ink); border: 1px solid #d7e0d2; border-radius: 5px; font: 12px var(--mono); }
.field-unit { font: 10px var(--mono); color: var(--muted); }
.view-toggles { display: flex; flex-wrap: wrap; gap: 6px 10px; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 9px; }
.view-toggles label, .checkbox-label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 11px; font-weight: 650; }
.view-toggles input, .checkbox-label input { margin: 0; accent-color: #407955; width: 15px; height: 15px; }
.ball-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 12px; font-weight: 650; }
.ball-picker select { min-width: 82px; background: #f5f7ee; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); padding: 4px; }
.ball-picker .checkbox-label { margin-left: auto; }
.ball-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.ball-tools label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; }
.ball-tools input { width: 34px; height: 27px; padding: 2px; border: 1px solid #bdcdbd; border-radius: 4px; background: #e9efdf; }
.ball-tools button span { font: 10px var(--mono); color: var(--muted); }

.lab-readouts { padding: 32px 0 0; }
.readout-heading { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin-bottom: 13px; }
.readout-heading h2 { font-size: clamp(26px, 3vw, 36px); }
#trace-context { margin: 0 0 3px; font-size: 12px; color: var(--muted); }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.readout { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.readout h3 { margin: 0; font-size: 13px; font-weight: 700; }
.readout h3 span { margin-left: 4px; color: var(--muted); font: 10px var(--mono); }
.readout output { display: block; margin-top: 6px; color: var(--green); font: 650 24px var(--mono); letter-spacing: -.05em; }
.readout canvas { display: block; width: 100%; height: 86px; margin-top: 7px; }
.readout-note { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.collective { background: #e8efdb; }
.coherence-bar { width: 100%; height: 5px; margin: 11px 0 13px; border-radius: 6px; background: #cedac5; }
.coherence-bar span { display: block; width: 0; height: 100%; background: #548554; border-radius: inherit; }
.collective dl { display: grid; gap: 7px; margin: 0; }
.collective dl div { display: flex; justify-content: space-between; align-items: baseline; gap: 5px; font-size: 11px; }
.collective dt { color: #44594b; }
.collective dd { margin: 0; white-space: nowrap; font: 600 11px var(--mono); }
.lab-challenge { display: flex; gap: 14px; align-items: baseline; margin-top: 17px; padding: 12px 14px; background: #eef1e4; border-radius: 9px; }
.lab-challenge p:last-child { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.lab-challenge strong { color: var(--ink); }

.context-section { margin-top: 49px; background: #ebeee1; border-block: 1px solid #dee4d7; padding: 48px 0 37px; }
.context-intro { max-width: 760px; }
.context-intro h2 { margin-top: 8px; }
.context-intro > p:last-child { font-size: 15px; line-height: 1.6; color: var(--muted); max-width: 660px; margin-bottom: 22px; }
.concept-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.concept { padding: 19px 20px; background: #f8f9f1; border: 1px solid #dae4d4; border-radius: 13px; }
.concept-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; background: #e0edcf; color: var(--green); font: 20px var(--mono); }
.concept h3 { margin: 12px 0 6px; font-size: 18px; letter-spacing: -.04em; }
.concept p, .sos-note { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.concept a, .sos-note a { display: inline-block; margin-right: 8px; color: var(--green); font-size: 12px; font-weight: 650; text-underline-offset: 3px; }
.sos-note { margin: 19px 0 0; }
.sos-note strong { color: var(--ink); }
.source-section { padding-block: 44px; scroll-margin-top: 16px; }
.sources-list { margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; }
.sources-list a { display: flex; justify-content: space-between; align-items: center; gap: 9px; border-bottom: 1px solid var(--line); padding: 9px 2px 11px; text-decoration: none; font-size: 13px; font-weight: 700; }
.sources-list a:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.sources-list small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); font-weight: 450; }
.model-details { margin-top: 22px; max-width: 760px; padding: 11px 14px; border: 1px solid var(--line); background: var(--card); border-radius: 9px; font-size: 13px; }
.model-details summary { font-weight: 700; cursor: pointer; }
.model-details p { color: var(--muted); line-height: 1.6; margin: 8px 0 0; }
.model-details code { color: var(--green); font-family: var(--mono); }
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { padding-block: 17px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.footer-inner a { text-underline-offset: 3px; }
dialog { position: fixed; width: min(470px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: var(--radius); padding: 25px; background: var(--card); color: var(--ink); box-shadow: 0 20px 60px #132d2740; }
dialog::backdrop { background: #102c24a1; }
dialog h2 { font-size: 27px; margin: 0 34px 8px 0; letter-spacing: -.06em; }
dialog p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.dialog-close { position: absolute; top: 14px; right: 14px; }
.dialog-close button { min-width: 32px; min-height: 32px; border-radius: 6px; border: 1px solid var(--line); background: #eff3e8; font-size: 19px; line-height: 1; }
.share-input { display: flex; gap: 7px; }
.share-input input { width: 0; flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 6px; color: var(--ink); background: #f5f7ee; font-size: 12px; }
#share-status { min-height: 1.4em; margin-bottom: 0; }
.noscript { margin: 20px; padding: 12px; background: var(--accent); }

@media (max-width: 990px) {
  .shell { width: calc(100% - 50px); }
  .experience { grid-template-columns: minmax(0, 1.42fr) minmax(285px, 1fr); }
  .lesson { padding: 25px; }
  .lesson-top { margin-bottom: 14px; }
  .lab-controls { padding: 15px; }
  .transport { gap: 8px; }
  .sim-top, .sim-bottom { padding-inline: 15px; }
}
@media (max-width: 730px) {
  .shell { width: calc(100% - 30px); }
  .header-inner { min-height: 0; grid-template-columns: 1fr auto; gap: 9px; padding-block: 11px; }
  .top-nav { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .header-source { grid-column: 2; grid-row: 1; }
  .hero { padding-block: 29px 19px; }
  .hero h1 { margin-block: 8px 10px; }
  .experience { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .scene { aspect-ratio: 1.51; }
  .experience[data-mode="laboratorio"] .simulation { position: relative; top: auto; }
  .lesson { padding: 21px; }
  .lesson h2 br { display: none; }
  .lesson-extra { margin: 13px 0 15px; }
  .stage-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .readout-grid, .concept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .concept:last-child { grid-column: 1 / -1; }
  .readout-heading { align-items: start; flex-direction: column; }
  .context-section { margin-top: 30px; padding-block: 30px; }
  .source-section { padding-block: 31px; }
}
@media (max-width: 395px) {
  .top-nav a { padding-inline: 10px; }
  .hero h1 { font-size: 49px; }
  .transport { gap: 6px; padding-inline: 9px; }
  .transport .play-button { padding-inline: 5px 7px; }
  .timeline-wrap { gap: 4px; }
  .timeline-wrap span { font-size: 9px; }
  .playback { padding-inline: 3px; }
  .field { grid-template-columns: minmax(94px, 1fr) minmax(41px, 1fr) 58px 19px; gap: 5px; }
  .concept-grid, .sources-list { grid-template-columns: minmax(0, 1fr); }
  .lab-challenge { display: block; }
  .lab-challenge p:last-child { margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
