/* base.css — Quantum Sims design tokens, reset and shared page chrome.
   Every page in the series loads this first, then its own stylesheet.
   Token names and values must stay identical across sims. */

:root {
  --bg: #070c18;
  --bg-panel: #0d1426;
  --bg-raised: #141d35;
  --line: #223052;
  --text: #e6ecf8;
  --muted: #8fa0c4;
  --accent: #48d6ff;
  --accent-dim: #1d4b60;
  --warn: #ffb454;
  --good: #5ce2a7;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f7fd;
    --bg-panel: #ffffff;
    --bg-raised: #eef2fa;
    --line: #d3dcec;
    --text: #101828;
    --muted: #55637d;
    --accent: #0b7fa8;
    --accent-dim: #a9dcee;
    --warn: #a55b00;
    --good: #0f7a52;
    --shadow: 0 1px 2px rgba(16, 24, 40, .08);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; }
button, select, input { font: inherit; color: inherit; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* -------------------------------------------------------------- chrome */

.topbar {
  display: flex; flex-wrap: wrap; gap: 10px 18px;
  align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 650; letter-spacing: .2px; }
.brand span { color: var(--accent); }
.topnav { display: flex; gap: 14px; align-items: center; font-size: .9rem; }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--text); text-decoration: underline; }

.card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  min-width: 0;
}
.card > h2 {
  margin: 0 0 10px; font-size: .78rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); font-weight: 650;
}

.btn {
  background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; cursor: pointer;
  transition: border-color .12s ease, background .12s ease, transform .06s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); color: #04121b; border-color: var(--accent); font-weight: 600; }
.btn.small { padding: 5px 9px; font-size: .82rem; }
@media (prefers-color-scheme: light) { .btn.primary { color: #fff; } }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.row.spread { justify-content: space-between; }
.spacer { flex: 1 1 auto; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 12px; }

.note, .hist-note { font-size: .78rem; color: var(--muted); }

/* --------------------------------------------------------------- prose */

.prose { max-width: 68ch; margin: 34px 0; }
.prose h1 { font-size: clamp(1.55rem, 3.6vw, 2.1rem); margin: 0 0 6px; }
.prose .dek { color: var(--muted); margin-top: 0; }
.prose h2 { font-size: 1.12rem; margin: 26px 0 6px; }
.prose code, .mono {
  font-family: var(--mono); font-size: .9em; background: var(--bg-panel);
  border: 1px solid var(--line); padding: 0 4px; border-radius: 4px;
}

.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 11px 0; font-weight: 600; }
.faq details > div { padding: 0 0 12px; color: var(--muted); }

.serieslinks {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  border-top: 1px solid var(--line); padding: 18px 0 34px; font-size: .92rem;
}

/* -------------------------------------------------------------- misc */

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(8px);
  background: var(--bg-raised); border: 1px solid var(--accent); color: var(--text);
  padding: 9px 14px; border-radius: 8px; font-size: .88rem; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; z-index: 60;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
