/* How do machines learn? — /iw/how-machines-learn/
   Information Warfare family language: near-black blue, cyan-led, with the
   AI/ML violet as the second accent. CSP is style-src 'self': every style
   for these pages lives in this file. Fonts are the site's self-hosted set. */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100% 110%;
  font-display: swap;
  src: url("/fonts/archivo-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100% 110%;
  font-display: swap;
  src: url("/fonts/archivo-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Chivo Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/chivo-mono-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Chivo Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/chivo-mono-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: dark;
  --void: #02070c;
  --deep: #030b12;
  --panel: rgba(5, 19, 29, 0.78);
  --panel-solid: #06141e;
  --raise: rgba(14, 38, 52, 0.7);
  --line: rgba(132, 194, 214, 0.18);
  --line-strong: rgba(132, 220, 235, 0.36);
  --text: #edf8fb;
  --soft: #c4dbe3;
  --muted: #8da8b3;
  --quiet: #668794;

  --cyan: #29d4e3;
  --cyan-bright: #5ce8f1;
  --violet: #b79bff;
  --gold: #ffd76a;
  --orange: #ff9156;
  --mint: #70e1c1;
  --rose: #ff6b81;

  /* meanings used by every picture on these pages */
  --hml-a: #4fd8eb;       /* first kind of point */
  --hml-b: #ff9a5c;       /* second kind */
  --hml-c: #b79bff;       /* third kind */
  --hml-sig: #5ce8f1;     /* signal going down the board */
  --hml-blame: #ffc24d;   /* correction coming back up */
  --hml-pos: #5ce8f1;     /* a weight that adds */
  --hml-neg: #ff7a8a;     /* a weight that subtracts */
  --hml-good: #70e1c1;
  --hml-bad: #ff6b81;
  --hml-grid: rgba(132, 194, 214, 0.12);
  --hml-axis: rgba(160, 214, 230, 0.42);

  --sans: "Archivo", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Chivo Mono", ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --col: 720px;
  --wide: 1120px;
  --gut: clamp(16px, 4.5vw, 36px);
  --r: 16px;
  --r-s: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -8%, rgba(24, 127, 151, 0.2), transparent 40%),
    radial-gradient(circle at 96% 4%, rgba(118, 92, 214, 0.13), transparent 34%),
    var(--void);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan-bright); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: #9af4fa; }

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

.hml-skip {
  position: absolute; left: -999px; top: 8px;
  padding: 8px 14px; background: var(--cyan); color: #012; border-radius: 8px; font-weight: 700;
}
.hml-skip:focus { left: 12px; z-index: 20; }

/* ---------------------------------------------------------------- top bar */
.hml-top {
  position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 7, 12, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.hml-top__in {
  max-width: var(--wide); margin: 0 auto; padding: 10px var(--gut);
  display: flex; align-items: center; gap: 16px;
}
.hml-top__home {
  display: inline-flex; align-items: center; gap: 10px; min-height: 30px;
  font-family: var(--mono); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.16em;
  color: var(--cyan); text-decoration: none; white-space: nowrap;
}
.hml-top__home img { display: block; width: 22px; height: 22px; border-radius: 6px; }
.hml-top__home:hover { color: var(--cyan-bright); }
.hml-steps-nav { margin: 0 0 0 auto; padding: 0; display: flex; align-items: center; gap: 6px; list-style: none; min-width: 0; }
.hml-steps-nav li { margin: 0; }
.hml-steps-nav a {
  display: grid; place-items: center; width: 28px; height: 28px;
  border: 1px solid var(--line); border-radius: 50%;
  font-family: var(--mono); font-size: 0.7rem; color: var(--muted); text-decoration: none;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.hml-steps-nav a:hover { border-color: var(--line-strong); color: var(--text); }
.hml-steps-nav a[aria-current="page"] { background: var(--cyan); border-color: var(--cyan); color: #011419; font-weight: 700; }
.hml-steps-nav a.is-done { border-color: rgba(41, 212, 227, 0.45); color: var(--cyan-bright); }
/* on a phone the label gives way to the mark, so the nine numbered pages fit without sideways scroll */
@media (max-width: 640px) {
  .hml-top__home span { display: none; }
  .hml-top__in { gap: 10px; }
  .hml-steps-nav { gap: 4px; }
}
@media (max-width: 360px) { .hml-steps-nav a { width: 25px; height: 25px; } .hml-steps-nav { gap: 3px; } }

/* ---------------------------------------------------------------- page frame */
main { display: block; padding: clamp(28px, 6vh, 64px) var(--gut) 40px; }
.hml-col { max-width: var(--col); margin: 0 auto; }
.hml-wide { max-width: var(--wide); margin: 0 auto; }

.hml-kicker {
  margin: 0 0 12px; color: var(--violet);
  font-family: var(--mono); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
}
h1 {
  margin: 0 0 16px; font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 780; font-stretch: 104%;
  letter-spacing: -0.035em; line-height: 1.04; text-wrap: balance;
}
h1 em { font-style: normal; color: var(--cyan-bright); }
.hml-lede { margin: 0 0 8px; color: var(--soft); font-size: clamp(1.1rem, 2.4vw, 1.3rem); line-height: 1.5; text-wrap: pretty; }

h2 {
  margin: 56px 0 12px; padding-top: 22px; border-top: 1px solid var(--line);
  font-size: clamp(1.35rem, 3.4vw, 1.75rem); font-weight: 720; letter-spacing: -0.025em; line-height: 1.15; text-wrap: balance;
}
h3 { margin: 30px 0 8px; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0 0 16px; text-wrap: pretty; }
.hml-col p, .hml-col li { color: var(--soft); }
.hml-col strong { color: var(--text); font-weight: 680; }
ul, ol { margin: 0 0 16px; padding-left: 1.25em; }
li { margin-bottom: 6px; }

dfn { font-style: normal; font-weight: 680; color: var(--text); border-bottom: 1px dashed rgba(183, 155, 255, 0.6); }
code, .hml-num { font-family: var(--mono); font-size: 0.92em; color: var(--cyan-bright); font-variant-numeric: tabular-nums; }

/* arithmetic a reader can follow, with its reading underneath */
.hml-math {
  margin: 18px 0 6px; padding: 16px 18px; overflow-x: auto;
  border: 1px solid var(--line); border-left: 3px solid var(--violet); border-radius: var(--r-s);
  background: rgba(8, 22, 34, 0.75);
  font-family: var(--mono); font-size: 0.92rem; line-height: 1.75; color: var(--text);
  white-space: pre; tab-size: 4;
}
.hml-math b { color: var(--gold); font-weight: 600; }
.hml-math i { font-style: normal; color: var(--muted); }
.hml-math .s { color: var(--hml-sig); }
.hml-math .k { color: var(--hml-blame); }
.hml-inwords { margin: 0 0 20px; padding-left: 21px; color: var(--muted); font-size: 0.96rem; }
.hml-inwords::before { content: "In words: "; color: var(--violet); font-weight: 650; }

/* the one sentence to carry to the next page */
.hml-carry {
  margin: 34px 0 0; padding: 18px 20px;
  border: 1px solid rgba(255, 215, 106, 0.4); border-radius: var(--r); background: rgba(255, 215, 106, 0.06);
}
.hml-carry p { margin: 0; color: var(--text); font-size: 1.08rem; line-height: 1.5; }
.hml-carry p.hml-carry__label { margin: 0 0 4px; color: var(--gold); font-family: var(--mono); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.18em; line-height: 1.6; }

/* who thought of it, and why */
.hml-origin {
  margin: 22px 0; padding: 18px 20px 16px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
}
.hml-origin__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin-bottom: 8px; }
.hml-origin__year { font-family: var(--mono); font-size: 0.95rem; font-weight: 600; color: var(--gold); }
.hml-origin__who { font-weight: 700; color: var(--text); }
.hml-origin p { margin: 0 0 10px; font-size: 0.98rem; color: var(--soft); }
.hml-origin blockquote {
  margin: 10px 0; padding: 2px 0 2px 16px; border-left: 2px solid var(--cyan);
  color: var(--text); font-size: 1rem; line-height: 1.55;
}
.hml-origin cite, .hml-src { display: block; margin-top: 6px; color: var(--quiet); font-size: 0.8rem; font-style: normal; }
.hml-origin cite a, .hml-src a { color: var(--muted); }
.hml-origin cite a:hover, .hml-src a:hover { color: var(--cyan-bright); }

.hml-chip {
  display: inline-block; padding: 2px 9px; border: 1px solid currentColor; border-radius: 99px;
  font-family: var(--mono); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap;
}
.hml-chip--reasoned { color: var(--cyan-bright); }
.hml-chip--tried { color: var(--orange); }
.hml-chip--proven { color: var(--mint); }
.hml-chip--open { color: var(--violet); }
.hml-chip--wall { color: var(--rose); }

details.hml-more {
  margin: 14px 0 20px; border: 1px solid var(--line); border-radius: var(--r-s); background: rgba(5, 19, 29, 0.5);
}
details.hml-more > summary {
  cursor: pointer; padding: 12px 16px; color: var(--text); font-weight: 650; list-style: none;
  display: flex; align-items: center; gap: 10px;
}
details.hml-more > summary::-webkit-details-marker { display: none; }
details.hml-more > summary::before {
  content: "+"; display: grid; place-items: center; width: 22px; height: 22px; flex: none;
  border: 1px solid var(--line-strong); border-radius: 6px; color: var(--cyan-bright); font-family: var(--mono);
}
details.hml-more[open] > summary::before { content: "\2212"; }
details.hml-more > .hml-more__body { padding: 2px 16px 12px; }

/* ---------------------------------------------------------------- widgets */
.hml-widget {
  margin: 26px auto; padding: 0; max-width: var(--wide);
  border: 1px solid var(--line); border-radius: var(--r);
  background: linear-gradient(180deg, rgba(8, 26, 38, 0.82), rgba(4, 15, 23, 0.86));
  box-shadow: 0 24px 60px -32px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(160, 230, 245, 0.06);
  overflow: hidden;
}
.hml-widget--narrow { max-width: var(--col); }
.hml-widget__bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
}
.hml-widget__title { margin: 0; font-family: var(--mono); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cyan); }
.hml-widget__hint { margin: 0 0 0 auto; color: var(--quiet); font-size: 0.8rem; }

.hml-stage { position: relative; background: var(--deep); }
/* pan-y lets a finger scroll the page across a picture; handles and free-drag surfaces opt out themselves */
.hml-stage canvas, .hml-stage svg { display: block; width: 100%; touch-action: pan-y; }
.hml-stage svg text { font-family: var(--mono); fill: var(--muted); }
.hml-stage--pad { padding: 14px; }
.hml-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.hml-split > .hml-pane { background: var(--deep); position: relative; min-width: 0; }
.hml-split--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .hml-split, .hml-split--3 { grid-template-columns: minmax(0, 1fr); } }
.hml-pane__label {
  position: absolute; left: 12px; top: 10px; z-index: 1; margin: 0; pointer-events: none;
  font-family: var(--mono); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  background: rgba(3, 11, 18, 0.72); padding: 2px 7px; border-radius: 6px;
}

.hml-controls {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px;
  padding: 14px 18px; border-top: 1px solid var(--line);
}
.hml-controls--tight { gap: 10px 12px; }
.hml-control { display: grid; gap: 5px; min-width: 132px; flex: 1 1 150px; max-width: 260px; }
.hml-control--grow { max-width: none; flex: 2 1 240px; }
.hml-control__label { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 0.8rem; }
.hml-control__label output { font-family: var(--mono); color: var(--cyan-bright); font-variant-numeric: tabular-nums; }
.hml-btnrow { display: flex; flex-wrap: wrap; gap: 8px; }

.hml-btn {
  appearance: none; cursor: pointer; min-height: 38px; padding: 8px 15px;
  border: 1px solid var(--line-strong); border-radius: 99px; background: rgba(41, 212, 227, 0.07);
  color: var(--text); font: 650 0.88rem/1 var(--sans); letter-spacing: 0.005em; white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, transform 80ms ease;
}
.hml-btn:hover { background: rgba(41, 212, 227, 0.16); border-color: var(--cyan-bright); }
.hml-btn:active { transform: translateY(1px); }
.hml-btn[disabled] { opacity: 0.4; cursor: default; }
.hml-btn--primary { background: var(--cyan); border-color: var(--cyan); color: #011419; }
.hml-btn--primary:hover { background: var(--cyan-bright); }
.hml-btn--gold { border-color: rgba(255, 215, 106, 0.6); background: rgba(255, 215, 106, 0.09); }
.hml-btn--gold:hover { background: rgba(255, 215, 106, 0.2); border-color: var(--gold); }
.hml-btn--icon { width: 38px; padding: 0; display: grid; place-items: center; border-radius: 10px; font-family: var(--mono); font-size: 1rem; }
.hml-btn[aria-pressed="true"] { background: rgba(41, 212, 227, 0.26); border-color: var(--cyan-bright); }

.hml-seg { display: inline-flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 99px; background: rgba(3, 11, 18, 0.8); }
.hml-seg button {
  appearance: none; cursor: pointer; min-height: 32px; padding: 6px 13px; border: 0; border-radius: 99px; background: transparent;
  color: var(--muted); font: 650 0.82rem/1 var(--sans); white-space: nowrap;
}
.hml-seg button:hover { color: var(--text); }
.hml-seg button[aria-pressed="true"] { background: var(--cyan); color: #011419; }

.hml-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--soft); font-size: 0.88rem; min-height: 38px; }
.hml-toggle input { appearance: none; margin: 0; width: 40px; height: 22px; border-radius: 99px; background: rgba(132, 194, 214, 0.2); border: 1px solid var(--line-strong); position: relative; cursor: pointer; flex: none; transition: background 140ms ease; }
.hml-toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform 140ms ease, background 140ms ease; }
.hml-toggle input:checked { background: rgba(41, 212, 227, 0.35); }
.hml-toggle input:checked::after { transform: translateX(18px); background: var(--cyan-bright); }

input[type="range"].hml-range { appearance: none; width: 100%; height: 26px; margin: 0; background: transparent; cursor: pointer; }
input[type="range"].hml-range::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: rgba(132, 194, 214, 0.28); }
input[type="range"].hml-range::-moz-range-track { height: 4px; border-radius: 99px; background: rgba(132, 194, 214, 0.28); }
input[type="range"].hml-range::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--cyan-bright); border: 2px solid #012a33; box-shadow: 0 0 0 1px var(--cyan-bright); }
input[type="range"].hml-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--cyan-bright); border: 2px solid #012a33; box-shadow: 0 0 0 1px var(--cyan-bright); }

select.hml-select {
  appearance: none; min-height: 38px; padding: 7px 34px 7px 13px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: rgba(3, 11, 18, 0.8) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235ce8f1' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center / 11px;
  color: var(--text); font: 600 0.88rem/1.2 var(--sans); cursor: pointer;
}

.hml-readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.hml-readout { padding: 10px 16px; background: var(--panel-solid); min-width: 0; }
.hml-readout__label { display: block; color: var(--quiet); font-size: 0.72rem; letter-spacing: 0.02em; }
.hml-readout__value { display: block; font-family: var(--mono); font-size: 1.18rem; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.3; }
.hml-readout--good .hml-readout__value { color: var(--hml-good); }
.hml-readout--bad .hml-readout__value { color: var(--hml-bad); }
.hml-readout--sig .hml-readout__value { color: var(--hml-sig); }
.hml-readout--blame .hml-readout__value { color: var(--hml-blame); }

.hml-note { margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--soft); font-size: 0.93rem; line-height: 1.5; min-height: 3.3em; }
.hml-note b { color: var(--gold); font-weight: 650; }
.hml-note code { font-size: 0.88em; }

.hml-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.8rem; }
.hml-legend li { display: inline-flex; align-items: center; gap: 7px; margin: 0; }
.hml-swatch { width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--muted); }
.hml-swatch--a { background: var(--hml-a); } .hml-swatch--b { background: var(--hml-b); } .hml-swatch--c { background: var(--hml-c); }
.hml-swatch--sig { background: var(--hml-sig); } .hml-swatch--blame { background: var(--hml-blame); }
.hml-swatch--pos { background: var(--hml-pos); } .hml-swatch--neg { background: var(--hml-neg); }
.hml-swatch--good { background: var(--hml-good); } .hml-swatch--bad { background: var(--hml-bad); } .hml-swatch--gold { background: var(--gold); } .hml-swatch--violet { background: var(--violet); }
.hml-swatch--line { width: 18px; height: 3px; border-radius: 2px; }

.hml-widget > figcaption { padding: 12px 18px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; line-height: 1.5; text-wrap: pretty; }
.hml-widget > figcaption strong { color: var(--text); }
.hml-widget noscript p { margin: 0; padding: 16px 18px; color: var(--muted); }

.hml-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- landing */
.hml-hero { max-width: var(--wide); margin: 0 auto; }
.hml-hero__text { max-width: 820px; }
/* nine cards: three level rows of three, or one column on a phone, so no row ends ragged */
.hml-path { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 22px 0 0; padding: 0; list-style: none; counter-reset: step; }
@media (max-width: 760px) { .hml-path { grid-template-columns: minmax(0, 1fr); } }
.hml-path li { margin: 0; counter-increment: step; }
.hml-path a {
  display: grid; grid-template-rows: auto auto 1fr; gap: 4px; height: 100%; padding: 16px 18px 18px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: inherit; text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}
.hml-path a:hover { border-color: var(--line-strong); transform: translateY(-2px); background: rgba(10, 30, 43, 0.86); }
.hml-path a::before { content: counter(step, decimal-leading-zero); font-family: var(--mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; color: var(--violet); }
.hml-path__name { font-weight: 720; font-size: 1.06rem; letter-spacing: -0.012em; color: var(--cyan-bright); text-wrap: balance; }
.hml-path__desc { color: var(--muted); font-size: 0.88rem; line-height: 1.45; text-wrap: pretty; }

.hml-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 20px 0; padding: 0; list-style: none; }
@media (max-width: 760px) { .hml-three { grid-template-columns: minmax(0, 1fr); } }
.hml-three li { margin: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.hml-three b { display: block; margin-bottom: 4px; color: var(--text); font-size: 1.02rem; }
.hml-three span { color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.hml-three .hml-three__n { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; color: var(--gold); margin-bottom: 6px; }

/* ---------------------------------------------------------------- tables */
.hml-table-wrap { overflow-x: auto; margin: 18px 0 22px; border: 1px solid var(--line); border-radius: var(--r-s); }
table.hml-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.hml-table th, .hml-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); color: var(--soft); }
.hml-table th { color: var(--muted); font-family: var(--mono); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; background: rgba(5, 19, 29, 0.7); white-space: nowrap; }
.hml-table tr:last-child td { border-bottom: 0; }
.hml-table td.n { font-family: var(--mono); color: var(--cyan-bright); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------------------------------------------------------- prev / next */
.hml-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: var(--col); margin: 56px auto 0; }
.hml-pager a {
  display: grid; gap: 3px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  color: inherit; text-decoration: none; transition: border-color 160ms ease, background 160ms ease;
}
.hml-pager a:hover { border-color: var(--cyan-bright); background: rgba(10, 30, 43, 0.9); }
.hml-pager a.is-next { text-align: right; border-color: rgba(41, 212, 227, 0.5); }
.hml-pager a:only-child.is-next { grid-column: 2; }
.hml-pager small { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--quiet); }
.hml-pager span { font-weight: 720; color: var(--cyan-bright); letter-spacing: -0.01em; text-wrap: balance; }
@media (max-width: 520px) { .hml-pager { grid-template-columns: minmax(0, 1fr); } .hml-pager a:only-child.is-next { grid-column: 1; } }

/* ---------------------------------------------------------------- sources */
.hml-sources { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.hml-sources li { margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--panel); }
.hml-sources b { color: var(--text); }
.hml-sources .hml-sources__meta { display: block; color: var(--muted); font-size: 0.88rem; margin: 2px 0 6px; }
.hml-sources .hml-sources__links { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.85rem; }

/* ---------------------------------------------------------------- footer */
.hml-foot { max-width: var(--col); margin: 64px auto 0; padding: 20px 0 40px; border-top: 1px dashed var(--line); }
.hml-foot .credit { margin: 0 0 10px; color: var(--muted); font-size: 0.82rem; }
.hml-foot .credit a { color: var(--cyan-bright); text-decoration: none; }
.hml-foot .credit a:hover { text-decoration: underline; }
.hml-foot .fine-print { margin: 0 0 8px; color: var(--quiet); font-size: 0.7rem; line-height: 1.55; }
.hml-foot .fine-print a { color: var(--muted); }
.hml-foot .fine-print a:hover { color: var(--cyan-bright); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
@media (prefers-contrast: more) {
  :root { --line: rgba(160, 220, 236, 0.4); --muted: #b4cdd6; --quiet: #9db8c2; }
}
@media print {
  .hml-top, .hml-controls, .hml-pager { display: none; }
  body { background: #fff; color: #000; }
}

/* ---------------------------------------------------------------- handles
   A draggable point that is also a real button, so it works from the keyboard.
   Positioned by the toolkit through left/top percentages of its host. */
.hml-handle {
  position: absolute; z-index: 2; width: 26px; height: 26px; margin: -13px 0 0 -13px; padding: 0;
  border: 2px solid var(--void); border-radius: 50%; background: var(--gold); color: #1a1200;
  box-shadow: 0 0 0 2px var(--gold), 0 4px 14px rgba(0, 0, 0, 0.6);
  cursor: grab; touch-action: none; font: 700 0.62rem/1 var(--mono);
  display: grid; place-items: center;
}
.hml-handle:active { cursor: grabbing; }
.hml-handle--a { background: var(--hml-a); box-shadow: 0 0 0 2px var(--hml-a), 0 4px 14px rgba(0, 0, 0, 0.6); }
.hml-handle--b { background: var(--hml-b); box-shadow: 0 0 0 2px var(--hml-b), 0 4px 14px rgba(0, 0, 0, 0.6); }
.hml-handle--c { background: var(--hml-c); box-shadow: 0 0 0 2px var(--hml-c), 0 4px 14px rgba(0, 0, 0, 0.6); }
.hml-handle--cyan { background: var(--cyan-bright); box-shadow: 0 0 0 2px var(--cyan-bright), 0 4px 14px rgba(0, 0, 0, 0.6); }
.hml-handle--small { width: 20px; height: 20px; margin: -10px 0 0 -10px; }
.hml-handle:focus-visible { outline: 2px solid #fff; outline-offset: 4px; border-radius: 50%; }
/* the finger needs a larger target than the eye does */
@media (pointer: coarse) { .hml-handle::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; } }

/* a stepped walkthrough inside a widget */
.hml-walk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.hml-walk__count { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hml-dots { display: flex; gap: 5px; margin: 0; padding: 0; list-style: none; }
.hml-dots li { width: 8px; height: 8px; margin: 0; border-radius: 50%; background: rgba(132, 194, 214, 0.25); }
.hml-dots li.is-on { background: var(--cyan-bright); }
.hml-dots li.is-past { background: rgba(92, 232, 241, 0.5); }

/* a formula line shown live inside a widget */
.hml-live-math { margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 0.9rem; line-height: 1.7; color: var(--text); white-space: pre-wrap; overflow-x: auto; }
.hml-live-math .s { color: var(--hml-sig); } .hml-live-math .k { color: var(--hml-blame); } .hml-live-math b { color: var(--gold); font-weight: 600; }
.hml-note .s { color: var(--hml-sig); } .hml-note .k { color: var(--hml-blame); }
