/*
 * Design tokens shared by the 3D explorer, the spectrum explorer and the wiki.
 * One source for the palette and the type, so the three surfaces cannot drift apart.
 * Fonts are served from this origin (assets/fonts); nothing is fetched from a font service.
 */
@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}

:root {
  /* surfaces */
  --bg: #05070b; /* space */
  --surface: #0e1015; /* cards, reading surface */
  --panel: rgba(14, 16, 21, 0.9); /* panels floating over the 3D view */
  --line: #2a2d34;
  --hi: #1f2a3a; /* selected control */
  /* text */
  --ink: #f0efec;
  --ink2: #b9b7b0;
  --muted: #7d7b75;
  /* accents */
  --acc: #4f8fe0; /* links, focus rings */
  --acc-ink: #8fd0ff; /* live readouts, probes */
  --warn: #ffcf7a; /* caveats, pins */
  /* type */
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  /* touch: minimum target size on coarse pointers */
  --touch-min: 44px;
}

/* Layout idea: instrument console: a sticky control rail on the left, readouts (tiles, spectrum, bin table) on the right. */
:root {
  color-scheme: light;
  --bg: #f4f5f3; /* page plane, faint green-gray */
  --panel: #fcfcfb; /* chart surface */
  --ink: #0f1412;
  --ink-2: #4b524e;
  --muted: #858c87;
  --line: #dfe3df;
  --accent: #1d6f5a; /* controls, focus */
  --accent-wash: #e3efea;
  --warn: #b26a00;
  --warn-wash: #fff4dc;
  --s-gcr: #2a78d6;
  --s-sep: #eb6834;
  --s-trapped: #1baf7a;
  --s-albedo: #eda100;
  --s-secondary: #e87ba4;
  --s-cxb: #008300;
  --s-solar: #6250d6;
  --s-plasma: #e34948;
  --s-total: #0b0b0b;
  --font-display: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0f1211;
    --panel: #171b19;
    --ink: #edf0ed;
    --ink-2: #b9c0bb;
    --muted: #858c87;
    --line: #2a302d;
    --accent: #4fc29f;
    --accent-wash: #1c2b26;
    --warn: #f0b44c;
    --warn-wash: #2b2416;
    --s-gcr: #3987e5;
    --s-sep: #d95926;
    --s-trapped: #199e70;
    --s-albedo: #c98500;
    --s-secondary: #d55181;
    --s-cxb: #008300;
    --s-solar: #9085e9;
    --s-plasma: #e66767;
    --s-total: #f0efec;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f1211;
  --panel: #171b19;
  --ink: #edf0ed;
  --ink-2: #b9c0bb;
  --muted: #858c87;
  --line: #2a302d;
  --accent: #4fc29f;
  --accent-wash: #1c2b26;
  --warn: #f0b44c;
  --warn-wash: #2b2416;
  --s-gcr: #3987e5;
  --s-sep: #d95926;
  --s-trapped: #199e70;
  --s-albedo: #c98500;
  --s-secondary: #d55181;
  --s-cxb: #008300;
  --s-solar: #9085e9;
  --s-plasma: #e66767;
  --s-total: #f0efec;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--font-body);
}
.app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0;
  min-height: 100%;
}
aside {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 18px 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
main {
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
h1 {
  font: 600 22px/1.15 var(--font-display);
  margin: 0 0 4px;
  letter-spacing: 0.01em;
  text-wrap: balance;
}
.sub {
  color: var(--ink-2);
  font-size: 12.5px;
  margin: 0 0 14px;
}
fieldset {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 12px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
legend {
  font: 600 11px/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  padding: 0 0 6px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.row {
  display: flex;
  gap: 8px;
}
.row > * {
  flex: 1;
}
select,
input[type='number'],
input[type='text'] {
  font: 13px var(--font-body);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  width: 100%;
}
input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}
.val {
  font-family: var(--font-mono);
  color: var(--ink);
  font-size: 12.5px;
}
.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}
.seg button {
  flex: 1;
  font: 500 12.5px var(--font-body);
  padding: 7px 4px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.seg button[aria-pressed='true'] {
  background: var(--accent-wash);
  color: var(--accent);
  font-weight: 600;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.chip {
  font: 12px var(--font-body);
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.chip:hover,
.seg button:hover {
  color: var(--accent);
}
.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.check input {
  accent-color: var(--accent);
}
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.hint {
  font-size: 11.5px;
  color: var(--muted);
}
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.tile .k {
  font-size: 11.5px;
  color: var(--ink-2);
}
.tile .v {
  font: 500 19px/1.2 var(--font-mono);
  margin-top: 3px;
}
.tile .u {
  font-size: 11px;
  color: var(--muted);
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  min-width: 0;
}
.card h2 {
  font: 600 15px/1.2 var(--font-display);
  margin: 0;
  letter-spacing: 0.01em;
}
.cardhead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tabs button {
  font: 500 12.5px var(--font-body);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.tabs button[aria-selected='true'] {
  background: var(--ink);
  color: var(--panel);
  border-color: var(--ink);
}
#chart {
  width: 100%;
  height: 440px;
}
.flags {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.flag {
  background: var(--warn-wash);
  border-left: 3px solid var(--warn);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--ink);
}
.tablewrap {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
}
th,
td {
  text-align: right;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th:first-child,
td:first-child,
.el {
  text-align: left;
}
th {
  font-weight: 600;
  color: var(--ink-2);
  font-size: 11.5px;
}
td {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
td.zero {
  color: var(--muted);
}
.swatch {
  display: inline-block;
  width: 10px;
  height: 3px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 5px;
}
.btn {
  font: 500 12.5px var(--font-body);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent-wash);
  color: var(--accent);
  cursor: pointer;
}
.meta {
  font-size: 12px;
  color: var(--ink-2);
}
.notes {
  columns: 2 320px;
  column-gap: 28px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.notes p {
  margin: 0 0 8px;
  break-inside: avoid;
}
.notes b {
  color: var(--ink);
  font-weight: 600;
}
@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
  }
  aside {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  main {
    padding: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
/* links to the rest of the site, and the version footer */
.sitelinks {
  display: flex;
  gap: 6px;
  margin: 0 0 10px;
}
.sitelinks a {
  color: var(--ink-2);
  font-size: 12px;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}
.sitelinks a:hover {
  color: var(--ink);
  border-color: var(--accent);
}
.foot {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  margin: 0;
  padding: 14px 18px 22px;
}
.notes a {
  color: var(--accent);
}
