/* NAI demo: a laboratory notebook. Paper and ink, a serif for what is said, a mono for what is
   measured; the law in a signal colour over the ink of the data. No build step. */

/* Newsreader upright: one variable file, weights 200 to 800 */
@font-face { font-family: "Newsreader"; src: url(fonts/newsreader.woff2) format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(fonts/ibm-plex-mono-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(fonts/ibm-plex-mono-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --paper: #f4f1e8;
  --paper2: #ebe7da;
  --card: #fbf9f3;
  --line: #d6d0bf;
  --line2: #c3bca7;
  --ink: #1b1a16;
  --ink2: #4a473e;
  --muted: #7d786b;
  --accent: #23395b;          /* ink blue: links, controls */
  --accent-ink: #f4f1e8;
  --accent-soft: #dde3ea;
  --law: #5c6bcb;             /* the law: a signal colour over the ink of the data */
  --good: #2f6b3f;
  --warn: #9a6512;
  --bad: #a83a2c;
  --point: #1b1a16;
  --g0: #5c6bcb; --g1: #2f8a6e; --g2: #a8466e;
  --bar: #1b1a16;             /* the title bars of the windows */
  --bar-ink: #f4f1e8;
  --radius: 4px;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141411; --paper2: #1b1b17; --card: #1d1d19; --line: #34332c; --line2: #4a483f;
    --ink: #ebe7da; --ink2: #bdb8a9; --muted: #8b8677; --accent: #9db7d8; --accent-ink: #141411; --accent-soft: #232b35;
    --law: #8f9bea; --good: #76b88a; --warn: #e0a64a; --bad: #ef7b6c; --point: #ebe7da;
    --g0: #8f9bea; --g1: #5cc0a0; --g2: #e07aa0; --bar: #ebe7da; --bar-ink: #141411;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141411; --paper2: #1b1b17; --card: #1d1d19; --line: #34332c; --line2: #4a483f;
  --ink: #ebe7da; --ink2: #bdb8a9; --muted: #8b8677; --accent: #9db7d8; --accent-ink: #141411; --accent-soft: #232b35;
  --law: #8f9bea; --good: #76b88a; --warn: #e0a64a; --bad: #ef7b6c; --point: #ebe7da;
  --g0: #8f9bea; --g1: #5cc0a0; --g2: #e07aa0; --bar: #ebe7da; --bar-ink: #141411;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--law); }
code, pre, textarea, .formula { font-family: var(--mono); }
code { font-size: 0.9em; background: var(--paper2); padding: 1px 5px; border-radius: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 300; line-height: 1.06; margin: 0 0 0.45em; letter-spacing: -0.02em; }
h1 { font-size: clamp(42px, 6vw, 76px); }
h1 em, h2 em { font-style: normal; color: var(--law); }
h2 { font-size: clamp(32px, 4vw, 48px); }
h3 { font-size: 24px; font-weight: 400; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
section { padding: 72px 0; scroll-margin-top: 72px; }
.band { background: var(--paper2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.sub { color: var(--ink2); margin: -2px 0 30px; max-width: 760px; }

/* NAI in a pipeline: the steps in a row, arrows between them, a loop back to the first */
.pipe-tabs { margin-bottom: 26px; }
@media (max-width: 560px) {
  .seg.pipe-tabs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; border-radius: 14px; }
  .pipe-tabs span { text-align: center; border-bottom: 1px solid var(--line); }
  .pipe-tabs label:nth-child(2n) span { border-right: 0; }
  .pipe-tabs label:nth-child(n+3) span { border-bottom: 0; }
}
.pipe-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 30px; }
.pipe-step { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 16px;
  background: var(--card); border: 1px solid var(--line2); border-radius: var(--radius); }
.pipe-step:not(:last-child)::after { content: "\2192"; position: absolute; right: -24px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font: 16px var(--mono); }
.pipe-step.nai { border-color: var(--law); box-shadow: 6px 6px 0 color-mix(in srgb, var(--ink) 10%, transparent); }
.pipe-step.nai::before { content: ""; position: absolute; left: -1px; right: -1px; top: -1px; height: 3px; background: var(--law);
  border-radius: var(--radius) var(--radius) 0 0; }
.pipe-no { font: 11.5px var(--mono); color: var(--muted); }
.pipe-step.nai .pipe-no { color: var(--law); }
.pipe-step b { font: 400 19px/1.15 var(--serif); letter-spacing: -0.01em; }
.pipe-step p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink2); }
.pipe-step code { margin-top: auto; padding: 8px 0 0; background: none; border-radius: 0; font: 11.5px/1.45 var(--mono); color: var(--ink); overflow-wrap: break-word;
  border-top: 1px dashed var(--line2); }
.pipe-loop { position: relative; height: 26px; margin: 10px 10% 0; border: 1px dashed var(--line2); border-top: 0;
  border-radius: 0 0 12px 12px; }
.pipe-loop::before { content: "\2191"; position: absolute; left: -6px; top: -10px; color: var(--muted); font: 14px/1 var(--mono); }
.pipe-loop code { white-space: nowrap; }
.pipe-note { margin: 34px 0 0; max-width: 760px; font-size: 13.5px; color: var(--muted); }
.pipe-loop span { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); padding: 0 12px; background: var(--paper);
  font: 12px var(--mono); color: var(--ink2); white-space: nowrap; }
.pipe-ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 56px; border-top: 1px solid var(--line2); }
.pipe-ways > div { padding: 18px 20px 4px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.pipe-ways > div:first-child { padding-left: 0; }
.pipe-ways > div:last-child { border-right: 0; padding-right: 0; }
.pipe-ways code { font: 12px var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.pipe-ways p { margin: 0; font-size: 14px; color: var(--ink2); }
@media (max-width: 1000px) {
  .pipe-steps { grid-template-columns: minmax(0, 1fr); gap: 28px; max-width: 560px; }
  .pipe-step:not(:last-child)::after { content: "\2193"; right: auto; left: 50%; top: auto; bottom: -25px; transform: translateX(-50%); }
  .pipe-loop { height: auto; margin: 14px 0 0; border: 0; max-width: 560px; }
  .pipe-loop::before { content: "\21BA"; position: static; margin-right: 8px; }
  .pipe-loop span { position: static; transform: none; padding: 0; white-space: normal; background: none; }
  .pipe-ways { grid-template-columns: minmax(0, 1fr); }
  .pipe-ways > div { padding: 16px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .pipe-ways > div:last-child { border-bottom: 0; }
}
.small { font-size: 13px; }
.muted { color: var(--muted); }
.privacy-note { margin: 30px 0 0; }
.note { color: var(--muted); font: 12px/1.5 var(--mono); margin-top: 16px; }
.eyebrow, .sec-no { font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.eyebrow { display: block; margin-bottom: 22px; }
.sec-head { display: flex; align-items: baseline; gap: 18px; border-bottom: 1px solid var(--line2); padding-bottom: 12px; margin-bottom: 18px; }
.sec-head h2 { margin: 0; }
.sec-no { min-width: 30px; }

/* icons: inline SVG from icons.js */
i[data-icon] { display: inline-flex; width: 1.1em; height: 1.1em; flex: none; }
i[data-icon] svg { width: 100%; height: 100%; stroke-width: 1.6; }

/* the header: a floating bar */
.top { position: sticky; top: 0; z-index: 10; width: 100%; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); }
.top-row { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { display: block; height: 46px; width: auto; }
/* the logo for the theme in view */
.brand .logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .logo-light { display: none; }
  :root:not([data-theme="light"]) .brand .logo-dark { display: block; }
}
:root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .brand .logo-dark { display: block; }
.top-right { display: flex; align-items: center; gap: 22px; }
.nav { display: flex; gap: 22px; flex-wrap: wrap; }
.nav a { color: var(--ink2); font: 13px var(--mono); text-decoration: none; }
.nav a:hover { color: var(--law); }
.theme { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; color: var(--ink2); cursor: pointer; padding: 0; }
.theme:hover { color: var(--law); border-color: var(--law); }
.theme i { width: 16px; height: 16px; }
@media (max-width: 720px) { .nav { display: none; } }

/* the hero: a field of measurements, the law through them */
.hero { position: relative; padding: 70px 0 56px; overflow: hidden; }
.hero-field { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.hero .wrap { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 44px; align-items: center; margin-bottom: 40px; }
@media (max-width: 920px) { .hero-grid { grid-template-columns: 1fr; } }
.lead { font-size: clamp(17px, 1.7vw, 20px); color: var(--ink2); max-width: 600px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 30px 0 0; }
.stats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line2); }
.stats li { padding: 16px 20px 4px; border-right: 1px solid var(--line); }
.stats li:first-child { padding-left: 0; }
.stats li:last-child { border-right: 0; padding-right: 0; }
.stats b { display: block; font: 600 28px/1 var(--serif); letter-spacing: -0.01em; margin-bottom: 8px; }
/* two lines: what was measured, and the place */
.stats span, .stats em { display: block; font: 11.5px/1.5 var(--mono); }
.stats span { color: var(--ink2); }
.stats em { font-style: normal; color: var(--ink); margin-top: 2px; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats li { padding-bottom: 14px; }
  .stats li:nth-child(2n+1) { padding-left: 0; } .stats li:nth-child(2n) { border-right: 0; padding-right: 0; }
  .stats li:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr; } .stats li, .stats li:nth-child(2n) { padding-left: 0; padding-right: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .stats li:last-child { border-bottom: 0; } }

/* buttons: pills, with a dot */
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 10px 20px; border-radius: 999px;
  border: 1px solid var(--line2); background: var(--card); color: var(--ink); font: 500 14px var(--sans); cursor: pointer; text-decoration: none; }
.btn::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-left: 6px; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: var(--law); border-color: var(--law); color: var(--paper); }
.btn:disabled { opacity: 0.5; cursor: progress; }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn.small::after { display: none; }

/* windows: a title bar, a body (the instrument's panels) */
.hero-anim, .viewer { border: 1px solid var(--ink); border-radius: var(--radius); background: var(--card); }
.hero-anim { margin: 0; min-height: 380px; display: flex; flex-direction: column; box-shadow: 6px 6px 0 color-mix(in srgb, var(--ink) 10%, transparent); }
.win-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 5px 10px;
  background: var(--bar); color: var(--bar-ink); font: 12px var(--mono); letter-spacing: 0.02em; }
.win-bar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--law); display: inline-block; margin-right: 6px; }
.win-body { padding: 12px 16px 10px; flex: 1; }
.hero-cap { display: flex; gap: 8px; align-items: center; font: 12px var(--mono); color: var(--ink2); margin-bottom: 4px; }
.hero-cap b { color: var(--ink); font-weight: 500; }
.hero-cap i { color: var(--law); }

/* examples: a numbered index, then the window */
.ex-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; margin-bottom: 26px; border-top: 1px solid var(--line2); border-bottom: 1px solid var(--line2); }
@media (max-width: 1000px) { .ex-grid { grid-template-columns: repeat(3, 1fr); border-bottom: 0; } .ex-grid .ex-card { border-bottom: 1px solid var(--line2); }
  .ex-grid .ex-card:nth-child(3n) { border-right: 0; } }
@media (max-width: 520px) { .ex-grid { grid-template-columns: 1fr 1fr; }
  .ex-grid .ex-card:nth-child(3n) { border-right: 1px solid var(--line); } .ex-grid .ex-card:nth-child(2n) { border-right: 0; } }
.ex-card { text-align: left; border: 0; border-right: 1px solid var(--line); background: transparent; padding: 14px 14px 16px;
  cursor: pointer; color: var(--ink); font: inherit; display: flex; flex-direction: column; gap: 6px; position: relative; }
.ex-card:last-child { border-right: 0; }
.ex-card:hover { background: var(--card); }
.ex-card[aria-selected="true"] { background: var(--card); }
.ex-card[aria-selected="true"]::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 3px; background: var(--law); }
.ex-no { font: 11px var(--mono); color: var(--muted); letter-spacing: 0.06em; }
.ex-card .ex-title { font: 400 18px/1.15 var(--serif); letter-spacing: -0.01em; }
.ex-card .ex-tag { font: 11.5px/1.4 var(--mono); color: var(--ink2); }

/* the result / example viewer */
.viewer:empty { display: none; }
.viewer { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 30px; padding: 0 22px 22px; box-shadow: 6px 6px 0 color-mix(in srgb, var(--ink) 10%, transparent); }
.viewer::before { content: attr(data-title); grid-column: 1 / -1; margin: 0 -22px 18px; padding: 5px 12px;
  background: var(--bar); color: var(--bar-ink); font: 12px var(--mono); letter-spacing: 0.02em; }
@media (max-width: 860px) { .viewer { grid-template-columns: minmax(0, 1fr); row-gap: 24px; } }
.viewer h3 { margin-top: 0; }
.viewer .about { color: var(--ink2); }
/* what kind of answer: a plate with a rule on the left; the same colours in both themes */
.badge { display: inline-flex; align-items: center; font: 500 11.5px var(--mono); letter-spacing: 0.04em;
  text-transform: uppercase; padding: 4px 10px; border: 0; border-left: 3px solid; border-radius: 0; color: #000; }
.badge.solved { background: #88e17d; border-left-color: #438b49; }
.badge.approx, .badge.noise { background: #ffd46e; border-left-color: #e0a64a; }
.badge.none { background: #ffb3a8; border-left-color: #a83a2c; }
.formula { font-size: 19px; padding: 14px 16px; background: var(--paper); border-left: 3px solid var(--law); overflow-x: auto;
  white-space: nowrap; margin: 14px 0; }
.formula.long { font-size: 14px; }
.formula-label { font: 11.5px var(--mono); color: var(--muted); margin: 10px 0 -8px; text-transform: uppercase; letter-spacing: 0.06em; }
.metrics { display: grid; grid-template-columns: auto 1fr; gap: 3px 16px; font: 13px var(--mono); margin: 12px 0; }
.metrics dt { color: var(--muted); }
.metrics dd { margin: 0; }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line2); }
.chart .tick { fill: var(--muted); font: 11px var(--mono); }
.chart .label { fill: var(--ink2); font: 12px var(--mono); }
.chart .curve { fill: none; stroke: var(--law); stroke-width: 2; }
.chart .curve.faint { stroke-dasharray: 6 5; opacity: 0.7; }
.chart .pt { fill: var(--point); }
.chart .curve.g0 { stroke: var(--g0); } .chart .curve.g1 { stroke: var(--g1); } .chart .curve.g2 { stroke: var(--g2); }
.chart .pt.g0 { fill: var(--g0); } .chart .pt.g1 { fill: var(--g1); } .chart .pt.g2 { fill: var(--g2); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font: 12px var(--mono); color: var(--ink2); margin-top: 6px; }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: 0; background: var(--point); }
.legend .l-curve::before { border-radius: 1px; height: 2px; width: 16px; vertical-align: 3px; background: var(--law); }
.sw::before, .lg::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.sw.g0::before, .lg.g0::before { background: var(--g0); }
.sw.g1::before, .lg.g1::before { background: var(--g1); }
.sw.g2::before, .lg.g2::before { background: var(--g2); }
.legend .lg { font-weight: 500; }
/* the forecast band, the cut where the data end, the truth not shown, the runs proposed next */
.chart .band { fill: color-mix(in srgb, var(--law) 24%, transparent); stroke: none; }
.chart .band.g0 { fill: color-mix(in srgb, var(--g0) 24%, transparent); }
.chart .band.g1 { fill: color-mix(in srgb, var(--g1) 24%, transparent); }
.chart .band.g2 { fill: color-mix(in srgb, var(--g2) 24%, transparent); }
.chart .vline { stroke: var(--muted); stroke-dasharray: 3 4; }
.chart .vline-t { fill: var(--muted); }
.chart .pt.truth, .chart .truth { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.chart .curve.cmp-poly { stroke: var(--warn); stroke-dasharray: 7 5; }
.chart .curve.cmp-tree { stroke: var(--muted); stroke-dasharray: 2 4; stroke-width: 2.2; }
.chart .mark circle { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.chart .mark.g0 circle { stroke: var(--g0); } .chart .mark.g1 circle { stroke: var(--g1); } .chart .mark.g2 circle { stroke: var(--g2); }
.chart .mark text { fill: var(--ink); font: 600 11px var(--mono); }
.legend .l-band::before { border-radius: 2px; width: 16px; height: 10px; vertical-align: -1px; background: color-mix(in srgb, var(--law) 22%, transparent); }
.legend .l-exact::before { display: none; }
.legend .l-truth::before { background: var(--paper); border: 1.5px solid var(--ink); width: 6px; height: 6px; }
.legend .l-poly::before { border-radius: 0; height: 0; width: 16px; vertical-align: 3px; background: none; border-top: 2px dashed var(--warn); }
.legend .l-tree::before { border-radius: 0; height: 0; width: 16px; vertical-align: 3px; background: none; border-top: 2px dotted var(--muted); }
.next-box { margin-top: 12px; padding: 12px 14px; border: 1px dashed var(--line2); border-radius: var(--radius); font: 12.5px/1.6 var(--mono); color: var(--ink2); }
.next-box[hidden] { display: none; }
.next-box p { margin: 0 0 6px; }
.next-box p:last-child { margin: 6px 0 0; }
.next-box ol { margin: 0; padding-left: 22px; }
.next-box b { color: var(--ink); font-weight: 500; }
/* the law to paste elsewhere */
.export { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 14px; }
.export .label { flex-basis: 100%; margin: 0; }
.export button { font: 12px var(--mono); padding: 3px 8px; border: 1px solid var(--line2); border-radius: 999px; background: var(--card);
  color: var(--ink); cursor: pointer; }
.export button:hover { border-color: var(--law); color: var(--law); }
.export .copied { flex-basis: 100%; min-height: 1em; }
/* 02: a law against curve fits */
.cmp { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 34px; align-items: start; }
.cmp-left { padding: 18px 18px 14px; background: var(--card); border: 1px solid var(--ink); border-radius: var(--radius);
  box-shadow: 6px 6px 0 color-mix(in srgb, var(--ink) 10%, transparent); }
.cmp-side p { margin: 0 0 14px; color: var(--ink2); }
.cmp-side .formula { margin-bottom: 14px; }
.cmp-table { width: 100%; border-collapse: collapse; font: 12.5px var(--mono); margin: 4px 0 16px; }
.cmp-table th { font: 500 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line2); }
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; }
.cmp-table td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cmp-table td.nai { color: var(--law); font-weight: 500; }
.cmp-table .err { display: block; color: var(--muted); font-size: 11px; }
@media (max-width: 860px) { .cmp { grid-template-columns: minmax(0, 1fr); } .cmp-left { padding: 12px 10px 10px; } }
/* 03: three answers */
.honest { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.honest-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 18px; background: var(--card);
  border: 1px solid var(--line2); border-radius: var(--radius); }
.honest-card h3 { font-size: 21px; margin: 0; }
.honest-card .badge { align-self: flex-start; }
.honest-card .formula { font-size: 14px; }
.honest-card p { margin: 0; font-size: 14px; color: var(--ink2); }
@media (max-width: 960px) { .honest { grid-template-columns: minmax(0, 1fr); max-width: 560px; } }
/* 07: questions */
.faq { max-width: 860px; }
.faq details { border-bottom: 1px solid var(--line2); padding: 4px 0; }
.faq summary { margin: 0; padding: 12px 0; font: 400 19px/1.3 var(--serif); color: var(--ink); }
.faq details p { margin: 0 0 16px; padding-left: 1.6em; color: var(--ink2); max-width: 720px; }
.sliders { display: grid; gap: 10px; margin: 14px 0; }
.slider { display: grid; grid-template-columns: 70px minmax(0, 1fr) 80px; gap: 10px; align-items: center; font: 13px var(--mono); }
@media (max-width: 520px) { .slider { grid-template-columns: 56px minmax(0, 1fr) 64px; } .viewer { padding: 0 14px 18px; } .viewer::before { margin: 0 -14px 14px; } }
.slider input[type="range"] { width: 100%; accent-color: var(--law); }
.slider output { text-align: right; }
.slider .seg.groups { grid-column: 2 / 4; }
/* a narrow screen: the groups under their label, in one row across the width */
@media (max-width: 520px) {
  .slider.group-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .slider .seg.groups { grid-column: 1; width: 100%; flex-wrap: nowrap; border-radius: 999px; }
  .seg.groups label { flex: 1 1 auto; min-width: 0; }
  .seg.groups span { padding: 6px 8px; text-align: center; white-space: nowrap; }
}
.front { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 10px; table-layout: fixed; }
.front th, .front td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.front th { font: 500 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.front th:first-child, .front td:first-child { width: 52px; }
.front th:nth-child(2), .front td:nth-child(2) { width: 64px; }
.front td { font-family: var(--mono); }
.front td.f { overflow-wrap: anywhere; word-break: break-all; }
details summary { cursor: pointer; color: var(--ink2); font: 13px var(--mono); margin-top: 12px; list-style: none; }
details summary::-webkit-details-marker { display: none; }
/* an own marker: the built-in one sits tight against the text */
details summary::before { content: "\25B8"; display: inline-block; width: 1.6em; transition: transform 0.15s; transform-origin: 0.32em 55%; }
details[open] > summary::before { transform: rotate(90deg); }

/* the search, replayed */
.play-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.play-bar .small { font-family: var(--mono); font-size: 11.5px; }
.ticker { font: 12px var(--mono); color: var(--ink2); min-height: 44px; margin-top: 10px; }
.ticker code { display: block; margin-top: 4px; padding: 0; background: none; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-size: 13px; color: var(--ink); }
.ticker .ok, .ok { color: var(--law); font-weight: 500; }
.pareto-box:empty { display: none; }
.pareto { width: 100%; max-width: 420px; height: auto; display: block; margin-top: 6px; }
.pareto .axis { stroke: var(--line2); }
.pareto .tick { fill: var(--muted); font: 10px var(--mono); }
.pareto .pline { fill: none; stroke: var(--ink2); stroke-width: 1; stroke-dasharray: 3 3; }
.pareto .pp { fill: var(--ink2); }
.pareto .pp.chosen { fill: var(--law); }
.pareto .pp.after { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.pareto .pp.now { stroke: var(--ink); stroke-width: 2.5; }

/* the law as a tree, growing level by level */
.tree-box { overflow-x: auto; margin: 4px 0 6px; }
.tree { display: block; max-width: 100%; height: auto; }
.tree .edge { stroke: var(--line2); stroke-width: 1.2; }
.tree .node circle, .tree .node rect { fill: var(--card); stroke: var(--ink); stroke-width: 1.2; }
.tree .node.var circle, .tree .node.var rect { fill: var(--ink); }
.tree .node.var text { fill: var(--paper); }
.tree .node.num circle, .tree .node.num rect { stroke: var(--law); }
.tree .node text { fill: var(--ink); font: 12px var(--mono); }
.tree .node, .tree .edge { animation: grow 0.45s ease both; }
.tree .d1 { animation-delay: 150ms; } .tree .d2 { animation-delay: 300ms; } .tree .d3 { animation-delay: 450ms; } .tree .d4 { animation-delay: 600ms; }
.tree .d5 { animation-delay: 750ms; } .tree .d6 { animation-delay: 900ms; } .tree .d7 { animation-delay: 1050ms; } .tree .d8 { animation-delay: 1200ms; }
.tree .d9 { animation-delay: 1350ms; } .tree .d10 { animation-delay: 1500ms; } .tree .d11 { animation-delay: 1650ms; } .tree .d12 { animation-delay: 1800ms; }
.ex-actions { margin-top: 14px; }
@keyframes grow { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tree .node, .tree .edge { animation: none; } }
.tree-note { font-family: var(--mono); margin: 0 0 8px; }

/* the form */
.job { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 34px; }
/* the room above the result comes with the result: nothing empty under the form before it */
#job-view { margin-top: 26px; }
#run-note { margin: 0; }
/* the live demo not open yet */
.soon { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: -14px 0 26px; max-width: 860px; }
.soon-plate { font: 500 11.5px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 10px;
  border-left: 3px solid #e0a64a; background: #ffd46e; color: #000; }
.soon p { margin: 0; color: var(--ink2); font-size: 14px; }
.btn.run:disabled { cursor: not-allowed; opacity: 0.55; }
@media (max-width: 860px) { .job { grid-template-columns: minmax(0, 1fr); } }
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.drop { border: 1px dashed var(--line2); border-radius: var(--radius); padding: 22px; display: flex; gap: 12px;
  align-items: center; color: var(--ink2); cursor: pointer; background: var(--card); font-size: 14px; }
.drop i { color: var(--law); width: 24px; height: 24px; }
.drop.over { border-color: var(--law); background: var(--paper2); }
.field { display: flex; flex-direction: column; gap: 10px; }
.label, legend { font: 500 11.5px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
textarea, select { width: 100%; border: 1px solid var(--line2); border-radius: var(--radius); padding: 10px 12px; background: var(--card);
  color: var(--ink); font-size: 13px; }
textarea { resize: vertical; }
select { font-family: var(--mono); }
textarea:focus, select:focus, .btn:focus-visible, .ex-card:focus-visible { outline: 2px solid var(--law); outline-offset: 1px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
/* a legend is not a flex item of its fieldset: the gap does not reach it */
fieldset > legend { padding: 0; margin-bottom: 10px; }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 1px solid var(--line2); border-radius: 999px; overflow: hidden; width: fit-content; }
.seg.groups { border-radius: 14px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; margin: 0; }
.seg span { display: block; padding: 6px 14px; font: 12.5px var(--mono); border-right: 1px solid var(--line); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 2px solid var(--law); outline-offset: -2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { cursor: pointer; }
.chips input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; margin: 0; }
.chips span { display: inline-block; padding: 4px 12px; border: 1px solid var(--line2); border-radius: 999px; font: 12.5px var(--mono); color: var(--muted); }
.chips input:checked + span { border-color: var(--ink); color: var(--ink); background: var(--card); }
.chips input:focus-visible + span { outline: 2px solid var(--law); }
.toggle { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.toggle input { accent-color: var(--law); width: 16px; height: 16px; }
.hint { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--muted);
  color: var(--muted); font-size: 10px; cursor: help; text-transform: none; }
.run { align-self: flex-start; }
.preview { font-size: 13px; color: var(--ink2); }
.preview:empty { display: none; }
.preview .roles { margin-bottom: 6px; font-family: var(--mono); font-size: 12px; }
.preview .err { color: var(--bad); }
.preview .tbl-wrap, details .tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 8px; }
.preview table, details table { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 12px; }
.preview th, .preview td, .tbl-wrap th, .tbl-wrap td { padding: 3px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.tbl-wrap th.y { color: var(--law); }
.status { display: flex; gap: 10px; align-items: center; color: var(--ink2); font: 13px var(--mono); padding: 14px 0; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } html { scroll-behavior: auto; } }

/* format and privacy */
.rules { padding-left: 20px; }
.rules li { margin-bottom: 12px; }
.sample { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--law); padding: 12px 14px; overflow-x: auto; font-size: 13px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; }
@media (max-width: 700px) { .two { grid-template-columns: 1fr; } }
.two h3 { font-size: 22px; }
.two h3 i { color: var(--law); width: 18px; height: 18px; }
.plain { padding-left: 18px; margin: 0; }
.plain li { margin-bottom: 6px; color: var(--ink2); }

.foot { border-top: 1px solid var(--line2); padding: 26px 0 40px; color: var(--muted); font: 12.5px var(--mono); }
.foot-row { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; }
.foot a { display: inline-flex; gap: 6px; align-items: center; color: var(--ink2); text-decoration: none; }
.foot a:hover { color: var(--law); }
