/* ==========================================================================
   Astrodyne — canonical public design system (Phase 4A.2)
   ==========================================================================

   One visual language for every public surface, derived from the approved
   builder-facing homepage. It replaces the older "Zen" light/paper system that
   still governed /pricing, /features, /catalog, /use-cases/* and /beta and made
   the product look like two different companies.

   Personality: clean, simple, modern, Apple-like, approachable, low cognitive
   load. Dark by default (matching the homepage and console); the light token
   set is opt-in via <html data-ad-theme="light">.

   Conventions
   -----------
   * All components are prefixed `ad-` so they cannot collide with the console's
     own classes or with the legacy zen.css.
   * Never hardcode a colour in a template — use a token.
   * Every interactive element gets a visible focus ring.

   Contents: tokens · shell · nav · typography · surfaces · cards · stats ·
   buttons · badges · alerts · forms · tables · code · tabs · empty/loading ·
   modal · utilities · responsive · motion
   ========================================================================== */

:root {
  /* ── surface + ink ───────────────────────────────────────────────────── */
  --ad-bg:            #0D1015;
  --ad-bg-raised:     #11151B;
  --ad-ink:           #F5F7FA;
  --ad-ink-soft:      #AEB6C2;
  --ad-ink-mute:      #7E8896;  /* Phase 5D — 4.25:1 measured; now 5.31:1 (WCAG AA) */

  --ad-glass:         rgba(255, 255, 255, 0.055);
  --ad-glass-2:       rgba(255, 255, 255, 0.085);
  --ad-edge:          rgba(255, 255, 255, 0.10);
  --ad-edge-soft:     rgba(255, 255, 255, 0.06);
  --ad-edge-strong:   rgba(255, 255, 255, 0.20);

  /* ── accent ──────────────────────────────────────────────────────────── */
  --ad-accent:        oklch(0.86 0.07 218);
  --ad-accent-soft:   rgba(127, 212, 224, 0.10);
  --ad-accent-border: rgba(127, 212, 224, 0.28);
  --ad-warm:          oklch(0.78 0.10 55);
  --ad-danger:        oklch(0.68 0.17 25);
  --ad-success:       oklch(0.78 0.12 155);

  /* ── type ────────────────────────────────────────────────────────────── */
  --ad-font-display: 'Instrument Serif', Georgia, serif;
  --ad-font-body:    'Instrument Sans', system-ui, -apple-system, sans-serif;
  --ad-font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --ad-text-xs:   12px;
  --ad-text-sm:   13px;
  --ad-text-base: 15px;
  --ad-text-md:   17px;
  --ad-text-lg:   21px;
  --ad-text-xl:   27px;
  --ad-text-2xl:  34px;

  /* ── spacing (4px grid) ──────────────────────────────────────────────── */
  --ad-s1: 4px;  --ad-s2: 8px;  --ad-s3: 12px; --ad-s4: 16px;
  --ad-s5: 20px; --ad-s6: 24px; --ad-s8: 32px; --ad-s10: 40px;
  --ad-s12: 48px; --ad-s16: 64px; --ad-s20: 80px;

  /* ── radii + shadow ──────────────────────────────────────────────────── */
  --ad-r-sm: 10px;
  --ad-r:    14px;
  --ad-r-lg: 20px;
  --ad-r-xl: 24px;
  --ad-r-pill: 999px;

  --ad-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --ad-shadow:    0 30px 70px -28px rgba(0, 0, 0, 0.70);
  --ad-shadow-lg: 0 40px 90px -30px rgba(0, 0, 0, 0.80);

  --ad-blur: 22px;
  --ad-ease: cubic-bezier(0.2, 0.65, 0.25, 1);
  --ad-maxw: 1180px;
}

/* Light theme — OPT-IN ONLY via <html data-ad-theme="light">.
   Deliberately NOT driven by prefers-color-scheme: the homepage shell is
   hard-dark, so honouring an OS light preference here would make /pricing light
   while / stayed dark — exactly the two-generations problem this phase fixes.
   The tokens exist so a future operator-controlled theme switch is a one-line
   change rather than a restyle. */
:root[data-ad-theme="light"] {
  --ad-bg:          #FBFBFC;
  --ad-bg-raised:   #FFFFFF;
  --ad-ink:         #14181D;
  --ad-ink-soft:    #4A525C;
  --ad-ink-mute:    #7A828C;
  --ad-glass:       rgba(15, 20, 26, 0.030);
  --ad-glass-2:     rgba(15, 20, 26, 0.055);
  --ad-edge:        rgba(15, 20, 26, 0.11);
  --ad-edge-soft:   rgba(15, 20, 26, 0.07);
  --ad-edge-strong: rgba(15, 20, 26, 0.22);
  --ad-shadow-sm:   0 1px 2px rgba(15, 20, 26, 0.06);
  --ad-shadow:      0 24px 60px -30px rgba(15, 20, 26, 0.22);
  --ad-shadow-lg:   0 34px 80px -32px rgba(15, 20, 26, 0.28);
}

/* ── shell ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.ad {
  margin: 0;
  background: var(--ad-bg);
  color: var(--ad-ink);
  font-family: var(--ad-font-body);
  font-size: var(--ad-text-base);
  line-height: 1.55;
  overflow-x: hidden;
}

.ad-bg-wash {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 820px at 18% -8%, rgba(90, 120, 150, 0.16), transparent 58%),
    radial-gradient(1000px 720px at 92% 4%, rgba(150, 110, 80, 0.07), transparent 52%),
    radial-gradient(1400px 900px at 50% 118%, rgba(70, 100, 130, 0.12), transparent 60%),
    var(--ad-bg);
}

.ad-main { display: block; }

.ad-container { max-width: var(--ad-maxw); margin: 0 auto; padding: 0 var(--ad-s6); }
.ad-section   { padding: var(--ad-s20) 0; }
.ad-section-sm { padding: var(--ad-s12) 0; }

/* ── navigation (public) ───────────────────────────────────────────────── */
.ad-nav {
  position: sticky; top: 18px; z-index: 60;
  display: flex; justify-content: center;
  padding: 14px var(--ad-s5) 0;
}
.ad-nav-inner {
  display: flex; align-items: center; gap: var(--ad-s6);
  width: 100%; max-width: var(--ad-maxw);
  padding: 11px 12px 11px 22px;
  border-radius: var(--ad-r-xl);
  background: var(--ad-glass);
  backdrop-filter: blur(var(--ad-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--ad-blur)) saturate(160%);
  border: 1px solid var(--ad-edge);
  box-shadow: var(--ad-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.ad-brand {
  display: flex; align-items: center; gap: 11px;
  color: var(--ad-ink); text-decoration: none;
  font-size: var(--ad-text-lg); font-weight: 600; letter-spacing: -0.02em;
}
.ad-nav-links {
  display: flex; gap: var(--ad-s8); margin: 0 auto;
  font-family: var(--ad-font-mono); font-size: var(--ad-text-sm);
}
.ad-nav-links a { color: var(--ad-ink-soft); text-decoration: none; transition: color .18s var(--ad-ease); }
.ad-nav-links a:hover, .ad-nav-links a[aria-current="page"] { color: var(--ad-ink); }
.ad-nav-actions { display: flex; align-items: center; gap: var(--ad-s2); }

/* ── typography ────────────────────────────────────────────────────────── */
.ad-display {
  font-family: var(--ad-font-display); font-weight: 400;
  line-height: 1.05; letter-spacing: -0.01em; margin: 0;
}
.ad-h1 { font-size: clamp(38px, 6vw, 84px); }
.ad-h2 { font-size: clamp(28px, 4.2vw, 50px); line-height: 1.08; }
.ad-h3 { font-size: clamp(20px, 2.4vw, 27px); line-height: 1.15; }
.ad-em { font-style: italic; color: var(--ad-ink); }

.ad-eyebrow {
  font-family: var(--ad-font-mono); font-size: var(--ad-text-xs);
  letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--ad-accent); margin: 0 0 var(--ad-s4);
}
.ad-lede { font-size: var(--ad-text-md); line-height: 1.7; color: var(--ad-ink-soft); margin: 0; }
.ad-muted { color: var(--ad-ink-soft); }
.ad-dim   { color: var(--ad-ink-mute); }
.ad-mono  { font-family: var(--ad-font-mono); font-size: var(--ad-text-xs); }
.ad-center { text-align: center; }
.ad-measure { max-width: 62ch; margin-left: auto; margin-right: auto; }

a { color: var(--ad-accent); text-decoration: none; }
a:hover { color: var(--ad-ink); }

/* ── cards + grid ──────────────────────────────────────────────────────── */
.ad-grid {
  display: grid; gap: var(--ad-s4);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.ad-grid-2, .ad-grid-4 { display: grid; gap: var(--ad-s4); }
.ad-grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.ad-grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.ad-card {
  padding: var(--ad-s6);
  border-radius: var(--ad-r-lg);
  background: var(--ad-glass);
  border: 1px solid var(--ad-edge);
  box-shadow: var(--ad-shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.ad-card-hover { transition: transform .28s var(--ad-ease), border-color .28s var(--ad-ease); }
.ad-card-hover:hover { transform: translateY(-3px); border-color: var(--ad-edge-strong); }
.ad-card-title { margin: 0 0 var(--ad-s2); font-size: var(--ad-text-md); font-weight: 600; }
.ad-card-body  { margin: 0; font-size: 14px; line-height: 1.65; color: var(--ad-ink-soft); }
.ad-card-foot  { margin-top: var(--ad-s4); padding-top: var(--ad-s3); border-top: 1px solid var(--ad-edge-soft); }

/* ── stat cards ────────────────────────────────────────────────────────── */
.ad-stat { padding: var(--ad-s5); border-radius: var(--ad-r); background: var(--ad-glass); border: 1px solid var(--ad-edge); }
.ad-stat-label { font-family: var(--ad-font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ad-ink-mute); }
.ad-stat-value { font-size: var(--ad-text-xl); font-weight: 600; margin-top: 6px; }
.ad-stat-detail { font-size: var(--ad-text-xs); color: var(--ad-ink-mute); margin-top: 4px; }

/* ── buttons ───────────────────────────────────────────────────────────── */
.ad-btn {
  display: inline-flex; align-items: center; gap: var(--ad-s2);
  padding: 13px 24px; border-radius: var(--ad-r-sm);
  font-family: var(--ad-font-body); font-size: 15px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .18s var(--ad-ease), filter .18s var(--ad-ease),
              border-color .18s var(--ad-ease), background .18s var(--ad-ease);
}
.ad-btn:hover { transform: translateY(-1px); }
.ad-btn-primary { color: #0D1015; background: #F5F7FA; box-shadow: 0 14px 34px -16px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.7); }
.ad-btn-primary:hover { filter: brightness(1.05); color: #0D1015; }
.ad-btn-ghost { color: var(--ad-ink); background: var(--ad-glass); border-color: var(--ad-edge); }
.ad-btn-ghost:hover { border-color: var(--ad-edge-strong); color: var(--ad-ink); }
.ad-btn-quiet { color: var(--ad-ink-soft); background: transparent; padding: 9px 14px; font-weight: 500; }
.ad-btn-quiet:hover { color: var(--ad-ink); }
.ad-btn-danger { color: #fff; background: var(--ad-danger); }
.ad-btn-sm { padding: 9px 16px; font-size: var(--ad-text-sm); }
.ad-btn-lg { padding: 15px 28px; font-size: var(--ad-text-md); }
.ad-btn[disabled], .ad-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }

/* ── badges + pills ────────────────────────────────────────────────────── */
.ad-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--ad-r-pill);
  font-size: 11px; font-family: var(--ad-font-mono);
  background: var(--ad-glass-2); border: 1px solid var(--ad-edge-soft);
  color: var(--ad-ink-soft);
}
.ad-badge-accent { background: var(--ad-accent-soft); border-color: var(--ad-accent-border); color: var(--ad-accent); }
.ad-badge-warn { background: rgba(240,180,90,.10); border-color: rgba(240,180,90,.28); color: var(--ad-warm); }
.ad-pill {
  display: inline-flex; align-items: center; gap: var(--ad-s2);
  padding: 8px 14px; border-radius: var(--ad-r-pill);
  background: var(--ad-glass); border: 1px solid var(--ad-edge-soft);
  font-size: var(--ad-text-sm); color: var(--ad-ink-soft);
}
.ad-pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ad-accent); box-shadow: 0 0 10px var(--ad-accent); }

/* ── alerts ────────────────────────────────────────────────────────────── */
.ad-alert {
  padding: var(--ad-s4) var(--ad-s5); border-radius: var(--ad-r);
  background: var(--ad-glass); border: 1px solid var(--ad-edge);
  border-left: 3px solid var(--ad-accent);
  font-size: 14px; color: var(--ad-ink-soft);
}
.ad-alert-danger { border-left-color: var(--ad-danger); }
.ad-alert-warn { border-left-color: var(--ad-warm); }

/* ── forms ─────────────────────────────────────────────────────────────── */
.ad-field { display: block; margin-bottom: var(--ad-s4); }
.ad-label {
  display: block; font-size: var(--ad-text-xs); font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ad-ink-mute); margin-bottom: 6px;
}
.ad-input, .ad-select, .ad-textarea {
  width: 100%; padding: 11px 14px;
  font-family: var(--ad-font-body); font-size: 15px;
  color: var(--ad-ink); background: var(--ad-glass-2);
  border: 1px solid var(--ad-edge); border-radius: var(--ad-r-sm);
  outline: none; transition: border-color .18s var(--ad-ease);
}
.ad-input::placeholder, .ad-textarea::placeholder { color: var(--ad-ink-mute); }
.ad-input:hover, .ad-select:hover, .ad-textarea:hover { border-color: var(--ad-edge-strong); }
.ad-textarea { min-height: 96px; resize: vertical; font-family: var(--ad-font-mono); font-size: 13px; }
.ad-help { font-size: var(--ad-text-xs); color: var(--ad-ink-mute); margin-top: 6px; }
.ad-check { display: inline-flex; align-items: center; gap: var(--ad-s2); font-size: 14px; color: var(--ad-ink-soft); }

/* ── tables ────────────────────────────────────────────────────────────── */
.ad-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ad-table th {
  text-align: left; padding: 10px 12px;
  font-family: var(--ad-font-mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ad-ink-mute);
  border-bottom: 1px solid var(--ad-edge);
  white-space: nowrap;
}
.ad-table td { padding: 12px; border-bottom: 1px solid var(--ad-edge-soft); color: var(--ad-ink-soft); }
.ad-table tr:last-child td { border-bottom: 0; }
.ad-table-num { text-align: right; font-family: var(--ad-font-mono); }

/* ── code ──────────────────────────────────────────────────────────────── */
.ad-code {
  margin: 0; padding: var(--ad-s5);
  font-family: var(--ad-font-mono); font-size: 13px; line-height: 1.85;
  color: var(--ad-ink-soft); background: var(--ad-bg-raised);
  border: 1px solid var(--ad-edge); border-radius: var(--ad-r);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  white-space: pre;
}
.ad-code-head {
  display: flex; align-items: center; gap: var(--ad-s3);
  padding: 12px var(--ad-s5); border-bottom: 1px solid var(--ad-edge-soft);
  font-family: var(--ad-font-mono); font-size: var(--ad-text-xs); color: var(--ad-ink-mute);
}
.ad-code-panel { border-radius: var(--ad-r); overflow: hidden; background: var(--ad-glass); border: 1px solid var(--ad-edge); }
.ad-code-panel .ad-code { border: 0; border-radius: 0; background: transparent; }

/* ── tabs ──────────────────────────────────────────────────────────────── */
.ad-tabs { display: flex; gap: var(--ad-s1); flex-wrap: wrap; border-bottom: 1px solid var(--ad-edge); }
.ad-tab {
  padding: 10px var(--ad-s4); border: 0; background: transparent;
  color: var(--ad-ink-mute); font-size: 14px; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.ad-tab[aria-selected="true"] { color: var(--ad-ink); border-bottom-color: var(--ad-accent); }

/* ── empty / loading states ────────────────────────────────────────────── */
.ad-empty { padding: var(--ad-s12) var(--ad-s6); text-align: center; }
.ad-empty-title { font-size: var(--ad-text-md); font-weight: 600; margin: 0 0 var(--ad-s2); }
.ad-empty-body { margin: 0 auto var(--ad-s5); max-width: 46ch; font-size: 14px; color: var(--ad-ink-soft); }

.ad-skeleton {
  background: linear-gradient(90deg, var(--ad-glass) 25%, var(--ad-glass-2) 37%, var(--ad-glass) 63%);
  background-size: 400% 100%;
  animation: ad-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--ad-r-sm); height: 14px;
}
@keyframes ad-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.ad-spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--ad-edge); border-top-color: var(--ad-accent);
  animation: ad-spin .8s linear infinite; display: inline-block;
}
@keyframes ad-spin { to { transform: rotate(360deg); } }

/* ── modal ─────────────────────────────────────────────────────────────── */
.ad-modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6, 8, 11, 0.66);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: var(--ad-s5);
}
.ad-modal {
  width: 100%; max-width: 520px; padding: var(--ad-s6);
  border-radius: var(--ad-r-lg); background: var(--ad-bg-raised);
  border: 1px solid var(--ad-edge); box-shadow: var(--ad-shadow-lg);
}
.ad-modal-title { margin: 0 0 var(--ad-s3); font-size: var(--ad-text-lg); font-weight: 600; }
.ad-modal-actions { display: flex; gap: var(--ad-s2); justify-content: flex-end; margin-top: var(--ad-s6); }

/* ── utilities ─────────────────────────────────────────────────────────── */
.ad-row { display: flex; gap: var(--ad-s3); flex-wrap: wrap; align-items: center; }
.ad-row-between { display: flex; gap: var(--ad-s3); flex-wrap: wrap; align-items: center; justify-content: space-between; }
.ad-stack > * + * { margin-top: var(--ad-s4); }
.ad-mt2 { margin-top: var(--ad-s2); } .ad-mt4 { margin-top: var(--ad-s4); }
.ad-mt6 { margin-top: var(--ad-s6); } .ad-mt8 { margin-top: var(--ad-s8); }
.ad-mb4 { margin-bottom: var(--ad-s4); } .ad-mb6 { margin-bottom: var(--ad-s6); }
.ad-hr { height: 1px; background: var(--ad-edge-soft); border: 0; margin: var(--ad-s8) 0; }

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

/* ── focus states (never removed) ──────────────────────────────────────── */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--ad-accent);
  outline-offset: 2px;
  border-radius: var(--ad-r-sm);
}

/* ── responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --ad-maxw: 100%; }
  .ad-section { padding: var(--ad-s12) 0; }
}
@media (max-width: 768px) {
  .ad-nav { top: 10px; padding-top: 10px; }
  .ad-nav-inner { flex-wrap: wrap; gap: var(--ad-s3); justify-content: center; padding: 12px; text-align: center; }
  .ad-nav-links { order: 3; width: 100%; justify-content: center; gap: var(--ad-s5); }
  .ad-grid, .ad-grid-2, .ad-grid-4 { grid-template-columns: 1fr; }
  .ad-container { padding: 0 var(--ad-s4); }
  .ad-h1 { font-size: clamp(32px, 9vw, 46px); }
  .ad-btn { width: 100%; justify-content: center; }
  .ad-nav-actions .ad-btn { width: auto; }
}
@media (min-width: 1600px) {
  :root { --ad-maxw: 1320px; }
}

/* ── reduced motion ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .ad-card-hover:hover, .ad-btn:hover { transform: none; }
}

/* ==========================================================================
   Phase 5A — product-explanation flow diagram
   ==========================================================================

   The homepage visual. It explains the actual request path — request → API →
   eligible routes → selected model → result → usage and cost — and nothing
   else. Deliberately NOT a live dashboard: there are no numbers, no provider
   names, no health indicators and no switching event, because every one of
   those would be a claim the product cannot currently support.

   The RESTING state is the complete diagram. Motion only adds a travelling
   pulse on top of something already fully readable, which is what makes the
   reduced-motion fallback correct rather than empty.
   ========================================================================== */

.ad-flow {
  position: relative;
  padding: var(--ad-s8) var(--ad-s6);
  border-radius: var(--ad-r-lg);
  background: var(--ad-glass);
  border: 1px solid var(--ad-edge);
  box-shadow: var(--ad-shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.ad-flow-caption {
  font-family: var(--ad-font-mono); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ad-ink-mute);
  margin: 0 0 var(--ad-s6); text-align: center;
}

.ad-flow-track {
  display: grid; gap: var(--ad-s3);
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: stretch;
}

.ad-flow-step {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  padding: var(--ad-s4) var(--ad-s3);
  border-radius: var(--ad-r);
  background: var(--ad-bg-raised);
  border: 1px solid var(--ad-edge-soft);
  /* Resting state is fully visible — see the block comment above. */
  opacity: 1;
}
.ad-flow-step[data-lit="true"] {
  border-color: var(--ad-accent-border);
  background: linear-gradient(180deg, var(--ad-accent-soft), transparent);
}
.ad-flow-num {
  font-family: var(--ad-font-mono); font-size: 10px; letter-spacing: .18em;
  color: var(--ad-accent);
}
.ad-flow-label { font-size: 14px; font-weight: 600; line-height: 1.3; }
.ad-flow-note  { font-size: 12px; line-height: 1.5; color: var(--ad-ink-mute); }

/* The connector between steps. Purely decorative. */
.ad-flow-step + .ad-flow-step::before {
  content: ""; position: absolute; top: 50%; left: calc(var(--ad-s3) * -1);
  width: var(--ad-s3); height: 1px; background: var(--ad-edge);
}

/* The travelling pulse. One element, transform-only, GPU-friendly. */
.ad-flow-pulse {
  position: absolute; top: 0; left: 0;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ad-accent); box-shadow: 0 0 12px var(--ad-accent);
  opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ad-ease), transform .55s var(--ad-ease);
}
.ad-flow[data-playing="true"] .ad-flow-pulse { opacity: 1; }

.ad-flow-legend {
  margin: var(--ad-s6) 0 0; text-align: center;
  font-size: 13px; line-height: 1.6; color: var(--ad-ink-soft);
}
.ad-flow-controls { margin-top: var(--ad-s4); text-align: center; }

@media (max-width: 900px) {
  .ad-flow-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ad-flow-step + .ad-flow-step::before { display: none; }
}
@media (max-width: 560px) {
  .ad-flow-track { grid-template-columns: 1fr; }
}

/* Reduced motion: the diagram is already complete at rest, so the correct
   fallback is simply to remove the pulse rather than to freeze a half-built
   animation. The control button is hidden because there is nothing to play. */
@media (prefers-reduced-motion: reduce) {
  .ad-flow-pulse { display: none; }
  .ad-flow-controls { display: none; }
  .ad-flow-step[data-lit="true"] { border-color: var(--ad-edge-soft); background: var(--ad-bg-raised); }
}

/* ── Phase 5A — model-level price comparison ───────────────────────────── */
.ad-compare-row {
  display: grid; gap: var(--ad-s3); align-items: baseline;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  padding: var(--ad-s3) 0; border-bottom: 1px solid var(--ad-edge-soft);
  font-size: 14px;
}
.ad-compare-row:last-child { border-bottom: 0; }
.ad-compare-head { color: var(--ad-ink-mute); font-family: var(--ad-font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.ad-compare-num  { font-family: var(--ad-font-mono); text-align: right; }
@media (max-width: 700px) {
  .ad-compare-row { grid-template-columns: 1fr 1fr; row-gap: 4px; }
  .ad-compare-num { text-align: left; }
}

/* Phase 5B — measured at 375px: a mono span (a model id or a base URL) sat
   194px wide and pushed past the viewport edge because monospace text has no
   natural break opportunity. Identifiers should wrap rather than widen the
   page; code BLOCKS still scroll, which is the correct behaviour for them. */
.ad-mono, code, .ad-lede .ad-mono {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ad-code { overflow-wrap: normal; word-break: normal; }
