/* Ionozond playground — same palette and type as docs/ionogram-physics.html */

:root {
  --ground: #eff3f4; --surface: #ffffff; --raised: #f7fafb; --ink: #0f171b; --muted: #54666e;
  --faint: #7d8f97; --rule: #d2dee2; --accent: #0b6b7c; --accent-soft: #e0eff1;
  --warn: #9d5407; --warn-soft: #f6ebdd;
  --comp: #7a4fc9;
  --seq-1: #e0eff1; --seq-2: #b3dbe1; --seq-3: #7cc0cb; --seq-4: #3e9aab; --seq-5: #0b6b7c; --seq-6: #07434e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #091013; --surface: #0f1a1f; --raised: #14242a; --ink: #dfe9ec; --muted: #8ba2ab;
    --faint: #6b838c; --rule: #1d2d34; --accent: #4ac0d3; --accent-soft: #0d2a31;
    --warn: #dfa059; --warn-soft: #2a2015;
    --comp: #9085e9;
    --seq-1: #10272d; --seq-2: #14404a; --seq-3: #1a5f6c; --seq-4: #248494; --seq-5: #3fb0c2; --seq-6: #9fe0ea;
  }
}
:root[data-theme="dark"] {
  --ground: #091013; --surface: #0f1a1f; --raised: #14242a; --ink: #dfe9ec; --muted: #8ba2ab;
  --faint: #6b838c; --rule: #1d2d34; --accent: #4ac0d3; --accent-soft: #0d2a31;
  --warn: #dfa059; --warn-soft: #2a2015;
  --comp: #9085e9;
  --seq-1: #10272d; --seq-2: #14404a; --seq-3: #1a5f6c; --seq-4: #248494; --seq-5: #3fb0c2; --seq-6: #9fe0ea;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 16px/1.6 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.mono, code { font-family: "IBM Plex Mono", ui-monospace, monospace; }

/* ------------------------------------------------------------------ shell */

.shell { max-width: 1240px; margin: 0 auto; padding: 0 16px 72px; display: grid; grid-template-columns: 1fr; gap: 0 40px; }
@media (min-width: 1020px) { .shell { grid-template-columns: 210px minmax(0, 1fr); padding: 0 24px 96px; } }

.top { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 0 18px; border-bottom: 1px solid var(--rule); margin-bottom: 28px; }
.brand { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.brand .eyebrow { margin: 0 0 2px; }
.brand b { font: 600 1.35rem/1.15 Spectral, Georgia, serif; }
.eyebrow { font: 11.5px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .13em; text-transform: uppercase; color: var(--accent); }

.prefs { display: flex; align-items: center; gap: 12px; flex: none; }
.lang, .theme { display: flex; gap: 4px; }
.theme button { display: grid; place-items: center; padding: 0; width: 32px; height: 28px; }
.theme svg { width: 15px; height: 15px; }
@media (max-width: 560px) {
  .top { flex-wrap: wrap; gap: 12px; }
  .prefs { width: 100%; justify-content: space-between; }
}

nav.rail { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 14px; margin-bottom: 8px; }
nav.rail a {
  flex: none; color: var(--muted); text-decoration: none; font-size: 13.5px; line-height: 1.35;
  padding: 6px 10px; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface);
}
nav.rail a[aria-current="page"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
@media (min-width: 1020px) {
  nav.rail { display: grid; gap: 4px; align-self: start; position: sticky; top: 24px; overflow: visible; padding: 0; }
  nav.rail a { border: 0; border-left: 2px solid var(--rule); border-radius: 0; background: none; padding: 5px 0 5px 12px; }
  nav.rail a[aria-current="page"] { border-left-color: var(--accent); background: none; }
  nav.rail a:hover { color: var(--accent); border-left-color: var(--accent); }
}

main { min-width: 0; }
.part-no { display: block; margin-bottom: 8px; }
h1 { font: 600 clamp(1.7rem, 3.6vw, 2.3rem)/1.12 Spectral, Georgia, serif; letter-spacing: -.012em; margin: 0 0 10px; text-wrap: balance; }
.lede { color: var(--muted); max-width: 70ch; margin: 0 0 24px; }
h2 { font: 600 1.02rem/1.3 "IBM Plex Sans", sans-serif; margin: 26px 0 10px; }
p { max-width: 72ch; }

footer.foot { grid-column: 1 / -1; border-top: 1px solid var(--rule); margin-top: 40px; padding-top: 18px; color: var(--faint); font-size: 13px; }
footer.foot p { max-width: 90ch; margin: 0 0 8px; }

/* ------------------------------------------------------------- components */

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 16px 18px 14px; margin: 0 0 16px; }
.panel > .cap { font: 12px "IBM Plex Mono", monospace; color: var(--muted); margin: 0 0 8px; }
.ctl { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 24px; align-items: start; }
.field label { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.field label b { font: 500 13px "IBM Plex Mono", monospace; color: var(--ink); white-space: nowrap; }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.field .seg { margin-top: 4px; }
.seg { display: flex; gap: 5px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }

button, select, input[type=number], input[type=text] {
  font: 12.5px "IBM Plex Mono", monospace; color: var(--ink); background: var(--raised);
  border: 1px solid var(--rule); border-radius: 4px; padding: 5px 9px;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); color: var(--accent); }
button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
button.primary { border-color: var(--accent); color: var(--accent); }
input[type=number] { width: 7.5em; }
input[type=text] { width: 9em; }
.check { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.check input { accent-color: var(--accent); }
.off { opacity: .45; pointer-events: none; }
[hidden] { display: none !important; }

svg.fig { display: block; width: 100%; height: auto; color: var(--ink); overflow: visible; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 16px; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 8px 12px; }
.card .l { font: 10.5px "IBM Plex Mono", monospace; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.card .v { font: 500 18px/1.35 "IBM Plex Mono", monospace; }
.card .s { font-size: 12px; color: var(--muted); }

.note { border-left: 2px solid var(--accent); background: var(--surface); padding: 12px 16px; margin: 0 0 16px; border-radius: 0 4px 4px 0; }
.note.caution { border-left-color: var(--warn); }
.note .lbl { font: 10.5px "IBM Plex Mono", monospace; letter-spacing: .11em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 4px; }
.note.caution .lbl { color: var(--warn); }
.note p { margin: 0; font-size: 14.5px; }
.note p + p { margin-top: 6px; }

details.calc { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; margin: 0 0 16px; }
details.calc > summary { cursor: pointer; padding: 10px 18px; font: 12.5px "IBM Plex Mono", monospace; color: var(--accent); }
details.calc > summary:hover { text-decoration: underline; }
details.calc[open] > summary { border-bottom: 1px solid var(--rule); }
ol.calc { list-style: none; counter-reset: step; margin: 0; padding: 14px 18px 2px; }
ol.calc > li { counter-increment: step; position: relative; padding-left: 32px; margin: 0 0 16px; }
ol.calc > li::before {
  content: counter(step); position: absolute; left: 0; top: 1px; width: 21px; height: 21px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font: 500 11.5px/21px "IBM Plex Mono", monospace; text-align: center;
}
ol.calc > li > b { font-weight: 600; font-size: 14.5px; }
ol.calc > li > p { margin: 2px 0 6px; font-size: 13.5px; color: var(--muted); }
.panel > .eq { margin-top: 12px; }
ol.calc .eq, .panel > .eq { font: 13px/1.65 "IBM Plex Mono", monospace; background: var(--raised); border-radius: 4px; padding: 6px 10px; overflow-wrap: anywhere; }
ol.calc .eq b, .panel > .eq b { font-weight: 500; color: var(--accent); }
@media (max-width: 560px) { ol.calc { padding: 12px 12px 2px; } ol.calc > li { padding-left: 28px; } }

.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.two > .panel { margin: 0; }
.stack { display: grid; gap: 16px; margin-bottom: 16px; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); margin: 6px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; }
.sw.dot { width: 9px; height: 9px; border-radius: 50%; }
.sw.ring { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--faint); }
.sw.line { width: 16px; border-top: 2px solid; }
.sw.dash { width: 16px; border-top: 2px dashed; }
.sw.box { width: 12px; height: 10px; border-radius: 2px; }
.sw.tri { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid; }

.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface); margin: 0 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: middle; }
thead th { font: 500 10.5px "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
td.num { font-family: "IBM Plex Mono", monospace; text-align: right; white-space: nowrap; }
tr.bad td { background: var(--warn-soft); }

.home { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.home a.tile { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 16px 18px; }
.home a.tile:hover { border-color: var(--accent); }
.home a.tile b { display: block; font: 600 1.12rem/1.25 Spectral, Georgia, serif; margin: 4px 0 6px; }
.home a.tile span.d { font-size: 14px; color: var(--muted); }

/* ------------------------------------------------------------------- wiki */
/* The reference document (js/wiki/physics.js), styled as ionozond/docs/ionogram-physics.html. */

.wiki .station { display: flex; flex-wrap: wrap; gap: 8px 24px; font: 12.5px "IBM Plex Mono", monospace; color: var(--faint); margin: -8px 0 22px; }
.wiki .station b { color: var(--ink); font-weight: 500; }
.wiki-toc { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 14px 18px 12px; margin: 0 0 44px; }
.wiki-toc h2 { font: 500 10.5px "IBM Plex Mono", monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin: 0 0 10px; }
.wiki-toc ol { list-style: none; counter-reset: part -1; margin: 0; padding: 0; columns: 2 230px; column-gap: 32px; font-size: 14px; line-height: 1.4; }
.wiki-toc li { counter-increment: part; break-inside: avoid; margin-bottom: 6px; display: flex; gap: 10px; }
.wiki-toc li::before { content: counter(part); flex: none; width: 1.5em; text-align: right; font: 11.5px/1.75 "IBM Plex Mono", monospace; color: var(--faint); }
.wiki-toc a { text-decoration: none; }
.wiki-toc a:hover { text-decoration: underline; }

.wiki section { margin: 0 0 60px; scroll-margin-top: 16px; }
.wiki .part-no { display: block; font: 11.5px "IBM Plex Mono", monospace; letter-spacing: .13em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.wiki h2.part { font: 600 clamp(1.45rem, 2.8vw, 1.85rem)/1.15 Spectral, Georgia, serif; letter-spacing: -.012em; text-wrap: balance; margin: 0 0 8px; }
.wiki .part-lede { color: var(--muted); max-width: 64ch; margin: 0 0 28px; }
.wiki p.wiki-try { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: -14px 0 28px; }
.wiki-try span { font: 10.5px "IBM Plex Mono", monospace; letter-spacing: .11em; text-transform: uppercase; color: var(--faint); margin-right: 4px; }
.wiki-try a { font-size: 13.5px; text-decoration: none; padding: 3px 10px; border: 1px solid var(--accent); border-radius: 4px; background: var(--accent-soft); }
.wiki-try a:hover { text-decoration: underline; }
.wiki h3 { font: 600 1.02rem/1.3 "IBM Plex Sans", sans-serif; margin: 34px 0 10px; text-wrap: balance; }
.wiki p { max-width: 68ch; margin: 0 0 16px; }
.wiki ol.plain, .wiki ul.plain { max-width: 68ch; padding-left: 20px; margin: 0 0 16px; }
.wiki ol.plain li, .wiki ul.plain li { margin-bottom: 8px; }
.wiki code, .wiki .mono { font-size: .875em; }
.wiki code { background: var(--raised); border: 1px solid var(--rule); border-radius: 3px; padding: .08em .34em; }
.wiki var { font-style: italic; font-family: Spectral, Georgia, serif; }
.wiki sub, .wiki sup { font-size: .68em; font-style: normal; }

.wiki .eq { margin: 20px 0; padding: 16px 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; overflow-x: auto; }
.wiki .eq-line { font-family: Spectral, Georgia, serif; font-size: 1.12rem; line-height: 1.7; white-space: nowrap; }
.wiki .eq-line + .eq-line { margin-top: 8px; }
.wiki .eq-where { margin: 12px 0 0; font-size: 13px; color: var(--muted); max-width: 62ch; }

.wiki .tablewrap { margin: 20px 0; }
.wiki table { font-size: 14px; }
.wiki caption { caption-side: bottom; text-align: left; font-size: 12.5px; color: var(--faint); padding: 10px 16px 12px; border-top: 1px solid var(--rule); }
.wiki th, .wiki td { padding: 9px 16px; vertical-align: top; }
.wiki th.num, .wiki td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: "IBM Plex Mono", monospace; white-space: nowrap; }
.wiki tbody tr.hi td { background: var(--accent-soft); }
.wiki .tag { display: inline-block; font: 10px "IBM Plex Mono", monospace; letter-spacing: .07em; text-transform: uppercase; padding: 2px 7px; border-radius: 3px; white-space: nowrap; border: 1px solid; }
.wiki .tag.phys { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.wiki .tag.inst { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }

.wiki figure { margin: 26px 0; }
.wiki figure svg { display: block; width: 100%; height: auto; color: var(--ink); }
.wiki .figframe { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 20px 18px 12px; overflow-x: auto; }
.wiki figcaption { font-size: 13px; color: var(--muted); margin-top: 10px; max-width: 66ch; line-height: 1.5; }
.wiki .note { margin: 22px 0; padding: 14px 18px; }
.wiki .note p { max-width: 62ch; }
.wiki .note p + p { margin-top: 10px; }
.wiki .note .lbl { margin-bottom: 6px; }
.wiki-foot { border-top: 1px solid var(--rule); padding-top: 18px; font-size: 13px; color: var(--faint); }
.wiki-foot p { max-width: 90ch; }

/* The simulator's description (js/wiki/simdoc.js): the wiki's styles, plus what the page adds. */
.simdoc .wiki-toc ol { counter-reset: part; }
.simdoc .facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 28px; margin: -8px 0 28px; }
.simdoc .facts div { min-width: 0; }
.simdoc .facts dt { font: 10.5px "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.simdoc .facts dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.simdoc .figframe { padding: 14px; }
.simdoc .figframe img { display: block; width: 100%; height: auto; border-radius: 2px; background: #fff; }
.simdoc .figframe svg { min-width: 460px; }
.simdoc .figframe svg text { font-family: "IBM Plex Sans", sans-serif; }
.simdoc figcaption b { color: var(--ink); }
.simdoc .chain { list-style: none; margin: 18px 0 20px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; counter-reset: c; }
.simdoc .chain li { counter-increment: c; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 12px 14px; min-width: 0; }
.simdoc .chain li::before { content: counter(c); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font: 500 11.5px "IBM Plex Mono", monospace; margin-bottom: 6px; }
.simdoc .chain b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.simdoc .chain span { display: block; font-size: 13px; color: var(--muted); line-height: 1.45; }
.simdoc .chain .lvl { font: 10.5px "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-top: 6px; }
.simdoc tr.sep td { background: var(--raised); font: 500 11px "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.simdoc .tag { padding: 1px 6px; vertical-align: 1px; }
.simdoc .tag.ok { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.simdoc .tag.prior { color: var(--muted); border-color: var(--rule); background: var(--raised); }
.simdoc .tag.model { color: var(--comp); border-color: var(--comp); }
.simdoc .guide { display: grid; gap: 12px; margin: 16px 0 20px; }
.simdoc .guide > div { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 14px 18px 12px; min-width: 0; }
.simdoc .guide h3 { margin: 0 0 6px; font-size: 1rem; }
.simdoc .guide p { font-size: 14.5px; margin-bottom: 8px; }
.simdoc .guide p:last-child { margin-bottom: 0; }
.simdoc .guide .look { color: var(--muted); }
.simdoc .guide .look b { color: var(--ink); }
.simdoc pre { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 12px 16px; overflow-x: auto; font: 13px/1.6 "IBM Plex Mono", monospace; margin: 12px 0 16px; max-width: 86ch; }
.simdoc pre .c { color: var(--faint); }

/* --------------------------------------------------------------- glossary */
/* Abbreviations in the text (js/modules/glossary.js), their popup, and the glossary page. */

abbr.gl { text-decoration: underline dotted var(--faint); text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: help; border-radius: 2px; }
abbr.gl:hover, abbr.gl:focus-visible, abbr.gl[aria-describedby] { color: var(--accent); text-decoration-color: var(--accent); outline: none; }
.gl-pop {
  position: fixed; z-index: 50; width: max-content; max-width: min(340px, calc(100vw - 16px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: 0 8px 28px -10px rgba(0, 0, 0, .45); padding: 10px 14px; font-size: 13.5px; line-height: 1.5;
}
.gl-pop b { display: block; font-weight: 600; margin-bottom: 3px; }
.gl-pop p { margin: 0 0 6px; color: var(--muted); max-width: none; }
.gl-pop .links { display: flex; flex-wrap: wrap; gap: 4px 16px; font: 12px "IBM Plex Mono", monospace; }
.gloss { display: grid; gap: 10px; margin: 0; }
.gloss > div { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 12px 16px; scroll-margin-top: 16px; }
.gloss dt { font-weight: 600; }
.gloss dd { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; max-width: 72ch; }
.gloss dd a { font: 12px "IBM Plex Mono", monospace; white-space: nowrap; }

.err { color: var(--warn); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
