/* =============================================================
   Investor Readiness Workbook — styles
   Built on The Product Bus design system.
   ============================================================= */

* { box-sizing: border-box; }

/* Defensive — when embedded in another site, ensure inline chrome SVGs
   respect their attribute dimensions, in case the host has a
   `svg { width: 100% }` style. */
.appbar svg,
.privacy-note svg,
.workbook-banner svg,
.step-nav svg,
#tweaks svg,
.btn svg,
.icon-btn svg,
.toc-chip svg { max-width: 100% !important; height: auto; }
.privacy-note svg { width: 14px !important; height: 14px !important; }
.btn svg, .step-nav .btn svg { width: 16px !important; height: 16px !important; }
.btn.btn-sm svg { width: 14px !important; height: 14px !important; }
.icon-btn svg { width: 18px !important; height: 18px !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-2);
  color: var(--fg-2);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Theme: accent overrides (set on :root) ----- */
:root {
  --accent: var(--pb-yellow);
  --accent-600: var(--pb-yellow-600);
  --accent-100: var(--pb-yellow-100);
  --accent-300: var(--pb-yellow-300);
  --ink: var(--pb-ink);
  --paper: var(--pb-paper-2);
  --card: var(--pb-paper);
  --line: var(--pb-line);
  --muted: var(--pb-ink-3);
  --muted-2: var(--pb-ink-4);
}

:root[data-accent="orange"] {
  --accent: #F08A24;
  --accent-600: #D8731A;
  --accent-100: #FCE9D2;
  --accent-300: #F7C079;
}
:root[data-accent="green"] {
  --accent: #5BB37C;
  --accent-600: #3F955F;
  --accent-100: #DFF1E5;
  --accent-300: #A6D5B6;
}
:root[data-accent="blue"] {
  --accent: #6FA8E0;
  --accent-600: #4C8CCB;
  --accent-100: #E0EBF7;
  --accent-300: #B0CDEB;
}

:root[data-theme="dark"] {
  --paper: #141414;
  --card: #1C1C1C;
  --ink: #FAF7F0;
  --line: #2E2E2E;
  --muted: #9C9C9C;
  --muted-2: #6E6E6E;
  color-scheme: dark;
}
:root[data-theme="dark"] body { background: #0E0E0E; color: var(--ink); }

body {
  background: var(--paper);
  color: var(--ink);
}

/* ---- Density ----- */
:root[data-density="compact"] {
  --gap-sec: var(--sp-10);
  --gap-blk: var(--sp-5);
  --card-pad: var(--sp-6);
  --body-fs: 0.9375rem;
}
:root {
  --gap-sec: var(--sp-16);
  --gap-blk: var(--sp-8);
  --card-pad: var(--sp-10);
  --body-fs: 1rem;
}

/* =============================================================
   Top app bar
   ============================================================= */
.appbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%);
}

.appbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  color: var(--ink);
}
.brand img { height: 28px; width: auto; display: block; }
:root[data-theme="dark"] .brand img.logo-light { display: none; }
:root:not([data-theme="dark"]) .brand img.logo-dark { display: none; }

.brand-meta {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
  padding-left: var(--sp-3);
  border-left: 1px solid var(--line);
  display: none; /* moved into workbook-banner */
}
.brand-meta span { display:block; }
.brand-meta .top { color: var(--ink); margin-bottom: 3px; }

.appbar-spacer { flex: 1; }

/* Segmented mode toggle */
.mode-toggle {
  display: inline-flex;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  padding: 3px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13px;
}
.mode-toggle button {
  border: none;
  background: transparent;
  color: var(--ink);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font: inherit;
  letter-spacing: 0.01em;
  transition: background var(--dur-base) var(--ease-out);
}
.mode-toggle button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--pb-ink);
}

.icon-btn {
  background: transparent;
  border: 2px solid var(--ink);
  color: var(--ink);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-base) var(--ease-out);
}
.icon-btn:hover { background: var(--accent-100); }
.icon-btn svg { width: 18px; height: 18px; }

/* Progress strip just under appbar */
.progress-strip {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--sp-6) var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
}
.progress-track {
  flex: 1;
  height: 6px;
  background: var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width var(--dur-slow) var(--ease-out);
}
.progress-counter {
  white-space: nowrap;
  color: var(--ink);
}

/* =============================================================
   Privacy note + workbook banner (under appbar)
   ============================================================= */
.privacy-note {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-6) var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.privacy-note svg { width: 14px; height: 14px; flex: none; }

.workbook-banner {
  background: var(--card);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.banner-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-6);
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.banner-id {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: var(--sp-4);
  flex: 1 1 auto;
  min-width: 0;
}
.banner-mark {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.banner-text { min-width: 0; }
.banner-title {
  font-family: 'Montserrat', system-ui, sans-serif !important;
  font-weight: 800 !important;
  font-size: 1rem !important;
  letter-spacing: 0.02em !important;
  text-transform: uppercase !important;
  color: var(--ink) !important;
  margin: 0 0 3px !important;
  line-height: 1.15 !important;
  white-space: nowrap;
}
.banner-sub {
  font-family: 'Montserrat', system-ui, sans-serif !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: var(--muted) !important;
  margin: 0 !important;
  line-height: 1.1 !important;
}
.banner-actions {
  display: flex !important;
  flex-direction: row !important;
  gap: var(--sp-2);
  align-items: center;
  flex: none;
}
.btn.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: var(--radius-pill);
  border-width: 1.5px;
}
.btn.btn-sm svg { width: 14px; height: 14px; }
.banner-actions .btn-ghost { background: var(--paper); }

@media (max-width: 640px) {
  .banner-inner { padding: var(--sp-3) var(--sp-4); }
  .banner-title { font-size: 0.85rem !important; }
  .banner-sub { font-size: 10px !important; }
  .btn.btn-sm { padding: 7px 12px; font-size: 0.75rem; }
}

/* =============================================================
   Page layout
   ============================================================= */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--sp-12) var(--sp-6) var(--sp-24);
}

/* Step-mode hides non-active screens */
:root[data-flow="step"] .screen:not(.active) { display: none; }
:root[data-flow="long"] main { max-width: 760px; }
:root[data-flow="long"] .screen + .screen { margin-top: var(--gap-sec); }

.screen { animation: fade-up var(--dur-slow) var(--ease-out); }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================
   Typography blocks
   ============================================================= */
.eyebrow {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--sp-3);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
}
.eyebrow .dot {
  width: 8px; height: 8px; background: var(--accent); border-radius: 999px;
  border: 1.5px solid var(--ink);
}

h1.title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.2rem, 4vw + 1rem, 3.4rem);
  line-height: 1.0;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0 0 var(--sp-4);
  text-wrap: balance;
}
h2.part-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.7rem, 2.4vw + 0.8rem, 2.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 var(--sp-5);
  text-wrap: balance;
}
h3.sub {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--sp-3);
}
.lead {
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 var(--sp-5);
  text-wrap: pretty;
}

p { margin: 0 0 var(--sp-4); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

.body { color: var(--ink); }
.body em { font-style: normal; font-weight: 700; }
.muted { color: var(--muted); }

strong { font-weight: 700; }

.accent-word {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
.accent-word::after {
  content: "";
  position: absolute;
  left: -4%; right: -4%; bottom: -6px;
  height: 10px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 10' preserveAspectRatio='none'><path d='M2 6 Q 25 1, 50 5 T 100 5 T 150 5 T 198 5' fill='none' stroke='%23FCD535' stroke-width='4' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  pointer-events: none;
}
:root[data-accent="orange"] .accent-word::after { filter: hue-rotate(-25deg) saturate(0.85); }
:root[data-accent="green"]  .accent-word::after { filter: hue-rotate(80deg) saturate(0.6); }
:root[data-accent="blue"]   .accent-word::after { filter: hue-rotate(180deg) saturate(0.5); }

/* =============================================================
   Part header (with motif)
   ============================================================= */
.part-header {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: var(--sp-6);
  align-items: start;
  margin-bottom: var(--gap-blk);
  padding-bottom: var(--sp-8);
  border-bottom: 1px solid var(--line);
}
.part-header .motif {
  width: 90px; height: 90px;
  display: flex; align-items: center; justify-content: center;
}
.part-header .motif svg { display: block; max-width: 100%; max-height: 100%; }
.part-label {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--sp-2);
}
.part-label .num { color: var(--ink); }

/* Motif colors follow accent */
.motif .fill { fill: var(--accent); }
.motif .stroke { stroke: var(--ink); }
:root[data-theme="dark"] .motif .fill { fill: var(--accent); }
:root[data-theme="dark"] .motif .stroke { stroke: var(--ink); }

/* =============================================================
   Body blocks: callouts, lists, tables, ladder
   ============================================================= */
.callout {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-m);
  padding: var(--sp-6) var(--sp-6);
  margin: var(--sp-6) 0;
  position: relative;
}
.callout-pull {
  background: var(--accent-100);
  border: none;
  border-left: 6px solid var(--accent);
  border-radius: var(--radius-s);
  padding: var(--sp-5) var(--sp-6);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.4;
  color: var(--ink);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
:root[data-theme="dark"] .callout-pull { background: rgba(252, 213, 53, 0.12); }

/* Funding methods cards */
.funding-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
  margin: var(--sp-6) 0 var(--sp-8);
}
.funding-card {
  display: grid;
  grid-template-columns: 200px 1fr 1fr;
  gap: var(--sp-5);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: var(--sp-5) var(--sp-6);
  align-items: start;
  transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.funding-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}
.funding-method {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.funding-method .glyph {
  display: inline-flex;
  width: 28px; height: 28px;
  background: var(--accent);
  border: 2px solid var(--ink);
  border-radius: 6px;
  align-items: center; justify-content: center;
  margin-right: var(--sp-2);
  vertical-align: -8px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--ink);
}
.funding-what,
.funding-cost {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
}
.funding-cost {
  color: var(--muted);
}
.funding-cost::before {
  content: "Real cost — ";
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
}
.funding-what::before {
  content: "What it is";
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
}

@media (max-width: 720px) {
  .funding-card { grid-template-columns: 1fr; gap: var(--sp-2); }
}

/* Evidence ladder */
.ladder {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: var(--sp-6) 0 var(--sp-8);
  border: 2px solid var(--ink);
  border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--card);
}
.rung {
  display: grid;
  grid-template-columns: 64px 200px 1fr;
  gap: var(--sp-4);
  align-items: center;
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--line);
}
.rung:first-child { border-top: none; }
.rung-num {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 2rem;
  line-height: 1;
  color: var(--ink);
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.rung-5 .rung-num { background: var(--accent); }
.rung-4 .rung-num { background: var(--accent-300); }
.rung-3 .rung-num { background: var(--accent-100); }
.rung-2 .rung-num { background: var(--card); }
.rung-1 .rung-num { background: var(--card); color: var(--muted); border-color: var(--muted); }
.rung-signal {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.rung-what {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
}

@media (max-width: 720px) {
  .rung { grid-template-columns: 48px 1fr; }
  .rung-signal { grid-column: 2; }
  .rung-what { grid-column: 1 / -1; padding-left: 64px; }
}

/* Right vs wrong question blocks (Part 5) */
.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin: var(--sp-6) 0;
}
.compare > div {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: var(--sp-5);
  background: var(--card);
}
.compare .wrong { border-left: 6px solid var(--pb-stop); }
.compare .right { border-left: 6px solid var(--pb-go); }
.compare .label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--sp-2);
}
.compare .q {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: var(--sp-3);
}
.compare .why {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted);
}

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

/* Assumptions list */
.assumptions {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
  margin: var(--sp-5) 0 var(--sp-6);
  counter-reset: a;
}
.assumption {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--sp-4);
  align-items: start;
}
.assumption::before {
  counter-increment: a;
  content: counter(a);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--ink);
  width: 44px; height: 44px;
  background: var(--accent-100);
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* =============================================================
   Reflection blocks
   ============================================================= */
.reflection {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-l);
  padding: var(--card-pad);
  margin: var(--sp-6) 0;
  position: relative;
}
.reflection-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--accent);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--ink);
  position: absolute;
  top: -14px;
  left: 24px;
}

.reflection-heading {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--ink);
  margin: var(--sp-2) 0 var(--sp-5);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.q-group { margin-bottom: var(--sp-6); }
.q-group:last-child { margin-bottom: 0; }

.q-label {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  margin: 0 0 var(--sp-1);
  line-height: 1.4;
}
.q-hint {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 var(--sp-3);
  font-style: normal;
}

textarea.answer {
  display: block;
  width: 100%;
  min-height: 110px;
  resize: vertical;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-s);
  padding: var(--sp-4);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink);
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
textarea.answer:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px var(--accent-300);
}
textarea.answer::placeholder { color: var(--muted-2); }

/* Print-blank lines (hidden on screen) */
.blank-lines { display: none; }

/* =============================================================
   Cover screen
   ============================================================= */
.cover {
  padding: var(--sp-8) 0 var(--sp-12);
}
.cover-meta {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--sp-4);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
}
.cover h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.6rem, 5vw + 1rem, 4.4rem);
  line-height: 0.96;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0 0 var(--sp-5);
  text-transform: uppercase;
  text-wrap: balance;
}
.cover .subtitle {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 var(--sp-8);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.cover .credits {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--sp-12);
}
.cover .credits b { color: var(--ink); }

.cover-grid {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: var(--sp-8);
  align-items: start;
}
@media (max-width: 700px) {
  .cover-grid { grid-template-columns: 1fr; }
  .cover-illo { display: none; }
}

.cover-illo {
  display: flex; justify-content: center; align-items: start;
}

.before-start {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-l);
  padding: var(--sp-8);
  margin-top: var(--sp-6);
}
.before-start h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--sp-4);
}
.before-start p { font-size: 1.05rem; line-height: 1.55; color: var(--ink); }

/* TOC chips */
.toc {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  margin-top: var(--sp-8);
}
@media (max-width: 720px) { .toc { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .toc { grid-template-columns: 1fr; } }
.toc-chip {
  display: block;
  text-decoration: none;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-m);
  padding: var(--sp-4) var(--sp-5);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--dur-base) var(--ease-out);
  text-align: left;
}
.toc-chip:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}
.toc-chip .toc-num {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.75rem;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}
.toc-chip .toc-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* =============================================================
   Wrap-up / final / export screen
   ============================================================= */
.wrap-up {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-l);
  padding: var(--sp-10);
}
.wrap-up h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2rem, 3vw + 0.8rem, 2.6rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--paper);
  margin: 0 0 var(--sp-4);
  text-transform: uppercase;
}
.wrap-up .accent-period { color: var(--accent); }
.wrap-up p { color: rgba(255,255,255,0.85); }
.wrap-up p strong { color: var(--paper); }
.wrap-up .resources {
  margin-top: var(--sp-8);
  padding-top: var(--sp-6);
  border-top: 1px solid rgba(255,255,255,0.18);
  font-size: 0.95rem;
  color: rgba(255,255,255,0.7);
}
.wrap-up .resources b { color: var(--accent); }

.export-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

/* =============================================================
   Buttons & nav
   ============================================================= */
.btn {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  padding: 12px 22px;
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  border: 2px solid var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--accent);
  color: var(--pb-ink);
}
.btn-primary:hover { background: var(--accent-600); }
.btn-secondary {
  background: var(--ink);
  color: var(--paper);
}
.btn-secondary:hover { color: var(--accent); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover { background: var(--card); }
.wrap-up .btn-ghost { color: var(--paper); border-color: var(--paper); }
.wrap-up .btn-ghost:hover { background: rgba(255,255,255,0.08); }
.wrap-up .btn-primary { border-color: var(--paper); }

/* Step nav (sticky bottom in step mode) */
.step-nav {
  display: none;
  position: sticky;
  bottom: 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: var(--sp-3) var(--sp-6);
  z-index: 40;
}
:root[data-flow="step"] .step-nav { display: block; }
.step-nav-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.step-nav-inner .save-state {
  flex: 1;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--muted);
}
.step-nav-inner .save-state .dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--pb-go);
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: 1px;
}

/* =============================================================
   Tweaks panel (vanilla, follows host protocol)
   ============================================================= */
#tweaks {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 280px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-2);
  z-index: 100;
  padding: var(--sp-5);
  font-family: var(--font-ui);
  display: none;
}
#tweaks[data-open="true"] { display: block; }
#tweaks header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
}
#tweaks header h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
#tweaks .tweak-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--ink); padding: 4px;
}
.tweak-group {
  margin-bottom: var(--sp-4);
}
.tweak-group:last-child { margin-bottom: 0; }
.tweak-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--sp-2);
  display: block;
}
.tweak-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tweak-row button {
  flex: 1;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 12px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.tweak-row button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.tweak-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.tweak-swatches button {
  height: 32px;
  border: 2px solid var(--line);
  border-radius: var(--radius-s);
  cursor: pointer;
  background: var(--accent);
}
.tweak-swatches button[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink);
}

/* =============================================================
   Footer / share band
   ============================================================= */
.footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-6);
  border-top: 1px solid var(--line);
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.footer .link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}

/* =============================================================
   Print / PDF export
   ============================================================= */
@media print {
  @page {
    size: A4;
    margin: 18mm 16mm 18mm 16mm;
  }
  html, body { background: white !important; color: black !important; }
  :root[data-theme="dark"] body { background: white !important; color: black !important; }
  body { font-size: 11pt; line-height: 1.5; }

  /* Hide all chrome */
  .appbar,
  .step-nav,
  #tweaks,
  .footer,
  .toc,
  .export-row,
  .icon-btn,
  .cover-illo,
  .step-nav-inner,
  .privacy-note,
  .workbook-banner,
  .progress-strip { display: none !important; }

  main { padding: 0; max-width: none; }

  /* Always show all screens in print */
  .screen { display: block !important; animation: none; }
  .screen + .screen { margin-top: 8mm; page-break-before: always; }
  .cover { padding: 0; }
  .cover-grid { grid-template-columns: 1fr; gap: 0; }
  .before-start { page-break-inside: avoid; }

  h1.title, h2.part-title { color: black; }
  .cover h1 { font-size: 36pt; color: black; }
  .cover .subtitle { font-size: 16pt; color: black; }

  /* Cards: simple, no fills */
  .reflection,
  .callout,
  .funding-card,
  .ladder,
  .before-start,
  .wrap-up,
  .compare > div {
    background: white !important;
    color: black !important;
    border-color: black !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
  .callout-pull {
    background: white !important;
    border-left-color: #FCD535 !important;
  }
  .wrap-up { color: black !important; }
  .wrap-up h2, .wrap-up p, .wrap-up .resources { color: black !important; }
  .wrap-up .resources { border-color: black !important; }

  .reflection-tag {
    background: #FCD535 !important;
    color: black !important;
    border-color: black !important;
  }

  /* Filled mode: print textarea contents */
  :root[data-print-mode="filled"] textarea.answer {
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid #999 !important;
    padding: 4px 0 !important;
    min-height: 0 !important;
    height: auto !important;
    color: black !important;
    font-family: var(--font-hand) !important;
    font-size: 14pt !important;
    line-height: 1.6 !important;
    resize: none !important;
    overflow: visible !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    display: block;
  }

  /* Blank mode: hide textarea, show writing lines */
  :root[data-print-mode="blank"] textarea.answer { display: none !important; }
  :root[data-print-mode="blank"] .blank-lines {
    display: block;
    margin-top: 6pt;
  }
  :root[data-print-mode="blank"] .blank-lines span {
    display: block;
    border-bottom: 1px solid #999;
    height: 24pt;
  }

  /* If user picks "blank PDF" without any data, give them lines */
  .rung-num { color: black !important; background: white !important; border-color: black !important; }
  .rung-5 .rung-num { background: #FCD535 !important; }

  a { color: black; text-decoration: none; }
}
