/* The 3D Statistics page (3d-statistics/index.html). Its own colour tokens,
   with a dark set under prefers-color-scheme, because the charts read them
   (assets/stats3d.js) as well as the page. */

:root {
  --s3-card: #ffffff;
  --s3-line: #d8e0ec;
  --s3-ink: #16233a;
  --s3-soft: #46566f;
  --s3-accent: #0f4c81;
  --s3-accent-bg: #e8f1fa;
  --s3-bar: #7fa8d1;
  --s3-bar-edge: #2f6ea8;
  --s3-c0: #0f6cbd;           /* variable 1 */
  --s3-c1: #c2410c;           /* variable 2 */
  --s3-c2: #0b7a5a;           /* variable 3 */
  --s3-c3: #7c3aed;           /* variable 4 */
  --s3-c4: #a16207;           /* variable 5 */
  --s3-curve: #b42318;
  --s3-grid: #e6ebf2;
  --s3-ok-bg: #e7f6ee;  --s3-ok-ink: #0b5e3c;
  --s3-no-bg: #fdecec;  --s3-no-ink: #9b1c1c;
  --s3-warn-bg: #fff6e0; --s3-warn-ink: #7a4b00;
  --s3-input: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --s3-card: #16202e;
    --s3-line: #2c3a4f;
    --s3-ink: #e6edf6;
    --s3-soft: #b3c0d2;
    --s3-accent: #8cc4f5;
    --s3-accent-bg: #1c2d42;
    --s3-bar: #3b6a99;
    --s3-bar-edge: #8cc4f5;
    --s3-c0: #6fb6ff;
    --s3-c1: #ffa36b;
    --s3-c2: #5fd3a6;
    --s3-c3: #c4a5ff;
    --s3-c4: #f2c14e;
    --s3-curve: #ff8a80;
    --s3-grid: #243246;
    --s3-ok-bg: #12352a;  --s3-ok-ink: #9be8c3;
    --s3-no-bg: #3a1a1c;  --s3-no-ink: #ffb4b0;
    --s3-warn-bg: #3a2e12; --s3-warn-ink: #ffd98a;
    --s3-input: #0f1722;
  }
}

.s3-privacy { font-size: .95rem; opacity: .95; margin-top: .4rem; }
.s3 { padding-bottom: 48px; }
.s3 h2 { margin-top: 1.6rem; }
.s3-small { font-size: .9rem; color: var(--s3-soft); }
.s3-note { background: var(--s3-warn-bg); color: var(--s3-warn-ink); padding: 10px 14px; border-radius: 10px; }

.s3-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 22px 0 6px;
  position: sticky; top: 0; z-index: 5; padding: 8px 0;
  background: var(--ground, #f4f6fa);
}
@media (prefers-color-scheme: dark) { .s3-tabs { background: #0d1520; } }
.s3-tabs a {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--s3-line);
  background: var(--s3-card); color: var(--s3-ink); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.s3-tabs a[aria-selected="true"] { background: var(--s3-accent); border-color: var(--s3-accent); color: #fff; }
@media (prefers-color-scheme: dark) { .s3-tabs a[aria-selected="true"] { color: #0d1520; } }
.s3-tabs a:focus-visible { outline: 3px solid var(--s3-accent); outline-offset: 2px; }

.s3-panel {
  background: var(--s3-card); border: 1px solid var(--s3-line); border-radius: 14px;
  padding: 6px 22px 22px; margin: 14px 0; color: var(--s3-ink);
}
.s3-panel[hidden] { display: none; }
@media (max-width: 600px) { .s3-panel { padding: 4px 14px 16px; } }

.s3-controls { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; margin: 12px 0; }
.s3-controls label, .s3-form > label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--s3-soft); font-weight: 600; }
.s3-inline { display: inline-flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; }
.s3-inline label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--s3-soft); font-weight: 600; }
.s3 input[type="text"], .s3 input[type="number"], .s3 select, .s3 textarea {
  font: inherit; font-size: 1rem; color: var(--s3-ink); background: var(--s3-input);
  border: 1px solid var(--s3-line); border-radius: 8px; padding: 7px 9px; min-width: 0;
}
.s3 input[type="number"] { width: 9.5em; }
.s3-name input { width: 9em; }
.s3 textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; }
.s3 select { max-width: 100%; }
.s3 button {
  font: inherit; font-weight: 600; cursor: pointer; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--s3-accent); background: var(--s3-accent); color: #fff; margin: 4px 6px 4px 0;
}
@media (prefers-color-scheme: dark) { .s3 button { color: #0d1520; } }
.s3 button.s3-quiet { background: transparent; color: var(--s3-accent); }
.s3 button:focus-visible, .s3 input:focus-visible, .s3 select:focus-visible, .s3 textarea:focus-visible {
  outline: 3px solid var(--s3-accent); outline-offset: 2px;
}
.s3-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.s3-check { display: inline-flex; gap: 6px; align-items: center; font-size: .95rem; }
.s3-paste { margin: 12px 0; }
.s3-paste summary { cursor: pointer; font-weight: 600; color: var(--s3-accent); }
.s3-paste label { display: block; margin: 8px 0 4px; font-size: .9rem; color: var(--s3-soft); }

.s3-grid { border-collapse: collapse; margin: 10px 0; }
.s3-grid th, .s3-grid td { border: 1px solid var(--s3-line); padding: 0; text-align: center; }
.s3-grid th { padding: 5px 8px; font-size: .9rem; background: var(--s3-accent-bg); color: var(--s3-ink); }
.s3-grid th.s3-row { color: var(--s3-soft); font-weight: 500; min-width: 2.6em; }
.s3-grid input { border: 0 !important; border-radius: 0 !important; width: 7.5em; text-align: right; padding: 6px 8px; background: var(--s3-input); }
.s3-grid input.s3-bad { background: var(--s3-no-bg); color: var(--s3-no-ink); }
.s3-status { min-height: 1.4em; font-size: .95rem; }
.s3-status .s3-err { color: var(--s3-no-ink); }
.s3-next { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.s3-go { padding: 8px 14px; border-radius: 999px; background: var(--s3-accent-bg); color: var(--s3-accent); font-weight: 600; text-decoration: none; }

.s3-table { border-collapse: collapse; margin: 10px 0 16px; font-size: .95rem; min-width: 18em; }
.s3-table th, .s3-table td { border-bottom: 1px solid var(--s3-line); padding: 6px 10px; text-align: right; vertical-align: top; }
.s3-table th:first-child, .s3-table td:first-child { text-align: left; }
.s3-table thead th { border-bottom: 2px solid var(--s3-accent); color: var(--s3-ink); }
.s3-table td.s3-l, .s3-table th.s3-l { text-align: left; }
.s3-table a { color: var(--s3-accent); }
.s3-table tr.s3-dim td { color: var(--s3-soft); }
.s3-num { font-variant-numeric: tabular-nums; }
.s3-sub { color: var(--s3-soft); font-size: .85rem; }

.s3-card {
  border: 1px solid var(--s3-line); border-left: 5px solid var(--s3-accent); border-radius: 10px;
  padding: 4px 18px 14px; margin: 16px 0; background: var(--s3-card);
}
.s3-card h3 { margin-top: 12px; }
.s3-learn { font-size: .92rem; }
.s3-learn a { color: var(--s3-accent); font-weight: 600; }
.s3-decision { border-radius: 10px; padding: 10px 14px; margin: 12px 0; font-weight: 600; }
.s3-decision.s3-reject { background: var(--s3-no-bg); color: var(--s3-no-ink); }
.s3-decision.s3-keep { background: var(--s3-ok-bg); color: var(--s3-ok-ink); }
.s3-decision.s3-na { background: var(--s3-warn-bg); color: var(--s3-warn-ink); }
.s3-working { overflow-x: auto; }
.s3-working details { margin: 8px 0; }
.s3 details > summary { cursor: pointer; color: var(--s3-accent); font-weight: 600; }

.s3-chart { margin: 10px 0 18px; }
.s3-chart svg { width: 100%; height: auto; max-width: 760px; display: block; }
.s3-chart figcaption { font-size: .88rem; color: var(--s3-soft); margin-top: 4px; }
.s3-chart text { fill: var(--s3-ink); font-size: 12px; font-family: inherit; }
.s3-chart .s3-axis { stroke: var(--s3-soft); stroke-width: 1; }
.s3-chart .s3-gridline { stroke: var(--s3-grid); stroke-width: 1; }
.s3-chart .s3-barrect { fill: var(--s3-bar); stroke: var(--s3-bar-edge); stroke-width: 1; }
.s3-chart .s3-curve { fill: none; stroke: var(--s3-curve); stroke-width: 2.2; }
.s3-chart .s3-pt { stroke: var(--s3-card); stroke-width: .8; }
.s3-chart .s3-line0 { stroke: var(--s3-c0); stroke-width: 2; }
.s3-chart .s3-line1 { stroke: var(--s3-c1); stroke-width: 2; stroke-dasharray: 6 4; }
.s3-chart .s3-ref { stroke: var(--s3-soft); stroke-width: 1.4; stroke-dasharray: 5 4; fill: none; }
.s3-chart .s3-box0 { fill: var(--s3-accent-bg); stroke: var(--s3-c0); stroke-width: 2; }
.s3-chart .s3-box1 { fill: var(--s3-accent-bg); stroke: var(--s3-c1); stroke-width: 2; }
.s3-chart .s3-box2 { fill: var(--s3-accent-bg); stroke: var(--s3-c2); stroke-width: 2; }
.s3-c0 { fill: var(--s3-c0); stroke: var(--s3-c0); }
.s3-c1 { fill: var(--s3-c1); stroke: var(--s3-c1); }
.s3-c2 { fill: var(--s3-c2); stroke: var(--s3-c2); }
.s3-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .9rem; color: var(--s3-soft); margin: 4px 0; }
.s3-legend i { display: inline-block; width: 18px; height: 3px; vertical-align: middle; margin-right: 6px; }

.s3-3d { position: relative; max-width: 760px; }
.s3-3d canvas { width: 100%; height: auto; display: block; border: 1px solid var(--s3-line); border-radius: 10px;
  background: var(--s3-card); touch-action: none; cursor: grab; }
.s3-3d canvas:active { cursor: grabbing; }
.s3-3d canvas:focus-visible { outline: 3px solid var(--s3-accent); outline-offset: 2px; }

.s3-dist-name { font-weight: 600; }
.s3-badge { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.s3-badge.s3-keep { background: var(--s3-ok-bg); color: var(--s3-ok-ink); }
.s3-badge.s3-reject { background: var(--s3-no-bg); color: var(--s3-no-ink); }
.s3-badge.s3-na { background: var(--s3-warn-bg); color: var(--s3-warn-ink); }

.s3-about { margin-top: 26px; }
.s3-about li { margin: 6px 0; }
.s3-chart .s3-ovline, .s3-legend .s3-ovline { fill: none; stroke-width: 2.4; }
.s3-chart .s3-ovthin { stroke-width: 1.3; opacity: .8; }
.s3-ov0 { stroke: var(--s3-curve); fill: var(--s3-curve); }
.s3-ov1 { stroke: var(--s3-c0); fill: var(--s3-c0); stroke-dasharray: 7 4; }
.s3-ov2 { stroke: var(--s3-c1); fill: var(--s3-c1); stroke-dasharray: 2 3; }
.s3-ov3 { stroke: var(--s3-c2); fill: var(--s3-c2); stroke-dasharray: 10 3 2 3; }
.s3-ov4 { stroke: var(--s3-c3); fill: var(--s3-c3); stroke-dasharray: 1 3; }
.s3-chart .s3-fitpt { fill: none; stroke: var(--s3-c4); stroke-width: 1.4; }
.s3-chart .s3-ovdot { stroke-dasharray: none; stroke-width: 1; }
.s3-legend svg { vertical-align: middle; }
/* A jump to a panel lands below the sticky tab bar, not under it. */
.s3-panel, .s3 h2, .s3 h3 { scroll-margin-top: 72px; }
/* site-dark.css puts a light panel behind every inline SVG, because the
   course diagrams were drawn for a white page. These charts take their
   colours from the tokens above, so they keep the page's own background. */
.s3 .s3-chart svg { background: var(--s3-card); border-radius: 8px; }
.s3 .s3-legend svg { background: none; }
/* On a phone the four tabs sit in one row that scrolls sideways, not three
   rows that cover the content. */
@media (max-width: 700px) {
  .s3-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .s3-tabs a { white-space: nowrap; font-size: .85rem; padding: 6px 11px; }
}
/* Label-and-value tables of a test result: on a phone each label sits above
   its value, so a long interval is never pushed out of sight. */
.s3-kv { width: 100%; max-width: 40rem; }
.s3-kv td:first-child { width: 45%; }
@media (max-width: 600px) {
  .s3-kv, .s3-kv tbody, .s3-kv tr, .s3-kv td { display: block; width: auto !important; }
  .s3-kv td:first-child { border-bottom: 0; padding-bottom: 0; color: var(--s3-soft); font-size: .88rem; }
  .s3-kv td + td { padding-top: 2px; }
}

/* Variables 4 and 5 (the calculator takes up to five). */
.s3-chart .s3-box3 { fill: var(--s3-accent-bg); stroke: var(--s3-c3); stroke-width: 2; }
.s3-chart .s3-box4 { fill: var(--s3-accent-bg); stroke: var(--s3-c4); stroke-width: 2; }
.s3-c3 { fill: var(--s3-c3); stroke: var(--s3-c3); }
.s3-c4 { fill: var(--s3-c4); stroke: var(--s3-c4); }
/* Grid cells past a column's own sample size: there is nothing to type. */
.s3-grid td.s3-off { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--s3-line) 6px 7px); }
.s3-grid th .s3-sub { font-weight: 500; }
.s3-balance { background: var(--s3-accent-bg); border-radius: 10px; padding: 8px 12px; font-size: .95rem; }
.s3 h3[id^="step-"] { margin-bottom: .3rem; }
.s3-nowrap { white-space: nowrap; }
