/* =============================================================================
   affiliate.css: the affiliate programme page.

   Concept. The product of this page is a MECHANIC, not a feature: a link goes
   out, somebody signs up, and then money arrives every month for a year. So
   the hero is that mechanic running. A pulse leaves the link, a customer
   lands, and twelve monthly bars fill one after another while a total counts
   up. Nobody has to read the terms to understand the offer; they watch it
   happen once and then read the terms to check it.

   Everything after the hero is a STATEMENT, because the subject is money and
   that is the form a reader already trusts for it: label left, figure right,
   ruled between, tabular numerals so a column lines up. The terms and the
   partner's own earnings use the same object, so the pitch and the account are
   one thing seen at two stages.

   Theme. Every colour is token-derived and only --af-* names are declared, so
   tests/theme-lint.mjs sees no second source of truth and the page is light
   when the site is light.

   Motion. Additive, never load-bearing. Under prefers-reduced-motion the
   diagram holds its finished state, the bars are full, the total shows its
   final figure and nothing moves: the page still says the same thing.
   ========================================================================== */

.af-page {
  /* site-chrome.css gives body a font and no background, so a page that does
     not paint its own ground borrows whatever is under it. */
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  --af-wrap: 1180px;
  --af-gut: clamp(20px, 5vw, 56px);

  --af-ink: var(--text-primary);
  --af-ink-2: var(--text-secondary);
  --af-ink-3: var(--text-tertiary);
  --af-rule: var(--border);
  --af-rule-2: var(--border-strong);
  --af-line-soft: color-mix(in oklab, var(--text) 7%, transparent);
  --af-card: var(--surface);
  --af-band: var(--bg-2);
}

.af-main { display: block; position: relative; }

.af-wrap {
  max-width: var(--af-wrap);
  margin: 0 auto;
  padding-left: var(--af-gut);
  padding-right: var(--af-gut);
  position: relative;
  z-index: 1;
}

/* ---- the ground ---------------------------------------------------------- */
/* Two layers, both inert: drifting brand light, and a measurement grid faint
   enough that body copy never fights it. */
.af-sky, .af-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.af-sky {
  background:
    radial-gradient(58vw 48vh at 12% 0%, color-mix(in oklab, var(--brand) 18%, transparent), transparent 70%),
    radial-gradient(48vw 42vh at 88% 12%, color-mix(in oklab, var(--brand-2) 14%, transparent), transparent 70%);
  animation: af-drift 34s ease-in-out infinite alternate;
}
@keyframes af-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(0, -3%, 0) scale(1.06); }
}
.af-grid {
  background-image:
    linear-gradient(to right, var(--af-line-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--af-line-soft) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(110vw 90vh at 50% 20%, black 0%, transparent 76%);
  opacity: .55;
}

/* ---- hero ---------------------------------------------------------------- */
.af-hero { position: relative; padding: clamp(44px, 7vw, 92px) 0 clamp(36px, 6vw, 72px); overflow: hidden; }
.af-hero-grid {
  display: grid;
  gap: clamp(28px, 4vw, 56px);
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}
@media (min-width: 980px) {
  .af-hero-grid { grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); }
}

.af-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--af-rule);
  background: var(--af-card);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--af-ink-2);
  margin-bottom: var(--space-4);
}
.af-kicker i {
  width: 7px; height: 7px; border-radius: var(--radius-pill);
  background: var(--brand); display: inline-block;
  animation: af-blink 2.6s ease-in-out infinite;
}
@keyframes af-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.af-h1 {
  font-family: var(--font-heading);
  font-size: clamp(34px, 5.6vw, 62px);
  line-height: 1.02;
  letter-spacing: -.025em;
  margin: 0 0 var(--space-4);
  color: var(--af-ink);
  text-wrap: balance;
}
.af-grad {
  background: linear-gradient(100deg, var(--brand), var(--brand-2) 60%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.af-lede {
  font-size: clamp(16px, 1.45vw, 19px);
  line-height: 1.62;
  color: var(--af-ink-2);
  margin: 0 0 var(--space-5);
  max-width: 56ch;
}

.af-cta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-5); }

.af-btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: 1px solid var(--af-rule-2);
  background: var(--af-card);
  color: var(--af-ink);
  padding: 12px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.af-btn:hover { background: var(--surface-hover); transform: translateY(-1px); }
.af-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.af-btn--primary { background: var(--gradient); border-color: transparent; color: var(--on-brand); }
/* Keep the gradient on hover. The base .af-btn:hover sets background to
   --surface-hover (a near-white raise on the light theme), and with nothing
   restoring it the primary button lost its gradient and went pale against the
   white page. Restate the gradient here so it wins, and brighten for feedback. */
.af-btn--primary:hover { background: var(--gradient); filter: brightness(1.06); }
.af-btn[disabled] { opacity: .55; cursor: default; transform: none; }

.af-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.af-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--af-rule);
  background: var(--af-card);
  font-size: 12.5px;
  color: var(--af-ink-2);
}
.af-chip b { color: var(--af-ink); font-weight: 650; }

/* ---- the hero illustration ----------------------------------------------
   The partner's own earnings surface. It replaced a 52px flow strip sitting
   inside a large card, which read as an afterthought at the size the card
   gave it. The card is now mostly chart, which is the thing worth showing.
   ========================================================================== */
.af-engine {
  position: relative;
  border: 1px solid var(--af-rule);
  border-radius: var(--radius-xl);
  background: var(--af-card);
  padding: clamp(18px, 2.2vw, 26px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
/* A soft brand bloom behind the card, so it sits in the hero's light rather
   than on top of it as a plain white rectangle. */
.af-engine-glow {
  position: absolute;
  inset: -40% -20% auto -20%;
  height: 70%;
  background: radial-gradient(60% 60% at 50% 0%, color-mix(in oklab, var(--brand) 22%, transparent), transparent 70%);
  pointer-events: none;
}
.af-engine--lift { animation: af-lift 7s ease-in-out infinite alternate; }
@keyframes af-lift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, -7px, 0); }
}

.af-engine-bar {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--af-rule);
  margin-bottom: var(--space-4);
}
.af-engine-bar i { width: 9px; height: 9px; border-radius: var(--radius-pill); background: var(--af-rule-2); }
.af-engine-bar b {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--af-ink-3); font-weight: 600;
}

.af-engine-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12.5px;
  color: var(--af-ink);
  background: var(--bg);
  border: 1px solid var(--af-rule-2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  overflow-x: auto; white-space: nowrap;
}
.af-engine-link svg { flex: none; color: var(--brand); }

/* ---- the figure ---------------------------------------------------------- */
.af-figure {
  position: relative;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-5) 0 var(--space-4);
}
.af-figure-l { font-size: 12.5px; color: var(--af-ink-3); margin: 0 0 4px; }
.af-figure-v {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(30px, 4.2vw, 46px);
  font-weight: 700;
  line-height: 1;
  margin: 0;
  letter-spacing: -.02em;
  background: linear-gradient(100deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.af-delta {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 650;
  color: var(--green);
  background: color-mix(in oklab, var(--green) 12%, transparent);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  white-space: nowrap;
}

/* ---- the chart ----------------------------------------------------------- */
.af-chart { display: block; width: 100%; height: auto; overflow: visible; margin-top: var(--space-2); }
.af-chart-grid line { stroke: var(--af-line-soft); stroke-width: 1; }
.af-chart-axis { stroke: var(--af-rule-2); stroke-width: 1.25; }
.af-chart-t {
  fill: var(--af-ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .04em;
}

.af-bar {
  fill: url(#afBarG);
  transform-box: fill-box;
  transform-origin: bottom;
  animation: af-grow 12s cubic-bezier(.22,.61,.36,1) infinite;
}
@keyframes af-grow {
  0%        { transform: scaleY(0); opacity: 0; }
  4%        { opacity: 1; }
  10%, 88%  { transform: scaleY(1); opacity: 1; }
  96%, 100% { transform: scaleY(0); opacity: 0; }
}
/* Stagger by position rather than an inline custom property, because rule 2
   of the constitution is no inline style and twelve of them to carry an index
   is exactly what it exists to stop. */
.af-bar:nth-child(1)  { animation-delay: 0s; }
.af-bar:nth-child(2)  { animation-delay: .26s; }
.af-bar:nth-child(3)  { animation-delay: .52s; }
.af-bar:nth-child(4)  { animation-delay: .78s; }
.af-bar:nth-child(5)  { animation-delay: 1.04s; }
.af-bar:nth-child(6)  { animation-delay: 1.3s; }
.af-bar:nth-child(7)  { animation-delay: 1.56s; }
.af-bar:nth-child(8)  { animation-delay: 1.82s; }
.af-bar:nth-child(9)  { animation-delay: 2.08s; }
.af-bar:nth-child(10) { animation-delay: 2.34s; }
.af-bar:nth-child(11) { animation-delay: 2.6s; }
.af-bar:nth-child(12) { animation-delay: 2.86s; }

/* The cumulative line draws itself across the same window the bars fill in. */
.af-trend {
  fill: none;
  stroke: url(#afLineG);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: af-draw 12s cubic-bezier(.22,.61,.36,1) infinite;
}
@keyframes af-draw {
  0%        { stroke-dashoffset: 420; }
  32%, 88%  { stroke-dashoffset: 0; }
  96%, 100% { stroke-dashoffset: 420; }
}
.af-trend-dot {
  fill: var(--brand-2);
  opacity: 0;
  animation: af-dot 12s ease-out infinite;
}
@keyframes af-dot {
  0%, 30%   { opacity: 0; r: 3; }
  36%       { opacity: 1; r: 6; }
  40%, 88%  { opacity: 1; r: 5; }
  96%, 100% { opacity: 0; r: 3; }
}

/* ---- the three counts ---------------------------------------------------- */
.af-stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--af-rule);
}
.af-stat { display: flex; flex-direction: column; gap: 2px; }
.af-stat-v {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(16px, 1.8vw, 20px);
  font-weight: 700;
  color: var(--af-ink);
}
.af-stat-v--good { color: var(--green); }
.af-stat-l { font-size: 11.5px; color: var(--af-ink-3); }

/* ---- commission landing -------------------------------------------------- */
.af-pop {
  position: absolute;
  /* Over the LEFT of the chart, where the early months are short and the
     space is empty. On the right it collided with the monthly delta pill, and
     pinned to the chart top it crowded the tallest bar. */
  left: clamp(18px, 2.2vw, 26px);
  top: 42%;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--green);
  background: var(--af-card);
  border: 1px solid color-mix(in oklab, var(--green) 40%, transparent);
  border-radius: var(--radius-pill);
  padding: 4px 11px;
  opacity: 0;
  pointer-events: none;
  animation: af-pop 6s ease-out infinite;
}
.af-pop--b { animation-delay: 3s; }
@keyframes af-pop {
  0%        { opacity: 0; transform: translateY(10px) scale(.92); }
  12%       { opacity: 1; transform: translateY(0) scale(1); }
  40%       { opacity: 1; transform: translateY(-14px) scale(1); }
  58%, 100% { opacity: 0; transform: translateY(-30px) scale(.96); }
}

/* ---- sections ------------------------------------------------------------ */
/* clip, because .af-sky inside these sections animates to scale(1.06) and is
   therefore WIDER than the section it sits in. Without this it pushed the
   document 1 to 38px past the viewport and a horizontal scrollbar appeared and
   disappeared as the background breathed. .af-hero already clipped its own;
   these sections gained a sky later and did not.

   clip rather than hidden: hidden makes the element a scroll container, and
   these sections are anchor targets (#terms, #calc, #apply). clip has no such
   side effect. */
.af-section { position: relative; padding: clamp(44px, 6.5vw, 84px) 0; overflow: clip; }
.af-band { background: var(--af-band); border-block: 1px solid var(--af-rule); }

.af-h2 {
  font-family: var(--font-heading);
  font-size: clamp(24px, 3.2vw, 36px);
  line-height: 1.12;
  letter-spacing: -.022em;
  margin: 0 0 var(--space-3);
  color: var(--af-ink);
  text-wrap: balance;
}
.af-sub { font-size: 15.5px; line-height: 1.6; color: var(--af-ink-2); margin: 0 0 var(--space-6); max-width: 62ch; }

/* ---- the ledger ---------------------------------------------------------- */
.af-ledger {
  border: 1px solid var(--af-rule);
  border-radius: var(--radius-lg);
  background: var(--af-card);
  overflow: hidden;
}
.af-ledger + .af-ledger { margin-top: var(--space-5); }
.af-ledger-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--af-rule);
  background: var(--af-band);
}
.af-ledger-title { font-family: var(--font-heading); font-size: 15px; font-weight: 700; margin: 0; color: var(--af-ink); }
.af-ledger-note { font-size: 12px; color: var(--af-ink-3); margin: 0; }

.af-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) var(--space-5); }
.af-row + .af-row { border-top: 1px solid var(--af-rule); }
.af-row-l { font-size: 14px; color: var(--af-ink-2); margin: 0; }
.af-row-l b { color: var(--af-ink); font-weight: 650; }
.af-row-s { display: block; font-size: 12.5px; color: var(--af-ink-3); margin-top: 3px; }

.af-fig {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(18px, 2vw, 23px);
  font-weight: 700;
  color: var(--af-ink);
  white-space: nowrap;
}
.af-fig--muted { color: var(--af-ink-3); font-weight: 500; font-size: 15px; }
.af-fig--good { color: var(--green); }
.af-fig--grad {
  background: linear-gradient(100deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---- the terms ----------------------------------------------------------
   This was a two-column table: label left, figure right, ruled between. It
   read as a spec dump, and worse, it gave all five terms the same weight when
   only one of them is the offer.

   So the rate carries the section and the other four qualify it. The hero card
   is the loudest thing on the page after the headline; the four tiles beside
   it are a quiet grid that answers the follow-up questions in order.

   Rule 5 of the constitution is no left-accent stripes, so the tiles are
   icon-chip led, which is the pattern it points at instead.
   ========================================================================== */
.af-terms {
  display: grid;
  gap: clamp(16px, 2.2vw, 24px);
  grid-template-columns: minmax(0, 1fr);
  /* stretch, so the rate card matches the tile grid by growing rather than by
     a 100% height against an align-start track. That combination constrained
     the card, and overflow:hidden (which the glow needs) then CLIPPED the
     bottom two checks. */
  align-items: stretch;
}
@media (min-width: 980px) {
  .af-terms { grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); }
}

/* ---- the rate ------------------------------------------------------------ */
.af-term-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in oklab, var(--brand) 34%, transparent);
  border-radius: var(--radius-xl);
  background: var(--af-card);
  padding: clamp(24px, 3.2vw, 38px);
  box-shadow: var(--shadow-lg);
  /* Lays its own content out so the space is used rather than left at the
     bottom: the checks sit on the floor of the card. The height comes from
     the grid stretching it, never from a percentage. */
  display: flex;
  flex-direction: column;
}
/* Addressed through the parent so it outweighs the .af-term-hero > * rule
   below, which is the same specificity and comes later. Without that the glow
   became an in-flow block the height of the card and painted over everything
   in it: the card rendered BLANK and every gate still passed. */
.af-term-hero > .af-term-hero-glow {
  position: absolute;
  inset: -60% -30% auto -30%;
  height: 120%;
  background:
    radial-gradient(52% 52% at 22% 0%, color-mix(in oklab, var(--brand) 26%, transparent), transparent 72%),
    radial-gradient(46% 46% at 92% 18%, color-mix(in oklab, var(--brand-2) 20%, transparent), transparent 72%);
  pointer-events: none;
}
.af-term-hero > * { position: relative; }

.af-term-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--purple-text);
  margin-bottom: var(--space-3);
}

.af-term-rate {
  font-family: var(--font-heading);
  font-size: clamp(68px, 11vw, 124px);
  font-weight: 800;
  line-height: .86;
  letter-spacing: -.045em;
  margin: 0;
  background: linear-gradient(100deg, var(--brand), var(--brand-2) 70%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* The sign is set smaller and raised, so the numeral is the thing you read
   and the unit does not fight it. */
.af-term-pct {
  font-size: .44em;
  vertical-align: super;
  letter-spacing: -.02em;
}
.af-term-rate-sub {
  font-size: 15px;
  font-weight: 600;
  color: var(--af-ink);
  margin: var(--space-3) 0 var(--space-4);
}
.af-term-hero-body {
  font-size: 14px;
  line-height: 1.66;
  color: var(--af-ink-2);
  margin: 0 0 var(--space-5);
  max-width: 44ch;
}

.af-term-nos { list-style: none; margin: auto 0 0; padding: 0; display: grid; gap: var(--space-2); }
.af-term-nos li {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--af-ink);
}
.af-term-nos svg { flex: none; color: var(--green); }

/* ---- the four that qualify it -------------------------------------------- */
.af-term-grid {
  display: grid;
  gap: clamp(14px, 1.6vw, 18px);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 640px) {
  .af-term-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.af-term {
  position: relative;
  border: 1px solid var(--af-rule);
  border-radius: var(--radius-lg);
  background: var(--af-card);
  padding: clamp(18px, 2.1vw, 24px);
  transition: transform .25s cubic-bezier(.22,.61,.36,1), border-color .25s ease, box-shadow .25s ease;
}
.af-term:hover {
  transform: translateY(-3px);
  border-color: color-mix(in oklab, var(--brand) 40%, transparent);
  box-shadow: var(--shadow-md);
}
.af-term-ic {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--brand) 12%, transparent);
  color: var(--purple-text);
  margin-bottom: var(--space-3);
}
.af-term-v {
  font-family: var(--font-heading);
  font-size: clamp(22px, 2.5vw, 29px);
  font-weight: 750;
  letter-spacing: -.025em;
  line-height: 1.04;
  color: var(--af-ink);
  margin: 0 0 3px;
}
.af-term-k {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--af-ink-3);
  margin: 0 0 var(--space-3);
}
.af-term-d { font-size: 13.5px; line-height: 1.6; color: var(--af-ink-2); margin: 0; }

/* The one that is a promise rather than a number gets the brand on its icon,
   so the eye lands on it last and it reads as the closing point. */
.af-term--accent { border-color: color-mix(in oklab, var(--brand) 30%, transparent); }
.af-term--accent .af-term-ic { background: var(--gradient); color: var(--on-brand); }
.af-term--accent .af-term-v {
  background: linear-gradient(100deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---- the calculator -----------------------------------------------------
   Every figure here is computed from the live plan prices in integer cents.
   The markup ships with the default already filled in, so a reader without
   scripting sees a true number rather than empty boxes.
   ========================================================================== */
.af-calc-head { max-width: 62ch; }

.af-calc {
  display: grid;
  gap: clamp(20px, 3vw, 32px);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  border: 1px solid var(--af-rule);
  border-radius: var(--radius-xl);
  background: var(--af-card);
  padding: clamp(20px, 3vw, 34px);
  box-shadow: var(--shadow-md);
}
@media (min-width: 900px) {
  .af-calc { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  .af-calc-note { grid-column: 1 / -1; }
}

.af-calc-controls { display: grid; gap: var(--space-6); }

/* ---- the plan picker ----------------------------------------------------- */
.af-seg { border: 0; padding: 0; margin: 0; }
.af-seg .af-label { display: block; margin-bottom: var(--space-3); }
.af-seg-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.af-seg-opt { cursor: pointer; }
/* Visually hidden rather than display:none, so it keeps its place in the tab
   order and can take focus. A control nobody can reach by keyboard is not a
   control. */
.af-seg-opt input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; margin: 0;
}
.af-seg-face {
  display: flex; flex-direction: column; gap: 2px;
  padding: 11px 12px;
  border: 1px solid var(--af-rule-2);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.af-seg-face b { font-size: 13.5px; font-weight: 650; color: var(--af-ink); }
.af-seg-face i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--af-ink-3);
}
.af-seg-opt input:checked + .af-seg-face {
  border-color: var(--brand);
  background: color-mix(in oklab, var(--brand) 10%, transparent);
}
.af-seg-opt input:checked + .af-seg-face b { color: var(--purple-text); }
.af-seg-opt input:focus-visible + .af-seg-face {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---- the slider ---------------------------------------------------------- */
.af-slider-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.af-slider-v {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 20px; font-weight: 700;
  color: var(--purple-text);
}
/* The 24px minimum target size, without moving a single painted pixel.
   -------------------------------------------------------------------------
   With appearance:none and no height, this element's box collapsed to the
   height of its runnable track below: 6px. Measured on production at 390x844,
   input#afCount was 308x6, and the 22px thumb does not help because it paints
   outside the input's box rather than enlarging it. So the whole calculator
   slider was a 6px tap target.

   height alone is not enough. The input is an inline-block with a 2px UA
   margin, so growing it changes the line box and pushes the scale below it
   down by 9px. The track is centred in the taller box by the browser, so it
   also moves. The two corrections below are measured, not derived:

     margin-top: 1px   puts the centred track back on row 147, exactly where
                       the 6px box had it (2px, the UA default, lands on 148)
     .af-slider-scale  absorbs the 9px the taller box adds above it, 7 -> -2

   Verified on production in Chrome at 390x844, both colour schemes: box 6px ->
   24px, the gap from the row above to the scale unchanged at 39px, the painted
   track unmoved, and the clipped screenshot byte-identical to before. Dragging
   still works, and a tap 3px below the top edge - dead before - now moves the
   value. */
.af-range {
  width: 100%;
  height: 24px;
  margin-top: 1px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}
.af-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: color-mix(in oklab, var(--text) 10%, transparent);
}
.af-range::-moz-range-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: color-mix(in oklab, var(--text) 10%, transparent);
}
.af-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  margin-top: -8px;
  border-radius: var(--radius-pill);
  background: var(--gradient);
  border: 2px solid var(--af-card);
  box-shadow: var(--shadow-sm);
}
.af-range::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  border: 2px solid var(--af-card);
  box-shadow: var(--shadow-sm);
}
.af-range:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: var(--radius-pill); }
.af-slider-scale {
  display: flex; justify-content: space-between;
  /* -2px, not the 7px this looks like it wants. .af-range above is now 24px
     tall for the tap target while painting the same 6px track, and the extra
     18px has to go somewhere: 9px of it lands between the track and this row.
     7 - 9 = -2 puts these labels back where they were. The two numbers belong
     together; changing the slider's height without changing this moves them. */
  margin-top: -2px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--af-ink-3);
}

/* ---- the answer ---------------------------------------------------------- */
.af-calc-out {
  position: relative;
  display: grid;
  gap: var(--space-4);
  padding: clamp(18px, 2.4vw, 26px);
  border-radius: var(--radius-lg);
  background: var(--af-band);
  border: 1px solid var(--af-rule);
  overflow: hidden;
}
.af-calc-cell { display: flex; flex-direction: column; gap: 3px; position: relative; z-index: 1; }
.af-calc-l { font-size: 12.5px; color: var(--af-ink-3); }
.af-calc-v {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 700;
  color: var(--af-ink);
  line-height: 1.1;
}
.af-calc-v--big {
  font-size: clamp(30px, 4.6vw, 50px);
  letter-spacing: -.02em;
  background: linear-gradient(100deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* A bar that fills with the count, so the figure has a shape as well as a
   value. Inert and decorative: the numbers carry the meaning. */
.af-calc-viz {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 5px;
  background: color-mix(in oklab, var(--text) 8%, transparent);
}
.af-calc-fill {
  display: block;
  height: 100%;
  width: 8%;
  background: var(--gradient);
  transition: width .35s cubic-bezier(.22,.61,.36,1);
}

.af-calc-note {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--af-ink-2);
  margin: 0;
}

/* ---- the state panel ----------------------------------------------------- */
.af-state { display: none; }
.af-state.is-on { display: block; }

.af-card {
  border: 1px solid var(--af-rule);
  border-radius: var(--radius-xl);
  background: var(--af-card);
  padding: clamp(22px, 3vw, 36px);
  box-shadow: var(--shadow-md);
}

.af-form { display: grid; gap: var(--space-4); }
.af-field { display: grid; gap: var(--space-2); }
.af-label { font-size: 13.5px; font-weight: 650; color: var(--af-ink); }
.af-hint { font-size: 12.5px; color: var(--af-ink-3); line-height: 1.5; }
.af-input, .af-textarea {
  font: inherit; font-size: 15px;
  color: var(--af-ink);
  background: var(--bg);
  border: 1px solid var(--af-rule-2);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  width: 100%;
}
.af-textarea { min-height: 100px; resize: vertical; }
.af-input:focus-visible, .af-textarea:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
.af-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

.af-link { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.af-link-v {
  font-family: var(--font-mono); font-size: 14px;
  color: var(--af-ink);
  background: var(--bg);
  border: 1px solid var(--af-rule-2);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  flex: 1 1 300px; min-width: 0;
  overflow-x: auto; white-space: nowrap;
}
.af-code-big {
  font-family: var(--font-mono);
  font-size: clamp(20px, 2.6vw, 30px);
  font-weight: 700;
  letter-spacing: .02em;
  margin: var(--space-2) 0 0;
  background: linear-gradient(100deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.af-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  border-radius: var(--radius-pill);
  border: 1px solid var(--af-rule-2);
  padding: 4px 11px;
  color: var(--af-ink-2);
}
.af-badge--good { color: var(--green); border-color: var(--green); }
.af-badge--warn { color: var(--amber); border-color: var(--amber); }

.af-msg { font-size: 14px; line-height: 1.6; color: var(--af-ink-2); margin: var(--space-3) 0 0; }
.af-msg--err { color: var(--red); }

/* ---- the FAQ -----------------------------------------------------------
   Eight equal cards of body copy is a wall, and a reader looking for one
   answer has to read all of them to find it. These are <details>, so the
   questions are a scannable list and only the one you want opens.

   <details> rather than a JavaScript accordion on purpose: the answers are in
   the DOM either way so search engines read them, it works with no script at
   all, and the keyboard and screen reader behaviour is the browser's rather
   than something to reimplement.
   ========================================================================== */
.af-faq { display: grid; gap: var(--space-3); }
@media (min-width: 900px) {
  /* Two columns, filled row by row (the grid default), so the cascade and
     the reading order both run left to right across each pair. */
  .af-faq { grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--space-4); }
}

.af-q {
  border: 1px solid var(--af-rule);
  border-radius: var(--radius-lg);
  background: var(--af-card);
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
  align-self: start;
}
.af-q:hover { border-color: var(--af-rule-2); }
.af-q[open] {
  border-color: color-mix(in oklab, var(--brand) 42%, transparent);
  box-shadow: var(--shadow-md);
}

.af-q > summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  list-style: none;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 650;
  color: var(--af-ink);
  line-height: 1.35;
}
/* The default disclosure triangle is replaced by the sign below, and Safari
   needs its own name for it. */
.af-q > summary::-webkit-details-marker { display: none; }
.af-q > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* A plus that becomes a minus. Two bars, one of which rotates, so there is no
   second glyph to keep in step and nothing to translate. */
.af-q-sign {
  position: relative;
  flex: none;
  width: 26px; height: 26px;
  margin-left: auto;
  border-radius: var(--radius-pill);
  border: 1px solid var(--af-rule-2);
  background: var(--bg);
  transition: background .2s ease, border-color .2s ease;
}
.af-q-sign::before, .af-q-sign::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 11px; height: 1.8px;
  margin: -0.9px 0 0 -5.5px;
  border-radius: var(--radius-pill);
  background: var(--af-ink-2);
  transition: transform .25s cubic-bezier(.22,.61,.36,1), background .2s ease;
}
.af-q-sign::after { transform: rotate(90deg); }
.af-q[open] .af-q-sign { background: var(--gradient); border-color: transparent; }
.af-q[open] .af-q-sign::before,
.af-q[open] .af-q-sign::after { background: var(--on-brand); }
.af-q[open] .af-q-sign::after { transform: rotate(0deg); }

.af-q-body {
  padding: 0 var(--space-5) var(--space-5);
  font-size: 14px;
  line-height: 1.68;
  color: var(--af-ink-2);
  margin: 0;
}
/* The answer slides rather than snapping. Only runs when the browser can
   animate to a content-sized height; everywhere else it simply appears, which
   is the behaviour <details> has always had. */
@supports (interpolate-size: allow-keywords) {
  .af-q { interpolate-size: allow-keywords; }
  .af-q::details-content {
    block-size: 0;
    overflow: hidden;
    transition: block-size .32s cubic-bezier(.22,.61,.36,1), content-visibility .32s allow-discrete;
  }
  .af-q[open]::details-content { block-size: auto; }
}

/* ---- steps --------------------------------------------------------------
   Three cards carrying a number and a line of copy. The number is real
   information here, because these happen in this order and you cannot share a
   link before you have one.
   ========================================================================== */
.af-steps {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  list-style: none; margin: 0; padding: 0;
  counter-reset: af-step;
}
.af-step {
  position: relative;
  border: 1px solid var(--af-rule);
  border-radius: var(--radius-lg);
  background: var(--af-card);
  padding: var(--space-5);
  overflow: hidden;
  transition: transform .25s cubic-bezier(.22,.61,.36,1), border-color .25s ease, box-shadow .25s ease;
}
.af-step:hover {
  transform: translateY(-3px);
  border-color: color-mix(in oklab, var(--brand) 38%, transparent);
  box-shadow: var(--shadow-md);
}
/* A large ghosted numeral behind the card, so the sequence reads at a glance
   without another element competing with the copy. */
.af-step::after {
  counter-increment: af-step;
  content: counter(af-step);
  position: absolute;
  right: -10px; bottom: -34px;
  font-family: var(--font-heading);
  font-size: 128px;
  font-weight: 800;
  line-height: 1;
  color: color-mix(in oklab, var(--brand) 9%, transparent);
  pointer-events: none;
}
.af-step-ic {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--brand) 12%, transparent);
  color: var(--purple-text);
  margin-bottom: var(--space-3);
}
.af-step h3 {
  position: relative;
  font-family: var(--font-heading);
  font-size: 17px; font-weight: 700;
  margin: 0 0 var(--space-2);
  color: var(--af-ink);
}
.af-step p { position: relative; font-size: 14px; line-height: 1.62; color: var(--af-ink-2); margin: 0; }

/* Links inside the page's own content only. The nav and footer are stamped
   chrome with their own .mv-* colours and must not be reached into. */
.af-main a { color: var(--purple-text); }
.af-main a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-xs); }
.af-main .af-btn { color: var(--af-ink); }
.af-main .af-btn--primary { color: var(--on-brand); }

/* ---- reveal on scroll ---------------------------------------------------
   Hidden ONLY when scripting is on, because only then will anything show it
   again. html.af-js is set by an inline head script before this file loads;
   without that guard a reader with JavaScript off loses the terms, the steps
   and the whole FAQ.

   .is-now is for a block that was ALREADY on screen when the page loaded. It
   gets the end state with no transition, because animating something the
   reader is already looking at moves the page under them for no reason. */
.af-js .af-rise {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s cubic-bezier(.22,.61,.36,1), transform .7s cubic-bezier(.22,.61,.36,1);
  will-change: opacity, transform;
}
.af-js .af-rise.is-in { opacity: 1; transform: none; }
.af-js .af-rise.is-now { opacity: 1; transform: none; transition: none; }

/* A group settles child by child instead of arriving as one slab. The delay
   is on the CHILD, so the parent's own transition still runs first. */
.af-js .af-stagger.is-in > * { animation: af-settle .7s cubic-bezier(.22,.61,.36,1) backwards; }
.af-js .af-stagger.is-now > * { animation: none; }
@keyframes af-settle {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.af-js .af-stagger.is-in > *:nth-child(1) { animation-delay: .04s; }
.af-js .af-stagger.is-in > *:nth-child(2) { animation-delay: .12s; }
.af-js .af-stagger.is-in > *:nth-child(3) { animation-delay: .2s; }
.af-js .af-stagger.is-in > *:nth-child(4) { animation-delay: .28s; }
.af-js .af-stagger.is-in > *:nth-child(5) { animation-delay: .36s; }
.af-js .af-stagger.is-in > *:nth-child(6) { animation-delay: .44s; }
.af-js .af-stagger.is-in > *:nth-child(7) { animation-delay: .52s; }
.af-js .af-stagger.is-in > *:nth-child(8) { animation-delay: .6s; }

/* ---- phone --------------------------------------------------------------- */
@media (max-width: 620px) {
  .af-row { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
  .af-ledger-head { flex-direction: column; align-items: flex-start; gap: var(--space-1); }
  .af-figure { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
  .af-stats { gap: var(--space-2); }
  /* The figure stacks here, which puts the monthly pill exactly where the
     floating chip lands. The chip is decoration, so it goes rather than
     overlapping a real number. */
  .af-pop { display: none; }
  .af-seg-row { grid-template-columns: 1fr; }
  .af-step::after { font-size: 96px; bottom: -26px; }
}

/* ---- reduced motion ------------------------------------------------------
   Everything above is additive, so this holds the finished state rather than
   hiding anything: the months are full, the pulse and the drift stop, and the
   reveal is already done. The page says exactly the same thing. */
@media (prefers-reduced-motion: reduce) {
  .af-sky, .af-kicker i, .af-engine--lift { animation: none; }
  .af-bar { animation: none; opacity: 1; transform: none; }
  .af-trend { animation: none; stroke-dashoffset: 0; }
  .af-trend-dot { animation: none; opacity: 1; }
  .af-pop { animation: none; display: none; }
  .af-calc-fill { transition: none; }
  .af-step, .af-q, .af-q-sign::before, .af-q-sign::after, .af-term { transition: none; }
  .af-term:hover { transform: none; }
  .af-step:hover { transform: none; }
  .af-q::details-content { transition: none; }
  .af-js .af-rise { opacity: 1; transform: none; transition: none; }
  .af-js .af-stagger.is-in > * { animation: none; }
  .af-btn { transition: none; }
  .af-btn:hover { transform: none; }
}
