*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* Self-hosted fonts (CSP font-src 'self'; no external CDN) */
@font-face { font-family:'Inter'; font-style:normal; font-weight:400; font-display:swap; src:url('/static/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family:'Inter'; font-style:normal; font-weight:500; font-display:swap; src:url('/static/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family:'Inter'; font-style:normal; font-weight:600; font-display:swap; src:url('/static/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family:'Space Grotesk'; font-style:normal; font-weight:500; font-display:swap; src:url('/static/fonts/space-grotesk-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family:'Space Grotesk'; font-style:normal; font-weight:700; font-display:swap; src:url('/static/fonts/space-grotesk-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family:'IBM Plex Mono'; font-style:normal; font-weight:400; font-display:swap; src:url('/static/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family:'IBM Plex Mono'; font-style:normal; font-weight:600; font-display:swap; src:url('/static/fonts/ibm-plex-mono-latin-600-normal.woff2') format('woff2'); }

/* ============================================================
   Identity Lab — "the decision ledger"
   One signature system: every decision renders as a checkpoint
   rail (square gate-nodes on a vertical rule) that resolves into
   a verdict stamp. Machine output is IBM Plex Mono on a dark
   instrument panel; human explanation is Inter on paper.
   ============================================================ */
:root {
  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --ink: #10192b;          /* text */
  --muted: #5b6577;
  --faint: #6e7889;        /* small labels — still AA on white */
  --paper: #f5f6f8;        /* page */
  --card: #ffffff;
  --line: #e2e6ee;         /* hairlines */

  --blue: #004ac6;         /* policy blue — the only brand accent */
  --blue-deep: #0035a0;
  --blue-ink: #0d3fa6;
  --blue-wash: #e9effc;

  --panel: #101d36;        /* instrument navy — the machine's surface */
  --panel-ink: #e7edf8;
  --panel-mut: #93a3c2;

  --allow: #0e6b3f;        /* verdict pair: pine / brick */
  --allow-wash: #e4f2e9;
  --allow-bright: #3ecf8e; /* pine on dark */
  --deny: #b42318;
  --deny-wash: #fbeae7;
  --deny-bright: #ff8f7d;  /* brick on dark */
  --warn: #92400e;
  --warn-wash: #fcf0df;
}

body { font-family: var(--font-body); background: var(--paper); color: var(--ink); line-height: 1.6; }
a { color: inherit; }
::selection { background: #c9d8f7; }

a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible,
summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 3px;
}

/* Disclaimer */
.disclaimer {
  background: #fdf6e7; border-bottom: 1px solid #f0e0ba;
  padding: 8px 24px; text-align: center; font-size: 0.75rem; color: #7c5309;
}

/* Phone-only notice (tablets/desktop get the full layout) */
.mobile-notice { display: none; }
@media (max-width: 640px) {
  .mobile-notice {
    display: block; background: var(--blue-wash); color: var(--blue-ink);
    border-bottom: 1px solid #c9d8f7; padding: 10px 16px;
    text-align: center; font-size: 0.8rem; line-height: 1.45;
  }
}

/* Footer */
.footer {
  text-align: center; padding: 30px; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--faint);
}

/* ============================================================
   Verdict stamps — the shared decision language
   ============================================================ */
.badge-ALLOW, .badge-DENY, .badge-CHALLENGE {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  font-family: var(--font-mono); font-weight: 600; font-size: 0.72rem;
  letter-spacing: 0.13em; text-transform: uppercase;
  padding: 5px 11px 4px; border: 1.5px solid currentColor; border-radius: 4px;
}
.badge-ALLOW::before, .badge-DENY::before, .badge-CHALLENGE::before {
  content: ""; width: 7px; height: 7px; background: currentColor; flex-shrink: 0;
}
.badge-ALLOW { color: var(--allow); background: var(--allow-wash); }
.badge-DENY { color: var(--deny); background: var(--deny-wash); }
.badge-CHALLENGE { color: var(--warn); background: var(--warn-wash); }
.badge-inline {
  display: inline-block; padding: 1px 6px; border: none; border-radius: 3px;
  font-family: var(--font-mono); font-weight: 600; font-size: 0.68rem; letter-spacing: 0.08em;
}
.badge-inline::before { display: none; }

/* Rung system — depth of the ladder encoded as ink density */
.rung-badge {
  display: inline-block; font-family: var(--font-mono); font-size: 0.66rem;
  font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase;
  padding: 5px 10px 4px; border-radius: 4px;
}
.r-basic { background: var(--blue-wash); color: var(--blue-ink); }
.r-inter { background: #c9d8f7; color: #0b2f80; }
.r-adv   { background: var(--panel); color: #dbe7ff; }

/* ============================================================
   Landing page
   ============================================================ */
.lp-hero {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center;
  max-width: 1160px; margin: 0 auto; padding: 64px 48px 40px;
}
.lp-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue);
  margin-bottom: 22px;
}
.lp-eyebrow::before { content: ""; width: 8px; height: 8px; background: var(--blue); }
.lp-h1 {
  font-family: var(--font-display); font-weight: 700; font-size: 3.15rem; line-height: 1.05;
  letter-spacing: -0.03em; color: var(--ink); margin-bottom: 18px;
}
.lp-h1 span { color: var(--blue); }
.lp-lede { font-size: 1.06rem; line-height: 1.6; color: #414b5e; max-width: 46ch; }
.lp-lede em { font-style: normal; font-weight: 600; color: var(--ink); }
/* Second lede line: names the full arc without competing with the first. */
.lp-lede-2 { margin-top: 12px; font-size: 0.98rem; color: var(--muted); }
.lp-cta { display: flex; gap: 12px; margin: 28px 0 16px; flex-wrap: wrap; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  background: var(--blue); color: #fff;
  font-weight: 600; font-size: 0.95rem; padding: 12px 22px; border-radius: 8px;
  transition: background .15s, transform .15s;
}
.btn-primary:hover { background: var(--blue-deep); transform: translateY(-1px); }
.btn-primary .arr { transition: transform .15s; }
.btn-primary:hover .arr { transform: translateX(3px); }
.btn-ghost {
  display: inline-flex; align-items: center; text-decoration: none; color: var(--ink);
  font-weight: 600; font-size: 0.95rem; padding: 12px 20px; border-radius: 8px;
  border: 1px solid #d0d6e0; background: var(--card); transition: border-color .15s, background .15s;
}
.btn-ghost:hover { border-color: var(--blue); background: #f6f9ff; }
.lp-trust { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.04em; color: var(--faint); }

/* Hero demo — the reference monitor as an instrument panel */
.lp-demo { display: flex; justify-content: center; }
.demo-card {
  width: 100%; max-width: 440px; background: var(--panel); color: var(--panel-ink);
  border: 1px solid rgba(231,237,248,0.08); border-radius: 14px; padding: 22px 24px;
  box-shadow: 0 30px 70px rgba(16,29,54,0.35);
}
.demo-top {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 0.76rem; color: var(--panel-mut);
}
.demo-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--allow-bright); box-shadow: 0 0 0 3px rgba(62,207,142,0.16); }
.demo-live {
  margin-left: auto; font-family: var(--font-mono); font-size: 0.62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--allow-bright);
  border: 1px solid rgba(62,207,142,0.4); padding: 2px 8px 1px; border-radius: 3px;
}
.demo-req {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 16px 0 14px;
  font-family: var(--font-mono); font-size: 0.8rem;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; padding: 12px 14px;
}
.demo-req .k { color: var(--panel-mut); } .demo-req .v { color: #fff; }
.demo-rules { position: relative; display: flex; flex-direction: column; margin: 2px 0 14px; }
.demo-rules::before {
  content: ""; position: absolute; left: 8px; top: 12px; bottom: 12px; width: 2px;
  background: rgba(231,237,248,0.14);
}
.demo-rule {
  display: flex; align-items: center; gap: 11px; padding: 5px 0;
  font-family: var(--font-mono); font-size: 0.78rem;
}
.demo-mark {
  position: relative; z-index: 1; width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 0.62rem; font-weight: 600;
  background: var(--panel);
}
.demo-rule.ok .demo-mark { color: var(--allow-bright); border: 1px solid rgba(62,207,142,0.55); background: rgba(62,207,142,0.12); }
.demo-rule.bad .demo-mark { color: var(--deny-bright); border: 1px solid rgba(255,143,125,0.55); background: rgba(255,143,125,0.12); }
.demo-rule.bad { color: var(--deny-bright); font-weight: 600; }
.demo-decision {
  display: flex; align-items: flex-start; gap: 12px;
  border-top: 1px solid rgba(231,237,248,0.12); padding-top: 14px;
}
.demo-decision .badge-DENY { color: var(--deny-bright); background: rgba(255,143,125,0.1); }
.demo-decision .badge-ALLOW { color: var(--allow-bright); background: rgba(62,207,142,0.1); }
.demo-why { font-size: 0.8rem; color: var(--panel-mut); line-height: 1.5; }

/* Sections */
.lp-section { max-width: 1160px; margin: 0 auto; padding: 36px 48px; }
.lp-section-head { margin-bottom: 22px; }
.lp-section-head h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.55rem; letter-spacing: -0.015em; }
.lp-section-head p { color: var(--muted); margin-top: 4px; font-size: 0.95rem; }

/* Open a lab */
.live-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.live-card {
  display: flex; align-items: flex-start; gap: 16px; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.live-card:hover { transform: translateY(-2px); border-color: var(--blue); box-shadow: 0 14px 34px rgba(16,25,43,0.08); }
.live-num {
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 1rem;
  border: 1.5px solid var(--blue); color: var(--blue); background: var(--blue-wash);
}
.live-title { font-family: var(--font-display); font-weight: 700; font-size: 1.04rem; display: flex; align-items: center; gap: 6px; }
.live-arr { color: var(--blue); transition: transform .15s; }
.live-card:hover .live-arr { transform: translateX(4px); }
.live-desc { font-size: 0.88rem; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.live-tag {
  margin-left: auto; align-self: center; white-space: nowrap;
  font-size: 0.8rem; font-weight: 600; color: #fff; background: var(--blue);
  padding: 7px 15px; border-radius: 7px; transition: background .15s;
}
.live-card:hover .live-tag { background: var(--blue-deep); }

/* Learning path */
.path { display: flex; flex-direction: column; gap: 20px; }
.path-tier { display: grid; grid-template-columns: 130px 1fr; gap: 20px; align-items: start; }
.tier-rail { padding-top: 5px; }
.tier-tagline { color: var(--muted); font-size: 0.9rem; line-height: 1.5; max-width: 72ch; margin-bottom: 12px; }
.tier-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  border-radius: 8px; padding: 8px 13px; font-size: 0.88rem;
  border: 1px solid var(--line); background: var(--card);
}
.chip-num {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600;
  width: 21px; height: 21px; border-radius: 5px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); color: var(--muted); border: 1px solid var(--line);
}
.chip-name { color: var(--ink); font-weight: 500; }
.chip-soon { border-style: dashed; background: transparent; }
.chip-soon .chip-name { color: var(--muted); font-weight: 400; }
.chip-soon-tag {
  font-family: var(--font-mono); font-size: 0.58rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint);
}
.chip-live { cursor: pointer; border-color: #b9ccf3; transition: transform .15s, box-shadow .15s, border-color .15s; }
.chip-live:hover { transform: translateY(-1px); border-color: var(--blue); box-shadow: 0 6px 18px rgba(0,74,198,0.12); }
.chip-live .chip-num { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip-go { color: var(--blue); font-weight: 700; }

@media (max-width: 860px) {
  .lp-hero { grid-template-columns: 1fr; padding: 36px 22px 24px; gap: 32px; }
  .lp-h1 { font-size: 2.3rem; }
  .lp-section { padding: 26px 22px; }
  .path-tier { grid-template-columns: 1fr; gap: 10px; }
}

/* ============================================================
   Module pages
   ============================================================ */
.module-hero { max-width: 1180px; margin: 0 auto; padding: 40px 52px 90px; }
/* Keep reading text to a comfortable line length even on wide screens. */
.module-hero > p, .module-hero .fx-h2, .module-hero .module-hero-head, .module-hero .breadcrumb { max-width: 760px; }
.breadcrumb {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.03em;
  color: var(--muted); text-decoration: none;
}
.breadcrumb:hover { color: var(--blue); }
.module-hero-head { display: flex; align-items: flex-end; gap: 16px; margin: 22px 0 12px; }
.module-hero-head .card-num.big { margin-bottom: 3px; }
.module-hero-head h1 { font-family: var(--font-display); font-weight: 700; font-size: 2.05rem; letter-spacing: -0.02em; margin-top: 6px; }
.module-hero > p { color: #414b5e; }
.card-num {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-family: var(--font-mono); font-weight: 600;
}
.card-num.big { width: 46px; height: 46px; font-size: 1.15rem; border-radius: 10px; }
.tabbar { display: flex; gap: 4px; margin: 28px 0 20px; border-bottom: 1px solid var(--line); }
.tab { padding: 8px 16px; font-size: 0.9rem; font-weight: 500; color: var(--muted); cursor: default; }
.tab.active { color: var(--blue); border-bottom: 2px solid var(--blue); }
.module-body { font-size: 0.95rem; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

.fx-h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; margin: 34px 0 6px; }

/* The four questions — same checkpoint rail as the live results */
.iaaa { list-style: none; counter-reset: iaaa; position: relative; margin-top: 14px; }
.iaaa::before { content: ""; position: absolute; left: 12px; top: 16px; bottom: 16px; width: 2px; background: var(--line); }
.iaaa li {
  counter-increment: iaaa; position: relative;
  display: grid; grid-template-columns: 205px 1fr; gap: 4px 16px;
  padding: 9px 0 9px 42px; align-items: baseline;
}
.iaaa li::before {
  content: counter(iaaa); position: absolute; left: 0; top: 9px;
  width: 25px; height: 25px; border-radius: 5px;
  background: var(--panel); color: #fff;
  font-family: var(--font-mono); font-weight: 600; font-size: 0.78rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 3px var(--paper);
}
.iaaa-k { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; }
.iaaa-v { font-size: 0.88rem; color: #414b5e; }
.iaaa-v em { font-style: normal; font-weight: 600; color: var(--blue-ink); }
.iaaa-term {
  display: inline-block; font-family: var(--font-mono);
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em; color: var(--blue-ink);
}

.fx-try code { font-family: var(--font-mono); font-size: 0.8em; background: #e9ecf2; padding: 0 4px; border-radius: 3px; }

/* Concept cards — used by the sessions "what can go wrong" trio. */
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.principle {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 13px 15px; font-size: 0.85rem; color: #414b5e;
}
.principle strong { display: block; margin-bottom: 3px; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 0.92rem; }

/* ---- Foundations: the guided walkthrough --------------------------------
   Situation first, name second. Each scene is a story the learner calls
   before the engine answers, so the layout leads with prose and keeps the
   controls to two buttons — nothing to configure, one thing to decide. */
.setup { font-size: 1.05rem; }
.setup em { font-style: normal; font-weight: 600; color: var(--ink); }
.setup-note { color: var(--muted); font-size: 0.92rem; margin-top: 8px; }

.scene {
  display: grid; grid-template-columns: 34px 1fr; gap: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px;
}
.scene-num {
  width: 30px; height: 30px; border-radius: 7px; background: var(--panel); color: #fff;
  font-family: var(--font-mono); font-weight: 600; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
}
.scene-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; margin-bottom: 5px; }
.scene-story { font-size: 0.97rem; line-height: 1.6; color: #414b5e; }
.scene-call { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.scene-ask { font-weight: 600; font-size: 0.9rem; color: var(--ink); margin-right: 4px; }
.call-btn {
  font: inherit; font-size: 0.87rem; font-weight: 600; cursor: pointer;
  padding: 8px 16px; border-radius: 7px; border: 1px solid #d0d6e0; background: var(--paper);
  color: var(--ink); transition: border-color .15s, background .15s, transform .1s;
}
.call-btn:hover { transform: translateY(-1px); }
.call-allow:hover { border-color: var(--allow); background: var(--allow-wash); }
.call-block:hover { border-color: var(--deny); background: var(--deny-wash); }

/* The reveal — the payoff. Green rail when the learner called it, amber when
   they didn't (wrong is the useful case, so it must not read as failure). */
.reveal { margin-top: 16px; padding: 15px 17px; border-radius: 9px; border: 1px solid var(--line); border-left-width: 3px; background: var(--paper); }
.reveal-right { border-left-color: var(--allow); }
.reveal-wrong { border-left-color: #d9922b; }
.reveal-verdict { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.reveal-call { font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.reveal-concept { display: flex; align-items: baseline; flex-wrap: wrap; gap: 9px; margin: 15px 0 9px; }
.reveal-label {
  flex-basis: 100%; font-family: var(--font-mono); font-size: 0.6rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.13em; color: var(--faint);
}
.reveal-term { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--blue); letter-spacing: -0.015em; }
.reveal-gloss { font-size: 0.9rem; color: var(--muted); }
.reveal-principle { flex-basis: 100%; font-size: 0.85rem; color: #414b5e; }
.reveal-principle strong { color: var(--blue-ink); }
.reveal-lesson { font-size: 0.94rem; line-height: 1.65; color: #414b5e; }
.reveal-rule { margin-top: 11px; font-family: var(--font-mono); font-size: 0.7rem; color: var(--faint); }
.reveal-rule code { font-family: inherit; color: var(--muted); }

/* ---- Walkthrough: one step at a time -------------------------------------
   The server sends every step as a plain vertical page. stepper.js adds
   .is-stepper, and only then does anything get hidden — with JS off the whole
   page is still readable, just scrolled. */
.walk { display: flex; flex-direction: column; gap: 14px; margin: 26px 0 24px; max-width: 760px; }
.walk.is-stepper { gap: 0; }
.walk.is-stepper .walk-step { display: none; }
.walk.is-stepper .walk-step.is-current { display: block; }
.walk.is-stepper .walk-step.scene.is-current { display: grid; }
.walk-step:focus { outline: none; }
.walk-prose > .fx-h2:first-child { margin-top: 0; }

/* Arrow bar. Hidden until the script unhides it, so a no-JS page never shows
   controls that do nothing. */
.step-nav[hidden] { display: none; }
.step-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 760px; margin: 4px 0 40px; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.step-arrow {
  display: inline-flex; align-items: center; gap: 8px; font: inherit;
  font-size: 0.88rem; font-weight: 600; color: var(--ink); cursor: pointer;
  padding: 9px 15px; border-radius: 8px; border: 1px solid #d0d6e0; background: var(--paper);
  transition: border-color .15s, background .15s, transform .1s, box-shadow .15s;
}
.step-arrow:hover:not(:disabled) { border-color: var(--blue); background: #f6f9ff; transform: translateY(-1px); }
.step-arrow:disabled { opacity: 0.4; cursor: default; }
.step-arrow-next.is-nudged { border-color: var(--blue); background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(0,74,198,0.25); }
.step-arrow-t { display: inline; }
.step-mid { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.step-count { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.step-dots { display: flex; gap: 7px; }
.step-dot {
  width: 9px; height: 9px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid #c3ccdb; background: transparent; transition: background .15s, border-color .15s, transform .15s;
}
.step-dot:hover { border-color: var(--blue); transform: scale(1.2); }
.step-dot.is-done { background: #b9ccf3; border-color: #b9ccf3; }
.step-dot.is-current { background: var(--blue); border-color: var(--blue); transform: scale(1.25); }

/* The rulebook — "policy" made concrete: the actual rules, in order. */
.rulebook { list-style: none; counter-reset: rb; margin: 14px 0 10px; max-width: 760px; display: flex; flex-direction: column; gap: 8px; }
.rulebook li {
  counter-increment: rb; position: relative; padding: 12px 15px 12px 40px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
}
.rulebook li::before {
  content: counter(rb); position: absolute; left: 14px; top: 13px;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; color: var(--faint);
}
.rulebook-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.rulebook-id { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; color: var(--ink); }
.rulebook-why { font-size: 0.88rem; line-height: 1.55; color: #414b5e; }

@media (max-width: 720px) {
  .lp-section, .module-hero { padding-left: 20px; padding-right: 20px; }
  .step-arrow-t { display: none; } /* arrows alone on narrow screens */
  .step-nav { gap: 10px; }
  .iaaa li { grid-template-columns: 1fr; }
  .principles { grid-template-columns: 1fr; }
  .scene { grid-template-columns: 1fr; gap: 10px; }
}

/* ============================================================
   Live flow (shared by foundations + sessions)
   ============================================================ */
.liveflow { display: grid; grid-template-columns: 320px 1fr; gap: 24px; margin-top: 20px; align-items: start; }
.scenario-col { display: flex; flex-direction: column; gap: 10px; }
.scenario-card {
  text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  padding: 12px 14px; cursor: pointer; font: inherit; color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.scenario-card:hover { border-color: var(--blue); box-shadow: 0 4px 14px rgba(16,25,43,0.05); }
.scenario-card.htmx-request { opacity: 0.55; }
.sc-top { display: flex; align-items: center; gap: 9px; }
.sc-name { font-weight: 600; font-size: 0.9rem; }
.sc-meta { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.03em; color: var(--faint); margin-top: 4px; }
.sc-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; display: inline-block; }
.sc-dot.sev-low { background: var(--allow); } .sc-dot.sev-medium { background: #c77d1d; }
.sc-dot.sev-high { background: var(--deny); } .sc-dot.sev-critical { background: #7f1d1d; }

.sev {
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 2px 7px 1px; border-radius: 3px;
}
.sev-low { background: var(--allow-wash); color: var(--allow); }
.sev-medium { background: var(--warn-wash); color: var(--warn); }
.sev-high { background: var(--deny-wash); color: var(--deny); }
.sev-critical { background: #f6d5d0; color: #7f1d1d; }
.tier { font-weight: 600; }
.tier-beginner { color: var(--allow); } .tier-intermediate { color: var(--warn); } .tier-advanced { color: var(--deny); }

.trace-empty {
  border: 1px dashed #c6cddb; border-radius: 10px; padding: 44px 24px; text-align: center;
  color: var(--muted); font-size: 0.9rem; background: rgba(255,255,255,0.55);
}

/* ============================================================
   The decision record (htmx results)
   ============================================================ */
.fx-result { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; }
.fx-result-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fx-stage { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.fx-sentence { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; margin: 14px 0 4px; line-height: 1.4; }
.fx-reason { font-size: 0.95rem; color: #33415e; margin: 12px 0 4px; line-height: 1.55; }
.fx-gate-intro { font-size: 0.8rem; color: var(--muted); margin: 2px 0 6px; }

/* Checkpoint rail — the four questions, answered in order */
.gate-list { list-style: none; position: relative; display: flex; flex-direction: column; }
.gate-list::before { content: ""; position: absolute; left: 11px; top: 14px; bottom: 14px; width: 2px; background: var(--line); }
.gate { position: relative; display: flex; gap: 13px; align-items: flex-start; padding: 8px 0; }
.gate-mark {
  position: relative; z-index: 1; flex-shrink: 0; width: 23px; height: 23px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700;
  background: var(--card); border: 1.5px solid var(--line); color: var(--faint);
  box-shadow: 0 0 0 3px var(--card);
}
.gate-pass .gate-mark { background: var(--allow); border-color: var(--allow); color: #fff; }
.gate-fail .gate-mark { background: var(--deny); border-color: var(--deny); color: #fff; }
.gate-skip .gate-mark { border-style: dashed; }
.gate-skip { opacity: 0.75; }
.gate-body { display: flex; flex-direction: column; gap: 2px; padding-top: 1px; }
.gate-q { font-weight: 600; font-size: 0.92rem; }
.gate-fail .gate-q { color: var(--deny); }
.gate-reason { font-size: 0.85rem; color: #4a5568; line-height: 1.45; }
.gate-body .gate-skip, .gate-note { font-size: 0.76rem; color: var(--faint); }

/* Takeaway + counterfactuals */
.fx-takeaway { font-size: 0.88rem; color: #33415e; margin: 12px 0 2px; line-height: 1.55;
  border-left: 3px solid var(--blue); padding-left: 12px; }
.fx-takeaway-k {
  display: inline-block; font-family: var(--font-mono); font-size: 0.62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--blue); margin-right: 6px;
}
.fx-cf { font-size: 0.83rem; color: #33415e; margin-bottom: 12px; }
.fx-cf-label { font-weight: 600; display: block; margin-bottom: 4px; }
.fx-cf ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.fx-cf code { font-family: var(--font-mono); font-size: 0.9em; background: #e9ecf2; padding: 0 4px; border-radius: 3px; }
.badge-inline.badge-ALLOW { background: var(--allow-wash); color: var(--allow); }
.badge-inline.badge-DENY { background: var(--deny-wash); color: var(--deny); }

/* Raw policy check — machine output on the instrument panel */
.fx-detail { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 11px; }
.fx-detail summary {
  cursor: pointer; list-style: revert;
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.04em; color: var(--muted);
}
.fx-detail summary:hover { color: var(--blue); }
.fx-detail .fx-cf { margin-top: 12px; }
.rule-list {
  list-style: none; display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border-radius: 10px; padding: 14px 16px; margin-top: 12px;
}
.rule { border: 1px solid rgba(231,237,248,0.1); border-radius: 7px; padding: 10px 12px; background: rgba(255,255,255,0.03); }
.rule-matched { border-color: rgba(255,143,125,0.5); background: rgba(255,143,125,0.07); }
.rule-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rule-id { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; color: #fff; }
.rule-outcome { font-family: var(--font-mono); font-size: 0.68rem; color: var(--panel-mut); }
.rule-matched .rule-outcome { color: var(--deny-bright); font-weight: 600; }
.cond-list { list-style: none; margin-top: 7px; display: flex; flex-direction: column; gap: 3px; }
.cond { font-size: 0.76rem; color: var(--panel-ink); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cond code { font-family: var(--font-mono); font-size: 0.95em; background: rgba(255,255,255,0.09); color: #dbe6fa; padding: 0 5px; border-radius: 3px; }
.cond-actual { color: var(--panel-mut); }
.cond-mark { margin-left: auto; font-weight: 700; }
.cond-pass .cond-mark { color: var(--allow-bright); } .cond-fail .cond-mark { color: var(--deny-bright); }

/* ============================================================
   Foundations checker form
   ============================================================ */
.fx-form {
  display: flex; flex-direction: column; gap: 13px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 18px;
}
.fx-check { display: flex; align-items: center; gap: 9px; font-size: 0.9rem; font-weight: 500; }
.fx-check input { width: 16px; height: 16px; accent-color: var(--blue); flex-shrink: 0; }
.fx-hint {
  margin-left: auto; font-family: var(--font-mono); font-size: 0.58rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); text-align: right;
}
.fx-field {
  display: flex; flex-direction: column; gap: 5px;
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em;
}
.fx-field select {
  font-family: var(--font-mono); font-size: 0.85rem; font-weight: 400;
  text-transform: none; letter-spacing: 0; color: var(--ink);
  padding: 8px 10px; border: 1px solid #c6cddb; border-radius: 7px; background: #fff;
}
.fx-field select:hover { border-color: var(--blue); }
.fx-try { margin-top: 2px; }

@media (max-width: 720px) { .liveflow { grid-template-columns: 1fr; } }

/* ============================================================
   Motion — one orchestrated moment: the hero trace resolves.
   All animation is gated on prefers-reduced-motion.
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  /* Hero demo loops on a slow 9s cycle: the trace cascades in, the verdict
     stamps, then it holds for ~7s before a quick re-trace — present, not busy. */
  .demo-rule { animation: demo-trace 9s ease-in-out infinite both; }
  .demo-rule:nth-child(1) { animation-delay: 0.3s; }
  .demo-rule:nth-child(2) { animation-delay: 0.7s; }
  .demo-rule:nth-child(3) { animation-delay: 1.1s; }
  .demo-decision { animation: demo-stamp 9s cubic-bezier(0.3, 1.2, 0.45, 1) 1.6s infinite both; }
  /* Live result panels (module pages) still animate once, not on a loop. */
  .fx-result { animation: rise-in 0.28s ease both; }
  .fx-result-top > .badge-ALLOW, .fx-result-top > .badge-DENY, .fx-result-top > .badge-CHALLENGE {
    animation: stamp-in 0.32s cubic-bezier(0.3, 1.35, 0.45, 1) backwards; animation-delay: 0.1s;
  }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@keyframes stamp-in { from { opacity: 0; transform: scale(1.3); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } }
/* Loop variants: motion in the first ~0.4s, a long hold, then a soft fade
   back out just before the cycle restarts so the repeat reads as seamless. */
@keyframes demo-trace {
  0%   { opacity: 0; transform: translateY(4px); }
  4%   { opacity: 1; transform: translateY(0); }
  93%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(4px); }
}
@keyframes demo-stamp {
  0%   { opacity: 0; transform: scale(0.94); }
  5%   { opacity: 1; transform: scale(1); }
  93%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.94); }
}
