/* Nova AI Ventures Blueprint · Shared Chapter Base
 * Design reference: infographics/html/index.html (masterpiece aesthetic)
 * Backward compatible: all existing chapter classes continue to work.
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=DM+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
}

/* Subtle background grid — the signature texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,188,212,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,188,212,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* === NAV (sticky, upgraded vocabulary) === */
.nav {
  position: sticky;
  top: 0;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 50;
}

.nav-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
}
.nav-logo a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: none;
}
.nav-logo img {
  height: 24px;
  width: auto;
  display: block;
}
.nav-logo a:hover { border-bottom: none; }

.nav-chip {
  font-family: var(--font-meta);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.35rem 0.85rem;
  background: var(--accent-dim, rgba(255,255,255,0.05));
  border: 1px solid var(--accent, var(--border));
  color: var(--accent, var(--text-secondary));
  border-radius: 6px;
  font-weight: 600;
}

.nav-links { display: flex; gap: 0.5rem; }
.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--font-meta);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.nav-links a:hover {
  color: var(--accent, var(--ch01-cyan));
  background: var(--accent-dim, rgba(255,255,255,0.04));
  border-color: var(--border);
}

/* === MAIN === */
main {
  position: relative;
  z-index: 1;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-xxl) var(--space-lg);
}

/* === HEADINGS === */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  margin-bottom: var(--space-md);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* Hero H1 — gradient text treatment (reference signature) */
h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent, var(--ch01-cyan)) 60%, var(--accent, var(--ch01-cyan)) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

h2 {
  font-size: 1.65rem;
  margin-top: var(--space-xl);
  color: var(--text-primary);
  padding-left: var(--space-md);
  border-left: 3px solid var(--accent, var(--ch01-cyan));
}

h3 {
  font-size: 1.2rem;
  margin-top: var(--space-lg);
  color: #fff;
  font-weight: 700;
}

h4 {
  font-size: 0.95rem;
  margin-top: var(--space-md);
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === PROSE === */
p {
  margin-bottom: var(--space-md);
  max-width: var(--content-max);
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.7;
}

p em {
  color: var(--accent, var(--ch01-cyan));
  font-style: italic;
  font-weight: 500;
}

p strong, li strong {
  color: #fff;
  font-weight: 600;
}

ul, ol { margin-left: var(--space-lg); margin-bottom: var(--space-md); max-width: var(--content-max); }
li { margin-bottom: var(--space-xs); line-height: 1.7; }

a {
  color: var(--accent, var(--ch01-cyan));
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
a:hover { border-bottom-color: var(--accent, var(--ch01-cyan)); }

/* === TABLES (reference-aligned) === */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

th {
  background: rgba(0,0,0,0.3);
  color: var(--text-dim);
  text-align: left;
  padding: 0.9rem 1.1rem;
  font-family: var(--font-meta);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.88rem;
  line-height: 1.55;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-card-hover); }

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-md) 0;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Top gradient accent on cards (reference pattern) */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent, var(--ch01-cyan));
}

.card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.card h3, .card h4 {
  margin-top: 0;
  color: #fff;
}
.card h3:first-child, .card h4:first-child { margin-top: 0; }

/* === BLOCKQUOTE === */
blockquote {
  border-left: 3px solid var(--accent, var(--ch01-cyan));
  padding: var(--space-sm) var(--space-lg);
  background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0.005));
  margin: var(--space-md) 0;
  font-style: italic;
  color: var(--text-secondary);
  border-radius: 0 12px 12px 0;
  font-size: 1.02rem;
}
blockquote cite {
  display: block;
  margin-top: var(--space-sm);
  font-size: 0.8rem;
  font-style: normal;
  font-family: var(--font-meta);
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* === CODE === */
code {
  font-family: var(--font-meta);
  background: rgba(0,0,0,0.35);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: var(--accent, var(--ch01-cyan));
  font-size: 0.88em;
  border: 1px solid var(--border);
}
pre {
  background: rgba(0,0,0,0.35);
  padding: var(--space-md);
  border-radius: 10px;
  overflow-x: auto;
  border: 1px solid var(--border);
  margin: var(--space-md) 0;
  font-size: 0.88rem;
  line-height: 1.6;
}
pre code { background: transparent; padding: 0; border: none; color: var(--text-primary); }

/* === FOOTER (legacy simple footer — chapters now use .footer-brand) === */
footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: var(--space-lg);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: var(--font-meta);
  letter-spacing: 0.05em;
  margin-top: var(--space-xxl);
}
footer a {
  color: var(--accent, var(--ch01-cyan));
  text-decoration: none;
  margin: 0 var(--space-sm);
  border: none;
}

/* === QUOTE BAND (footer lead-in) === */
.quote-band {
  text-align: center;
  padding: 3rem 2.5rem;
  background: rgba(0,0,0,0.35);
  margin-top: 5rem;
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
}
.quote-band .quote-text {
  font-family: var(--font-heading);
  font-size: clamp(0.95rem, 1.5vw, 1.3rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
  max-width: 1100px;
  margin: 0 auto;
  line-height: 1.45;
  font-weight: 700;
}
.quote-band .quote-text .accent {
  color: var(--ch01-cyan);
}

/* === GRADIENT DIVIDER (orange → magenta → purple → cyan) === */
.gradient-line {
  height: 3px;
  background: linear-gradient(90deg,
    var(--ch04-orange) 0%,
    var(--ch08-magenta) 33%,
    var(--ch05-purple) 66%,
    var(--ch01-cyan) 100%);
  position: relative;
  z-index: 1;
}

/* === BRANDED FOOTER === */
.footer-brand {
  background: var(--bg-deep);
  text-align: center;
  padding: 2.5rem 2.5rem 3rem;
  border-top: none;
  margin-top: 0;
  position: relative;
  z-index: 1;
  font-family: var(--font-body);
  color: var(--text-muted);
  letter-spacing: 0;
}
.footer-brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
  opacity: 0.45;
}
.footer-brand-mark img {
  height: 28px;
  width: auto;
  display: block;
}
.footer-brand-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}
.footer-brand-note {
  font-family: var(--font-meta);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  margin-top: 0.25rem;
}
.footer-brand-note .sep { color: var(--text-dim); margin: 0 0.4rem; }
.footer-brand a {
  color: var(--text-secondary);
  border: none;
}
.footer-brand a:hover { color: var(--ch01-cyan); }

/* === CHAPTER META (uppercase label above h1) === */
.chapter-meta {
  font-family: var(--font-meta);
  font-size: 0.72rem;
  color: var(--accent, var(--ch01-cyan));
  margin-bottom: var(--space-md);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-weight: 600;
}

/* === CALLOUTS === */
.callout {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, var(--ch01-cyan));
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-md) 0;
  border-radius: 0 10px 10px 0;
  font-size: 0.95rem;
  line-height: 1.7;
}

.callout strong { color: #fff; }
.callout em { color: var(--accent, var(--ch01-cyan)); font-style: normal; font-weight: 500; }

.callout.emphasis {
  background: linear-gradient(135deg,
    var(--accent-dim, rgba(255,255,255,0.04)),
    rgba(255,255,255,0.01));
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent, var(--ch01-cyan));
  font-size: 1rem;
  padding: var(--space-lg);
}
.callout.emphasis strong { color: var(--accent, var(--ch01-cyan)); }

.callout.sub {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-left: 2px solid var(--text-muted);
  font-size: 0.88rem;
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
}

/* === CHAPTER NAV (prev/next at bottom) === */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-xxl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  gap: var(--space-md);
}
.chapter-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--font-meta);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s;
  border-bottom: 1px solid var(--border);
}
.chapter-nav a:hover {
  color: var(--accent, var(--ch01-cyan));
  background: var(--accent-dim, rgba(255,255,255,0.04));
  border-color: var(--accent, var(--ch01-cyan));
}

/* === HERO (chapter opening) === */
.hero {
  text-align: center;
  padding: var(--space-xl) 0 var(--space-lg);
  margin-bottom: var(--space-xl);
  position: relative;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent, var(--ch01-cyan)), transparent);
}
.hero h1 {
  margin-bottom: var(--space-sm);
}
.hero .chapter-meta {
  margin-bottom: var(--space-md);
}
.hero .hero-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-weight: 300;
  max-width: 700px;
  margin: var(--space-md) auto 0;
  line-height: 1.7;
}
.hero .hero-sub em {
  color: var(--ch04-orange);
  font-style: normal;
  font-weight: 500;
}

/* === MINI HEADING (small label above a block) === */
.mini-heading {
  font-family: var(--font-meta);
  font-size: 0.72rem;
  color: var(--accent, var(--ch01-cyan));
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-xs);
  font-weight: 600;
}

/* === SECTION CARD (for index / landing cards) === */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem 2rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.section-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--ch01-cyan));
}
.section-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.section-card .card-number {
  font-family: var(--font-heading);
  font-size: 56px;
  font-weight: 700;
  position: absolute;
  top: 14px;
  right: 24px;
  opacity: 0.06;
  line-height: 1;
  color: var(--card-accent, var(--ch01-cyan));
}
.section-card .card-tag {
  font-family: var(--font-meta);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  background: var(--card-accent-dim, rgba(255,255,255,0.06));
  color: var(--card-accent, var(--ch01-cyan));
}
.section-card h2 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.5rem 0;
  padding-left: 0;
  border-left: none;
  line-height: 1.3;
}
.section-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
  max-width: none;
}

/* === PART DIVIDER (reference pattern) === */
.part-divider {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 3rem 0 1.5rem;
}
.part-divider .part-number {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  background: var(--part-dim, rgba(255,255,255,0.06));
  color: var(--part-accent, var(--ch01-cyan));
}
.part-divider .part-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--part-accent-fade, rgba(0,188,212,0.3)), transparent);
}
.part-divider .part-title {
  font-family: var(--font-meta);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--part-accent, var(--ch01-cyan));
}

/* === THRESHOLD BANNER === */
.threshold-banner {
  background: linear-gradient(135deg,
    var(--accent-dim, rgba(16,185,129,0.08)),
    rgba(0,188,212,0.04));
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 2rem 2.5rem;
  text-align: center;
  margin: var(--space-lg) 0;
  position: relative;
  overflow: hidden;
}
.threshold-banner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    var(--accent, var(--ch01-cyan)),
    var(--ch03-green),
    var(--accent, var(--ch01-cyan)));
}
.threshold-banner .threshold-icon { font-size: 32px; margin-bottom: 0.5rem; }
.threshold-banner .threshold-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.4rem;
}
.threshold-banner .threshold-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent, var(--ch03-green));
  margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
}
.threshold-banner .threshold-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.threshold-banner .threshold-sub em {
  color: var(--accent, var(--ch01-cyan));
  font-style: normal;
  font-weight: 600;
}
.threshold-banner .threshold-note {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-meta);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

/* === STACKED PROPORTION BAR === */
.buckets-bar {
  display: flex;
  border-radius: 12px;
  overflow: hidden;
  height: 70px;
  margin: var(--space-md) 0;
  border: 1px solid var(--border);
}
.bucket-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
}
.bucket-segment:hover { filter: brightness(1.2); }
.bucket-segment + .bucket-segment { border-left: 1px solid rgba(255,255,255,0.08); }
.bucket-pct {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
}
.bucket-name {
  font-family: var(--font-meta);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

/* === DEEP-DIVE SEPARATOR === */
.deep-dive-separator {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin: 4rem 0 2rem;
}
.deep-dive-separator .dds-line {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}
.deep-dive-separator .dds-text {
  font-family: var(--font-meta);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

/* === KEY NUMBERS GRID === */
.key-numbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}
.key-number {
  text-align: center;
  padding: 1.25rem var(--space-md);
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.key-number::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent, var(--ch01-cyan));
  opacity: 0.6;
}
.key-number:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.key-number .num {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  display: block;
  margin-bottom: 0.35rem;
  background: linear-gradient(135deg, #fff, var(--accent, var(--ch01-cyan)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.key-number .label {
  font-family: var(--font-meta);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* === ANIMATIONS === */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { opacity: 0; animation: fadeUp 0.6s ease forwards; }
.animate-in.delay-1 { animation-delay: 0.1s; }
.animate-in.delay-2 { animation-delay: 0.2s; }
.animate-in.delay-3 { animation-delay: 0.3s; }
.animate-in.delay-4 { animation-delay: 0.4s; }
.animate-in.delay-5 { animation-delay: 0.5s; }

/* Accessibility: respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .animate-in { opacity: 1; animation: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   V3 COMPONENT LIBRARY · Rainbow-border containers · Flow patterns
   ============================================================ */

/* === CANON BLOCK · Locked source-of-truth container === */
.canon-block {
  background: linear-gradient(135deg,
    var(--accent-dim, rgba(255,255,255,0.04)),
    rgba(255,255,255,0.015));
  border: 2px solid var(--accent, var(--border-strong));
  border-radius: 16px;
  padding: 2rem 2.3rem;
  margin: 2rem 0;
  position: relative;
  overflow: hidden;
}
.canon-block::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent, var(--ch01-cyan));
}

/* Tri-color variants (apply via additional class) */
.canon-block.canon-rainbow-red::before {
  background: linear-gradient(90deg, var(--ch07-red), var(--ch01-cyan), var(--ch08-magenta));
}
.canon-block.canon-rainbow-red {
  border-color: rgba(239,68,68,0.28);
  background: linear-gradient(135deg, rgba(239,68,68,0.06), rgba(0,188,212,0.05));
}
.canon-block.canon-rainbow-purple::before {
  background: linear-gradient(90deg, var(--ch05-purple), var(--ch03-green), var(--ch01-cyan));
}
.canon-block.canon-rainbow-purple {
  border-color: rgba(139,92,246,0.28);
  background: linear-gradient(135deg, rgba(139,92,246,0.06), rgba(16,185,129,0.04));
}
.canon-block.canon-rainbow-gold::before {
  background: linear-gradient(90deg, var(--ch06-yellow), var(--ch04-orange), var(--ch01-cyan));
}
.canon-block.canon-rainbow-gold {
  border-color: rgba(251,191,36,0.28);
  background: linear-gradient(135deg, rgba(251,191,36,0.05), rgba(0,188,212,0.04));
}

/* === CANON BADGE · Pill label inside container header === */
.canon-badge {
  display: inline-block;
  font-family: var(--font-meta);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent, var(--ch07-red));
  background: var(--accent-dim, rgba(239,68,68,0.15));
  padding: 0.35rem 0.85rem;
  border-radius: 4px;
  border: 1px solid var(--accent, var(--border-strong));
  margin-bottom: 1rem;
  font-weight: 600;
}
.canon-block h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.75rem 0;
  padding: 0;
  border: none;
  letter-spacing: -0.02em;
  line-height: 1.25;
  background: none;
  -webkit-text-fill-color: #fff;
}
.canon-block > p,
.canon-block .canon-intro {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  max-width: 900px;
}
.canon-block .canon-intro strong { color: var(--text-primary); font-weight: 500; }
.canon-block .canon-intro em { color: var(--accent, var(--ch07-red)); font-style: italic; font-weight: 500; }

/* === CANON SECTION · Delimited sub-block inside container === */
.canon-section {
  margin-bottom: 1.4rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px dashed var(--border);
}
.canon-section:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.canon-section-label {
  font-family: var(--font-meta);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent, var(--ch01-cyan));
  margin-bottom: 0.75rem;
  font-weight: 600;
}
.canon-section h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.6rem;
  margin-top: 0;
}
.canon-section > p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: none;
}
.canon-section > p strong { color: var(--text-primary); font-weight: 500; }
.canon-section > p em { color: var(--accent, var(--ch07-red)); font-style: italic; font-weight: 500; }
.canon-section ul, .canon-section ol {
  padding-left: 1.4rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  max-width: none;
}
.canon-section li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.4rem;
}
.canon-section li strong { color: var(--text-primary); font-weight: 500; }

/* === CANON KEY-VALUE (dl/dt/dd) === */
.canon-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1.2rem;
  margin-top: 0.6rem;
  max-width: none;
}
.canon-kv dt {
  font-family: var(--font-meta);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  font-weight: 600;
  padding: 0.4rem 0;
}
.canon-kv dd {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  padding: 0.4rem 0;
  margin: 0;
}
.canon-kv dd strong { color: #fff; font-weight: 600; }

/* === CANON TABLE (minimal, code-chip cells) === */
.canon-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.6rem;
  font-size: 0.82rem;
  background: transparent;
  border: none;
  border-radius: 0;
}
.canon-table th {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-meta);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  background: transparent;
}
.canon-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px dashed var(--border);
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 0.82rem;
}
.canon-table tr:last-child td { border-bottom: none; }
.canon-table tr:hover td { background: transparent; }
.canon-table td strong { color: #fff; font-weight: 600; }
.canon-table td code {
  font-family: var(--font-meta);
  font-size: 0.7rem;
  color: var(--accent, var(--ch01-cyan));
  background: var(--accent-dim, rgba(0,188,212,0.08));
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  border: none;
}

/* === FLOW STAGE CARD (with floating badge) === */
.flow-stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  margin-top: 1rem;
  position: relative;
}
.flow-stage-card.has-badge { padding-top: 1.75rem; }
.flow-stage-card .stage-badge {
  position: absolute;
  top: -10px;
  left: 18px;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--bg-deep);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  letter-spacing: 0.08em;
  color: var(--accent, var(--ch01-cyan));
}
/* Per-phase stage colors */
.stage-pre    .stage-badge { color: var(--ch01-cyan); border-color: rgba(0,188,212,0.4); }
.stage-spec   .stage-badge { color: var(--ch05-purple); border-color: rgba(139,92,246,0.4); }
.stage-brand  .stage-badge { color: var(--ch08-magenta); border-color: rgba(233,30,99,0.4); }
.stage-build  .stage-badge { color: var(--ch03-green); border-color: rgba(16,185,129,0.4); }
.stage-launch .stage-badge { color: var(--ch04-orange); border-color: rgba(249,115,22,0.4); }
.stage-live   .stage-badge { color: var(--ch07-red); border-color: rgba(239,68,68,0.4); }
.flow-stage-card h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin: 0.4rem 0 0.5rem;
  letter-spacing: -0.01em;
}
.flow-stage-card .stage-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 0.75rem;
  max-width: none;
}
.flow-stage-card .stage-sub em {
  color: var(--accent, var(--ch06-yellow));
  font-style: italic;
}

/* === PRE-INPUT CARD (icon + title + sub) === */
.pre-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  max-width: none;
  margin-left: 0;
}
@media (max-width: 700px) { .pre-inputs { grid-template-columns: repeat(2, 1fr); } }
.pre-input-card {
  background: rgba(0,0,0,0.35);
  border: 1px dashed var(--accent, rgba(0,188,212,0.3));
  border-radius: 8px;
  padding: 0.9rem 0.75rem;
  text-align: center;
  transition: all 0.2s ease;
}
.pre-input-card:hover {
  background: rgba(0,0,0,0.5);
  border-style: solid;
}
.pre-input-card .pi-icon {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
  line-height: 1;
}
.pre-input-card h4 {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.25rem 0;
  text-transform: none;
  letter-spacing: 0;
}
.pre-input-card p {
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.45;
  margin: 0;
  max-width: none;
}

/* === FLOW ARROWS === */
.flow-arrow-down {
  text-align: center;
  font-family: var(--font-heading);
  font-size: 1.75rem;
  color: var(--accent, var(--ch06-yellow));
  line-height: 1;
  margin: 0.5rem 0;
  opacity: 0.7;
}
.staging-arrow-h {
  display: flex;
  align-items: center;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--ch06-yellow);
  line-height: 1;
  flex: 0 0 auto;
  padding: 0 0.15rem;
  opacity: 0.7;
}

/* === FLOW PIVOT (big gradient callout with emoji) === */
.flow-pivot {
  background: linear-gradient(135deg, rgba(251,191,36,0.18), rgba(249,115,22,0.12));
  border: 2px solid rgba(251,191,36,0.55);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin: 1rem 0;
}
.flow-pivot::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(251,191,36,0.1), transparent 60%);
  pointer-events: none;
}
.flow-pivot > * { position: relative; z-index: 1; }
.flow-pivot .pivot-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  line-height: 1;
}
.flow-pivot .pivot-label {
  font-family: var(--font-meta);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ch06-yellow);
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.flow-pivot h3 {
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.flow-pivot .pivot-cmd {
  display: inline-block;
  font-family: var(--font-meta);
  font-size: 0.72rem;
  color: var(--ch01-cyan);
  background: rgba(0,0,0,0.4);
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  border: 1px solid rgba(0,188,212,0.2);
  margin-top: 0.4rem;
}
.flow-pivot .pivot-creates {
  margin-top: 0.9rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  max-width: none;
}
.flow-pivot .pivot-creates strong { color: var(--ch06-yellow); }

/* === FOLDER PHASE + FOLDER CHIP === */
.folder-sequence { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0; }
.folder-phase {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  position: relative;
}
.folder-phase::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0; width: 3px;
  border-radius: 10px 0 0 10px;
  background: var(--accent, var(--ch01-cyan));
}
/* Per-phase accents */
.folder-phase.p-spec::before   { background: var(--ch05-purple); }
.folder-phase.p-brand::before  { background: var(--ch08-magenta); }
.folder-phase.p-build::before  { background: var(--ch03-green); }
.folder-phase.p-launch::before { background: var(--ch04-orange); }
.folder-phase.p-live::before   { background: var(--ch07-red); }
.folder-phase.side { background: rgba(0,0,0,0.2); border-style: dashed; }
.folder-phase.side::before { background: var(--text-dim); }
.folder-phase .phase-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.folder-phase .phase-name {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}
.folder-phase .phase-note {
  font-family: var(--font-meta);
  font-size: 0.68rem;
  color: var(--text-dim);
}
.folder-phase.p-spec .phase-note em   { color: var(--ch05-purple); font-style: italic; }
.folder-phase.p-brand .phase-note em  { color: var(--ch08-magenta); font-style: italic; }
.folder-phase.p-build .phase-note em  { color: var(--ch03-green); font-style: italic; }
.folder-phase.p-launch .phase-note em { color: var(--ch04-orange); font-style: italic; }
.folder-phase.p-live .phase-note em   { color: var(--ch07-red); font-style: italic; }

.folder-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.4rem; }
.folder-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  position: relative;
  flex: 1 1 160px;
  min-width: 0;
}
.folder-chip .step-num {
  position: absolute;
  top: -8px; left: 10px;
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--accent, var(--ch01-cyan));
}
.folder-phase.p-spec   .folder-chip .step-num { color: var(--ch05-purple); border-color: rgba(139,92,246,0.4); }
.folder-phase.p-brand  .folder-chip .step-num { color: var(--ch08-magenta); border-color: rgba(233,30,99,0.4); }
.folder-phase.p-build  .folder-chip .step-num { color: var(--ch03-green); border-color: rgba(16,185,129,0.4); }
.folder-phase.p-launch .folder-chip .step-num { color: var(--ch04-orange); border-color: rgba(249,115,22,0.4); }
.folder-phase.p-live   .folder-chip .step-num { color: var(--ch07-red); border-color: rgba(239,68,68,0.4); }
.folder-chip code {
  font-family: var(--font-meta);
  font-size: 0.72rem;
  color: #fff;
  font-weight: 600;
  display: block;
  margin-bottom: 0.15rem;
  background: transparent;
  border: none;
  padding: 0;
}
.folder-chip .chip-desc {
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* === STAGING FLOW (local → cicd → staging → prod) === */
.staging-diagram {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-top: 0.75rem;
}
.staging-flow {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.staging-box {
  flex: 1;
  min-width: 120px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  position: relative;
}
.staging-box.local   { border-left: 3px solid var(--ch01-cyan); }
.staging-box.cicd    { border-left: 3px solid var(--ch06-yellow); }
.staging-box.staging { border-left: 3px solid var(--ch03-green); }
.staging-box.prod    { border-left: 3px solid var(--ch07-red); }
.staging-box h5 {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.25rem 0;
  letter-spacing: 0;
  text-transform: none;
}
.staging-box p {
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: none;
  margin: 0;
}
.staging-box code {
  font-family: var(--font-meta);
  font-size: 0.65rem;
  color: var(--ch01-cyan);
  background: rgba(0,188,212,0.08);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  border: none;
}
.staging-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: none;
}
.staging-note strong { color: var(--text-primary); font-weight: 500; }
.staging-note em { color: var(--ch06-yellow); font-style: italic; }

/* === HARD RULE (red-bordered "must not" strip) === */
.hard-rule {
  background: rgba(239,68,68,0.05);
  border-left: 3px solid var(--ch07-red);
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: none;
}
.hard-rule strong { color: var(--ch07-red); }

/* === LEGEND STRIP === */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.8rem 1.1rem;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.legend-item {
  font-family: var(--font-meta);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent, var(--ch01-cyan));
}

/* === BLOCK LABEL (section delimiter with horizontal line) === */
.block-label {
  font-family: var(--font-meta);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 2rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.block-label .line {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.08);
}
.block-label strong {
  color: var(--accent, var(--ch06-yellow));
  font-weight: 600;
}

/* === ICON TILE (for pre-input-like cards with accent-colored icons) === */
.icon-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
  max-width: none;
}
.icon-tile-grid > * { margin: 0; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  main { padding: var(--space-lg) var(--space-md); }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.3rem; }
  table { font-size: 0.85rem; }
  .part-divider { flex-wrap: wrap; gap: 10px; }
  .buckets-bar { height: auto; flex-direction: column; }
  .bucket-segment { width: 100% !important; height: 50px; border-left: none; border-top: 1px solid rgba(255,255,255,0.08); }
  .bucket-segment:first-child { border-top: none; }
  .threshold-banner .threshold-value { font-size: 1.5rem; }
  .canon-block { padding: 1.5rem 1.25rem; }
  .pre-inputs { grid-template-columns: repeat(2, 1fr); }
  .staging-flow { flex-direction: column; }
  .staging-arrow-h { transform: rotate(90deg); padding: 0.25rem 0; }
  .folder-row { flex-direction: column; }
  .folder-chip { flex: 1 1 auto; }
}
