/* Shared chrome for the interactive sketches. */
:root {
    --paper: #faf8f2;
    --ink: #1f1e1a;
    --muted: #7a766b;
    --rule: #e3dfd3;
    --accent: #FEDB09;
    --series-linear: #3a6ea5;
    --series-hermite: #9a7d00;
    --status-serious: #b3403a;
}
@media (prefers-color-scheme: dark) {
    :root {
        --paper: #1c1b18;
        --ink: #e8e4d8;
        --muted: #8f8b7f;
        --rule: #35332c;
        --series-linear: #4179bd;
        --series-hermite: #ab8800;
        --status-serious: #d06a5f;
    }
}
* { box-sizing: border-box; margin: 0; }
body {
    background: var(--paper);
    color: var(--ink);
    font-family: "Newsreader", Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.6;
    padding: 3rem 1.5rem 4rem;
}
main { max-width: 46rem; margin: 0 auto; }
.crumb { font-size: 0.9375rem; }
.crumb a {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid var(--rule);
    transition: border-color 120ms ease;
}
.crumb a:hover { border-color: var(--accent); }
h1 {
    margin-top: 1.5rem;
    font-size: 1.875rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
h1::after {
    content: "";
    display: block;
    width: 2rem;
    height: 3px;
    background: var(--accent);
    margin-top: 0.75rem;
}
.lede {
    margin-top: 1rem;
    color: var(--muted);
    font-style: italic;
}
/* ── controls ── */
.controls {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.75rem;
    font-size: 0.9375rem;
}
.seg { display: flex; gap: 0.125rem; }
.seg button {
    font: inherit;
    color: var(--muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.125rem 0.375rem;
    cursor: pointer;
}
.seg button[aria-pressed="true"] {
    color: var(--ink);
    border-bottom-color: var(--accent);
}
.nodes-ctl { display: flex; align-items: center; gap: 0.625rem; }
.nodes-ctl output {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8125rem;
    min-width: 4.5rem;
}
input[type="range"] {
    width: 10rem;
    height: 20px;
    -webkit-appearance: none;
    background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
    background: var(--rule); height: 4px; border-radius: 2px;
}
input[type="range"]::-moz-range-track {
    background: var(--rule); height: 4px; border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent); cursor: pointer; margin-top: -5px;
}
input[type="range"]::-moz-range-thumb {
    width: 14px; height: 14px; border: none; border-radius: 50%;
    background: var(--accent); cursor: pointer;
}
.jets-ctl { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; user-select: none; }
.jets-ctl input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
/* ── legend ── */
.legend {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 1.375rem;
    font-size: 0.9375rem;
    color: var(--muted);
}
.legend button, .legend .key {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.legend button { cursor: pointer; }
.legend button[aria-pressed="false"] { opacity: 0.35; }
.legend .swatch { width: 20px; height: 0; border-top: 2.5px solid; }
.legend .swatch.dashed { border-top-style: dashed; }
.legend .swatch.fill { height: 11px; border: none; }
/* ── charts ── */
figure { margin: 0.875rem 0 0; position: relative; }
svg { display: block; width: 100%; height: auto; }
.axis-label, .tick-label, .direct-label {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    fill: var(--muted);
}
.direct-label { font-size: 12px; }
.tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 0.375rem 0.625rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    line-height: 1.7;
    color: var(--ink);
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    white-space: nowrap;
    display: none;
    z-index: 2;
}
.tooltip .dot {
    display: inline-block;
    width: 8px; height: 8px; border-radius: 50%;
    margin-right: 0.375rem;
}
/* ── stat tiles ── */
.stats {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    border-top: 1px solid var(--rule);
    padding-top: 1.25rem;
}
.stat .num {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.375rem;
}
.stat .cap {
    font-size: 0.875rem;
    color: var(--muted);
}
/* ── prose ── */
.explain {
    margin-top: 2.5rem;
    border-top: 1px solid var(--rule);
    padding-top: 1.5rem;
    font-size: 1.0625rem;
}
.explain p + p { margin-top: 0.875rem; }
.explain a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--rule);
    transition: border-color 120ms ease;
}
.explain a:hover { border-color: var(--accent); }
