/* ================================================================
   Elevator primitives — scrollytelling site
   ================================================================
   Layout: hero → pinned-viz scrolly → outro.
   Animations driven by body[data-stage] + .shown class on
   anything with [data-from]. JS keeps these in sync with scroll.
   ================================================================ */

:root {
  --bg: #0a0d11;
  --bg-soft: #11151b;
  --panel: #161b22;
  --fg: #e8eaed;
  --fg-soft: #c9ced4;
  --muted: #7e858d;
  --rule: rgba(255, 255, 255, 0.07);

  /* Per-primitive accent colours — match the static mermaid diagram. */
  --target: #f59e0b;
  --section: #60a5fa;
  --requirement: #a78bfa;
  --document: #818cf8;
  --evidence: #34d399;
  --question: #fb7185;
  --user: #94a3b8;
  --draft: #5eead4;
  --review: #fbbf24;
  --cross: #c084fc;

  /* Status colours */
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular,
               Menlo, Monaco, Consolas, monospace;

  --nav-height: 58px;

  /* Audience colours used in the Separation Principle sub-journey. */
  --audience-user: #fb923c;     /* orange-400 — narrative, for humans */
  --audience-machine: #22d3ee;  /* cyan-400  — structured, for the integrator */
}

* { box-sizing: border-box; }

html { background: var(--bg); }

html, body {
  margin: 0;
  padding: 0;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 19px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Bottom-of-page illumination — sits on body so it spans whatever
   the page ends with (outro + next-page on most pages). The .outro
   rule no longer carries its own gradient. */
body {
  background:
    radial-gradient(ellipse 1200px 640px at center 100%,
                    rgba(94, 234, 212, 0.05), transparent 70%) no-repeat,
    var(--bg);
}

a { color: inherit; }
code { font-family: var(--font-mono); font-size: 0.92em; color: var(--fg-soft); }
b, strong { font-weight: 600; }

/* ----------------------------------------------------------------
   SITE NAV — sticky header across every page
   ---------------------------------------------------------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  background: rgba(10, 13, 17, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}

.site-nav-inner {
  max-width: 1900px;
  height: 100%;
  margin: 0 auto;
  padding: 0 2.5rem;
  display: flex;
  align-items: center;
  gap: 2.2rem;
}

.site-brand {
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--fg);
  font-weight: 600;
  flex-shrink: 0;
}

.site-nav nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  flex-wrap: wrap;
}

.site-nav nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  transition: color 200ms ease, border-color 200ms ease;
}

/* Tour links (everything other than Overview) get a slightly tighter,
   mono-flavoured treatment so the eye registers that they lead to
   technical / operational content. */
.site-nav nav a[data-route]:not([data-route="/"]) {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

/* Vertical divider before the first tour link, plus a touch of
   extra leading-margin so Overview sits visibly apart. */
.site-nav nav a[data-route="/round"] {
  margin-left: 0.6rem;
  padding-left: 1.3rem;
  border-left: 1px solid var(--rule);
}

.site-nav nav a:hover { color: var(--fg-soft); }
.site-nav nav a.active {
  color: var(--fg);
  border-bottom-color: var(--fg);
}

/* ----------------------------------------------------------------
   HERO
   ---------------------------------------------------------------- */

.hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at top, rgba(96, 165, 250, 0.08), transparent 60%),
              var(--bg);
  border-bottom: 1px solid var(--rule);
}

.hero-inner {
  max-width: 760px;
  padding: 4rem 2rem;
  text-align: center;
}

.brand {
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1.4rem;
  font-weight: 600;
}

.lede {
  font-size: 1.1rem;
  color: var(--fg-soft);
  max-width: 56ch;
  margin: 0 auto;
}

.scroll-hint {
  margin-top: 4rem;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50%      { transform: translateY(6px); opacity: 1; }
}

/* ----------------------------------------------------------------
   SCROLLY: pinned viz + scrolling stages
   ---------------------------------------------------------------- */

.scrolly {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 3rem;
  max-width: 1900px;
  margin: 0 auto;
  padding: 0 2.5rem;
}

.viz {
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
  display: grid;
  place-items: center;
  align-self: start;
}

.viz svg {
  width: 100%;
  max-height: 94vh;
  overflow: visible;
}

.stages {
  padding: 30vh 0 30vh;
}

.stages > section {
  min-height: 78vh;
  padding: 8vh 1rem;
  border-top: 1px solid var(--rule);
}

.stages > section:first-child { border-top: 0; }

.stage-num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.stages h2 {
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
  letter-spacing: -0.01em;
  margin: 0 0 1.4rem;
  font-weight: 600;
}

.stages p {
  margin: 0 0 1.2rem;
  color: var(--fg-soft);
}

.stages em { color: var(--fg); font-style: italic; }

.callout {
  border-left: 2px solid var(--rule);
  padding: 0.4rem 0 0.4rem 1.2rem;
  color: var(--fg) !important;
}
.callout.strong {
  border-left-color: var(--question);
  font-size: 1.12rem;
  line-height: 1.45;
}

/* Inline-tags that pick up primitive accent colours */
.t-target      { color: var(--target); }
.t-section     { color: var(--section); }
.t-requirement { color: var(--requirement); }
.t-document    { color: var(--document); }
.t-evidence    { color: var(--evidence); }
.t-question    { color: var(--question); }
.t-user        { color: var(--user); }
.t-draft       { color: var(--draft); }
.t-review      { color: var(--review); }

/* ----------------------------------------------------------------
   STAGE INDICATOR DOTS (fixed, right edge)
   ---------------------------------------------------------------- */

.stage-dots {
  position: fixed;
  top: 50%;
  right: 1.4rem;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 10;
  opacity: 0;
  transition: opacity 400ms ease;
  pointer-events: none;
}

body.in-scrolly .stage-dots {
  opacity: 1;
  pointer-events: auto;
}

.stage-dots a {
  display: block;
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  text-decoration: none;
}
.stage-dots a span {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rule);
  transition: background 200ms ease, transform 200ms ease;
}
.stage-dots a:hover span { transform: scale(1.5); background: var(--muted); }

/* Active dot, driven by body[data-stage] */
body[data-stage="1"] .stage-dots a[data-jump="1"] span,
body[data-stage="2"] .stage-dots a[data-jump="2"] span,
body[data-stage="3"] .stage-dots a[data-jump="3"] span,
body[data-stage="4"] .stage-dots a[data-jump="4"] span,
body[data-stage="5"] .stage-dots a[data-jump="5"] span,
body[data-stage="6"] .stage-dots a[data-jump="6"] span,
body[data-stage="7"] .stage-dots a[data-jump="7"] span,
body[data-stage="8"] .stage-dots a[data-jump="8"] span,
body[data-stage="9"] .stage-dots a[data-jump="9"] span {
  background: var(--fg);
  transform: scale(1.4);
}

/* ----------------------------------------------------------------
   SVG: defaults for arrows + edges + nodes
   ---------------------------------------------------------------- */

#arrow path { fill: var(--fg-soft); }
#arrow-dim path { fill: var(--muted); }

/* Edges — solid (animated draw via dashoffset).
   opacity is the master visibility switch — SVG marker-end arrows render
   at path endpoints independently of stroke-dasharray, so without an
   opacity:0 base the arrowheads would float in space before reveal.
   Opacity also propagates to markers, so this hides the arrow too. */
.edges .edge {
  stroke: var(--fg-soft);
  stroke-width: 1.4;
  fill: none;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  opacity: 0;
  /* OUT direction (.shown removed): fade quickly, no delay. */
  transition: opacity 400ms ease, stroke-dashoffset 600ms ease, stroke 300ms ease;
  marker-end: url(#arrow);
}
.edges .edge.shown {
  opacity: 0.65;
  stroke-dashoffset: 0;
  /* IN direction: wait for endpoint nodes to fade in (350ms),
     then both reveal opacity and draw the line. */
  transition: opacity 400ms ease 350ms, stroke-dashoffset 900ms ease 350ms, stroke 300ms ease;
}

/* Edges — dashed cross-cutting (no draw animation; just fade) */
.edges .edge.edge-dashed {
  stroke: var(--cross);
  stroke-dasharray: 4 5;
  stroke-dashoffset: 0;
  stroke-width: 1.2;
  opacity: 0;
  transition: opacity 600ms ease;
  marker-end: url(#arrow-dim);
}
.edges .edge.edge-dashed.shown {
  opacity: 0.55;
  /* Same delay-on-reveal pattern as solid edges. */
  transition: opacity 700ms ease 350ms;
}

/* The "blocking" edge (Question → Requirement) gets a different colour */
.edges .edge.edge-block.shown { stroke: var(--question); opacity: 0.85; }

/* Once the Question is answered (stage 6+), tone down the blocking edge —
   the visual cue that the block has been lifted, even though the Question
   itself stays in the diagram. */
body[data-stage="6"] .edges .edge.edge-block.shown,
body[data-stage="7"] .edges .edge.edge-block.shown,
body[data-stage="8"] .edges .edge.edge-block.shown {
  stroke: var(--muted);
  opacity: 0.3;
}

/* ----------------------------------------------------------------
   NODES: fade in by default, pop on highlight
   ---------------------------------------------------------------- */

.nodes .node {
  opacity: 0;
  transition: opacity 700ms ease, filter 400ms ease;
}
.nodes .node.shown { opacity: 1; }

.nodes .node rect,
.nodes .node circle,
.nodes .node polygon,
.nodes .node path {
  fill: var(--panel);
  stroke: var(--muted);
  stroke-width: 1.5;
  transition: fill 300ms ease, stroke 300ms ease, stroke-width 300ms ease;
}

.nodes .node text {
  text-anchor: middle;
  fill: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.nodes .node .node-sub {
  font-size: 10.5px;
  font-weight: 400;
  fill: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Per-primitive accent colours — applied to stroke of the shape */
.nodes .node-target rect       { stroke: var(--target); fill: rgba(245,158,11,0.08); }
.nodes .node-section rect      { stroke: var(--section); fill: rgba(96,165,250,0.08); }
.nodes .node-requirement polygon { stroke: var(--requirement); fill: rgba(167,139,250,0.08); }
.nodes .node-document path     { stroke: var(--document); fill: rgba(129,140,248,0.08); }
.nodes .node-evidence circle   { stroke: var(--evidence); fill: rgba(52,211,153,0.10); }
.nodes .node-question rect     { stroke: var(--question); fill: rgba(251,113,133,0.10); }
.nodes .node-user circle       { stroke: var(--user); fill: rgba(148,163,184,0.10); }
.nodes .node-user-input rect   { stroke: var(--user); fill: rgba(148,163,184,0.06); }
.nodes .node-draft rect        { stroke: var(--draft); fill: rgba(94,234,212,0.08); }
.nodes .node-review rect       { stroke: var(--review); fill: rgba(251,191,36,0.08); }
.nodes .node-cross rect        { stroke: var(--cross); fill: rgba(192,132,252,0.06); stroke-dasharray: 4 4; }

/* Submission — final compilation, end of the journey. Reuses the
   green/done palette so it pairs visually with Target.completed. */
.nodes .node-submission rect {
  stroke: var(--ok);
  fill: rgba(16,185,129,0.14);
}

/* "Closed" Requirement (green tick) — applied via JS class */
.nodes .node-requirement.closed polygon {
  stroke: var(--ok);
  stroke-width: 2.2;
  fill: rgba(16,185,129,0.18);
  filter: drop-shadow(0 0 8px rgba(16,185,129,0.45));
}

/* "Blocked" Requirement (red, when Question is unresolved) */
.nodes .node-requirement.blocked polygon {
  stroke: var(--question);
  stroke-width: 2.4;
  fill: rgba(251,113,133,0.18);
  filter: drop-shadow(0 0 10px rgba(251,113,133,0.55));
}

/* "Ready" Requirement — unblocked by a user response, awaiting drafting.
   Amber, not green: the answer unblocks the Requirement; it doesn't evidence it. */
.nodes .node-requirement.ready polygon {
  stroke: var(--warn);
  stroke-width: 2.2;
  fill: rgba(245,158,11,0.14);
  filter: drop-shadow(0 0 8px rgba(245,158,11,0.45));
}

/* Target lifecycle = completed — fires in stage 9 when the
   submission ships. Same green tone as Evidence "closed" /
   Submission node, with a brighter glow. */
.nodes .node-target.completed rect {
  stroke: var(--ok);
  fill: rgba(16, 185, 129, 0.20);
  stroke-width: 2.4;
  filter: drop-shadow(0 0 14px rgba(16, 185, 129, 0.55));
}

/* "Emphasised" — used on the focal node of a stage (e.g. the Target alone) */
.nodes .node.emphasised rect,
.nodes .node.emphasised circle,
.nodes .node.emphasised polygon,
.nodes .node.emphasised path {
  stroke-width: 2.4;
  filter: drop-shadow(0 0 16px currentColor);
}
.nodes .node-target.emphasised rect { color: var(--target); }
.nodes .node-draft.emphasised rect  { color: var(--draft); }

/* ----------------------------------------------------------------
   OUTRO
   ---------------------------------------------------------------- */

.outro {
  margin-top: 6rem;
  padding: 8rem 2rem 6rem;
  border-top: 1px solid var(--rule);
  /* Bottom illumination now lives on <body> so it extends into
     the .next-page block below as well. */
}
.outro-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.outro h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 1.4rem;
}
.outro p { color: var(--fg-soft); margin: 0 0 1rem; }
.outro .muted { color: var(--muted); font-size: 0.92rem; }

/* ----------------------------------------------------------------
   RESPONSIVE: stack the layout below ~960px
   ---------------------------------------------------------------- */

@media (max-width: 960px) {
  .scrolly {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 1.2rem;
  }
  .viz {
    height: 60vh;
    top: 0;
    background: linear-gradient(to bottom, var(--bg) 88%, transparent);
    z-index: 5;
    backdrop-filter: blur(4px);
  }
  .stages { padding: 4vh 0 30vh; }
  .stages > section { min-height: auto; padding: 4vh 0; }
  .stage-dots { display: none; }
}

/* Reduce-motion users: skip the staged animations, just fade. */
@media (prefers-reduced-motion: reduce) {
  .edges .edge { stroke-dashoffset: 0 !important; transition: opacity 200ms ease; }
  .nodes .node { transition: opacity 200ms ease; }
  .scroll-hint { animation: none; }
}

/* ================================================================
   SUB-JOURNEY: The Separation Principle
   ================================================================
   Renders a single Evidence card with its fields. Stages reveal
   which fields are user-facing (narrative) vs machine-state
   (structured), then show what the integrator re-reads on a later
   cycle.
   ================================================================ */

.entity-card {
  width: 100%;
  max-width: 580px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.card-header {
  padding: 1.1rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--rule);
}

.card-label {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--evidence);
  font-weight: 600;
}

.card-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
  font-family: var(--font-mono);
}

.card-body {
  padding: 0.4rem 0;
}

.field {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1rem;
  padding: 0.55rem 1.5rem;
  border-left: 3px solid transparent;
  transition: background 500ms ease,
              border-left-color 500ms ease,
              opacity 500ms ease;
}

.field-name {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  padding-top: 0.1rem;
}

.field-value {
  color: var(--fg-soft);
  font-size: 0.88rem;
  line-height: 1.45;
}

.field-value.muted { color: var(--muted); font-style: italic; }

/* Stage-driven audience colours */
.field.audience-user-active {
  border-left-color: var(--audience-user);
  background: rgba(251, 146, 60, 0.07);
}
.field.audience-machine-active {
  border-left-color: var(--audience-machine);
  background: rgba(34, 211, 238, 0.07);
}
.field.audience-user-dimmed {
  opacity: 0.22;
}

/* Inline tags used inside stage prose */
.t-narrative { color: var(--audience-user); font-weight: 600; }
.t-machine { color: var(--audience-machine); font-weight: 600; }

/* The "next cycle" label that drops in during stage 4. CSS-only —
   hidden by default, revealed when body[data-stage="4" | "5"]. */
.next-cycle-banner {
  margin-top: 1.4rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--audience-machine);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 600ms ease, transform 600ms ease;
}
body[data-stage="4"] .next-cycle-banner,
body[data-stage="5"] .next-cycle-banner {
  opacity: 1;
  transform: translateY(0);
}

/* ================================================================
   COMING-SOON STUBS
   For sub-journey routes that haven't been implemented yet.
   ================================================================ */

.coming-soon {
  min-height: calc(100vh - var(--nav-height));
  display: grid;
  place-items: center;
  padding: 2rem;
}
.coming-soon-inner {
  max-width: 600px;
  text-align: center;
}
.coming-soon .stage-num { display: block; margin-bottom: 1.2rem; }
.coming-soon h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 600;
  margin: 0 0 1.4rem;
  letter-spacing: -0.02em;
}
.coming-soon p {
  color: var(--fg-soft);
  margin: 0 0 1rem;
}
.coming-soon a {
  color: var(--target);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
.coming-soon a:hover { color: var(--fg); }

/* ================================================================
   TECH SHIFT — sub-journey pages (Round / Questions / Evidence /
   Drafts / Separation) tag <body class="tech …">. Headings and a
   few label elements pick up the mono stack so the visual signals
   "this is operational / technical content."
   ================================================================ */

body.tech .hero h1,
body.tech .stages h2,
body.tech .outro h2 {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* Mono is wider than sans at the same nominal size, so trim each
   heading scale slightly to keep the visual weight comparable to
   the Overview. */
body.tech .hero h1 {
  font-size: clamp(1.8rem, 3.8vw, 2.9rem);
  line-height: 1.18;
}
body.tech .stages h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.95rem);
}
body.tech .outro h2 {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
}

/* Eyebrow above the hero on a tech page reads "operations"-ish */
body.tech .hero .brand { letter-spacing: 0.28em; }

/* ================================================================
   PRELUDE — opening section above the main scrolly on the Overview.
   Introduces the human + AI co-working philosophy before the first
   "Why" stage.
   ================================================================ */

.prelude {
  max-width: 820px;
  margin: 0 auto;
  padding: 8rem 2rem 6rem;
  text-align: center;
  border-bottom: 1px solid var(--rule);
}

.prelude-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.4rem;
}

.prelude h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 2rem;
  line-height: 1.18;
}

.prelude p {
  color: var(--fg-soft);
  margin: 0 0 1.2rem;
  font-size: 1.05rem;
  line-height: 1.65;
}

.prelude p em { color: var(--fg); font-style: italic; }

.prelude .roles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  margin: 3rem auto 2rem;
  text-align: left;
  max-width: 640px;
}

.role-card {
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.4rem 1.5rem;
  background: var(--panel);
}

.role-card .role-label {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.role-card.human .role-label { color: var(--audience-user); }
.role-card.integrator .role-label { color: var(--audience-machine); }

.role-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.8rem;
}

.role-card p {
  font-size: 0.92rem;
  color: var(--fg-soft);
  margin: 0;
  line-height: 1.5;
  text-align: left;
}

@media (max-width: 720px) {
  .prelude .roles { grid-template-columns: 1fr; gap: 1.2rem; }
}

/* ================================================================
   NEXT-PAGE NUDGE — appears at the bottom of each page, suggesting
   the next sub-journey in the reading order.
   ================================================================ */

.next-page {
  padding: 4rem 2rem 6rem;
  text-align: center;
  border-top: 1px solid var(--rule);
}

.next-page-inner {
  max-width: 560px;
  margin: 0 auto;
}

.next-label {
  font-size: 0.74rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.next-link {
  display: inline-block;
  text-decoration: none;
  color: var(--fg);
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 0.6rem 0;
  border-bottom: 2px solid var(--rule);
  transition: border-color 250ms ease, color 250ms ease;
}

.next-link::after {
  content: "  →";
  color: var(--muted);
  transition: color 250ms ease, transform 250ms ease;
  display: inline-block;
}

.next-link:hover {
  border-color: var(--fg);
}
.next-link:hover::after {
  color: var(--fg);
  transform: translateX(4px);
}

.next-blurb {
  color: var(--fg-soft);
  font-size: 0.98rem;
  margin: 1rem auto 0;
  max-width: 460px;
  line-height: 1.55;
}

/* ================================================================
   PIPELINE NODES — used in the Round sub-journey (SVG diagram of
   one integration cycle). Layered on top of .node defaults from
   the Overview's diagram styles.
   ================================================================ */

.nodes .node-step rect       { stroke: var(--muted); fill: rgba(148,163,184,0.08); }
.nodes .node-specialist rect { stroke: var(--section); fill: rgba(96,165,250,0.10); }
.nodes .node-audit rect      { stroke: var(--review); fill: rgba(251,191,36,0.10); }
.nodes .node-integrate rect  { stroke: var(--requirement); fill: rgba(167,139,250,0.12); }
.nodes .node-validate rect   { stroke: var(--audience-machine); fill: rgba(34,211,238,0.10); }
.nodes .node-push rect       { stroke: var(--ok); fill: rgba(16,185,129,0.12); }

/* Inputs label at the top of the Round pipeline. Visually distinct
   from the regular nodes — more of a stamp than a step. */
.nodes .node-inputs rect {
  stroke: var(--rule);
  stroke-dasharray: 4 3;
  fill: transparent;
}
.nodes .node-inputs text { fill: var(--muted); }

/* ================================================================
   STATUS BADGES — applied to .entity-card variants in sub-journeys.
   ================================================================ */

.card-status {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.6rem;
  vertical-align: middle;
}
.card-status.status-open      { background: rgba(251,113,133,0.16); color: var(--question); }
.card-status.status-answered  { background: rgba(16,185,129,0.16);  color: var(--ok); }
.card-status.status-retired   { background: rgba(148,163,184,0.16); color: var(--muted); }
.card-status.status-satisfied { background: rgba(16,185,129,0.16);  color: var(--ok); }
.card-status.status-concern   { background: rgba(245,158,11,0.16);  color: var(--warn); }
.card-status.status-stale     { background: rgba(148,163,184,0.16); color: var(--muted); }
.card-status.status-proposed  { background: rgba(94,234,212,0.14);  color: var(--draft); }
.card-status.status-revised   { background: rgba(94,234,212,0.18);  color: var(--draft); }
.card-status.status-approved  { background: rgba(16,185,129,0.18);  color: var(--ok); }

/* When a card has multiple status badges representing successive
   states (e.g. open → answered → retired on Questions), tag each
   with data-state and let JS toggle .active-badge to show exactly
   one at a time. Badges without data-state are static. */
.card-status[data-state] { display: none; }
.card-status[data-state].active-badge { display: inline-block; }

/* Same pattern for confidence bars on Evidence — multiple bars in
   markup, only one .active-badge at a time. */
.confidence-bar[data-state] { display: none; }
.confidence-bar[data-state].active-badge { display: inline-flex; }

/* Inline text variants — e.g. a date or fragment that mutates over
   stages. Multiple <span class="state-variant" data-state="…"> in
   markup; JS toggles .active on the one for the current stage. */
.state-variant { display: none; transition: opacity 400ms ease; }
.state-variant.active { display: inline; }

/* Refresh / change banners — appear below a card when an event
   happens (e.g. source document refreshed). Driven by data-from. */
.refresh-banner {
  margin-top: 1.4rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--warn);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 600ms ease, transform 600ms ease;
}
.refresh-banner.shown {
  opacity: 1;
  transform: translateY(0);
}

/* Card grouping — used when a sub-journey shows multiple entity
   cards stacked or side by side (e.g. Draft v1 above Draft v2). */
.card-stack {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  width: 100%;
  max-width: 580px;
}

.card-stack .entity-card {
  transition: opacity 600ms ease, transform 600ms ease;
}
.card-stack .entity-card[data-from] {
  opacity: 0;
  transform: translateY(12px);
}
.card-stack .entity-card[data-from].shown {
  opacity: 1;
  transform: translateY(0);
}

.card-divider {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
  transition: opacity 600ms ease;
  margin: -0.3rem 0;
}
.card-divider.shown { opacity: 0.9; }

/* Confidence bars (Evidence sub-journey) */
.confidence-bar {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
  margin-left: 0.6rem;
}
.confidence-bar span {
  width: 18px;
  height: 4px;
  border-radius: 2px;
  background: var(--rule);
}
.confidence-bar.high span:nth-child(-n+3) { background: var(--ok); }
.confidence-bar.medium span:nth-child(-n+2) { background: var(--warn); }
.confidence-bar.low span:nth-child(-n+1) { background: var(--bad); }

/* Coverage stripes (Drafts sub-journey) — paragraph rows annotated
   with which Requirement each addresses. */
.coverage-row {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 0.8rem;
  padding: 0.55rem 1.5rem;
  align-items: baseline;
  font-size: 0.86rem;
}
.coverage-row .req-id {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--requirement);
  letter-spacing: 0.04em;
}
.coverage-row .coverage-text { color: var(--fg-soft); line-height: 1.45; }
.coverage-row.placeholder .coverage-text {
  color: var(--muted);
  font-style: italic;
}
.coverage-row.placeholder .req-id { color: var(--warn); }

/* Requirement rows — used to list a Section's Requirements inside
   an .entity-card. Each row carries a left-border readiness tint:
   green for evidenced, amber for unblocked-but-not-yet-documented. */
.req-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.8rem;
  padding: 0.55rem 1.5rem;
  border-left: 3px solid transparent;
  align-items: baseline;
  transition: border-left-color 400ms ease, background 400ms ease;
}
.req-row.ready {
  border-left-color: var(--ok);
  background: rgba(16, 185, 129, 0.04);
}
.req-row.ready-pending {
  border-left-color: var(--warn);
  background: rgba(245, 158, 11, 0.04);
}
.req-row .req-id {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--requirement);
  letter-spacing: 0.04em;
  padding-top: 0.1rem;
}
.req-row .req-text {
  font-size: 0.88rem;
  color: var(--fg-soft);
  line-height: 1.45;
}

/* Section diagram on the Drafts page — bare SVG, no card wrapper.
   Visible at stage 1, collapses to zero height when .phased-out is
   applied at stage 2+ so the Draft cards below take its space. */
.section-diagram {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 0.5rem 0;
}
.section-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

#section-card {
  max-height: 360px;
  overflow: hidden;
  transition: opacity 400ms ease,
              max-height 500ms ease 100ms,
              padding 500ms ease 100ms,
              margin 500ms ease 100ms;
}
#section-card.phased-out {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
}
