:root {
  --bg: #0b0e14;
  --panel: #121826;
  --panel-2: #0f1420;
  --ink: #d9dfeb;
  --muted: #8b94a7;
  --faint: #5a6375;
  --accent: #7cc4ff;
  --rule: #232c3f;
  --good: #7fd8a4;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 0 24px 96px; }

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: 0.2px; }
h1 { font-size: 2.6rem; margin: 0.2em 0 0.1em; }
h2 { font-size: 1.6rem; margin-top: 2.2em; border-bottom: 1px solid var(--rule); padding-bottom: 0.35em; }
h3 { font-size: 1.15rem; margin-top: 1.8em; color: var(--accent); }
p { max-width: 72ch; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
em { color: #e8d8a8; font-style: italic; }
blockquote {
  border-left: 3px solid var(--rule); margin: 1.2em 0; padding: 0.2em 0 0.2em 1.2em;
  color: var(--muted); font-style: italic;
}

.crumbs { padding: 18px 0 0; font-size: 0.9rem; color: var(--muted); display: flex; align-items: center; gap: 12px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.backbtn {
  display: inline-block; padding: 6px 14px; border: 1px solid var(--rule); border-radius: 7px;
  background: var(--panel-2); color: var(--ink) !important; font-size: 0.9rem;
}
.backbtn:hover { border-color: var(--accent); color: var(--accent) !important; text-decoration: none; }

/* Hero fringe motif: a cos² interference pattern, in CSS */
.hero {
  margin-top: 28px; padding: 40px 36px 34px;
  background:
    linear-gradient(rgba(11,14,20,0.82), rgba(11,14,20,0.94)),
    repeating-linear-gradient(90deg,
      #7cc4ff33 0px, #7cc4ff10 9px, transparent 18px, #7cc4ff10 27px, #7cc4ff33 36px);
  border: 1px solid var(--rule); border-radius: 12px;
}
.hero .greek { color: var(--accent); font-family: Georgia, serif; font-size: 1.05rem; }
.hero .tagline { color: var(--muted); font-size: 1.12rem; max-width: 64ch; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); grid-auto-rows: 1fr; gap: 14px; margin: 1.4em 0; padding: 0; list-style: none; }
.cards li { display: flex; }
.cards .card { flex: 1; }
.card {
  background: var(--panel); border: 1px solid var(--rule); border-radius: 10px;
  padding: 16px 18px; display: block; color: var(--ink); min-height: 172px;
}
a.card:hover { border-color: var(--accent); text-decoration: none; }
.card .num { color: var(--faint); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; }
.card h3 { margin: 0.25em 0 0.3em; }
.card p { color: var(--muted); font-size: 0.92rem; margin: 0; }
.card.soon { opacity: 0.5; }
.card.soon .num::after { content: " · planned"; color: var(--faint); }

.timeline { list-style: none; padding: 0; margin: 1.5em 0; border-left: 2px solid var(--rule); }
.timeline li { margin: 0 0 1.1em 0; padding-left: 1.4em; position: relative; max-width: 70ch; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 0.5em;
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
}
.timeline .yr { font-family: Georgia, serif; color: var(--accent); font-weight: 600; margin-right: 0.5em; }

/* Bench layout for interactive pages */
.bench { display: flex; gap: 16px; margin: 1.4em 0; flex-wrap: wrap; }
.bench canvas { background: #05070c; border: 1px solid var(--rule); border-radius: 8px; }
.panel {
  background: var(--panel); border: 1px solid var(--rule); border-radius: 10px;
  padding: 14px 18px 16px; margin: 1em 0;
}
.controls { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: center; }
.ctl { display: flex; flex-direction: column; gap: 4px; min-width: 180px; }
.ctl label { font-size: 0.82rem; color: var(--muted); letter-spacing: 0.04em; }
.ctl output { font-variant-numeric: tabular-nums; color: var(--ink); font-size: 0.9rem; }
input[type=range] { width: 180px; accent-color: var(--accent); }
button, .btn {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 7px; padding: 7px 14px; font-size: 0.9rem; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.active { border-color: var(--accent); color: var(--accent); }
.seg { display: inline-flex; gap: 6px; }
.readout { color: var(--muted); font-size: 0.9rem; }
.readout b { color: var(--ink); font-variant-numeric: tabular-nums; }
.note { color: var(--muted); font-size: 0.92rem; max-width: 76ch; }
.note.hint { border-left: 3px solid var(--accent); padding-left: 1em; }

/* hover-to-explain popovers */
.x { color: var(--accent); border-bottom: 1px dotted currentColor; cursor: help; white-space: nowrap; }
.x::after { content: 'ⓘ'; font-size: 0.7em; vertical-align: 0.35em; margin-left: 1px; opacity: 0.7; }
.x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
#pop {
  position: fixed; z-index: 60; max-width: 320px; background: var(--panel);
  border: 1px solid #2e3850; border-radius: 12px; padding: 13px 15px;
  box-shadow: 0 22px 55px -16px #000, 0 0 0 1px #000;
  font-size: 0.85rem; line-height: 1.55; visibility: hidden; opacity: 0;
  transform: translateY(4px); pointer-events: none; transition: opacity 0.13s, transform 0.13s;
}
#pop.show { visibility: visible; opacity: 1; transform: none; pointer-events: auto; }
#pop h4 { margin: 0 0 7px; font-size: 0.88rem; color: var(--accent); font-family: Georgia, serif; }
#pop p { margin: 0 0 8px; }
#pop p:last-child { margin: 0; }
#pop b { color: var(--ink); font-weight: 600; }
#pop .muted { color: var(--muted); font-size: 0.8rem; }
#pop .eq {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  background: var(--panel-2); border: 1px solid var(--rule); border-radius: 7px;
  padding: 8px 10px; margin: 9px 0; font-size: 0.85rem; text-align: center; color: #e6ebff;
}
#pop .fig { display: block; margin: 9px auto 5px; }

/* "things to notice" cards */
.notice { margin-top: 40px; border-top: 1px solid var(--rule); padding-top: 22px; }
.notice-title {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1.6px;
  color: var(--muted); margin: 0 0 14px; font-weight: 600; font-family: inherit; border: none;
}
.notice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.ncard { background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; padding: 15px 16px; }
.ncard h3 { margin: 0 0 7px; font-size: 0.95rem; font-weight: 600; font-family: inherit; color: var(--ink); }
.ncard p { margin: 0 0 11px; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.ncard .why { font-size: 0.85rem; font-weight: 600; }

footer { margin-top: 72px; color: var(--faint); font-size: 0.85rem; border-top: 1px solid var(--rule); padding-top: 1.2em; }

/* Popover states (STOA popover, WCAG 1.4.13) */
#pop.pinned { border-color: var(--accent); }
.x[aria-expanded="true"] { border-bottom-style: solid; }

/* Shared footer: link back to the hub (TAXIS G3) */
footer .hub { display: inline-flex; align-items: center; gap: 7px; margin-left: 0.4em; }
footer .hub img { width: 13px; height: auto; vertical-align: -2px; }

/* Say "tap" on touch screens (TAXIS R15) */
.tap-word { display: none; }
@media (pointer: coarse) { .tap-word { display: inline; } .click-word { display: none; } }

/* Visually hidden live readouts for screen readers */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Reduced motion: keep state changes, drop transitions (STYLE.md) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Chapter 2 showcase: predict, what-if sentence, stepped formula */
.predict { border-left: 3px solid var(--rule); padding-left: 1em; color: var(--muted); max-width: 72ch; }
.predict b { color: var(--ink); }
.whatif { font-size: 1.05rem; max-width: 72ch; }
.whatif .muted-hint { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 0.3em; }
.formula { margin: 1.2em 0 0.4em; font-size: 26px; }
.formula .eq-caption { color: var(--muted); }
.formula-nav { display: flex; align-items: center; justify-content: center; gap: 14px; }
.formula-nav button:disabled { opacity: 0.4; cursor: default; }
input[type=range][data-ent] { accent-color: currentColor; }

/* Canvases scale down on narrow screens instead of pushing the page sideways */
.bench canvas, canvas { max-width: 100%; height: auto; }
