/* =========================================================
   The Rewire Map / Primer — v2 stylesheet
   Single-font system (Geist). Clinical, premium, dark.
   Hierarchy through weight, size, spacing.
   ========================================================= */

:root {
  /* Palette — clinical dark */
  --bg: #0A0A0B;
  --bg-soft: #0E0E11;
  --charcoal: #14141A;
  --charcoal-soft: #1A1A22;
  --panel: #111116;
  --text: #ECECEF;
  --text-dim: #9A9AA3;
  --text-faint: #5F5F68;
  --text-quiet: #44444C;
  --navy: #0C1A2E;
  --navy-soft: #0F2238;
  --blue: #3D5AFE;
  --blue-soft: #5C9CFF;
  --blue-faint: #2C3A5E;
  --amber: #C9A26A;
  --red: #B0241E;
  --green: #84CC9C;
  --rule: rgba(236, 236, 239, 0.07);
  --rule-strong: rgba(236, 236, 239, 0.14);

  /* Single-font system */
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  /* Rhythm */
  --reading-width: 38rem;
  --wide-width: 46rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-space: clamp(3.5rem, 8vw, 6rem);
  --para-space: 1.1rem;
}

/* =========================================================
   Reset / base
   ========================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Minimal ambient depth — kept very subtle for clinical feel */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(110% 70% at 50% -10%, rgba(60, 90, 140, 0.04), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

main,
.progress {
  position: relative;
  z-index: 1;
}

p,
ul,
ol,
figure,
blockquote {
  margin: 0 0 var(--para-space);
}

a {
  color: var(--blue-soft);
  text-decoration: none;
  border-bottom: 1px solid rgba(92, 156, 255, 0.3);
  transition: border-color 0.2s ease;
}

a:hover {
  border-bottom-color: var(--blue-soft);
}

strong {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.005em;
}

em {
  font-style: italic;
  color: var(--text);
}

/* =========================================================
   Reading-progress bar
   ========================================================= */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  pointer-events: none;
  z-index: 100;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--blue-soft);
  opacity: 0.9;
  transition: width 0.1s linear;
}

/* =========================================================
   Layout shell
   ========================================================= */

.shell {
  width: 100%;
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter) clamp(5rem, 10vw, 8rem);
}

section,
header.hero {
  margin-bottom: var(--section-space);
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--section-space) auto;
  max-width: 6rem;
}

/* =========================================================
   Hero / opening
   ========================================================= */

.hero {
  padding-top: clamp(1rem, 4vw, 3rem);
  padding-bottom: clamp(1.5rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--rule);
}

.kicker {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  margin-bottom: 1.75rem;
}

.hero h1 {
  font-family: var(--font);
  font-weight: 600;
  font-size: clamp(2.25rem, 6vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 0 0 1.25rem;
}

.hero .subtitle {
  font-family: var(--font);
  font-weight: 400;
  font-size: clamp(1.0625rem, 2vw, 1.1875rem);
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: var(--text-dim);
  margin: 0 0 2rem;
  max-width: 30rem;
}

.byline {
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--text-dim);
  margin: 0 0 0.25rem;
}

.read-time {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 1.75rem;
}

/* =========================================================
   Section headings
   ========================================================= */

.section-title {
  font-family: var(--font);
  font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 1.9375rem);
  line-height: 1.2;
  letter-spacing: -0.018em;
  color: var(--text);
  margin: 0 0 1.75rem;
  max-width: 30rem;
}

.phase {
  scroll-margin-top: 2rem;
}

.phase-num {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 0.75rem;
}

.phase-title {
  font-family: var(--font);
  font-weight: 600;
  font-size: clamp(1.625rem, 3.5vw, 2.125rem);
  line-height: 1.15;
  letter-spacing: -0.022em;
  color: var(--text);
  margin: 0 0 2.25rem;
  max-width: 28rem;
}

/* =========================================================
   Sub-headings (used in adaptation / mechanism / reversal blocks)
   ========================================================= */

.spine-label {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--blue-soft);
  margin: 2rem 0 0.6rem;
}

.spine-label:first-child {
  margin-top: 0;
}

/* =========================================================
   Story prose
   ========================================================= */

.story p {
  margin-bottom: var(--para-space);
}

.story p + p {
  margin-top: 0;
}

/* =========================================================
   Sidebar callout — neuroscience block
   ========================================================= */

.sidebar {
  margin: 2.5rem 0;
  padding: 1.75rem clamp(1.25rem, 4vw, 1.875rem);
  background: var(--panel);
  border-left: 2px solid var(--blue-faint);
  border-radius: 1px;
  position: relative;
}

.sidebar-label {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--blue-soft);
  margin: 0 0 1rem;
}

.sidebar p {
  font-size: 0.96875rem;
  line-height: 1.65;
  color: var(--text-dim);
  margin-bottom: 0.85rem;
}

.sidebar p:last-child {
  margin-bottom: 0;
}

.sidebar strong {
  color: var(--text);
  font-weight: 500;
}

/* =========================================================
   Reflection callout — "Pause"
   ========================================================= */

.reflection {
  margin: 2.5rem 0;
  padding: 1.75rem clamp(1.25rem, 4vw, 2rem);
  background: var(--navy);
  border-left: 2px solid var(--blue);
  border-radius: 1px;
}

.reflection-label {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--blue-soft);
  margin: 0 0 1rem;
}

.reflection p {
  font-family: var(--font);
  font-weight: 400;
  font-size: 1.03125rem;
  line-height: 1.55;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.008em;
}

/* =========================================================
   Six questions
   ========================================================= */

.six-questions {
  margin: var(--section-space) 0;
  padding: 2.25rem clamp(1.5rem, 4vw, 2.25rem);
  background: var(--navy);
  border: 1px solid var(--blue-faint);
  border-radius: 2px;
}

.six-questions .reflection-label {
  font-size: 0.75rem;
  letter-spacing: 0.28em;
  margin-bottom: 1.5rem;
}

.six-questions .intro {
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.six-questions ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: q;
}

.six-questions li {
  counter-increment: q;
  position: relative;
  font-family: var(--font);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.5;
  letter-spacing: -0.008em;
  color: var(--text);
  padding: 1.15rem 0 1.15rem 2.75rem;
  border-top: 1px solid rgba(236, 236, 239, 0.05);
}

.six-questions li:first-child {
  border-top: 0;
  padding-top: 0;
}

.six-questions li:last-child {
  padding-bottom: 0;
}

.six-questions li::before {
  content: counter(q, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1.3rem;
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--blue-soft);
}

.six-questions li:first-child::before {
  top: 0.2rem;
}

/* =========================================================
   The Rewire Method
   ========================================================= */

.method ol {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  counter-reset: m;
}

.method li {
  counter-increment: m;
  position: relative;
  padding: 1.5rem 0 1.5rem 3.5rem;
  border-top: 1px solid var(--rule);
}

.method li:first-child {
  border-top: 0;
  padding-top: 0;
}

.method li::before {
  content: counter(m, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1.5rem;
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--blue-soft);
}

.method li:first-child::before {
  top: 0.1rem;
}

.method-name {
  display: block;
  font-family: var(--font);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.012em;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.method-desc {
  font-size: 0.96875rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
}

/* =========================================================
   Seven-day plan
   ========================================================= */

.seven-days .intro {
  margin-bottom: 2.25rem;
}

.seven-days ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: d;
}

.seven-days li {
  counter-increment: d;
  position: relative;
  padding: 1.5rem 0 1.5rem 4.75rem;
  border-top: 1px solid var(--rule);
}

.seven-days li:first-child {
  border-top: 0;
  padding-top: 0;
}

.seven-days li::before {
  content: "Day " counter(d);
  position: absolute;
  left: 0;
  top: 1.5rem;
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue-soft);
}

.seven-days li:first-child::before {
  top: 0.1rem;
}

.day-name {
  display: block;
  font-family: var(--font);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.012em;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.day-desc {
  font-size: 0.96875rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
}

/* =========================================================
   Closing / signature
   ========================================================= */

.closing p {
  margin-bottom: var(--para-space);
}

.signature {
  font-family: var(--font);
  font-weight: 500;
  font-size: 1.125rem;
  color: var(--text);
  margin-top: 2.75rem;
}

/* =========================================================
   Diagrams
   ========================================================= */

.diagram {
  margin: 2.5rem 0;
  padding: 1.5rem 0 0.5rem;
  text-align: center;
}

.diagram svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.diagram-caption {
  margin: 1.25rem auto 0;
  max-width: 28rem;
  font-family: var(--font);
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: -0.002em;
}

.diagram-title {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--blue-soft);
  margin: 0 0 1.25rem;
  text-align: center;
}

/* SVG internal styles */
.svg-text {
  font-family: var(--font);
  font-size: 12px;
  fill: var(--text);
}

.svg-text-dim {
  font-family: var(--font);
  font-size: 11px;
  fill: var(--text-dim);
}

.svg-label-mono {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  fill: var(--blue-soft);
}

/* =========================================================
   Prologue / framing — slightly different feel
   ========================================================= */

.prologue .section-title,
.main-idea .section-title {
  color: var(--text-dim);
  font-weight: 500;
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
}

/* =========================================================
   Italic emphasis — used sparingly
   ========================================================= */

.story em,
.story p em {
  color: var(--text);
  font-style: italic;
  font-weight: 400;
}

/* =========================================================
   Primer — Part headers (Part 01 / Part 02)
   ========================================================= */

.part-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.part-num {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--blue-soft);
  margin: 0 0 0.65rem;
}

.part-title {
  font-family: var(--font);
  font-weight: 600;
  font-size: clamp(1.625rem, 3.5vw, 2.125rem);
  line-height: 1.15;
  letter-spacing: -0.022em;
  color: var(--text);
  margin: 0;
  max-width: 28rem;
}

/* =========================================================
   Primer — Subsections (01.1 The prediction system, etc.)
   ========================================================= */

.subsection {
  margin: 0 0 var(--section-space);
  scroll-margin-top: 2rem;
}

.subsection:last-child {
  margin-bottom: 0;
}

.subsection-num {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 0.65rem;
}

.subsection-title {
  font-family: var(--font);
  font-weight: 600;
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0 0 1.5rem;
  max-width: 26rem;
}

/* =========================================================
   Primer — Founder note (short, lighter feel)
   ========================================================= */

.founder-note .section-title {
  color: var(--text-dim);
  font-weight: 500;
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
}

/* =========================================================
   Map — Framing section (Before you read this style)
   ========================================================= */

.framing .section-title {
  color: var(--text-dim);
  font-weight: 500;
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
}

/* =========================================================
   Primer — CTA block
   ========================================================= */

.cta {
  margin: var(--section-space) 0 0;
  padding: 2.5rem 0 0;
  border-top: 1px solid var(--rule);
}

.cta .section-title {
  color: var(--text);
  font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 1.9375rem);
}

.cta-actions {
  margin: 2.5rem 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}

.cta-button {
  display: inline-block;
  background: var(--navy);
  color: var(--text);
  font-family: var(--font);
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: 0.005em;
  padding: 1.05rem 2rem 1.1rem;
  border: 1px solid var(--blue);
  border-radius: 1px;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.cta-button:hover,
.cta-button:focus {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.cta-note {
  font-family: var(--font);
  font-size: 0.875rem;
  letter-spacing: 0.005em;
  color: var(--text-faint);
  margin: 0;
  max-width: 24rem;
  line-height: 1.5;
}

.cta-signature {
  font-family: var(--font);
  font-weight: 500;
  font-size: 1.0625rem;
  color: var(--text);
  margin-top: 2.5rem;
}

/* =========================================================
   Print stylesheet — clean PDF export
   ========================================================= */

@media print {
  :root {
    --bg: #ffffff;
    --text: #0a0a0b;
    --text-dim: #44444c;
    --text-faint: #777780;
    --charcoal: #f5f5f3;
    --panel: #f6f6f4;
    --navy: #f0f3f9;
    --navy-soft: #e6ecf6;
    --blue-faint: #b8c2d8;
    --rule: rgba(0, 0, 0, 0.12);
  }

  body {
    background: #fff;
    color: #0a0a0b;
    font-size: 11pt;
    line-height: 1.55;
  }

  body::before {
    display: none;
  }

  .progress {
    display: none;
  }

  .shell {
    max-width: 100%;
    padding: 0;
  }

  .hero h1 {
    font-size: 30pt;
    color: #000;
  }

  .section-title,
  .phase-title {
    color: #000;
  }

  .sidebar,
  .reflection,
  .six-questions {
    background: #f6f6f4;
    border-left-color: #6e7a96;
    color: #222;
    page-break-inside: avoid;
  }

  .reflection p,
  .sidebar p,
  .six-questions li {
    color: #222;
  }

  .phase {
    page-break-inside: avoid;
  }

  .phase-num,
  .sidebar-label,
  .reflection-label,
  .diagram-title,
  .spine-label {
    color: #4a5a8a;
  }

  .diagram svg {
    filter: invert(0.9) hue-rotate(180deg);
  }

  a {
    color: #1a3aaa;
    border-bottom: none;
  }
}
