/* "how it learns" (grad.html): every rule under .gx */
.gx .claim.mid { margin-bottom: 12px; }
.gx .gx-soft { color: var(--ink2); }
.gx .lede { margin-bottom: 18px; }
.gx .fine.gx-note { margin-top: 10px; font-size: 12.5px; }
.gx svg text.gx-halo { paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }

/* toggles: one row, and the sliding highlight's copy never wraps either */
.gx .tabs { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.gx .tabs::-webkit-scrollbar { display: none; }
.gx .tabs button { flex: 0 0 auto; white-space: nowrap; }
.gx .glass-in > span { white-space: nowrap; }

/* 1. spectrum */
.gx .gx-spec { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 30px; align-items: center; margin-top: 6px; }
.gx .gx-spec-fig svg { display: block; width: 100%; height: auto; overflow: visible; font-family: "Inter", sans-serif; }
.gx .gx-end { fill: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.gx .gx-node { cursor: pointer; outline: none; }
.gx .gx-hit { fill: transparent; }
.gx .gx-dot { transition: r 0.25s ease, stroke-width 0.25s ease; }
.gx .gx-node .gx-core { opacity: 0; transition: opacity 0.25s ease; }
.gx .gx-node.on .gx-core { opacity: 1; }
.gx .gx-node.on .gx-dot { r: 19; }
.gx .gx-node:hover .gx-dot, .gx .gx-node:focus-visible .gx-dot { stroke-width: 5; }
.gx .gx-name { fill: var(--ink2); font-weight: 600; }
.gx .gx-node.on .gx-name { fill: var(--ink); }
.gx .gx-fb { fill: var(--muted); }
.gx .gx-fb .gx-l { fill: #9ca3af; font-weight: 600; letter-spacing: 0.04em; }
.gx .gx-det { display: grid; background: var(--card); border-radius: 22px; padding: 18px 24px 20px; }
/* the three panels share one grid cell, so the card always has the height of the tallest and the figure beside it never moves */
.gx .gx-panel { grid-area: 1 / 1; min-width: 0; visibility: hidden; opacity: 0; transition: opacity 0.16s ease, visibility 0s linear 0.16s; }
/* a switch is a cross-fade in place: the old panel fades out, then the new one fades in; nothing moves */
.gx .gx-panel.on { visibility: visible; opacity: 1; transition: opacity 0.22s ease 0.14s, visibility 0s; }
@media (prefers-reduced-motion: reduce) { .gx .gx-panel, .gx .gx-panel.on { transition: none; } }
@keyframes gx-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.gx .gx-k { margin: 0 0 10px; font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.gx .gx-io { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 14px; align-items: baseline; margin: 0 0 14px; padding: 0 0 12px; border-bottom: 1px solid #e2e4e9; font-size: 14.5px; }
.gx .gx-io dt { font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.gx .gx-io dd { margin: 0; color: var(--ink); }
.gx .gx-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 6px 0 12px; }
.gx .gx-nums b { display: block; font-family: var(--display); font-size: 40px; font-weight: 800; letter-spacing: -0.035em; line-height: 1; color: var(--ink); }
.gx .gx-nums b i { font-style: normal; font-size: 0.45em; margin-left: 3px; color: var(--ink2); }
.gx .gx-nums small { display: block; margin-top: 6px; font-size: 13px; color: var(--ink2); line-height: 1.35; }
.gx .gx-p { margin: 0; font-size: 14.5px; color: var(--ink2); }
.gx .gx-eq { margin: 4px 0 10px; overflow-x: auto; overflow-y: hidden; font-size: 15px; }
.gx .gx-eq .katex-display { margin: 0.3em 0; }
.gx .gx-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
.gx .gx-sub { margin: 4px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink2); }
.gx #gx-cos-bars { margin: 10px 0 12px; }
.gx #gx-cos-bars .brow { grid-template-columns: 1fr; gap: 0; padding: 3px 0; }
.gx #gx-cos-bars .brow .name { font-size: 13.5px; }
.gx .gx-dots svg { display: block; width: 100%; height: auto; }

/* 3. fixes */
/* three cards on one shared row grid, so numbers, headings, formulas and text line up across the cards */
.gx .gx-tricks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(4, auto); gap: 0 16px; margin-top: 14px; }
.gx .gx-tricks article { display: grid; grid-template-rows: subgrid; grid-row: span 4; min-width: 0; background: var(--card); border-radius: 22px; padding: 20px 18px 20px; }
.gx .gx-tricks h4 { display: flex; align-items: baseline; gap: 12px; margin: 0; font-family: var(--display); font-size: 22px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; color: var(--ink); }
.gx .gx-n { flex: none; font-size: 30px; color: #b9bec7; line-height: 1; }
.gx .gx-gain { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #e2e4e9; }
.gx .gx-gain b { flex: none; font-family: var(--display); font-size: 34px; font-weight: 800; letter-spacing: -0.035em; line-height: 1; color: var(--accent); white-space: nowrap; }
.gx .gx-gain b i { font-style: normal; font-size: 0.46em; letter-spacing: -0.01em; margin-left: 3px; }
.gx .gx-gain span { font-size: 13px; line-height: 1.4; color: var(--ink2); }
.gx .gx-tricks p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink2); }
.gx .gx-tricks .gx-eq { align-self: center; margin: 8px 0 10px; font-size: 14px; color: var(--ink); scrollbar-width: none; }
.gx .gx-tricks .gx-eq::-webkit-scrollbar { display: none; }

/* 4. economics: sources down, quantities across; rounded bars with the value at the end */
.gx .gx-econ { display: grid; grid-template-columns: max-content repeat(4, minmax(0, 1fr)); column-gap: 26px; margin-top: 26px; }
.gx .ec-col { min-width: 0; }
.gx .ec-h { margin: 0 0 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-family: var(--display); font-size: 19px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; color: var(--ink); }
.gx .ec-h small { display: block; margin-top: 3px; min-height: 2.7em; font-family: "Inter", sans-serif; font-size: 13px; font-weight: 500; letter-spacing: 0; line-height: 1.35; color: var(--ink2); }
.gx .ec-r { display: flex; align-items: center; height: 54px; margin: 0; border-bottom: 1px solid var(--line); }
.gx .ec-n { font-size: 15px; color: var(--ink2); line-height: 1.25; white-space: nowrap; }
.gx .ec-r.ours .ec-n { color: var(--ink); font-weight: 600; }
.gx .ec-col:not(.ec-names) .ec-n { display: none; }
.gx .ec-c { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; }
.gx .ec-bar { flex: none; box-sizing: border-box; height: 18px; width: 0; border-radius: 9px; background: #6b7280; transition: width 0.9s cubic-bezier(.2,.7,.2,1); transition-delay: calc(0.15s + var(--i) * 0.2s); }
.gx .ec-r.ours .ec-bar { background: var(--accent); }
.gx .ec-r.ref .ec-bar { background: none; border: 1px dashed #9ca3af; }
.gx .gx-econ.in .ec-bar { width: calc(var(--w) * 0.46); }
.gx .ec-v { font-size: 16px; color: var(--ink2); line-height: 1.1; white-space: nowrap; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity 0.4s ease; transition-delay: calc(0.3s + var(--i) * 0.2s); }
.gx .gx-econ.in .ec-v { opacity: 1; }
.gx .ec-v small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.gx .ec-r.ours .ec-v { color: var(--ink); font-weight: 600; }
.gx .gx-est { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 2px; }
.gx .ec-legend { display: none; }
.gx .gx-bridge { margin: 30px 0 0; max-width: 900px; text-wrap: balance; font-family: var(--display); font-size: clamp(20px, 2.2vw, 28px); font-weight: 700; letter-spacing: -0.015em; color: var(--ink); }

@media (max-width: 759px) {
  .gx .gx-spec { grid-template-columns: minmax(0, 1fr); }
  .gx .gx-spec { gap: 16px; }
  .gx .gx-tricks { display: flex; flex-direction: column; gap: 10px; }
  .gx .gx-tricks article { display: block; padding: 16px; border-radius: 16px; }
  .gx .gx-tricks .gx-eq { margin: 8px 0 10px; }
  .gx .gx-n { font-size: 24px; }
  .gx .gx-tricks h4 { font-size: 19px; }
  .gx .gx-gain b { font-size: 28px; }
  .gx .gx-det { min-height: 0; padding: 18px; border-radius: 16px; }
  /* economics on phones: a shared legend names the three sources once, then the four quantities in a 2x2 grid of bars + values */
  .gx .gx-econ { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin-top: 12px; }
  .gx .ec-names { display: none; }
  .gx .ec-legend { display: grid; gap: 5px; grid-column: 1 / -1; padding-bottom: 2px; }
  .gx .ec-legend .ec-r { display: flex; align-items: center; gap: 9px; height: auto; padding: 0; border-bottom: 0; }
  .gx .ec-legend .ec-n { font-size: 13px; line-height: 1.3; }
  .gx .ec-legend .ec-bar, .gx .gx-econ.in .ec-legend .ec-bar { flex: none; width: 24px; height: 10px; border-radius: 5px; transition: none; }
  /* inside a cell the source name stays for screen readers only */
  .gx .ec-col:not(.ec-names) .ec-n { display: block; position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .gx .ec-h { font-size: 16px; margin-bottom: 4px; padding-bottom: 6px; }
  .gx .ec-h small { min-height: 2.6em; margin-top: 2px; font-size: 11.5px; line-height: 1.3; }
  .gx .ec-col .ec-r { position: relative; height: 26px; border-bottom: 0; }
  .gx .ec-c { gap: 7px; }
  .gx .gx-econ.in .ec-col .ec-bar { width: calc(var(--w) * 0.5); }
  .gx .ec-bar { height: 12px; border-radius: 6px; } .gx .ec-v { font-size: 14px; } .gx .ec-v small { display: none; }
  .gx .gx-econ ~ .gx-bridge { font-size: 19px; line-height: 1.25; }
  .gx .gx-econ ~ .gx-lead { margin-top: 18px; }
  .gx .gx-nums b { font-size: 32px; }
  .gx .gx-eq { font-size: 13px; }
}

.gx .gx-spec-fig { padding-top: 8px; }
.gx #gx-cos-bars .brow { padding: 1px 0; }
.gx #gx-cos-bars .brow .lane { height: 24px; }
.gx .gx-det .gx-sub { margin-top: 2px; }
.gx .gx-det .gx-dots { margin-top: 2px; }
.gx .gx-eqn { margin: -4px 0 12px; font-size: 13px; color: var(--muted); }

/* detail panels: efficiency numbers, the heavy tail, labelled cosine bars */
.gx .gx-io { margin-bottom: 10px; padding-bottom: 10px; }
.gx .gx-eff { grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; margin: 2px 0 6px; }
.gx .gx-eff > div:first-child { max-width: 190px; }
.gx .gx-eff > div:first-child b { color: var(--accent); }
.gx .gx-vs p { margin: 0; font-size: 14px; color: var(--ink2); line-height: 1.35; }
.gx .gx-vs p b { display: inline-block; min-width: 62px; font-family: var(--display); font-size: 19px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.gx .gx-vs small { margin-top: 3px; font-size: 12.5px; }
.gx .gx-tail svg { display: block; width: 100%; height: auto; overflow: visible; font-family: "Inter", sans-serif; }
.gx .gx-tail { margin: 4px 0 6px; }
.gx svg text.gx-ax { font-size: 10.5px; fill: var(--muted); }
.gx .gx-cos-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gx .gx-cos-h .gx-sub { margin: 0; }
.gx .gx-cos-h .tabs button { padding: 5px 12px; font-size: 13px; }
.gx #gx-cos-bars { margin: 8px 0 10px; }
.gx #gx-cos-bars .brow .name { font-size: 13px; }
.gx #gx-cos-bars .brow .lane { height: 22px; }
.gx #gx-cos-bars .brow .fill { top: 4px; height: 14px; }
.gx #gx-cos-bars .brow .val { top: 0; font-size: 14.5px; }
.brow.wm-lite .fill { background: #9fd0ff; }
.gx .gx-nums small { font-size: 12.5px; }
@media (max-width: 759px) {
  .gx .gx-eff { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .gx .gx-cos-h { display: block; } .gx .gx-cos-h .gx-sub { margin-bottom: 6px; }
}

.gx .gx-cos-h .tabs { flex: none; }
.gx .gx-cos-h .gx-sub { font-size: 11px; white-space: nowrap; }
.gx #gx-cos-bars .brow .lane { height: 20px; }
.gx #gx-cos-bars .brow .fill { top: 3px; }
.gx #gx-cos-bars .brow .val { top: -1px; }
.gx .gx-eqn { margin: -4px 0 8px; line-height: 1.4; }
.gx .gx-nums { margin-bottom: 4px; }
.gx .gx-nums b { font-size: 36px; }
@media (max-width: 759px) { .gx .gx-cos-h .gx-sub { white-space: normal; } }
.gx .gx-cos-h { min-width: 0; }
.gx .gx-cos-h .gx-sub { font-size: 10.5px; letter-spacing: 0.03em; }
.gx .gx-cos-h .tabs button { padding: 5px 10px; }

/* end-label arrows; the backward line of a detail card stays on one line on wide screens */
.gx .gx-arr { fill: none; stroke: #9ca3af; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 760px) { .gx .gx-io { column-gap: 10px; } .gx .gx-io dd { white-space: nowrap; font-size: 14px; } }

/* the title, the forward/backward rows and the divider sit at the same place in all three panels */
.gx .gx-k { line-height: 1.2; }
.gx .gx-io dt, .gx .gx-io dd { line-height: 1.5; }
@media (max-width: 759px) { .gx .gx-io dd:last-of-type { min-height: 3em; } }

/* choosing a source: no tap box; the ring pulses once in the source's colour and the name turns bold */
.gx .gx-spec-fig, .gx .gx-spec-fig svg, .gx .gx-node { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.gx .gx-node, .gx .gx-node:focus { outline: none; }
.gx .gx-pulse { opacity: 0; pointer-events: none; transform-box: fill-box; transform-origin: center; }
.gx .gx-node.on .gx-pulse { animation: gx-pulse 0.6s ease-out; }
@keyframes gx-pulse { from { opacity: 0.55; transform: scale(1); } to { opacity: 0; transform: scale(2.1); } }
.gx .gx-node.on .gx-name { font-weight: 700; }
.gx .gx-node:focus-visible .gx-dot { stroke-width: 6; }
@media (prefers-reduced-motion: reduce) { .gx .gx-node.on .gx-pulse { animation: none; } }
/* economics: the trade-off in one line, then the conclusion */
.gx .gx-pre { margin: 28px 0 0; max-width: 900px; font-size: clamp(16px, 1.6vw, 20px); color: var(--ink2); }
.gx .gx-pre + .gx-bridge, .gx .gx-lead + .gx-bridge { margin-top: 8px; }
@media (max-width: 759px) { .gx .gx-pre { margin-top: 20px; } }

/* fixes on phones: eyebrow, heading and the three cards fit in one screen below the nav */
@media (max-width: 759px) {
  .gx #tricks .eyebrow { margin-bottom: 6px; }
  .gx #tricks .claim.mid { font-size: clamp(24px, 6.9vw, 28px); margin-bottom: 10px; }
  .gx .gx-tricks { gap: 6px; margin-top: 0; }
  .gx .gx-tricks article { padding: 10px 14px; border-radius: 16px; }
  .gx .gx-tricks h4 { gap: 8px; font-size: 17px; line-height: 1.2; }
  .gx .gx-tricks .gx-n { font-size: 17px; }
  .gx .gx-tricks .gx-eq { margin: 4px 0; font-size: 12px; }
  .gx .gx-tricks .gx-eq .katex-display { margin: 0; }
  .gx .gx-tricks p { font-size: 13px; line-height: 1.35; }
  .gx .gx-tricks .gx-gain { gap: 10px; margin-top: 7px; padding-top: 7px; }
  .gx .gx-tricks .gx-gain b { min-width: 74px; font-size: 24px; }
  .gx .gx-tricks .gx-gain span { font-size: 13px; line-height: 1.25; }
}
@media (max-width: 374px) { .gx .gx-tricks .gx-eq { font-size: 11.5px; } }
/* taller phones get a little more air */
@media (max-width: 759px) and (min-height: 780px) { .gx .gx-tricks { gap: 8px; } .gx .gx-tricks article { padding: 12px 14px; } .gx .gx-tricks .gx-eq { margin: 5px 0; } }
