:root {
  --bg: #040810;
  --bg2: #0a1220;
  --panel: #0f1a2e;
  --border: #2a4068;
  --text: #e8f2ff;
  --muted: #8aa4c8;
  --phi: #38bdf8;
  --thermo: #f59e0b;
  --flow: #a78bfa;
  --gold: #f0d060;
  --ok: #34d399;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  --page-max: min(96vw, 1280px);
  --page-pad: max(1.25rem, env(safe-area-inset-left, 1.25rem));
  --font-base: clamp(1.125rem, 0.45vw + 1.05rem, 1.3125rem);
  --font-scale: 1.12;
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: var(--font-base);
  min-height: 100dvh;
  min-height: 100svh;
}

a { color: var(--phi); text-decoration: none; }
a:hover { color: var(--gold); text-decoration: underline; }

.hero {
  position: relative;
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: center/cover no-repeat url("../assets/images/v3/science/textbook-hero.jpg");
  filter: saturate(1.1) brightness(0.55);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(4,8,16,0.4) 40%, var(--bg) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 4rem var(--page-pad) max(3rem, env(safe-area-inset-bottom));
  width: 100%;
}

.eyebrow {
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--phi);
  margin-bottom: 0.75rem;
}

h1 {
  font-size: clamp(2.6rem, 6vw + 0.5rem, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--phi) 50%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lead {
  font-size: clamp(1.2rem, 1.5vw + 1rem, 1.45rem);
  color: var(--muted);
  max-width: min(52rem, 100%);
  margin-bottom: 1.5rem;
}

.badges { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.5rem; }

.badge {
  font-size: 0.8rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15,26,46,0.8);
  color: var(--muted);
}

.badge.phi { border-color: var(--phi); color: var(--phi); }
.badge.thermo { border-color: var(--thermo); color: var(--thermo); }
.badge.flow { border-color: var(--flow); color: var(--flow); }

nav.top {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(4,8,16,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

nav.top .inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0.95rem var(--page-pad);
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: center;
  justify-content: space-between;
}

nav.top .logo { font-weight: 700; color: var(--gold); font-size: 1.08rem; }

nav.top ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  font-size: 1rem;
}

main {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 3rem var(--page-pad) max(5rem, env(safe-area-inset-bottom));
  width: 100%;
}

section { margin-bottom: 4rem; }

h2 {
  font-size: clamp(1.85rem, 2.5vw + 1rem, 2.25rem);
  margin-bottom: 1rem;
  color: var(--gold);
  border-left: 4px solid var(--phi);
  padding-left: 1rem;
}

h3 { font-size: 1.35rem; margin: 1.5rem 0 0.6rem; color: var(--phi); }

p { margin-bottom: 1rem; }
body:not(.reader-active) p { color: var(--text); }

.muted { color: var(--muted); }

.lanes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.lane {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
}

.lane:hover { border-color: var(--phi); transform: translateY(-2px); }

.lane .icon { font-size: 2rem; margin-bottom: 0.5rem; }

.lane h3 { margin-top: 0; }

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.15rem;
  width: 100%;
}

.chapter-card {
  display: block;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.2s;
}

.chapter-card:hover {
  border-color: var(--gold);
  text-decoration: none;
  transform: translateY(-2px);
}

.chapter-card .num {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--thermo);
  margin-bottom: 0.4rem;
}

.chapter-card h4 { color: var(--text); font-size: 1.15rem; margin-bottom: 0.4rem; }

.chapter-card p { font-size: 1.02rem; color: var(--muted); margin: 0; }

.figure {
  margin: 2rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.figure img { width: 100%; display: block; }

.figure figcaption {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--panel);
}

.eq {
  font-family: var(--mono);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  overflow-x: auto;
  font-size: 0.95rem;
  color: var(--gold);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 1.02rem;
}

th, td {
  border: 1px solid var(--border);
  padding: 0.65rem 0.85rem;
  text-align: left;
}

th { background: var(--panel); color: var(--phi); }

tr:nth-child(even) td { background: rgba(15,26,46,0.5); }

.callout {
  border-left: 4px solid var(--thermo);
  background: rgba(245,158,11,0.08);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.25rem 0;
}

.callout.science { border-color: var(--phi); background: rgba(56,189,248,0.08); }
.callout.everyone { border-color: var(--ok); background: rgba(52,211,153,0.08); }

.cta-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }

.btn {
  display: inline-block;
  padding: 0.85rem 1.6rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.05rem;
  border: 1px solid var(--phi);
  background: rgba(56,189,248,0.15);
  color: var(--phi);
}

.btn:hover { background: rgba(56,189,248,0.3); text-decoration: none; color: var(--text); }

.btn.secondary {
  border-color: var(--border);
  background: var(--panel);
  color: var(--muted);
}

footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

footer .brand-small {
  margin-top: 1rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

.v3-badge,
.v4-badge {
  display: inline-block;
  font-size: 0.72em;
  font-weight: 700;
  color: var(--flow);
  border: 1px solid var(--flow);
  border-radius: 8px;
  padding: 0.1em 0.45em;
  margin-left: 0.25em;
  vertical-align: middle;
  letter-spacing: 0.05em;
}

.v4-badge {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(240, 208, 96, 0.08);
}

.v5-badge,
.v6-badge {
  display: inline-block;
  font-size: 0.72em;
  font-weight: 700;
  color: var(--flow);
  border: 1px solid var(--flow);
  border-radius: 8px;
  padding: 0.1em 0.45em;
  margin-left: 0.25em;
  vertical-align: middle;
  letter-spacing: 0.05em;
  background: rgba(167, 139, 250, 0.12);
}

.creditor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.creditor-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  transition: border-color 0.2s, transform 0.2s;
}

.creditor-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  text-decoration: none;
}

.creditor-card img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  display: block;
}

.creditor-card h4 {
  font-size: 0.95rem;
  padding: 0.75rem 1rem 0.25rem;
  color: var(--text);
}

.creditor-card p {
  font-size: 0.8rem;
  padding: 0 1rem 1rem;
  color: var(--muted);
}

.creditor-hero {
  display: grid;
  grid-template-columns: minmax(280px, 400px) 1fr;
  gap: 2rem;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 3rem 2rem 1rem;
  align-items: end;
}

.creditor-portrait img {
  width: 100%;
  border-radius: var(--radius);
  border: 2px solid var(--gold);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.creditor-portrait figcaption {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.creditor-hero-text h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  -webkit-text-fill-color: var(--gold);
  background: none;
}

.love-block { border-left: 4px solid #f472b6; padding-left: 1rem; }
.god-block { border-left: 4px solid var(--gold); padding-left: 1rem; }

.callout.love {
  border-color: #f472b6;
  background: rgba(244, 114, 182, 0.08);
}

.callout.god {
  border-color: var(--gold);
  background: rgba(240, 208, 96, 0.08);
}

@media (max-width: 800px) {
  .creditor-hero { grid-template-columns: 1fr; }
}

.axiom-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.axiom {
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.4rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--gold);
  background: rgba(15, 26, 46, 0.85);
}

.v3-launch {
  background: linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 4rem;
}

.v3-launch-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.v3-covers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0;
}

.v3-covers img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.callout.axiom {
  border-color: var(--flow);
  background: rgba(167, 139, 250, 0.08);
}

@media (max-width: 900px) {
  .v3-launch-inner { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .chapter-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (max-width: 768px) {
  body {
    font-size: clamp(1.0625rem, 3.8vw, 1.2rem);
  }

  nav.top .inner {
    padding: 0.75rem max(1.15rem, env(safe-area-inset-left)) 0.75rem max(1.15rem, env(safe-area-inset-right));
    gap: 0.75rem;
  }

  nav.top ul {
    gap: 0.85rem;
    font-size: 0.85rem;
    width: 100%;
    justify-content: flex-start;
  }

  nav.top .logo {
    font-size: 0.92rem;
  }

  .hero {
    min-height: 100dvh;
    min-height: 100svh;
  }

  .hero-content {
    padding: 3rem max(1.15rem, env(safe-area-inset-left)) 2.5rem max(1.15rem, env(safe-area-inset-right));
  }

  h1 {
    font-size: clamp(2rem, 8vw, 2.8rem);
  }

  .lead {
    font-size: 1.15rem;
  }

  main {
    padding: 2rem max(1.15rem, env(safe-area-inset-left)) 4rem max(1.15rem, env(safe-area-inset-right));
    padding-bottom: max(4rem, env(safe-area-inset-bottom));
  }

  .v3-launch {
    padding: 1.35rem;
  }

  .v3-covers {
    grid-template-columns: 1fr;
  }

  .chapter-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .cta-row {
    flex-direction: column;
    align-items: stretch;
  }

  .cta-row .btn {
    width: 100%;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
  }

  .btn {
    min-height: 44px;
    touch-action: manipulation;
  }

  .axiom-bar {
    gap: 0.5rem;
  }

  .axiom {
    font-size: 0.75rem;
    padding: 0.35rem 0.7rem;
  }

  footer {
    padding: 2rem max(1.15rem, env(safe-area-inset-left)) max(2.5rem, env(safe-area-inset-bottom)) max(1.15rem, env(safe-area-inset-right));
  }
}

@media (max-width: 640px) {
  .hero-content, main, nav.top .inner {
    padding-left: max(1.15rem, env(safe-area-inset-left));
    padding-right: max(1.15rem, env(safe-area-inset-right));
  }

  .lanes {
    grid-template-columns: 1fr;
  }
}

/* Tablet landscape — comfortable reading width */
@media (min-width: 769px) and (max-width: 1100px) {
  .chapter-main {
    max-width: 40rem;
    padding-left: 2rem;
    padding-right: 2rem;
  }
}