/* ============================================================================
   /guides/practical-ai-adoption/ — guide styles
   Loaded by src/pages/guides/practical-ai-adoption.astro. BaseLayout supplies
   the site header/footer/fonts.

   Canon mapping for the three figures (the prototypes used a brass/rust
   palette that does not exist in tokens.css):
     brass  → accent-secondary (sky)  = live, active, the thing AI can improve
     rust   → brand-coral            = the wall, the failure, compounding cost
     steel  → ink-soft               = neutral structure
   accent-primary (yellow) stays reserved for CTAs per canon.

   Colours declared as rgb() so lint:hex (#xxx only) stays clean.
   ============================================================================ */

:root {
  --pai-ink:              rgb(3 5 16);
  --pai-ink-soft:         rgb(90 94 110);
  --pai-paper:            rgb(244 241 234);
  --pai-paper-soft:       rgb(233 230 223);
  --pai-accent-primary:   rgb(255 189 105);   /* yellow — primary CTA only */
  --pai-accent-secondary: rgb(134 165 217);   /* sky — active / improvable */
  --pai-coral:            rgb(242 87 87);     /* the wall / compounding cost */

  --pai-hair:             rgb(3 5 16 / 0.14);
  --pai-hair-strong:      rgb(3 5 16 / 0.28);

  --pai-font-display: "IBM Plex Mono", ui-monospace, monospace;
  --pai-font-body:    "Space Mono", ui-monospace, monospace;

  --pai-shadow-cta: 6px 6px 0 0 rgb(3 5 16);
  --pai-shadow-md:  4px 4px 0 0 rgb(3 5 16);

  --pai-pad-x: clamp(20px, 5vw, 64px);
}

/* overflow-x: clip (not hidden) — `hidden` forces overflow-y to compute to
   `auto`, turning <main> into a nested vertical scroll container. */
.pai { position: relative; overflow-x: clip; }
.pai *, .pai *::before, .pai *::after { box-sizing: border-box; }

/* Section-break reveal — scoped so the shared header/footer are untouched. */
.pai [data-reveal],
.pai[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.pai [data-reveal].in-view,
.pai[data-reveal].in-view { opacity: 1; transform: none; }

/* ----------------------------------------------------------------------------
   Layout scaffolding
   ---------------------------------------------------------------------------- */
.pai-section, .pai-hero {
  width: 100%;
  padding: clamp(64px, 10vw, 140px) var(--pai-pad-x);
}
.pai-hero { padding-top: clamp(56px, 9vw, 130px); }
.pai-inner { max-width: 1080px; margin: 0 auto; }

.pai-slab { height: 6px; width: 100%; background: var(--pai-accent-secondary); }
.pai-section--soft { background: var(--pai-paper-soft); }

/* ----------------------------------------------------------------------------
   Type
   ---------------------------------------------------------------------------- */
.pai-kicker {
  font-family: var(--pai-font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--pai-ink-soft); margin: 0 0 18px;
}
.pai-num {
  font-family: var(--pai-font-display); font-weight: 700; font-size: 13px;
  letter-spacing: 0.14em; color: var(--pai-accent-secondary); margin: 0 0 12px;
}
.pai-h1 {
  font-family: var(--pai-font-display); font-weight: 700;
  font-size: clamp(32px, 4.8vw, 62px); line-height: 1.04; letter-spacing: -0.045em;
  text-transform: uppercase; color: var(--pai-ink);
  margin: 0; max-width: 46rem;
}
.pai-h2 {
  font-family: var(--pai-font-display); font-weight: 700;
  font-size: clamp(25px, 3.2vw, 42px); line-height: 1.06; letter-spacing: -0.045em;
  text-transform: uppercase; color: var(--pai-ink);
  margin: 0 0 4px; max-width: 42rem;
}
.pai-h2--big { font-size: clamp(24px, 2.9vw, 38px); text-transform: none; letter-spacing: -0.03em; line-height: 1.18; max-width: 46rem; }

/* Sky highlight — the one decorative flourish, used twice on the page. */
.pai-mark {
  background-image: linear-gradient(var(--pai-accent-secondary), var(--pai-accent-secondary));
  background-repeat: no-repeat; background-position: 0 88%; background-size: 100% 0.28em;
}

.pai-lede {
  font-family: var(--pai-font-body); font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.6; color: var(--pai-ink); margin: 28px 0 0; max-width: 40rem;
}
.pai-body {
  font-family: var(--pai-font-body); font-size: 15px; line-height: 1.75;
  color: var(--pai-ink); margin: 20px 0 0; max-width: 40rem;
}
.pai-body--strong {
  font-family: var(--pai-font-display); font-weight: 700;
  font-size: clamp(16px, 1.7vw, 21px); line-height: 1.4; letter-spacing: -0.02em;
  margin-top: 28px;
}
.pai-body--lead { color: var(--pai-ink-soft); margin: 0 0 22px; }
.pai-aside {
  font-family: var(--pai-font-body); font-size: 13px; line-height: 1.6;
  color: var(--pai-ink-soft); margin: 32px 0 0; max-width: 40rem;
}
.pai-body em, .pai-lede em, .pai-aside em { font-style: italic; }

/* Thesis — the one-line claim the whole guide hangs on. */
.pai-thesis {
  margin: 14px 0 0; padding: 24px 26px; max-width: 44rem;
  border: 3px solid var(--pai-ink); background: var(--pai-paper);
  box-shadow: var(--pai-shadow-md);
}
.pai-thesis p {
  font-family: var(--pai-font-display); font-weight: 700;
  font-size: clamp(17px, 2vw, 26px); line-height: 1.3; letter-spacing: -0.03em;
  margin: 0; color: var(--pai-ink);
}

/* Pull-quote — hairline left rule, no box. */
.pai-pull {
  margin: 32px 0 0; padding: 4px 0 4px 22px; max-width: 40rem;
  border-left: 6px solid var(--pai-accent-secondary);
}
.pai-pull p {
  font-family: var(--pai-font-display); font-weight: 700;
  font-size: clamp(16px, 1.8vw, 22px); line-height: 1.4; letter-spacing: -0.025em;
  margin: 0; color: var(--pai-ink);
}

/* ----------------------------------------------------------------------------
   § 1 · More vs. better
   ---------------------------------------------------------------------------- */
.pai-poles {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: clamp(12px, 3vw, 36px); align-items: stretch; margin-top: 40px;
}
.pai-pole { border: 2px solid var(--pai-ink); background: var(--pai-paper); padding: 24px; }
.pai-pole--better { box-shadow: var(--pai-shadow-md); }
.pai-pole--more { opacity: 0.92; }
.pai-pole__label {
  font-family: var(--pai-font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--pai-ink-soft); margin: 0 0 14px;
}
.pai-pole--better .pai-pole__label { color: var(--pai-ink); }
.pai-pole__list { list-style: none; margin: 0; padding: 0; }
.pai-pole__list li {
  font-family: var(--pai-font-body); font-size: 15px; line-height: 1.5;
  padding: 8px 0; border-bottom: 1px solid var(--pai-hair);
}
.pai-pole__list li:last-child { border-bottom: 0; }
.pai-pole__big {
  font-family: var(--pai-font-display); font-weight: 700;
  font-size: clamp(30px, 4vw, 52px); line-height: 1; letter-spacing: -0.05em;
  text-transform: uppercase; margin: 0; color: var(--pai-ink);
}
.pai-pole__note {
  font-family: var(--pai-font-body); font-size: 13px; line-height: 1.55;
  color: var(--pai-ink-soft); margin: 14px 0 0;
}
.pai-pole__conv { display: flex; align-items: center; justify-content: center; }
.pai-pole__arrow { font-family: var(--pai-font-display); font-size: 28px; color: var(--pai-ink); }

/* ----------------------------------------------------------------------------
   § 3 · Rules + Brooks levels
   ---------------------------------------------------------------------------- */
.pai-rules { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 36px; }
.pai-rule {
  border: 2px solid var(--pai-ink); border-top: 6px solid var(--pai-accent-secondary);
  background: var(--pai-paper); padding: 22px 24px;
}
.pai-rule__tag {
  font-family: var(--pai-font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--pai-accent-secondary); margin: 0 0 8px;
}
.pai-rule__name {
  font-family: var(--pai-font-display); font-weight: 700; font-size: 19px;
  letter-spacing: -0.03em; text-transform: uppercase; margin: 0 0 12px; color: var(--pai-ink);
}
.pai-rule__body { font-family: var(--pai-font-body); font-size: 14px; line-height: 1.65; margin: 0; color: var(--pai-ink); }

.pai-levels { list-style: none; margin: 36px 0 0; padding: 0; }
/* Label in column 1; name and body stack in column 2. The placement must be
   explicit — three children in a two-column grid would otherwise auto-flow the
   body into the 150px label column. */
.pai-level {
  border-top: 1px solid var(--pai-hair-strong); padding: 24px 0;
  display: grid; grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px clamp(12px, 3vw, 32px);
}
.pai-level__tag  { grid-column: 1; grid-row: 1; }
.pai-level__name { grid-column: 2; grid-row: 1; }
.pai-level__body { grid-column: 2; grid-row: 2; }
.pai-level:last-child { border-bottom: 1px solid var(--pai-hair-strong); }
.pai-level__tag {
  font-family: var(--pai-font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--pai-ink-soft); margin: 0;
}
.pai-level__name {
  font-family: var(--pai-font-display); font-weight: 700; font-size: 20px;
  letter-spacing: -0.03em; text-transform: uppercase; margin: 0 0 10px; color: var(--pai-ink);
}
.pai-level__body { font-family: var(--pai-font-body); font-size: 14.5px; line-height: 1.7; margin: 0; max-width: 38rem; }

/* ----------------------------------------------------------------------------
   § 4 · Get-started steps
   ---------------------------------------------------------------------------- */
.pai-steps { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 14px; }
.pai-step {
  display: grid; grid-template-columns: 52px 1fr; gap: 18px; align-items: start;
  border: 2px solid var(--pai-ink); background: var(--pai-paper); padding: 20px 22px;
}
.pai-step:first-child { box-shadow: var(--pai-shadow-md); }
.pai-step__n {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 3px solid var(--pai-ink);
  background: var(--pai-accent-secondary); color: var(--pai-ink);
  font-family: var(--pai-font-display); font-weight: 700; font-size: 18px;
}
.pai-step__name {
  font-family: var(--pai-font-display); font-weight: 700; font-size: 17px;
  letter-spacing: -0.02em; text-transform: uppercase; margin: 0 0 6px; color: var(--pai-ink);
}
.pai-step__body { font-family: var(--pai-font-body); font-size: 14px; line-height: 1.6; margin: 0; color: var(--pai-ink-soft); }

/* ============================================================================
   FIGURES — shared chrome
   ============================================================================ */
.pai-fig {
  margin: 48px 0 0; padding: clamp(20px, 3vw, 30px);
  border: 2px solid var(--pai-ink); background: var(--pai-paper);
}
.pai-section--soft .pai-fig { background: var(--pai-paper); }
.pai-fig__head { margin: 0 0 22px; }
.pai-fig__kicker {
  font-family: var(--pai-font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--pai-accent-secondary); margin: 0 0 10px;
}
.pai-fig__title {
  font-family: var(--pai-font-display); font-weight: 700;
  font-size: clamp(18px, 2.1vw, 26px); line-height: 1.15; letter-spacing: -0.035em;
  text-transform: uppercase; color: var(--pai-ink); margin: 0; max-width: 30rem;
}
.pai-fig__sub {
  font-family: var(--pai-font-body); font-size: 14px; line-height: 1.6;
  color: var(--pai-ink-soft); margin: 10px 0 0; max-width: 38rem;
}

.pai-fig__controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.pai-fig__controls--split {
  margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--pai-hair-strong);
}

/* Caption / note rail — sky left rule, coral when the state is a dead end. */
.pai-fig__cap {
  font-family: var(--pai-font-body); font-size: 13.5px; line-height: 1.7;
  color: var(--pai-ink); margin: 18px 0 0; padding-left: 14px;
  border-left: 3px solid var(--pai-accent-secondary); min-height: 2.6em; max-width: 42rem;
}
.pai-fig__cap.is-wall { border-left-color: var(--pai-coral); }
.pai-fig__cap b, .pai-fig__cap strong { font-family: var(--pai-font-display); font-weight: 700; }

.pai-fig__tally {
  font-family: var(--pai-font-body); font-size: 15px; line-height: 1.65;
  color: var(--pai-ink-soft); margin: 16px 0 0; max-width: 42rem;
}
.pai-fig__tally b {
  font-family: var(--pai-font-display); font-weight: 700; color: var(--pai-ink);
}
.pai-fig__tally b.is-gain { color: var(--pai-accent-secondary); }
.pai-fig__tally b.is-cost { color: var(--pai-coral); }

.pai-fig__readout {
  font-family: var(--pai-font-body); font-size: 14px; line-height: 1.7;
  color: var(--pai-ink-soft); margin: 20px 0 0; padding-top: 18px;
  border-top: 1px solid var(--pai-hair-strong); max-width: 48rem;
}
.pai-fig__readout b { font-family: var(--pai-font-display); font-weight: 700; color: var(--pai-ink); }

.pai-fig__canvas { width: 100%; }

/* Buttons — the site's stamp vocabulary at control scale. */
.pai-seg { display: flex; border: 2px solid var(--pai-ink); background: var(--pai-paper); }
.pai-seg__btn {
  appearance: none; cursor: pointer; border: 0; background: transparent;
  font-family: var(--pai-font-body); font-weight: 700; font-size: 11.5px;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 10px 16px; color: var(--pai-ink-soft);
  transition: background .18s ease, color .18s ease;
}
.pai-seg__btn + .pai-seg__btn { border-left: 2px solid var(--pai-ink); }
.pai-seg__btn[aria-pressed="true"] { background: var(--pai-ink); color: var(--pai-paper); }
.pai-seg__btn:focus-visible { outline: 3px solid var(--pai-accent-secondary); outline-offset: -3px; }

.pai-replay {
  appearance: none; cursor: pointer; background: transparent; border: 0;
  font-family: var(--pai-font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--pai-ink-soft);
  border-bottom: 2px solid var(--pai-hair-strong); padding: 0 0 3px;
}
.pai-replay:hover { color: var(--pai-ink); border-bottom-color: var(--pai-accent-secondary); }
.pai-replay:focus-visible { outline: 3px solid var(--pai-accent-secondary); outline-offset: 3px; }

.pai-act {
  appearance: none; cursor: pointer;
  font-family: var(--pai-font-body); font-weight: 700; font-size: 12px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--pai-ink); border: 3px solid var(--pai-ink);
  background: var(--pai-accent-secondary); padding: 11px 18px;
  transition: transform .1s ease, box-shadow .1s ease;
  box-shadow: var(--pai-shadow-md);
}
.pai-act:active { transform: translate(4px, 4px); box-shadow: none; }
.pai-act:focus-visible { outline: 3px solid var(--pai-ink); outline-offset: 3px; }
.pai-act--ghost { background: var(--pai-paper); box-shadow: none; border-width: 2px; color: var(--pai-ink-soft); }
.pai-act--ghost:active { transform: none; }
.pai-act[disabled] {
  cursor: not-allowed; background: var(--pai-paper); color: var(--pai-ink-soft);
  border-color: var(--pai-hair-strong); border-style: dashed; box-shadow: none;
}
.pai-act[disabled]:active { transform: none; }

/* ============================================================================
   FIG 1 · Invisible process
   ============================================================================ */
.pai-stage { display: block; width: 100%; height: auto; margin-top: 12px; }
.pai-ghost { fill: none; stroke: var(--pai-ink); stroke-width: 1; opacity: 0.16; }
.pai-strand { fill: none; stroke: var(--pai-accent-secondary); stroke-width: 2.4; stroke-linecap: round; }
.pai-tip { fill: var(--pai-accent-secondary); }
.pai-route { fill: none; stroke: var(--pai-accent-secondary); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.pai-bypass { fill: none; stroke: var(--pai-coral); stroke-width: 2; stroke-dasharray: 4 5; }
/* SVG text scales with the viewBox, so these are authored above the 11px floor
   (MASTER.md §11) at the narrowest width this diagram is still shown: 880px,
   where the 920-unit box renders at ~0.80 and 14px lands at ~11.2px. */
.pai-endnode { fill: var(--pai-ink); }
.pai-endlab { font-family: var(--pai-font-display); font-weight: 700; font-size: 14px; fill: var(--pai-ink); }
.pai-endsub { font-family: var(--pai-font-body); font-size: 14px; letter-spacing: 0.14em; fill: var(--pai-ink-soft); }
.pai-slab-t { font-family: var(--pai-font-body); font-size: 14px; fill: var(--pai-ink); }
.pai-faillab { font-family: var(--pai-font-body); font-weight: 700; font-size: 14px; fill: var(--pai-coral); }

/* Numbered stops in agent mode — click to remove a judgment. */
.pai-stop { cursor: pointer; }
.pai-stop circle { fill: var(--pai-paper); stroke: var(--pai-accent-secondary); stroke-width: 2.5; }
.pai-stop text { font-family: var(--pai-font-display); font-weight: 700; font-size: 14px; fill: var(--pai-ink); }
.pai-stop:hover circle { fill: var(--pai-accent-secondary); }
.pai-stop:focus-visible { outline: none; }
.pai-stop:focus-visible circle { stroke: var(--pai-ink); stroke-width: 4; }
.pai-stop.is-off circle { stroke: var(--pai-coral); stroke-dasharray: 3 4; }
.pai-stop.is-off text { fill: var(--pai-ink-soft); }

/* --- FIG 1 · narrow-screen variant -------------------------------------------
   Same five judgments, turned 90°: one rail, five stops, labels as HTML so they
   never scale. The rail itself carries the argument — a bundle of parallel
   strands in "You" mode, a single threaded line with chevrons in "AI Agent".
   Shown only below 880px (see the media block at the foot of this file). */
.pai-strandlist { display: none; }

.pai-scap__name {
  font-family: var(--pai-font-display); font-weight: 700; font-size: 13px;
  letter-spacing: -0.02em; text-transform: uppercase; color: var(--pai-ink);
}
.pai-scap__sub {
  font-family: var(--pai-font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--pai-ink-soft);
}
.pai-srow__lab {
  display: block; font-family: var(--pai-font-body); font-size: 14px;
  line-height: 1.5; color: var(--pai-ink);
}
.pai-srow__fail { display: none; }
.pai-srow.is-off .pai-srow__fail {
  display: block; font-family: var(--pai-font-body); font-weight: 700;
  font-size: 11.5px; line-height: 1.5; color: var(--pai-coral); margin-top: 7px;
}
.pai-srow.is-off .pai-srow__lab { color: var(--pai-ink-soft); text-decoration: line-through; }

/* ============================================================================
   FIG 2 · Brooks multitool
   ============================================================================ */
.pai-demands { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 26px; }
.pai-dem {
  appearance: none; cursor: pointer; display: block; text-align: left;
  border: 2px solid var(--pai-hair-strong); background: var(--pai-paper-soft);
  padding: 16px 18px; transition: border-color .2s ease, background .2s ease;
}
.pai-dem:hover { border-color: var(--pai-ink); }
.pai-dem[aria-pressed="true"] { border-color: var(--pai-ink); background: var(--pai-accent-secondary); }
.pai-dem:focus-visible { outline: 3px solid var(--pai-ink); outline-offset: 2px; }
.pai-dem__said {
  display: block; font-family: var(--pai-font-body); font-size: 15px; line-height: 1.45;
  color: var(--pai-ink); margin-bottom: 9px;
}
.pai-dem__cost {
  display: block; font-family: var(--pai-font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.11em; text-transform: uppercase; line-height: 1.5; color: var(--pai-ink-soft);
}
.pai-dem[aria-pressed="true"] .pai-dem__cost { color: var(--pai-ink); }

.pai-state { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.pai-state__now {
  font-family: var(--pai-font-display); font-weight: 700; font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: -0.04em; text-transform: uppercase; color: var(--pai-ink);
}
.pai-state__mult {
  font-family: var(--pai-font-display); font-weight: 700; font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: -0.04em; color: var(--pai-accent-secondary);
}
.pai-state__mult.is-max { color: var(--pai-coral); }

.pai-stage-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 176px));
  grid-auto-rows: 104px; gap: 8px; justify-content: start;
}
.pai-cell {
  padding: 11px 12px; position: relative; border: 2px solid transparent;
  opacity: 0; transform: scale(.86); pointer-events: none;
  transition: opacity .42s cubic-bezier(.2,.8,.3,1), transform .42s cubic-bezier(.2,.8,.3,1);
}
.pai-cell.is-show { opacity: 1; transform: none; pointer-events: auto; }
.pai-cell__t { font-family: var(--pai-font-body); font-size: 11.5px; line-height: 1.5; margin: 0; }
.pai-cell__u {
  position: absolute; bottom: 8px; right: 10px; margin: 0;
  font-family: var(--pai-font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.72;
}
/* The blade you started with — unchanged, and eventually 11% of the job. */
.pai-cell--base { background: var(--pai-ink); border-color: var(--pai-ink); }
.pai-cell--base .pai-cell__t { color: var(--pai-paper); font-size: 12.5px; }
.pai-cell--base .pai-cell__u { color: var(--pai-accent-primary); letter-spacing: 0.14em; }
/* Work each demand adds on its own. */
.pai-cell--add { background: rgb(134 165 217 / 0.24); border-color: rgb(134 165 217 / 0.85); }
.pai-cell--add .pai-cell__t { color: var(--pai-ink); }
.pai-cell--add .pai-cell__u { color: var(--pai-ink-soft); }
/* Work that exists only where the two demands meet — nobody budgets for these. */
.pai-cell--compound { background: rgb(242 87 87 / 0.16); border-color: rgb(242 87 87 / 0.7); }
.pai-cell--compound .pai-cell__t { color: var(--pai-ink); }
.pai-cell--compound .pai-cell__u { color: var(--pai-coral); }

/* ============================================================================
   FIG 3 · Constraint chain
   ============================================================================ */
/* The SVG holds geometry only. Every gate label is HTML in .pai-flume-labs,
   positioned as a percentage of the wrapper so it tracks the gate in either
   orientation while its type stays at a fixed px size. */
.pai-flume-wrap { position: relative; }
.pai-flume { display: block; width: 100%; height: auto; }
.pai-wall { fill: none; stroke: var(--pai-ink-soft); stroke-width: 1.8; opacity: 0.6; }
.pai-gatebar { fill: var(--pai-ink-soft); opacity: 0.55; }
.pai-gatebar.is-neck { fill: var(--pai-accent-secondary); opacity: 1; }
.pai-gatebar.is-wall { fill: var(--pai-coral); opacity: 1; }
.pai-dot { fill: var(--pai-ink-soft); }

.pai-flume-labs { position: relative; height: 78px; margin-top: 6px; }
.pai-flume-lab {
  position: absolute; top: 0; width: 18%;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-align: center; transform: translateX(-50%);
}
.pai-flume-lab__tag {
  font-family: var(--pai-font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.3;
  color: var(--pai-accent-secondary); min-height: 1.3em;
}
.pai-flume-lab.is-wall .pai-flume-lab__tag { color: var(--pai-coral); }
.pai-flume-lab__name {
  font-family: var(--pai-font-display); font-weight: 700; font-size: 14px;
  letter-spacing: -0.02em; text-transform: uppercase; line-height: 1.2; color: var(--pai-ink);
}
.pai-flume-lab__type,
.pai-flume-lab__starve {
  font-family: var(--pai-font-body); font-size: 11px; letter-spacing: 0.09em;
  text-transform: uppercase; line-height: 1.4; color: var(--pai-ink-soft);
}

/* ============================================================================
   Payoff + CTA
   ============================================================================ */
.pai-section--dark { background: var(--pai-ink); }
.pai-section--dark .pai-h2 { color: var(--pai-paper); }
.pai-section--dark .pai-body { color: rgb(244 241 234 / 0.72); }
.pai-section--dark .pai-mark {
  background-image: none; color: var(--pai-accent-primary);
}

.pai-section--cta { padding-top: clamp(48px, 7vw, 90px); }
.pai-ctas { display: flex; flex-wrap: wrap; gap: 14px; }
.pai-cta {
  font-family: var(--pai-font-display); font-weight: 700; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.02em; text-decoration: none;
  border: 3px solid var(--pai-ink); background: var(--pai-paper); color: var(--pai-ink);
  padding: 14px 22px; transition: transform .1s ease, box-shadow .1s ease;
}
.pai-cta--primary { background: var(--pai-accent-primary); box-shadow: var(--pai-shadow-cta); }
.pai-cta--primary:active { transform: translate(6px, 6px); box-shadow: none; }

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 900px) {
  .pai-poles { grid-template-columns: 1fr; }
  .pai-pole__conv { padding: 2px 0; }
  .pai-pole__arrow { display: inline-block; transform: rotate(90deg); }
  .pai-rules { grid-template-columns: 1fr; }
  .pai-demands { grid-template-columns: 1fr; }
}

/* Below 880px a 900-unit-wide viewBox can no longer hold 11px type (MASTER.md
   §11) and the canon forbids horizontal scroll at any width (MASTER.md:203).
   So both wide figures turn 90°: the geometry goes vertical and every label
   becomes HTML at a fixed px size. script.js watches the same breakpoint. */
@media (max-width: 880px) {

  /* --- FIG 1 · strands become rows on a rail --- */
  [data-invisible] .pai-fig__canvas { display: none; }
  .pai-strandlist { display: block; position: relative; list-style: none; margin: 20px 0 0; padding: 0; }

  /* The rail. "You" mode draws it as a bundle of parallel strands — five
     judgments running at once; "AI Agent" collapses it to a single line. */
  .pai-strandlist::before {
    content: ""; position: absolute; top: 14px; bottom: 14px;
    left: 15px; width: 2px; background: var(--pai-hair-strong);
  }
  .pai-strandlist.is-you::before {
    left: 10px; width: 12px; background: repeating-linear-gradient(
      90deg, var(--pai-accent-secondary) 0 2px, transparent 2px 5px);
  }
  .pai-strandlist.is-agent::before { background: var(--pai-accent-secondary); }

  .pai-scap {
    position: relative; z-index: 1; padding: 6px 0 6px 46px; min-height: 34px;
    display: flex; flex-direction: column; justify-content: center; gap: 3px;
  }
  .pai-scap::before {
    content: ""; position: absolute; left: 8px; top: 50%; margin-top: -8px;
    width: 16px; height: 16px; background: var(--pai-ink);
    box-shadow: 0 0 0 5px var(--pai-paper);
  }

  .pai-srow { position: relative; z-index: 1; padding: 15px 0 15px 46px; min-height: 46px; }
  .pai-srow__mark {
    position: absolute; left: 0; top: 15px; width: 32px; height: 32px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    appearance: none; cursor: default;
    border: 2.5px solid var(--pai-accent-secondary); background: var(--pai-paper);
    font-family: var(--pai-font-display); font-weight: 700; font-size: 14px;
    color: var(--pai-ink); transition: background .18s ease, border-color .18s ease;
  }
  /* No stops in "You" mode — there is nothing to step through, so the bundle
     runs uninterrupted from cap to cap and the labels ride alongside it. */
  .pai-strandlist.is-you .pai-srow__mark { display: none; }
  .pai-strandlist.is-agent .pai-srow__mark { cursor: pointer; }
  /* Pads the 32px stamp out to a 48px touch target without moving it. */
  .pai-strandlist.is-agent .pai-srow__mark::after { content: ""; position: absolute; inset: -8px; }
  .pai-srow__mark:focus-visible { outline: 3px solid var(--pai-ink); outline-offset: 3px; }
  .pai-srow.is-off .pai-srow__mark {
    border-color: var(--pai-coral); border-style: dashed;
    background: var(--pai-paper); color: var(--pai-ink-soft);
  }

  /* Entry reveal — the per-row transition-delay is set in script.js: together
     in "You", and timed to the runner's arrival at each stop in "AI Agent".
     Only armed once script.js adds .has-js, so the no-JS render stays visible. */
  .pai-strandlist.has-js .pai-scap,
  .pai-strandlist.has-js .pai-srow {
    opacity: 0; transform: translateY(8px);
    transition: opacity .42s ease, transform .42s ease;
  }
  .pai-strandlist.has-js.is-live .pai-scap,
  .pai-strandlist.has-js.is-live .pai-srow { opacity: 1; transform: none; }

  /* "You": the strand bundle draws down as one, so the five judgments read as
     running at once. (Agent mode keeps the rail present for the runner.) */
  .pai-strandlist.has-js.is-you::before { transform: scaleY(0); transform-origin: top center; }
  .pai-strandlist.has-js.is-you.is-live::before {
    transform: scaleY(1); transition: transform .6s cubic-bezier(.4, .1, .2, 1);
  }

  /* "AI Agent": the runner — the narrow-layout twin of the SVG route dot. It
     travels the rail (script.js sets translateY per frame), tucking behind each
     numbered stop as it arrives. Circle, matching the figure's dot vocabulary. */
  .pai-runner {
    position: absolute; left: 9px; top: 0; margin-top: -7px; z-index: 0;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--pai-accent-secondary); opacity: 0; pointer-events: none;
    will-change: transform;
  }

  /* --- FIG 3 · the channel runs top to bottom --- */
  .pai-flume-wrap { display: flex; align-items: flex-start; gap: 14px; }
  .pai-flume { flex: 0 0 112px; width: 112px; height: 620px; }
  .pai-flume-labs { flex: 1 1 auto; height: 620px; margin: 0; }
  .pai-flume-lab {
    width: 100%; align-items: flex-start; text-align: left;
    transform: translateY(-50%);
  }
}

@media (max-width: 700px) {
  .pai-level { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pai-level__tag  { grid-column: 1; grid-row: 1; }
  .pai-level__name { grid-column: 1; grid-row: 2; }
  .pai-level__body { grid-column: 1; grid-row: 3; }
  /* The 3x3 stays 3x3 — nine cells IS the argument — so the rows grow instead
     of the type shrinking. Nothing here drops below the 11px floor. */
  .pai-stage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(168px, auto); gap: 6px; }
  .pai-cell { padding: 9px 8px 30px; }
  .pai-cell__t { font-size: 11px; line-height: 1.45; }
  .pai-cell--base .pai-cell__t { font-size: 11.5px; }
  .pai-cell__u { bottom: 8px; right: 8px; font-size: 11px; }
  .pai-step { grid-template-columns: 40px 1fr; gap: 14px; padding: 18px; }
  .pai-step__n { width: 36px; height: 36px; font-size: 15px; border-width: 2px; }
  .pai-cta { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .pai [data-reveal], .pai[data-reveal] { opacity: 1; transform: none; transition: none; }
  .pai-cell, .pai-act, .pai-cta, .pai-dem, .pai-seg__btn, .pai-srow__mark { transition: none; }
  .pai-strandlist.has-js .pai-scap,
  .pai-strandlist.has-js .pai-srow {
    opacity: 1; transform: none; transition: none;
  }
  /* No rail-draw, no runner — the list is simply present. */
  .pai-strandlist.has-js.is-you::before,
  .pai-strandlist.has-js.is-you.is-live::before { transform: none; transition: none; }
  .pai-runner { display: none; }
}
