/* ==========================================================================
   RAID Toolkit — dark theme
   Shared stylesheet for index.html and raid-types.html
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg: #0a0d13;
  --bg-glow-1: rgba(79, 156, 249, 0.10);
  --bg-glow-2: rgba(34, 211, 238, 0.07);

  --surface: #111721;
  --surface-2: #161d29;
  --surface-3: #1c2534;
  --border: #232d3d;
  --border-strong: #31405a;

  --text: #e7eef8;
  --text-dim: #9dabc0;
  --text-faint: #6c7c93;

  --accent: #4f9cf9;
  --accent-soft: rgba(79, 156, 249, 0.14);
  --accent-line: rgba(79, 156, 249, 0.45);

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.13);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.13);

  --parity: #b78bf5;
  --parity-soft: rgba(183, 139, 245, 0.16);
  --spare: #94a3b8;
  --spare-soft: rgba(148, 163, 184, 0.14);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --maxw: 1180px;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

/* ---------------------------------------------------------------- reset -- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(58rem 30rem at 12% -8%, var(--bg-glow-1), transparent 60%),
    radial-gradient(48rem 26rem at 100% 0%, var(--bg-glow-2), transparent 62%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.22;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 { font-size: clamp(1.6rem, 1.2rem + 1.9vw, 2.5rem); }
h2 { font-size: clamp(1.22rem, 1.05rem + 0.8vw, 1.6rem); }
h3 { font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.22rem); }
h4 { font-size: 0.97rem; }

p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: currentColor; }

ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin-bottom: 0.35em; }

code, kbd, samp {
  font-family: var(--mono);
  font-size: 0.9em;
}
code {
  padding: 0.12em 0.42em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: #cfe3ff;
  white-space: nowrap;
}

hr {
  height: 1px;
  margin: 2rem 0;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

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

::selection { background: rgba(79, 156, 249, 0.32); }

/* --------------------------------------------------------------- layout -- */

.shell {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1rem, 0.55rem + 2.2vw, 2.25rem);
}

.site-head {
  position: relative;
  z-index: 2;
  padding-block: clamp(1.75rem, 1.2rem + 2.6vw, 3.25rem) clamp(1.25rem, 1rem + 1.2vw, 1.75rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.1rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent), #7c5cf0);
  color: #04101f;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
}

.lead {
  max-width: 62ch;
  margin-bottom: 1.4rem;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1rem);
  color: var(--text-dim);
}

/* ------------------------------------------------------------------ nav -- */

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(17, 23, 33, 0.72);
  backdrop-filter: blur(8px);
  width: fit-content;
  max-width: 100%;
}

.nav a {
  display: block;
  padding: 0.5rem 1.05rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 550;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
}

.nav a:hover {
  background: var(--surface-3);
  color: var(--text);
}

.nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: #cfe3ff;
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* ---------------------------------------------------------------- cards -- */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
}

.card__head {
  padding: 1.05rem clamp(1rem, 0.8rem + 0.6vw, 1.5rem);
  border-bottom: 1px solid var(--border);
}

.card__head h2,
.card__head h3 { margin: 0; }

.card__body { padding: clamp(1rem, 0.8rem + 0.6vw, 1.5rem); }

.eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ------------------------------------------------------------ calculator -- */

.calc-grid {
  display: grid;
  gap: clamp(1rem, 0.6rem + 1.4vw, 1.5rem);
  align-items: start;
  grid-template-columns: 1fr;
}

@media (min-width: 60rem) {
  .calc-grid { grid-template-columns: minmax(19rem, 23rem) minmax(0, 1fr); }
}

.field { margin-bottom: 1.1rem; }
.field:last-of-type { margin-bottom: 0; }

.field > label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.field__hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--text-faint);
}

.control {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem; /* >=16px stops iOS zooming on focus */
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.control:hover { border-color: #3d5070; }

.control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #080b10;
}

.control::placeholder { color: #55637a; }

.control[aria-invalid="true"] {
  border-color: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
}

select.control {
  appearance: none;
  padding-right: 2.6rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239dabc0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1.1rem;
}

.field__error {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--bad);
}

.field__error:empty { display: none; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.35rem;
}

.btn {
  flex: 1 1 9rem;
  min-height: 3rem;
  padding: 0.7rem 1.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: linear-gradient(180deg, #5aa4fa, var(--accent));
  color: #04101f;
  box-shadow: 0 10px 22px -14px rgba(79, 156, 249, 0.95);
}
.btn--primary:hover { filter: brightness(1.08); }

.btn--ghost {
  flex: 0 1 auto;
  border-color: var(--border-strong);
  background: transparent;
  color: var(--text-dim);
}
.btn--ghost:hover { background: var(--surface-3); color: var(--text); }

/* --------------------------------------------------------------- alerts -- */

.alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  padding: 0.8rem 0.95rem;
  margin-bottom: 1rem;
  border: 1px solid;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.alert:last-child { margin-bottom: 0; }

.alert__icon { font-size: 1rem; line-height: 1.45; }
.alert__body > * + * { margin-top: 0.3em; }
.alert ul { margin: 0.3em 0 0; padding-left: 1.15em; }

.alert--bad {
  border-color: rgba(248, 113, 113, 0.4);
  background: var(--bad-soft);
  color: #ffd4d4;
}
.alert--warn {
  border-color: rgba(251, 191, 36, 0.36);
  background: var(--warn-soft);
  color: #ffeec2;
}
.alert--info {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: #d6e7ff;
}

/* -------------------------------------------------------------- results -- */

.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.85rem;
}

.results-head h2 { margin: 0; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.badge--ok {
  border-color: rgba(52, 211, 153, 0.4);
  background: var(--ok-soft);
  color: #a9f3d8;
}
.badge--bad {
  border-color: rgba(248, 113, 113, 0.4);
  background: var(--bad-soft);
  color: #ffc9c9;
}
.badge--none {
  border-color: rgba(248, 113, 113, 0.4);
  background: var(--bad-soft);
  color: #ffc9c9;
}

.metrics {
  display: grid;
  gap: 0.7rem;
  /* Auto-fit so tiles never squeeze below a readable width on phones. */
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  margin-bottom: 1.25rem;
}

.metric {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  min-width: 0;
}

.metric__label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.metric__value {
  display: block;
  font-family: var(--mono);
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.metric__sub {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.metric--ok .metric__value { color: var(--ok); }
.metric--bad .metric__value { color: var(--bad); }
.metric--accent .metric__value { color: #8ec2ff; }

.sub-metrics {
  display: grid;
  gap: 0.5rem 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  padding: 0.9rem 1rem;
  margin-bottom: 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(10, 13, 19, 0.5);
}

.sub-metric { min-width: 0; }

.sub-metric__label {
  display: block;
  font-size: 0.74rem;
  color: var(--text-faint);
}

.sub-metric__value {
  display: block;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.note {
  padding: 0.95rem 1.05rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.92rem;
  color: var(--text-dim);
}

.note:empty { display: none; }
.note strong { color: var(--text); }

/* ----------------------------------------------------------- usage bar -- */

.usage { margin-bottom: 1.25rem; }

.usage__track {
  display: flex;
  height: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg);
}

.usage__seg {
  display: grid;
  place-items: center;
  min-width: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  transition: flex-basis 0.35s ease;
}

.usage__seg--usable {
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.4), rgba(52, 211, 153, 0.22));
  color: #b6f5de;
}
.usage__seg--overhead {
  background: repeating-linear-gradient(
    -45deg,
    rgba(148, 163, 184, 0.16),
    rgba(148, 163, 184, 0.16) 6px,
    rgba(148, 163, 184, 0.07) 6px,
    rgba(148, 163, 184, 0.07) 12px
  );
  color: #cbd5e1;
}

.usage__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin-top: 0.55rem;
  font-size: 0.8rem;
  color: var(--text-faint);
}

.usage__legend span { display: inline-flex; align-items: center; gap: 0.4rem; }

.usage__swatch {
  width: 0.7rem;
  height: 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  flex: none;
}
.usage__swatch--usable { background: rgba(52, 211, 153, 0.45); }
.usage__swatch--overhead { background: rgba(148, 163, 184, 0.25); }

/* ------------------------------------------------------------ diagrams -- */

.diagram { margin-bottom: 1.25rem; }
.diagram:empty { display: none; }

.diagram__scroll {
  overflow-x: auto;
  padding-bottom: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
}

.diagram__inner { padding: 0.85rem; min-width: max-content; }

.diagram__caption {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--text-faint);
}

.dg-block + .dg-block { margin-top: 1rem; }

.dg-block__title {
  margin: 0 0 0.4rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.dg-grid {
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(var(--cols, 4), minmax(2.6rem, 1fr));
}

.dg-cell {
  display: grid;
  place-items: center;
  min-height: 2rem;
  padding: 0.2rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text);
}

.dg-cell--data {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: #cfe3ff;
}
.dg-cell--p1 {
  background: var(--parity-soft);
  border-color: rgba(183, 139, 245, 0.5);
  color: #e2d2ff;
}
.dg-cell--p2 {
  background: rgba(244, 114, 182, 0.14);
  border-color: rgba(244, 114, 182, 0.45);
  color: #fbd0e4;
}
.dg-cell--spare {
  background: var(--spare-soft);
  border-color: rgba(148, 163, 184, 0.42);
  border-style: dashed;
  color: #cbd5e1;
}
.dg-cell--empty {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 5px,
    rgba(148, 163, 184, 0.09) 5px,
    rgba(148, 163, 184, 0.09) 10px
  );
  color: var(--text-faint);
}

.dg-head {
  margin-bottom: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-faint);
}

.dg-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin-top: 0.7rem;
  font-size: 0.76rem;
  color: var(--text-faint);
}

.dg-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }

.dg-legend i {
  width: 0.62rem;
  height: 0.62rem;
  border: 1px solid;
  border-radius: 3px;
  flex: none;
}
.dg-legend i.k-data { background: var(--accent-soft); border-color: var(--accent-line); }
.dg-legend i.k-p1 { background: var(--parity-soft); border-color: rgba(183, 139, 245, 0.5); }
.dg-legend i.k-p2 { background: rgba(244, 114, 182, 0.14); border-color: rgba(244, 114, 182, 0.45); }
.dg-legend i.k-spare { background: var(--spare-soft); border-color: rgba(148, 163, 184, 0.42); }
.dg-legend i.k-empty {
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--border-strong);
}

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

.doc { max-width: 78ch; }
.doc--wide { max-width: none; }

.section { scroll-margin-top: 5rem; }

.section__head { margin-bottom: 1rem; }

.section__head p {
  margin-bottom: 0;
  color: var(--text-dim);
}

.section + .section { margin-top: clamp(2rem, 1.5rem + 2vw, 3rem); }

.toc {
  padding: 1rem clamp(1rem, 0.8rem + 0.6vw, 1.4rem);
  margin-bottom: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.toc h2 {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.toc ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.92rem;
}

.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ----------------------------------------------------------- level docs -- */

.level {
  padding: clamp(1.05rem, 0.85rem + 0.8vw, 1.6rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  scroll-margin-top: 5rem;
}

.level + .level { margin-top: clamp(1rem, 0.8rem + 0.8vw, 1.4rem); }

.level__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.75rem;
}

.level__head h3 { margin: 0; }

.level__tag {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.level__stats {
  display: grid;
  gap: 0.4rem 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 0.84rem;
}

.level__stats div { min-width: 0; }
.level__stats dt { color: var(--text-faint); font-size: 0.76rem; }
.level__stats dd {
  margin: 0;
  font-family: var(--mono);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.level__cols {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 56rem) {
  .level__cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.formula {
  display: block;
  padding: 0.6rem 0.8rem;
  margin: 0 0 0.85rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #cfe3ff;
}

.ticks { margin: 0; padding-left: 1.2em; font-size: 0.92rem; }
.ticks li { color: var(--text-dim); }
.ticks li::marker { color: var(--accent); }

.good { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }

.callout {
  padding: 0.9rem 1.05rem;
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  font-size: 0.92rem;
}

.callout--info { border-left-color: var(--accent); background: var(--accent-soft); }
.callout--danger { border-left-color: var(--bad); background: var(--bad-soft); }
.callout > :last-child { margin-bottom: 0; }
.callout strong { color: #fff; }

/* -------------------------------------------------------------- tables -- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  min-width: 44rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data caption {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.86rem;
  text-align: left;
}

table.data th,
table.data td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

table.data thead th {
  position: sticky;
  top: 0;
  background: var(--surface-3);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

table.data tbody tr:last-child th,
table.data tbody tr:last-child td { border-bottom: 0; }

table.data tbody tr:hover { background: rgba(79, 156, 249, 0.05); }

table.data tbody th {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

table.data td.num {
  font-family: var(--mono);
  font-size: 0.86rem;
  white-space: nowrap;
}

table.data td.num.pos { color: var(--ok); }
table.data td.num.neg { color: var(--bad); }

.dl-glossary { display: grid; gap: 0.9rem; grid-template-columns: 1fr; margin: 0; }

@media (min-width: 44rem) {
  .dl-glossary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.dl-glossary div {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.dl-glossary dt {
  margin-bottom: 0.2rem;
  font-weight: 650;
  color: var(--text);
}
.dl-glossary dd { margin: 0; font-size: 0.9rem; color: var(--text-dim); }

/* --------------------------------------------------------------- footer -- */

.site-foot {
  padding-block: clamp(2rem, 1.5rem + 2vw, 3.5rem);
  margin-top: clamp(2rem, 1.5rem + 2vw, 3rem);
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
  color: var(--text-faint);
}

.site-foot p { margin-bottom: 0.4em; }

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
}

.btn-link {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  font-weight: 600;
  text-decoration: none;
}
.btn-link:hover { background: rgba(79, 156, 249, 0.22); }

/* ------------------------------------------------------------ utilities -- */

.stack-sm > * + * { margin-top: 0.6rem; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }
.text-center { text-align: center; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 20;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--accent);
  color: #04101f;
  font-weight: 650;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

.empty-state {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.92rem;
}

/* --------------------------------------------------------- preferences -- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .card,
  .metric,
  .control,
  .dg-cell,
  .alert { border: 1px solid CanvasText; }
  .usage__seg--usable { background: Highlight; color: HighlightText; }
}

@media print {
  body { background: #fff; color: #000; }
  .nav, .btn-row, .skip-link, .link-row { display: none; }
  .card, .metric, .diagram__scroll { box-shadow: none; border-color: #999; }
  .dg-cell--data { background: #e6eefc; }
}