/* Probability for Robotics: self-contained. Inherit root tokens, define the rest. */
@import url("../styles.css");

:root { --accent: #0e7c8a; }
.mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 7px; color: #fff; background: linear-gradient(135deg, #2f8a5e, #0e7c8a); }
button { cursor: pointer; font: inherit; }
.hl { color: var(--accent); }
.nowrap { white-space: nowrap; }
.eyebrow { margin: 0 0 12px; color: var(--rose); font-size: .78rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(24px, 5vw, 56px); align-items: center; padding: clamp(44px, 7vw, 84px) clamp(18px, 4vw, 56px); min-height: 540px; background: radial-gradient(900px 460px at 88% -10%, #dce8d2, transparent 60%), var(--paper); }
.hero h1 { margin: 0; font-size: clamp(2rem, 4.4vw, 3.6rem); line-height: 1.06; }
.lead { color: var(--muted); line-height: 1.7; font-size: clamp(1rem, 1.55vw, 1.14rem); max-width: 65ch; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.hero-badges span { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: #fff; font-weight: 800; font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-weight: 850; transition: transform .15s ease, box-shadow .15s ease; }
.button:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.hero-stage { border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.hero-stage canvas { display: block; width: 100%; height: auto; }

/* bands */
.howto, .band, .study, .next { padding: clamp(36px, 6vw, 76px) clamp(18px, 4vw, 56px); border-top: 1px solid var(--line); }
.band { background: #e7eddc; } .band.alt { background: #edf5f6; }
.section-title { max-width: 820px; margin: 0 auto 24px; text-align: center; }
.section-title h2 { margin: 6px 0 10px; font-size: clamp(1.6rem, 3.2vw, 2.6rem); }
.section-title .lead { margin-inline: auto; }
.howto { background: #fff; }
.howlist { max-width: 900px; margin: 0 auto; color: var(--ink); line-height: 1.7; padding-left: 20px; }
.howlist li { margin-bottom: 6px; } .howlist strong { color: var(--accent); }

/* era bar + deck */
.era-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 1000px; margin: 0 auto 20px; }
.era { border: 1px solid var(--line); border-radius: 999px; padding: 8px 15px; background: #fff; font-weight: 800; font-size: .9rem; }
.era:hover { border-color: var(--c, var(--accent)); } .era.on { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); color: #fff; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; max-width: 1200px; margin: 0 auto; }
.model-card { position: relative; display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 15px 14px; border: 1px solid var(--line); border-top: 3px solid var(--c, var(--accent)); border-radius: 12px; background: #fff; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.model-card:hover { transform: translateY(-3px); box-shadow: 0 20px 44px rgba(24, 35, 49, .16); }
.model-card.sel { outline: 3px solid var(--c, var(--accent)); outline-offset: 1px; }
.mc-top { display: flex; justify-content: space-between; align-items: center; }
.mc-emoji { font-size: 1.4rem; } .mc-year { font-size: .74rem; font-weight: 900; color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 13%, #fff); border-radius: 999px; padding: 2px 8px; }
.model-card strong { font-size: 1.02rem; color: var(--ink); }
.mc-era { font-size: .68rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; color: var(--c, var(--accent)); }
.mc-one { color: var(--muted); font-size: .84rem; line-height: 1.45; }

/* study view */
.study-head { display: flex; align-items: center; gap: 16px; max-width: 1080px; margin: 0 auto 18px; padding: 16px 18px; border: 1px solid var(--line); border-left: 6px solid var(--c, var(--accent)); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.study-head .sh-emoji { font-size: 2.4rem; }
.study-head h2 { margin: 2px 0; font-size: clamp(1.4rem, 3vw, 2rem); color: var(--c, var(--accent)); }
.sh-auth { margin: 0; color: var(--muted); font-weight: 600; font-size: .92rem; }
.arxiv { color: var(--accent); font-weight: 850; white-space: nowrap; }
.study-view { max-width: 1080px; margin: 0 auto; }
.card { border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); padding: clamp(16px, 2.6vw, 28px); }
.idea { line-height: 1.7; color: var(--ink); } .idea p { margin: 0 0 10px; }
.idea code, .legend code, .cite code { background: #e7eddc; padding: 1px 5px; border-radius: 5px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
.lbl { margin: 22px 0 8px; font-size: .74rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lbl.warn { color: var(--rose); }

/* animation */
.anim-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--paper); }
.anim-wrap canvas { display: block; width: 100%; height: auto; }
.anim-bar { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.abtn { min-height: 36px; padding: 5px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 800; }
.abtn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.anim-cap { color: var(--ink); line-height: 1.5; font-size: .92rem; align-self: center; }

/* concept navigation (prev / next) */
.study-nav { display: flex; align-items: stretch; justify-content: space-between; gap: 12px; margin: 26px 0 4px; padding-top: 18px; border-top: 1px solid var(--line); }
.snav { display: flex; flex-direction: column; gap: 3px; min-height: 56px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; transition: transform .08s, border-color .12s, box-shadow .12s; max-width: 46%; }
.snav:hover { transform: translateY(-1px); border-color: var(--accent); box-shadow: 0 4px 14px rgba(31,42,34,.12); }
.snav.next { text-align: right; align-items: flex-end; border-color: var(--accent); background: linear-gradient(180deg,#fff, #f3fbf8); }
.snav-k { font-size: .74rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.snav-n { font-weight: 800; color: var(--ink); font-size: .95rem; line-height: 1.2; }
.snav-pos { align-self: center; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.snav-spacer { max-width: 46%; display: flex; align-items: center; }
.snav-done { color: var(--muted); font-weight: 700; font-size: .9rem; }
@media (max-width: 560px) { .study-nav { flex-wrap: wrap; } .snav, .snav-spacer { max-width: none; flex: 1 1 100%; } .snav.next { text-align: left; align-items: flex-start; } .snav-pos { order: -1; flex: 1 1 100%; text-align: center; } }

/* relation chips */
.relations { display: grid; gap: 8px; margin: 10px 0 4px; }
.rel-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rel-k { font-size: .75rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); min-width: 74px; }
.relchip { min-height: 32px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 700; font-size: .86rem; cursor: pointer; transition: transform .08s, border-color .12s, background .12s; }
.relchip:hover { transform: translateY(-1px); border-color: var(--accent); background: #f3fbf8; }
.relchip.b { border-left: 3px solid var(--accent); }
.relchip.l { border-left: 3px solid var(--rose); }

/* proof problem statement */
.proof-problem { margin: 0 0 10px; padding: 10px 14px; border-radius: 10px; background: #f3eee5; border: 1px solid #f0d8c8; color: var(--ink); line-height: 1.6; }
.proof-problem strong { color: #b5560f; }

/* doors-this-opens list */
.olist { margin: 6px 0 16px; padding: 0; list-style: none; display: grid; gap: 8px; }
.olist li { padding: 10px 14px; border: 1px solid var(--line); border-left: 4px solid #b57910; border-radius: 10px; background: #fbfbf2; line-height: 1.6; }

/* interactive lab */
.lab { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 14px 16px; background: var(--panel); margin: 0 0 16px; }
.lab-title { margin: 0 0 4px; font-weight: 900; color: var(--ink); font-size: 1rem; }
.lab-blurb { margin: 0 0 10px; color: var(--muted); line-height: 1.55; font-size: .92rem; }
.lab canvas { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.lab-ctrls { display: grid; gap: 8px; margin: 12px 0 4px; }
.lab-row { display: grid; grid-template-columns: minmax(120px, 38%) 1fr auto; align-items: center; gap: 10px; }
.lab-name { font-weight: 700; color: var(--ink); font-size: .9rem; }
.lab-slider { width: 100%; min-height: 28px; accent-color: var(--accent); }
.lab-val { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--accent); min-width: 3.2em; text-align: right; }
.lab-out { margin-top: 10px; padding: 10px 12px; border-top: 1px dashed var(--line); color: var(--ink); line-height: 1.7; font-size: .92rem; overflow-x: auto; }
@media (max-width: 560px) { .lab-row { grid-template-columns: 1fr auto; } .lab-name { grid-column: 1 / -1; } }

/* guided lesson */
.lesson { border: 2px solid var(--accent); border-radius: 16px; padding: 16px 18px 18px; background: linear-gradient(180deg, #f3fbf8, #fff); margin: 0 0 18px; }
.ls-lbl { margin: 0 0 10px !important; color: var(--accent) !important; }
.lesson-dots { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 14px; }
.ls-dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--accent); background: #fff; padding: 0; cursor: pointer; transition: transform .1s; }
.ls-dot:hover { transform: scale(1.2); }
.ls-dot.on { background: var(--accent); }
.lesson-stage { min-height: 220px; }
.ls-step { margin: 0 0 4px; font-size: .76rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ls-title { margin: 0 0 12px; font-size: 1.35rem; line-height: 1.25; color: var(--ink); font-weight: 900; }
.ls-body { color: var(--ink); line-height: 1.85; font-size: 1.05rem; max-width: 66ch; }
.ls-body p { margin: 0 0 12px; }
.ls-body strong { color: var(--accent); }
.ls-body em { font-style: italic; color: var(--ink); }
.ls-math { margin: 14px 0 6px; background: #fff; }
.ls-math .math-render { font-size: 1.05em; }
.ls-viz { margin: 14px 0 0; }
.lesson-ctrls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.lesson-ctrls .abtn { min-width: 96px; }
.lesson-ctrls .abtn:disabled { opacity: .4; cursor: default; }
.lesson-pos { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--muted); }

/* go-deeper panel */
.deeper { margin: 0 0 8px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.deeper > summary { cursor: pointer; padding: 13px 16px; font-weight: 800; color: var(--ink); list-style: none; }
.deeper > summary::-webkit-details-marker { display: none; }
.deeper > summary::before { content: "▸ "; color: var(--accent); font-weight: 900; }
.deeper[open] > summary::before { content: "▾ "; }
.deeper[open] > summary { border-bottom: 1px solid var(--line); }
.deeper-body { padding: 16px; }

/* prerequisites recap */
.prereq { margin: 8px 0 18px; border: 1px solid var(--line); border-radius: 12px; background: #edf5f6; overflow: hidden; }
.prereq > summary { cursor: pointer; padding: 12px 16px; font-weight: 800; color: var(--ink); list-style: none; }
.prereq > summary::-webkit-details-marker { display: none; }
.prereq > summary::before { content: "▸ "; color: var(--accent); }
.prereq[open] > summary::before { content: "▾ "; }
.prereq-body { padding: 0 16px 14px; }
.prereq-body p { margin: 8px 0; color: var(--ink); line-height: 1.7; }

/* deep dive: textbook prose */
.deepdive { margin: 4px 0 8px; }
.dd { margin: 0 0 18px; padding: 0 0 0 16px; border-left: 3px solid var(--accent); }
.dd h4 { margin: 0 0 8px; font-size: 1.08rem; color: var(--ink); font-weight: 900; }
.dd-body { color: var(--ink); line-height: 1.78; max-width: 70ch; }
.dd-body p { margin: 0 0 12px; }
.dd-body ul, .dd-body ol { margin: 8px 0 12px; padding-left: 22px; line-height: 1.7; }
.dd-body li { margin: 5px 0; }
.dd-body .katex-display { overflow-x: auto; overflow-y: hidden; padding: 6px 2px; }
.dd-body .note { display: block; margin: 10px 0; padding: 10px 14px; border-radius: 10px; background: #edf5f6; border: 1px solid var(--line); }

/* worked example */
.worked { margin: 6px 0 10px; padding: 16px 18px; border: 1px solid var(--line); border-left: 4px solid #15856f; border-radius: 12px; background: #f3fbf8; }
.worked-title { margin: 0 0 6px; font-weight: 800; color: var(--ink); }
.worked-intro { margin: 0 0 12px; color: var(--ink); line-height: 1.7; }
.wstep { display: flex; gap: 12px; margin: 0 0 12px; align-items: flex-start; }
.wstep-n { flex: 0 0 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: #15856f; color: #fff; font-weight: 900; font-size: .85rem; margin-top: 2px; }
.wstep-main { flex: 1; min-width: 0; }
.wstep-l { margin: 0 0 4px; color: var(--ink); line-height: 1.6; }
.wstep-tex { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.worked-result { margin: 6px 0 0; padding: 10px 14px; border-radius: 10px; background: #dcf3ec; font-weight: 700; color: var(--ink); line-height: 1.6; }

/* exercises */
.exercises { margin: 8px 0 10px; }
.exercise { margin: 0 0 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.ex-q { margin: 0 0 8px; color: var(--ink); line-height: 1.7; }
.ex-n { font-weight: 900; color: var(--accent); margin-right: 4px; }
.ex-hint { margin: 6px 0; }
.ex-hint > summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.ex-hint-body { margin: 6px 0; color: var(--ink); line-height: 1.6; }
.ex-toggle { min-height: 34px; padding: 5px 14px; border: 1px solid var(--accent); border-radius: 8px; background: #fff; color: var(--accent); font-weight: 800; cursor: pointer; }
.ex-sol { margin: 10px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); line-height: 1.7; }
.ex-sol .katex-display { overflow-x: auto; overflow-y: hidden; }

/* open problems list */
.openlist { margin: 6px 0 16px; padding: 0; list-style: none; display: grid; gap: 8px; }
.openlist li { padding: 10px 14px; border: 1px solid var(--line); border-left: 4px solid #0f8c8c; border-radius: 10px; background: #f2fbfb; line-height: 1.6; }

/* math cards */
.math-card { margin: 0 0 14px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 14px 16px; background: var(--panel); }
.math-render { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.math-card figcaption p { margin: 6px 0; color: var(--ink); line-height: 1.6; }
.legend { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 3px; color: var(--muted); line-height: 1.5; }
.legend strong { color: var(--ink); }

/* interactive proof */
.proof { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: linear-gradient(180deg, #f3fbf8, #fff); }
.proof-claim { margin: 0 0 10px; font-weight: 700; color: var(--ink); }
.proof-ctrls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.proof-count { margin-left: auto; font-weight: 800; color: var(--muted); font-size: .85rem; }
.pstep { display: none; margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; animation: pin .35s ease; }
.pstep.show { display: block; }
@keyframes pin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.pstep-tex { overflow-x: auto; }
.pwhy { margin-top: 6px; border: 1px dashed var(--accent); background: #f3fbf8; color: var(--accent); border-radius: 7px; padding: 4px 10px; font-weight: 800; font-size: .82rem; }
.pwhy-body { margin-top: 8px; padding: 9px 11px; border-radius: 8px; background: #e7eddc; color: var(--ink); line-height: 1.55; }
.qed { text-align: right; font-weight: 800; color: var(--green); }

/* lists */
.alist, .tlist, .wlist, .flist { margin: 0; padding-left: 18px; line-height: 1.6; }
.alist { color: var(--ink); } .alist li { margin-bottom: 4px; }
.tlist { color: var(--ink); } .tlist li { margin-bottom: 4px; }
.wlist { color: var(--ink); } .wlist li { margin-bottom: 4px; }
.flist { color: var(--ink); } .flist li { margin-bottom: 4px; }
.cite { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.6; }

/* references */
.ref-list { max-width: 1000px; margin: 0 auto; color: var(--ink); line-height: 1.7; padding-left: 22px; }
.ref-list li { margin-bottom: 8px; } .ref-list a { color: var(--accent); font-weight: 800; white-space: nowrap; }
.note { max-width: 1000px; margin: 14px auto 0; color: var(--muted); font-size: .9rem; }
.next { text-align: center; background: linear-gradient(180deg, #e2ebdb, var(--paper)); } .next .actions { justify-content: center; }

/* reveal */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 920px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .anim-bar { flex-direction: column; }
}
@media (max-width: 560px) { .actions .button { flex: 1 1 100%; justify-content: center; } .proof-count { margin-left: 0; width: 100%; } }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } .model-card:hover { transform: none; } .pstep { animation: none; } html { scroll-behavior: auto; } }

/* ✦ beautiful-math highlight callouts (concept deck intro) */
.beauty-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; max-width: 1080px; margin: 4px auto 26px; }
.beauty-note { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 14px 16px 16px; background: linear-gradient(180deg, var(--panel), #fff); box-shadow: var(--shadow); }
.bn-lbl { margin: 0 0 6px; font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.bn-name { margin: 0 0 8px; font-size: 1.04rem; line-height: 1.3; color: var(--ink); font-weight: 900; }
.bn-eq { margin: 4px 0 10px; overflow-x: auto; overflow-y: hidden; }
.bn-eq .katex-display { margin: 0; }
.bn-why { margin: 0; color: var(--ink); line-height: 1.7; font-size: .92rem; }
.bn-why em { font-style: normal; font-weight: 800; color: var(--accent); }

/* 1-D Kalman update lab, uses the existing .lab classes; ensure a comfortable canvas height */
#klab canvas { aspect-ratio: 2 / 1; max-height: 300px; }
#klabOut b { font-variant-numeric: tabular-nums; }

/* ============================================================
   POLISH PASS: additive, low-risk. Targets room-owned shell
   classes only (never the fx- classes injected by frontier.js,
   never the canvas widgets). Hover effects use only transform /
   box-shadow / color / opacity, so no interactive layout shifts.
   ============================================================ */

/* --- Keyboard focus: visible, on-brand rings (no layout shift) --- */
.button:focus-visible,
.abtn:focus-visible,
.era:focus-visible,
.snav:focus-visible,
.relchip:focus-visible,
.ex-toggle:focus-visible,
.pwhy:focus-visible,
.ls-dot:focus-visible,
.deeper > summary:focus-visible,
.prereq > summary:focus-visible,
.ex-hint > summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, #fff);
  outline-offset: 2px;
}
.ref-list a:focus-visible,
.arxiv:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, #fff);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --- Hero badges: faint lift on hover (decorative, safe) --- */
.hero-badges span {
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.hero-badges span:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 4px 12px rgba(31,42,34,.08);
}

/* --- How-to list: gentle accent tick on each step --- */
.howlist li {
  transition: color .15s ease;
}
.howlist li::marker {
  color: color-mix(in srgb, var(--accent) 70%, var(--muted));
}

/* --- Reference links: animated underline instead of nothing --- */
.ref-list a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 2px;
  transition: background-size .22s ease;
  padding-bottom: 1px;
}
.ref-list a:hover { background-size: 100% 2px; }

/* --- Era pills: smooth the color swap that already exists --- */
.era { transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease; }
.era:hover { transform: translateY(-1px); }

/* --- Disclosure summaries: subtle hover wash + arrow nudge --- */
.deeper > summary,
.prereq > summary,
.ex-hint > summary {
  transition: color .15s ease, background .15s ease;
  border-radius: 10px;
}
.deeper > summary:hover,
.prereq > summary:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

/* --- Interactive lab (styling exists in the room, currently unmounted):
   pre-polish the slider + container so any future .lab topic looks finished. --- */
.lab { transition: box-shadow .18s ease; }
.lab:hover { box-shadow: 0 6px 20px rgba(31,42,34,.07); }
.lab-slider:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 50%, #fff);
  outline-offset: 2px;
  border-radius: 6px;
}
.lab-out code,
.lab-out .katex-display { overflow-x: auto; overflow-y: hidden; }

/* --- Typography micro-refinements (no reflow risk) --- */
.lead { text-wrap: pretty; }
.section-title h2 { text-wrap: balance; }
.idea p, .dd-body p, .ls-body p { text-wrap: pretty; }

/* --- Responsive hardening: long math / code must scroll, not overflow,
   on narrow viewports. Belt-and-suspenders over the per-class rules. --- */
@media (max-width: 560px) {
  .math-render,
  .pstep-tex,
  .wstep-tex,
  .ex-sol .katex-display,
  .dd-body .katex-display,
  .worked-result,
  .lab-out { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .era-bar { gap: 6px; }
  .hero-badges span { font-size: .8rem; padding: 5px 10px; }
}

/* --- Reduced motion: neutralize the polish-pass transitions too
   (the existing block already handles .reveal / .pstep / model-card). --- */
@media (prefers-reduced-motion: reduce) {
  .hero-badges span,
  .era,
  .lab,
  .ref-list a,
  .howlist li,
  .deeper > summary,
  .prereq > summary,
  .ex-hint > summary { transition: none; }
  .hero-badges span:hover,
  .era:hover { transform: none; }
}
