/* ============================================================
   The Next Soul — palette sampled from the attached image
   cream paper #fbfbf9  ·  warm taupe ink #6f6b69 / #2c2a28
   ============================================================ */

:root {
  --cream:      #fbfbf9;
  --paper:      #f3f2ef;
  --paper-2:    #eceae6;
  --ink:        #2c2a28;
  --ink-soft:   #6f6b69;
  --mute:       #959290;
  --line:       #dcdad6;
  --hair:       #e6e4e0;

  --dot-empty:  #e3e1dd;
  --dot-1:      #c3c0bc;
  --dot-2:      #9a9794;
  --dot-3:      #716d6b;
  --dot-4:      #4a4744;
  --dot-5:      #2c2a28;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --wrap: 1120px;
  --ease: cubic-bezier(.22,.61,.36,1);

  --foot-bg: var(--ink);

  /* births map — pastel continent fills (hover only) */
  --c-asia:           #b8cfc0;
  --c-africa:         #d4c4a8;
  --c-europe:         #b0c4d4;
  --c-north-america:  #c0bdd4;
  --c-south-america:  #d4b8b0;
  --c-oceania:        #b8d0d4;
  --c-other:          #ccc8c0;
}

/* ---------- warm dark mode (palette kept warm, just inverted) ---------- */
[data-theme="dark"] {
  --cream:      #1b1917;
  --paper:      #232120;
  --paper-2:    #2b2825;
  --ink:        #f1efea;
  --ink-soft:   #b4afa9;
  --mute:       #847f7a;
  --line:       #383532;
  --hair:       #2f2c29;

  --dot-empty:  #2d2a27;
  --dot-1:      #45413e;
  --dot-2:      #615d59;
  --dot-3:      #8a8682;
  --dot-4:      #b9b4af;
  --dot-5:      #f1efea;

  --foot-bg:    #131110;

  --c-asia:           #5a7268;
  --c-africa:         #7a6e58;
  --c-europe:         #5a6878;
  --c-north-america:  #626078;
  --c-south-america:  #786860;
  --c-oceania:        #5a7078;
  --c-other:          #686460;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }

/* subtle paper grain so the cream feels warm, not flat */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .5;
  background-image: radial-gradient(var(--paper-2) .5px, transparent .5px);
  background-size: 4px 4px;
  mix-blend-mode: multiply;
}

a { color: inherit; }

::selection { background: var(--ink); color: var(--cream); }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--cream) 82%, transparent);
  border-bottom: 1px solid var(--hair);
}
.head-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { font-size: 20px; color: var(--ink-soft); }
.brand-name { font-family: var(--serif); font-weight: 600; letter-spacing: .2px; font-size: 19px; }
.site-nav { display: flex; gap: 26px; }
.site-nav a {
  text-decoration: none; color: var(--ink-soft); font-size: 14px; font-weight: 500;
  letter-spacing: .02em; transition: color .2s var(--ease); position: relative;
}
.site-nav a::after {
  content: ""; position: absolute; left: 0; bottom: -6px; height: 1px; width: 0;
  background: var(--ink); transition: width .25s var(--ease);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a:hover::after { width: 100%; }

.head-right { display: flex; align-items: center; gap: 22px; }
.theme-toggle {
  position: relative; width: 38px; height: 38px; flex: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 50%; background: transparent;
  color: var(--ink-soft); display: grid; place-items: center;
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.theme-toggle:hover { border-color: var(--ink); color: var(--ink); background: var(--paper); }
.theme-icon { position: absolute; font-size: 16px; line-height: 1; transition: opacity .25s var(--ease), transform .35s var(--ease); }
.theme-icon--sun { opacity: 0; transform: rotate(-90deg) scale(.6); }
.theme-icon--moon { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"] .theme-icon--sun { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"] .theme-icon--moon { opacity: 0; transform: rotate(90deg) scale(.6); }

/* ---------- hero ---------- */
.hero { position: relative; z-index: 2; padding: 92px 28px 64px; max-width: 980px; }
.eyebrow {
  font-size: 13px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--mute); margin: 0 0 22px;
}
.hero-title {
  font-family: var(--serif); font-weight: 500; font-size: clamp(34px, 6vw, 68px);
  line-height: 1.05; letter-spacing: -.015em; margin: 0 0 28px;
}
.hero-title em { font-style: italic; font-weight: 600; }
.hero-lede {
  font-size: clamp(17px, 2.1vw, 21px); line-height: 1.6; color: var(--ink-soft);
  max-width: 640px; margin: 0 0 34px;
}
.hero-lede strong { color: var(--ink); font-weight: 600; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--sans); font-size: 15px; font-weight: 500; letter-spacing: .01em;
  padding: 13px 22px; border-radius: 999px; text-decoration: none;
  border: 1px solid transparent; transition: all .22s var(--ease);
}
.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:hover { background: #000; transform: translateY(-1px); }
[data-theme="dark"] .btn-primary:hover { background: #fff; }
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: .25; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); background: var(--paper); }

.hero-counter { margin-top: 56px; display: flex; align-items: baseline; gap: 14px; }
.counter-num {
  font-family: var(--serif); font-weight: 600; font-size: clamp(40px, 8vw, 76px);
  line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.counter-label { font-size: 14px; color: var(--mute); max-width: 180px; line-height: 1.4; }

/* ---------- intro strip ---------- */
.intro-strip {
  position: relative; z-index: 2; border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair); background: var(--paper); padding: 30px 0;
}
.intro-strip .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.strip-text { margin: 0; font-size: clamp(16px, 2vw, 19px); max-width: 720px; color: var(--ink-soft); }
.strip-text strong { color: var(--ink); font-family: var(--serif); font-weight: 600; }
.legend-hint { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); white-space: nowrap; }

/* ---------- content blocks ---------- */
.block { position: relative; z-index: 2; padding: 84px 0; border-bottom: 1px solid var(--hair); }
.block-alt { background: var(--paper); }
.block-grid {
  display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 56px; align-items: center;
}
.block-grid--rev .block-copy { order: 2; }
.block-grid--rev .block-viz { order: 1; }

.block-num {
  font-family: var(--serif); font-size: 14px; color: var(--mute);
  letter-spacing: .1em; display: block; margin-bottom: 14px;
}
.block-copy h2 {
  font-family: var(--serif); font-weight: 500; font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08; letter-spacing: -.015em; margin: 0 0 18px;
}
.block-copy p { color: var(--ink-soft); margin: 0 0 16px; max-width: 46ch; }
.block-copy strong { color: var(--ink); font-weight: 600; }
.block-copy--wide { max-width: 640px; margin-bottom: 44px; }
.lifeexp { font-style: italic; }

/* ---------- stat legend ---------- */
.stat-legend { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 10px; }
.stat-legend li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; }
.stat-legend .sw {
  width: 13px; height: 13px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.stat-legend .lab { color: var(--ink); }
.stat-legend .val { margin-left: auto; color: var(--ink-soft); font-variant-numeric: tabular-nums; font-weight: 500; }

/* ---------- mass grid ---------- */
.masgrid {
  display: grid;
  grid-template-columns: repeat(40, 1fr);
  gap: 3px;
  width: 100%;
}
.masgrid--mini { grid-template-columns: repeat(25, 1fr); gap: 2.5px; max-width: 280px; }
.dot {
  aspect-ratio: 1 / 1; border-radius: 50%; background: var(--dot-empty);
  transform: scale(.2); opacity: 0;
  transition: transform .5s var(--ease), opacity .5s var(--ease), background-color .3s var(--ease);
}
.masgrid.in .dot { transform: scale(1); opacity: 1; }
.dot.is-on { /* color set inline per segment */ }

.mini-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; margin-top: 8px; }
.mini { margin: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; }
.mini figcaption { font-size: 14px; color: var(--mute); line-height: 1.4; }
.mini figcaption strong {
  display: block; font-family: var(--serif); font-size: 30px; color: var(--ink); font-weight: 600;
}
.mini figcaption span { display: block; margin-top: 4px; }

/* ---------- births map (lead) ---------- */
.births-section {
  position: relative; z-index: 2; padding: 76px 0 72px;
  border-bottom: 1px solid var(--hair);
}
.births-head { max-width: 680px; margin: 0 auto 10px; text-align: center; }
.births-head .eyebrow { margin-bottom: 18px; }
.births-title {
  font-family: var(--serif); font-weight: 500; font-size: clamp(32px, 6vw, 60px);
  line-height: 1.04; letter-spacing: -.02em; margin: 0 0 18px;
}
.births-title em { font-style: italic; font-weight: 600; }
.births-lede { color: var(--ink-soft); margin: 0 auto; max-width: 560px; }
.births-lede strong { color: var(--ink); font-weight: 600; }

.births-figure { margin: 8px 0 0; }
.births-chart {
  width: 100%; max-width: 660px; margin: 0 auto;
  aspect-ratio: 1 / 1;
}
.births-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* country cells — area encodes births, monochrome ink-on-cream tiles */
.cell { cursor: default; }
.cell path {
  fill: var(--ink);
  stroke: var(--cream);
  stroke-width: 1.1;
  stroke-linejoin: round;
  transition:
    fill .25s var(--ease), fill-opacity .25s var(--ease),
    stroke .25s var(--ease), stroke-width .25s var(--ease), stroke-opacity .25s var(--ease);
}
.cell .c-name {
  font-family: var(--serif); font-weight: 600; fill: var(--ink);
  text-anchor: middle; pointer-events: none;
}
.cell .c-val {
  font-family: var(--sans); font-weight: 500; fill: var(--ink-soft);
  text-anchor: middle; pointer-events: none; font-variant-numeric: tabular-nums;
}
.cell .c-flag { text-anchor: middle; pointer-events: none; }
.cell .c-other { font-style: italic; font-weight: 500; fill: var(--ink-soft); }

/* continent group outlines */
.group path {
  fill: none; stroke: var(--ink); stroke-width: 2.4;
  stroke-linejoin: round; pointer-events: none; opacity: .5;
}

/* hover: whole continent gets a pastel wash; hovered country lifts brighter with ink border */
.births-chart.is-hovering[data-continent="Asia"] .cell[data-continent="Asia"] path {
  fill: var(--c-asia); fill-opacity: .36;
}
.births-chart.is-hovering[data-continent="Africa"] .cell[data-continent="Africa"] path {
  fill: var(--c-africa); fill-opacity: .36;
}
.births-chart.is-hovering[data-continent="Europe"] .cell[data-continent="Europe"] path {
  fill: var(--c-europe); fill-opacity: .36;
}
.births-chart.is-hovering[data-continent="North America"] .cell[data-continent="North America"] path {
  fill: var(--c-north-america); fill-opacity: .36;
}
.births-chart.is-hovering[data-continent="South America"] .cell[data-continent="South America"] path {
  fill: var(--c-south-america); fill-opacity: .36;
}
.births-chart.is-hovering[data-continent="Oceania"] .cell[data-continent="Oceania"] path {
  fill: var(--c-oceania); fill-opacity: .36;
}
.births-chart.is-hovering[data-continent="Other"] .cell[data-continent="Other"] path {
  fill: var(--c-other); fill-opacity: .36;
}

.births-chart.is-hovering .cell.is-hovered path {
  fill-opacity: .62;
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-opacity: .82;
}
.births-chart.is-hovering[data-continent="Asia"] .cell.is-hovered path {
  fill: color-mix(in srgb, var(--c-asia) 82%, #fff 18%);
}
.births-chart.is-hovering[data-continent="Africa"] .cell.is-hovered path {
  fill: color-mix(in srgb, var(--c-africa) 82%, #fff 18%);
}
.births-chart.is-hovering[data-continent="Europe"] .cell.is-hovered path {
  fill: color-mix(in srgb, var(--c-europe) 82%, #fff 18%);
}
.births-chart.is-hovering[data-continent="North America"] .cell.is-hovered path {
  fill: color-mix(in srgb, var(--c-north-america) 82%, #fff 18%);
}
.births-chart.is-hovering[data-continent="South America"] .cell.is-hovered path {
  fill: color-mix(in srgb, var(--c-south-america) 82%, #fff 18%);
}
.births-chart.is-hovering[data-continent="Oceania"] .cell.is-hovered path {
  fill: color-mix(in srgb, var(--c-oceania) 82%, #fff 18%);
}
.births-chart.is-hovering[data-continent="Other"] .cell.is-hovered path {
  fill: color-mix(in srgb, var(--c-other) 82%, #fff 18%);
}

.births-caption {
  text-align: center; margin-top: 26px; min-height: 22px;
  font-size: 14px; color: var(--ink-soft);
}
.bc-hint { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
.births-caption strong { font-family: var(--serif); font-weight: 600; color: var(--ink); }
.births-caption .bc-region { color: var(--mute); }

.births-source {
  text-align: center; max-width: 620px; margin: 18px auto 0;
  font-size: 12.5px; line-height: 1.55; color: var(--mute);
}
.births-source strong { color: var(--ink-soft); font-weight: 600; }

.births-scroll { text-align: center; margin-top: 30px; }
.births-scroll a {
  font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute);
  text-decoration: none; transition: color .2s var(--ease);
}
.births-scroll a:hover { color: var(--ink); }

/* ---------- births globe (testing) ---------- */
.births-figure--globe {
  margin-top: 56px;
  padding-top: 48px;
  border-top: 1px solid var(--hair);
}
.births-globe-tag {
  text-align: center;
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--mute);
}
.births-globe {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  position: relative;
}
.births-globe canvas { outline: none; }

.globe-country-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  user-select: none;
  transform: translate(-50%, -50%) scale(var(--label-scale, 1));
  white-space: nowrap;
  text-shadow: 0 0 6px var(--cream), 0 0 10px var(--cream);
}
.glob-label-flag {
  font-size: 21px;
  line-height: 1;
}
.glob-label-pct {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: -.01em;
}
.globe-country-label.is-large .glob-label-flag { font-size: 30px; }
.globe-country-label.is-large .glob-label-pct { font-size: 18px; }
.globe-country-label.is-medium .glob-label-flag { font-size: 24px; }
.globe-country-label.is-medium .glob-label-pct { font-size: 16px; }
.globe-country-label.is-small .glob-label-pct { font-size: 13px; font-weight: 500; color: var(--ink-soft); }

[data-theme="dark"] .globe-country-label {
  text-shadow: 0 0 8px var(--cream), 0 0 12px var(--cream);
}

/* ---------- beyond kardashev (manifesto) ---------- */
.beyond {
  position: relative; z-index: 2; background: var(--ink); color: var(--cream);
  padding: 96px 0 100px; transition: background-color .4s var(--ease), color .4s var(--ease);
}
.eyebrow--invert { color: var(--mute); }
.beyond-title {
  font-family: var(--serif); font-weight: 500; font-size: clamp(32px, 6vw, 60px);
  line-height: 1.04; letter-spacing: -.015em; margin: 0 0 36px;
}
.beyond-title em { font-style: italic; font-weight: 600; }
.beyond-body { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; max-width: 900px; margin-bottom: 64px; }
.beyond-body p { margin: 0; font-size: clamp(16px, 1.9vw, 19px); line-height: 1.6; color: color-mix(in srgb, var(--cream) 78%, transparent); }
.beyond-body strong { color: var(--cream); font-weight: 600; }

.ladder { display: grid; grid-template-columns: 1fr auto 1fr; gap: 28px; align-items: stretch; margin-bottom: 64px; }
.ladder-col {
  border: 1px solid color-mix(in srgb, var(--cream) 18%, transparent);
  border-radius: 16px; padding: 28px 26px;
}
.ladder-col--new { background: color-mix(in srgb, var(--cream) 8%, transparent); border-color: color-mix(in srgb, var(--cream) 34%, transparent); }
.ladder-tag { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }
.ladder-col h3 { font-family: var(--serif); font-weight: 600; font-size: 26px; margin: 8px 0 20px; }
.ladder-col ol { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 14px; counter-reset: step; }
.ladder-col li {
  font-size: 15.5px; line-height: 1.4; color: color-mix(in srgb, var(--cream) 72%, transparent);
  padding-left: 0;
}
.ladder-col li span {
  display: inline-block; min-width: 74px; font-weight: 600; color: var(--cream);
  font-family: var(--serif);
}
.ladder-col--old ol li { opacity: .65; }
.ladder-foot { margin: 0; font-size: 14px; font-style: italic; color: var(--mute); }
.ladder-foot em { color: color-mix(in srgb, var(--cream) 80%, transparent); }
.ladder-arrow { align-self: center; font-size: 26px; color: var(--mute); }

.beyond-quote {
  margin: 0 0 44px; padding: 0 0 0 24px; border-left: 2px solid color-mix(in srgb, var(--cream) 40%, transparent);
  font-family: var(--serif); font-size: clamp(22px, 3.2vw, 34px); line-height: 1.3; font-weight: 500;
  max-width: 820px;
}
.beyond-quote strong { font-weight: 600; font-style: italic; }
.beyond-close { max-width: 720px; margin: 0; font-size: clamp(16px, 1.9vw, 19px); color: color-mix(in srgb, var(--cream) 80%, transparent); }

@media (max-width: 760px) {
  .beyond-body { grid-template-columns: 1fr; gap: 18px; margin-bottom: 44px; }
  .ladder { grid-template-columns: 1fr; gap: 18px; }
  .ladder-arrow { transform: rotate(90deg); justify-self: center; }
}

/* ---------- footer ---------- */
.site-foot { position: relative; z-index: 2; background: var(--foot-bg); color: #cfccc9; padding: 56px 0; transition: background-color .4s var(--ease); }
.foot-inner { display: grid; gap: 18px; }
.foot-note { max-width: 720px; margin: 0; font-size: 14px; line-height: 1.7; color: #b7b3b0; }
.foot-note strong { color: #efece9; font-weight: 600; }
.foot-meta { margin: 0; font-family: var(--serif); font-size: 14px; color: #8d8a87; letter-spacing: .04em; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .site-nav { display: none; }
  .block-grid { grid-template-columns: 1fr; gap: 36px; }
  .block-grid--rev .block-copy { order: 1; }
  .block-grid--rev .block-viz { order: 2; }
  .masgrid { grid-template-columns: repeat(34, 1fr); }
  .mini-row { grid-template-columns: 1fr; gap: 44px; }
  .hero { padding-top: 64px; }
}
@media (max-width: 480px) {
  body { font-size: 16px; }
  .masgrid { grid-template-columns: repeat(28, 1fr); }
  .hero-counter { flex-direction: column; gap: 2px; }
  .births-section { padding: 56px 0 56px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .dot { transition: none; transform: none; opacity: 1; }
}

