/* ==========================================================================
   prototyping-guide.css
   Page styles for /prototyping-guide — "Kinetic Editorial" (WNCP AI).
   All pg- prefixed; tokens from colors_and_type.css via styles.css.
   Hard brand rules: 0px card corners (full radius only on numbered circles),
   4px red top bars on cards, NO shadows (tonal elevation), red used sparingly,
   light-first with a single dark hero. Reveal is a JS enhancement only —
   resting state is fully visible without JS and under reduced-motion.
   ========================================================================== */

/* ==========================================================================
   Scroll-reveal — progressive enhancement.
   prototyping-guide.js adds .pg-reveal-on to <html> ONLY when an
   IntersectionObserver is available and motion is allowed. Until then (no JS,
   reduced motion, old browsers) every .reveal element is fully visible.
   ========================================================================== */
.pg-reveal-on .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--easing), transform 0.6s var(--easing);
  will-change: opacity, transform;
}
.pg-reveal-on .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   Shared section primitives
   ========================================================================== */
.pg-lead {
  font-size: clamp(17px, 1.55vw, 20px);
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 70ch;
  margin: var(--s6) 0 var(--s7);
}
.pg-lead strong { color: var(--ink); }

.pg-nav__back {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
}

/* Anchor targets clear the sticky nav when jumped to */
.section[id],
.pg-stage[id],
.pg-version[id] { scroll-margin-top: 84px; }

/* ==========================================================================
   §1 — Dark editorial hero
   ========================================================================== */
.pg-hero {
  background: var(--inverse-bg);
  color: var(--inverse-body);
  position: relative;
  overflow: hidden;
  padding: clamp(30px, 4vw, 52px) 0 clamp(48px, 6vw, 84px);
}
.pg-hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0; height: 4px;
  background: var(--gradient-red);
  z-index: 4;
}
.pg-hero__accent {
  position: absolute;
  top: 0; right: 0;
  width: 34%; height: 100%;
  background: var(--gradient-red);
  clip-path: polygon(64% 0, 100% 0, 100% 100%, 30% 100%);
  opacity: 0.14;
  z-index: 0;
  pointer-events: none;
}
.pg-hero__inner { position: relative; z-index: 2; }

.pg-hero__masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  flex-wrap: wrap;
  margin-bottom: clamp(32px, 4.5vw, 56px);
  padding-bottom: clamp(20px, 3vw, 28px);
  border-bottom: 1px solid rgba(var(--border-rgb), 0.12);
}
.pg-hero__session {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--inverse-body); /* --muted fails contrast on dark; --inverse-body ~13:1 */
}

/* Hero grid: headline left, guardrails card right */
.pg-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
.pg-hero__body { min-width: 0; }
.pg-hero__kicker { color: var(--red); }
.pg-hero__h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 5.4vw, 62px);
  letter-spacing: -0.03em;
  line-height: 1.02;
  color: var(--inverse-head);
  margin: var(--s4) 0 0;
  text-wrap: balance;
}
.pg-hero__sub {
  font-family: var(--font-body);
  font-size: clamp(15px, 1.3vw, 18px);
  line-height: 1.62;
  color: var(--inverse-body);
  margin: var(--s5) 0 0;
  max-width: 60ch;
}

/* Three-stage arc strip */
.pg-hero__stages {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
  margin-top: var(--s6);
}
.pg-arc__pill {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(var(--white-rgb), 0.66);
  padding: var(--s2) var(--s3);
  border: 1px solid rgba(var(--border-rgb), 0.14);
}
.pg-arc__pill--current {
  color: var(--inverse-head);
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 16%, transparent);
}
.pg-arc__pill--future { color: rgba(var(--white-rgb), 0.55); }
.pg-arc__arrow { color: var(--red); font-size: 14px; }
.pg-hero__stages-note {
  margin: var(--s4) 0 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: rgba(var(--white-rgb), 0.72);
  max-width: 58ch;
}

/* Guardrails card (hero right) */
.pg-hero__guardrails {
  background: rgba(var(--white-rgb), 0.04);
  border: 1px solid rgba(var(--border-rgb), 0.14);
  border-left: 4px solid var(--red);
  padding: var(--s5) var(--s5) var(--s4);
}
.pg-guardrails__label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 var(--s4);
}
.pg-guardrails__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.pg-guardrails__list li {
  position: relative;
  padding-left: var(--s5);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--inverse-body);
}
.pg-guardrails__list li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 8px; height: 8px;
  background: var(--red);
}
.pg-guardrails__list strong { color: var(--inverse-head); display: block; margin-bottom: 2px; }
.pg-guardrails__instruction {
  margin: var(--s4) 0 0;
  padding-top: var(--s4);
  border-top: 1px solid rgba(var(--border-rgb), 0.12);
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(var(--white-rgb), 0.7);
  font-style: italic;
}

/* ==========================================================================
   §2 — Tabs (Spec / Build)
   ========================================================================== */
.pg-tabs-section { position: relative; padding-top: var(--s8); }

.pg-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s3);
  margin-bottom: var(--s7);
}
.pg-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s2);
  font-family: var(--font-body);
  text-align: left;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--border);
  padding: var(--s5);
  cursor: pointer;
  transition: color 0.14s var(--easing), background 0.14s var(--easing),
    border-color 0.14s var(--easing);
}
.pg-tab:hover {
  color: var(--ink);
  border-top-color: var(--ink-2);
}
.pg-tab--active,
.pg-tab[aria-selected="true"] {
  color: var(--ink);
  background: var(--elevated);
  border-top-color: var(--red);
}
.pg-tab__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.12em;
  transition: color 0.14s var(--easing);
}
.pg-tab--active .pg-tab__num,
.pg-tab[aria-selected="true"] .pg-tab__num { color: var(--red); }
.pg-tab__label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: inherit;
}
.pg-tab__sub {
  font-weight: 500;
  font-size: 14.5px;
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: var(--muted);
}
.pg-tab--active .pg-tab__sub,
.pg-tab[aria-selected="true"] .pg-tab__sub { color: var(--ink-2); }

/* Panels — progressive enhancement.
   No-JS / pre-JS: all panels visible in document order.
   The inline <script> adds .js to <html> before deferred scripts run, and the
   .js qualifier hides inactive panels so only the active one shows. */
.pg-panel { display: block; }
.js .pg-panel { display: none; }
.js .pg-panel--active { display: block; }
.js .pg-panel[hidden] { display: none !important; }

/* "Where to stop" sub-section divider inside the Build panel */
.pg-where {
  margin-top: var(--s8);
  padding-top: var(--s8);
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   §2b — Spec your build
   ========================================================================== */

/* Minimum-viable-spec callout */
.pg-mvs {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s6);
  align-items: center;
  border: 1px solid var(--border);
  border-top: 4px solid var(--red);
  background: var(--elevated);
  padding: var(--s5) var(--s6);
  margin-bottom: var(--s8);
}
.pg-mvs__mark {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
}
.pg-mvs__file {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  background: var(--surface);
  white-space: nowrap;
}
.pg-mvs__plus { color: var(--red); font-weight: 700; font-size: 18px; }
.pg-mvs__label { margin: 0 0 var(--s2); }
.pg-mvs__body { margin: 0; font-size: var(--fs-body-lg); line-height: 1.6; color: var(--ink-2); }
.pg-mvs__body strong { color: var(--ink); }

/* Spec doc list */
.pg-spec-list { display: flex; flex-direction: column; }
.pg-spec-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(0, 2.4fr) auto;
  gap: var(--s5) var(--s6);
  align-items: start;
  padding: var(--s6) 0;
  border-top: 1px solid var(--border);
}
.pg-spec-row:last-child { border-bottom: 1px solid var(--border); }

.pg-spec-row__lead { display: flex; flex-direction: column; gap: var(--s3); }
.pg-spec-row__heading { display: flex; flex-direction: column; gap: 3px; }
.pg-spec-row__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-card);
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0;
}
.pg-spec-row__full { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.pg-spec-row__badges { display: flex; gap: var(--s2); flex-wrap: wrap; }

.pg-spec-row__main { min-width: 0; }
.pg-spec-row__desc {
  font-size: var(--fs-body);
  line-height: 1.62;
  color: var(--ink-2);
  margin: 0 0 var(--s3);
}
.pg-spec-row__desc a { color: var(--red); text-underline-offset: 2px; }
.pg-spec-row__desc a:hover { color: var(--red-dark); }
.pg-spec-row__how {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}
.pg-spec-row__how-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--ink);
  margin-right: 4px;
}

/* Badges */
.pg-badge {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 3px var(--s3);
  border: 1px solid currentColor;
  white-space: nowrap;
}
.pg-badge--required { color: var(--red); background: color-mix(in srgb, var(--red) 6%, transparent); }
.pg-badge--optional { color: var(--muted); border-color: var(--border); }
.pg-badge--tool { color: var(--ink-2); border-color: var(--ink-2); }
.pg-badge--stage { color: var(--muted); border-color: var(--border); }

/* Download button */
.pg-download-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding: 9px 16px;
  border: 1.5px solid var(--ink);
  white-space: nowrap;
  transition: background 0.12s var(--easing), color 0.12s var(--easing);
}
.pg-download-btn:hover { background: var(--ink); color: var(--elevated); }
.pg-download-btn__arrow { font-size: 13px; font-weight: 400; letter-spacing: 0; transition: transform 0.15s var(--easing); }
.pg-download-btn:hover .pg-download-btn__arrow { transform: translateY(2px); }

/* ==========================================================================
   §3 — The development cycle
   ========================================================================== */

/* Phase-circle rail */
.pg-rail {
  list-style: none;
  margin: 0 0 var(--s8);
  padding: var(--s6) var(--s5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(8px, 1.6vw, 22px);
  flex-wrap: wrap;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-top: 4px solid var(--red);
}
.pg-rail__node { flex: 0 1 auto; }
.pg-rail__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  text-decoration: none;
  text-align: center;
  width: clamp(110px, 14vw, 150px);
}
.pg-rail__circ {
  width: 54px; height: 54px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  line-height: 1;
  transition: background 0.14s var(--easing), transform 0.14s var(--easing);
}
.pg-rail__circ--active { background: var(--red); }
.pg-rail__link:hover .pg-rail__circ { background: var(--red); transform: translateY(-2px); }
.pg-rail__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1.2;
}
.pg-rail__link:hover .pg-rail__name { color: var(--red); }
.pg-rail__tools {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1.4;
}
.pg-rail__arrow {
  align-self: flex-start;
  margin-top: 16px;
  color: var(--red);
  font-size: 18px;
  font-weight: 400;
  flex: 0 0 auto;
}

/* Stage blocks — timeline with a left number rail */
.pg-stages { display: flex; flex-direction: column; }
.pg-stage {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--s5);
  padding: var(--s7) 0;
  border-top: 1px solid var(--border);
}
.pg-stage:first-child { border-top: 0; padding-top: var(--s2); }
.pg-stage:last-child { padding-bottom: var(--s2); }

/* Left rail: number marker + connecting spine */
.pg-stage__rail { position: relative; display: flex; justify-content: center; }
.pg-stage__rail-num {
  position: relative;
  z-index: 1;
  width: 44px; height: 44px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
}
.pg-stage:not(:last-child) .pg-stage__rail::after {
  content: "";
  position: absolute;
  top: 44px; bottom: calc(var(--s7) * -1 - 1px);
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--border);
}

.pg-stage__content { min-width: 0; padding-top: 2px; }
.pg-stage__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s5);
  flex-wrap: wrap;
  margin-bottom: var(--s4);
}
.pg-stage__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(21px, 2.3vw, 26px);
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
  line-height: 1.12;
}
.pg-stage__dash { color: var(--border); font-weight: 400; }
.pg-stage__tag { color: var(--red); }
.pg-stage__facts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* No flex-shrink:0 — facts must be able to shrink and wrap rather than
     overflow at tablet widths (the title yields first when space is tight). */
  min-width: 0;
}
.pg-stage__facts p { margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--ink-2); }
.pg-stage__fact-k {
  display: inline-block;
  min-width: 44px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: var(--s2);
}
.pg-stage__facts a { color: var(--red); font-weight: 700; text-decoration: none; }
.pg-stage__facts a:hover { color: var(--red-dark); text-decoration: underline; text-underline-offset: 2px; }

.pg-stage__goal {
  font-size: var(--fs-body-lg);
  line-height: 1.55;
  color: var(--ink);
  font-weight: 500;
  margin: 0 0 var(--s5);
  max-width: 64ch;
}

/* Full tool library callout (Notion) — dark banner above the stages */
.pg-catalog {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s5) var(--s6);
  flex-wrap: wrap;
  background: var(--ink);
  color: #fff;
  border-left: 4px solid var(--red);
  padding: var(--s5) var(--s6);
  margin: 0 0 var(--s8);
}
.pg-catalog__text { flex: 1 1 340px; min-width: 0; }
.pg-catalog__label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(var(--white-rgb), 0.6);
  margin: 0 0 var(--s2);
}
.pg-catalog__body {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(var(--white-rgb), 0.86);
  max-width: 64ch;
}
.pg-catalog__body strong { color: #fff; }
.pg-catalog__btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: var(--red);
  text-decoration: none;
  padding: 14px 22px;
  border: 1px solid var(--red);
  transition: background 0.14s var(--easing), transform 0.14s var(--easing);
}
.pg-catalog__btn:hover { background: var(--red-dark); border-color: var(--red-dark); transform: translateY(-1px); }

/* Per-stage tool cards */
.pg-stage__tools { margin: 0 0 var(--s6); }
.pg-stage__tools-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s4);
  flex-wrap: wrap;
  margin-bottom: var(--s4);
}
.pg-stage__tools-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.pg-stage__tools-or { color: var(--red); }
.pg-stage__specs { margin: 0; font-size: 11.5px; color: var(--muted); }
.pg-stage__specs-k {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--ink);
  margin-right: 5px;
}

.pg-tools { display: flex; flex-direction: column; gap: var(--s3); }

/* Each tool is a collapsible <details> section (native, no JS needed) */
.pg-tool {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  transition: border-left-color 0.14s var(--easing);
}
.pg-tool[open] { background: var(--surface); border-left-color: var(--red-dark); }

.pg-tool__summary {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.pg-tool__summary::-webkit-details-marker { display: none; }
.pg-tool__summary::marker { content: ""; }
.pg-tool__summary:hover .pg-tool__name { color: var(--red-dark); }
.pg-tool__summary:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

.pg-tool__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(16px, 1.7vw, 18px);
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.1;
}
.pg-tool__tag {
  font-family: var(--font-body);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
/* Caret — a rotating chevron drawn from borders */
.pg-tool__chev {
  margin-left: auto;
  width: 10px; height: 10px;
  border-right: 2px solid var(--red);
  border-bottom: 2px solid var(--red);
  transform: rotate(45deg);
  transition: transform 0.18s var(--easing);
  flex-shrink: 0;
  margin-right: 3px;
}
.pg-tool[open] .pg-tool__chev { transform: rotate(-135deg); }

.pg-tool__body {
  padding: var(--s4) var(--s5) var(--s5);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.pg-tool__tagline {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}
.pg-tool__desc { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.pg-tool__best { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.pg-tool__best-k {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--ink);
  margin-right: 6px;
}
.pg-tool__links { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s2); }
.pg-tool__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  padding: 9px 15px;
  border: 1.5px solid var(--border);
  transition: background 0.12s var(--easing), color 0.12s var(--easing), border-color 0.12s var(--easing);
}
.pg-tool__link:hover { border-color: var(--ink); }
.pg-tool__link--primary { border-color: var(--red); color: var(--red); }
.pg-tool__link--primary:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* Numbered "what to do" steps */
.pg-steps {
  list-style: none;
  counter-reset: pg-step;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  max-width: 72ch;
}
.pg-steps > li {
  counter-increment: pg-step;
  position: relative;
  padding-left: var(--s7);
  font-size: var(--fs-body);
  line-height: 1.62;
  color: var(--ink-2);
}
.pg-steps > li::before {
  content: counter(pg-step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 1px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--red);
  letter-spacing: 0.02em;
}
.pg-steps > li strong {
  display: block;
  color: var(--ink);
  font-size: 14.5px;
  letter-spacing: -0.005em;
  margin-bottom: 3px;
}
.pg-steps a { color: var(--red); font-weight: 600; text-underline-offset: 2px; }
.pg-steps a:hover { color: var(--red-dark); }
.pg-steps code {
  font-family: var(--wncp-font-mono, ui-monospace, "SF Mono", Menlo, monospace);
  font-size: 12.5px;
  background: color-mix(in srgb, var(--red) 7%, transparent);
  color: var(--red-dark);
  padding: 1px 6px;
}

/* Inline two-option choice (Stage 03: backend pick) */
.pg-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s3);
  margin-top: var(--s3);
}
.pg-choice__opt {
  display: block;
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
}
.pg-choice__name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 3px;
}

/* Stage guardrail note */
.pg-stage__guard {
  margin: var(--s5) 0 0;
  padding: var(--s3) var(--s4);
  background: color-mix(in srgb, var(--red) 5%, transparent);
  border-left: 3px solid var(--red);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
}
.pg-stage__guard-k {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--red);
  margin-right: var(--s2);
}

/* Stage footer: done-when + stop-here */
.pg-stage__foot {
  margin-top: var(--s5);
  padding-top: var(--s4);
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.pg-stage__done { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.pg-stage__done-k {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--ink);
  margin-right: var(--s2);
}
.pg-stage__stop { margin: 0; font-size: 13.5px; line-height: 1.5; }
.pg-stage__stop a { color: var(--red); font-weight: 700; text-decoration: none; }
.pg-stage__stop a:hover { color: var(--red-dark); text-decoration: underline; text-underline-offset: 2px; }

/* ==========================================================================
   §4 — Where to stop (versions) + mobile branch
   ========================================================================== */

.pg-versions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s5);
  margin-bottom: var(--s8);
}
.pg-version {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  background: var(--elevated);
  border: 1px solid var(--border);
  border-top: 4px solid var(--red);
  padding: var(--s5);
}
.pg-version--full { border-left: 4px solid var(--red); }
.pg-version__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}
.pg-version__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--red);
  letter-spacing: -0.02em;
  line-height: 1;
}
.pg-version__stop {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
}
.pg-version__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-card);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: var(--s1) 0 0;
  line-height: 1.15;
}
.pg-version__get {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
}
.pg-version__meta {
  margin: var(--s2) 0 0;
  padding-top: var(--s4);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.pg-version__meta > div { display: flex; flex-direction: column; gap: 3px; }
.pg-version__meta dt {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.pg-version__meta dd { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }

/* Mobile branch callout */
.pg-mobile {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-top: 4px solid var(--ink);
  padding: var(--s6);
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 2fr);
  gap: var(--s6);
}
.pg-mobile__head { border-right: 1px solid var(--border); padding-right: var(--s6); }
.pg-mobile__kicker { color: var(--muted) !important; margin-bottom: var(--s2); }
.pg-mobile__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(20px, 2.2vw, 26px);
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
  line-height: 1.1;
}
.pg-mobile__body > p { font-size: var(--fs-body); line-height: 1.62; color: var(--ink-2); margin: 0 0 var(--s4); }
.pg-mobile__body a { color: var(--red); font-weight: 600; text-underline-offset: 2px; }
.pg-mobile__body a:hover { color: var(--red-dark); }
.pg-mobile__paths {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
  margin-bottom: var(--s4);
}
.pg-mobile__path {
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
}
.pg-mobile__path p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.pg-mobile__path-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px !important;
  color: var(--ink) !important;
  margin-bottom: var(--s2) !important;
}
.pg-mobile__path-label span { color: var(--red); font-weight: 700; }
.pg-mobile__note {
  font-size: 12.5px !important;
  line-height: 1.55;
  color: var(--muted) !important;
  margin: 0 !important;
  padding-top: var(--s3);
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   §5 — Capture
   ========================================================================== */
.pg-capture-section { border-top: 1px solid var(--border); }
.pg-capture-section .pg-lead { margin-bottom: var(--s7); }
.pg-capture-steps {
  display: flex;
  flex-direction: column;
  gap: var(--s7);
  max-width: 820px;
}
.pg-capture-step {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: var(--s5);
  align-items: start;
}
.pg-capture-step__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1;
  color: var(--red);
  letter-spacing: -0.03em;
}
.pg-capture-step__lead {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-card);
  color: var(--ink);
  margin: 0 0 var(--s3);
  line-height: 1.3;
}
.pg-capture-step p { font-size: var(--fs-body); line-height: 1.62; color: var(--ink-2); margin: 0 0 var(--s3); }
.pg-capture-step code {
  font-family: var(--wncp-font-mono, ui-monospace, "SF Mono", Menlo, monospace);
  font-size: 13px;
  background: var(--border);
  padding: 2px 6px;
  color: var(--ink);
}
.pg-hypothesis {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.5;
  color: var(--ink);
  border-left: 3px solid var(--red);
  padding: var(--s4) var(--s5);
  margin: var(--s4) 0;
  background: var(--elevated);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1023px) {
  .pg-hero__grid { grid-template-columns: 1fr; gap: var(--s6); }
  .pg-versions { grid-template-columns: repeat(2, 1fr); }
  .pg-mobile { grid-template-columns: 1fr; gap: var(--s5); }
  .pg-mobile__head { border-right: 0; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: var(--s4); }
}

@media (max-width: 820px) {
  /* Spec rows stack into a single column */
  .pg-spec-row {
    grid-template-columns: 1fr;
    gap: var(--s4);
  }
  .pg-spec-row__lead {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--s3);
  }
  .pg-mvs { grid-template-columns: 1fr; gap: var(--s4); }
  .pg-choice { grid-template-columns: 1fr; }
  .pg-mobile__paths { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .pg-versions { grid-template-columns: 1fr; }

  /* Tool-library banner: button drops below the text and spans the row.
     Reset the text block's flex-basis — in column flow it would become a
     340px *height* and open a dead gap above the button. */
  .pg-catalog { flex-direction: column; align-items: stretch; }
  .pg-catalog__text { flex: 0 0 auto; }
  .pg-catalog__btn { justify-content: center; }

  /* Tabs stack full-width on narrow screens */
  .pg-tabs { grid-template-columns: 1fr; gap: var(--s2); }
  .pg-tab { padding: var(--s4); }
  .pg-tab__label { font-size: 28px; }

  /* Cycle rail → vertical stack */
  .pg-rail {
    flex-direction: column;
    align-items: stretch;
    padding: var(--s5) var(--s4);
    gap: 0;
  }
  .pg-rail__node { width: 100%; }
  .pg-rail__link {
    flex-direction: row;
    align-items: center;
    gap: var(--s4);
    width: 100%;
    text-align: left;
    padding: var(--s3) 0;
  }
  .pg-rail__circ { width: 46px; height: 46px; font-size: 17px; flex-shrink: 0; }
  .pg-rail__arrow {
    align-self: flex-start;
    margin: 0 0 0 22px;
    transform: rotate(90deg);
    font-size: 15px;
    line-height: 1;
  }

  /* Stage rail spine shifts to align with the smaller markers */
  .pg-stage { grid-template-columns: 44px 1fr; gap: var(--s4); }
  .pg-stage__rail-num { width: 38px; height: 38px; font-size: 14px; }
  .pg-stage:not(:last-child) .pg-stage__rail::after { top: 38px; }
  /* Stack title over facts so the long Tools line wraps instead of overflowing */
  .pg-stage__head { flex-direction: column; align-items: stretch; gap: var(--s3); }
  .pg-stage__facts { width: 100%; flex-shrink: 1; }
}

@media (max-width: 480px) {
  .pg-hero__masthead { flex-direction: column; align-items: flex-start; gap: var(--s3); }
  .pg-hero__stages { gap: var(--s2); }
  .pg-arc__arrow { display: none; }

  /* Drop the timeline rail; numbers sit inline above content */
  .pg-stage { grid-template-columns: 1fr; gap: var(--s3); }
  .pg-stage__rail { justify-content: flex-start; }
  .pg-stage:not(:last-child) .pg-stage__rail::after { display: none; }
  .pg-steps > li { padding-left: var(--s6); }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .pg-rail__circ,
  .pg-rail__link:hover .pg-rail__circ,
  .pg-download-btn,
  .pg-download-btn__arrow,
  .reveal { transition: none; }
  /* Safety: never leave reveal content hidden under reduced motion */
  .pg-reveal-on .reveal { opacity: 1; transform: none; }
}

/* ==========================================================================
   Print — flatten the dark hero, drop chrome, keep content legible
   ========================================================================== */
@media print {
  .nav, .top-rule, .pg-tabs { display: none !important; }

  /* Print both tab panels in full, regardless of which is active on screen */
  .pg-panel,
  .pg-panel[hidden] { display: block !important; }
  .pg-panel + .pg-panel { margin-top: var(--s7); }

  .pg-hero {
    background: #fff;
    color: #000;
    padding: 16px 0 24px;
  }
  .pg-hero::after, .pg-hero__accent { display: none; }
  .pg-hero__grid { grid-template-columns: 1fr; gap: 16px; }
  .pg-hero__h1 { color: #000; font-size: 28px; }
  .pg-hero__sub, .pg-hero__session, .pg-hero__stages-note { color: #333; }
  .pg-arc__pill { color: #333; border-color: #ccc; }
  .pg-hero__guardrails {
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-left: 4px solid #bd1b04;
  }
  .pg-guardrails__list li, .pg-guardrails__instruction { color: #333; }
  .pg-guardrails__list strong { color: #000; }

  .reveal { opacity: 1 !important; transform: none !important; }

  .pg-mvs, .pg-rail, .pg-version, .pg-mobile, .pg-mobile__path,
  .pg-choice__opt, .pg-hypothesis, .pg-stage__guard, .pg-tool, .pg-catalog {
    border: 1px solid #ccc;
    background: #fff;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  /* Flatten the dark tool-library banner for print */
  .pg-catalog { border-left: 4px solid #bd1b04; color: #000; }
  .pg-catalog__label { color: #555; }
  .pg-catalog__body { color: #333; }
  .pg-catalog__body strong { color: #000; }
  .pg-catalog__btn { background: #fff; color: #bd1b04; border: 1px solid #bd1b04; }
  .pg-tool__desc, .pg-tool__best, .pg-tool__tagline { color: #333; }
  .pg-tool__name { color: #000; }
  /* Print every tool section expanded, regardless of open/closed on screen */
  .pg-tool__body { display: flex !important; }
  .pg-tool__chev { display: none; }
  .pg-tool__link { border-color: #999; color: #000; }
  .pg-tool__link--primary { border-color: #bd1b04; color: #bd1b04; }
  .pg-rail__circ, .pg-stage__rail-num { background: #bd1b04; color: #fff; }
  .pg-stage { page-break-inside: avoid; break-inside: avoid; }
}
