:root {
  --bg: #f7f7f5;
  --paper: #ffffff;
  --paper-alt: #fafaf9;
  --text: #202124;
  --text-2: #66676b;
  --text-3: #97989c;
  --line: #e5e5e2;
  --line-strong: #d5d5d1;
  --accent: #ff0173;
  --accent-2: #ffa916;
  --accent-soft: rgba(255, 1, 115, 0.06);
  --accent-line: rgba(255, 1, 115, 0.22);
  --green: #159455;
  --yellow: #ad7500;
  --red: #c54040;
  --gradient: linear-gradient(90deg, #ffa916 0%, #ff0173 100%);
  --font: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --content: 760px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(0, 0, 0, 0.025);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

/* Inline citation & cross-reference links (applied by i18n.js). Keep the flow
   color so dense citations stay quiet; signal clickability with a dotted
   underline that turns accent on hover/focus. */
.refx {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--line-strong);
  transition: color 160ms ease, border-color 160ms ease;
}

.refx:hover,
.refx:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

::selection {
  color: #fff;
  background: var(--accent);
}

.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: 1000;
  background: transparent;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gradient);
  will-change: width;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 28px;
  border-bottom: 1px solid rgba(229, 229, 226, 0.92);
  background: rgba(247, 247, 245, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar__type,
.lang-toggle {
  justify-self: end;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lang-toggle {
  min-width: 40px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  font-family: var(--font);
  line-height: 1;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.lang-toggle:hover {
  border-color: var(--accent-line);
  background: var(--paper);
  color: var(--accent);
}

.page-shell {
  position: relative;
  width: 100%;
}

.toc {
  position: fixed;
  top: 104px;
  left: max(24px, calc(50vw - 720px));
  width: 190px;
  max-height: calc(100vh - 128px);
  padding: 2px 0 28px;
  overflow-y: auto;
  scrollbar-width: none;
}

.toc::-webkit-scrollbar {
  display: none;
}

.toc__label {
  margin: 0 0 14px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toc nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc nav a {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 7px;
  align-items: baseline;
  padding: 5px 0;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-decoration: none;
  transition: color 180ms ease;
}

.toc nav a span {
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.toc nav a:hover,
.toc nav a.is-active {
  color: var(--text);
}

.toc nav a.is-active span {
  color: var(--accent);
}

.document {
  width: min(var(--content), calc(100% - 48px));
  min-width: 0;
  margin: 0 auto;
  padding: 0 0 96px;
}

.document-hero {
  padding: clamp(78px, 11vw, 126px) 0 clamp(76px, 9vw, 110px);
  border-bottom: 1px solid var(--line-strong);
  text-align: center;
}

.document-hero h1 {
  max-width: 690px;
  margin: 0 auto 30px;
  font-size: clamp(46px, 7.2vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.document-hero h1 em {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: normal;
}

.document-hero p {
  max-width: 700px;
  margin: 0 auto 16px;
  color: var(--text-2);
  font-size: 16px;
}

.document-hero .lede {
  color: var(--text);
  font-size: clamp(19px, 2.1vw, 23px);
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: -0.015em;
}

.chapter {
  padding: clamp(80px, 10vw, 116px) 0;
  border-bottom: 1px solid var(--line-strong);
}

.chapter__header {
  margin-bottom: 46px;
}

.chapter__header h2 {
  margin: 0;
  font-size: clamp(31px, 4.2vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.chapter__header h2 small {
  display: block;
  margin-top: 10px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

.chapter > p,
.method-notes p,
.bibliography p,
.confidence li {
  color: var(--text-2);
}

.chapter > p {
  margin: 0 0 24px;
}

.chapter > p + p {
  margin-top: 0;
}

.chapter strong {
  color: var(--text);
  font-weight: 650;
}

.chapter em {
  color: var(--text);
}

.chapter > h3 {
  margin: 60px 0 20px;
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: -0.025em;
}

.chapter__header + h3,
.chapter__header + p + h3 {
  margin-top: 0;
}

blockquote {
  position: relative;
  margin: 42px 0;
  padding: 8px 0 8px 34px;
  border-left: 2px solid var(--accent);
}

blockquote::before {
  content: '“';
  position: absolute;
  top: -2px;
  left: 12px;
  color: var(--accent);
  font-size: 27px;
  line-height: 1;
}

blockquote p {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.58;
  letter-spacing: -0.015em;
}

blockquote cite {
  display: block;
  margin-top: 12px;
  color: var(--text-3);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.callout {
  margin: 34px 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-alt);
  box-shadow: var(--shadow);
}

.callout--accent {
  border-color: var(--accent-line);
  background: linear-gradient(135deg, rgba(255, 169, 22, 0.055), rgba(255, 1, 115, 0.045));
}

.callout p {
  margin: 0;
  color: var(--text-2);
}

.thesis {
  margin-top: 42px !important;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  color: var(--text) !important;
  line-height: 1.65;
}

.table-wrap {
  width: 100%;
  margin: 30px 0 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.45;
}

th,
td {
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

thead th {
  color: var(--text-3);
  background: var(--paper-alt);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr:last-child > * {
  border-bottom: 0;
}

tbody td {
  color: var(--text-2);
}

td strong,
th strong {
  color: var(--text);
}

td small,
th small {
  display: block;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.35;
}

td.number,
.number {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.table-wrap--wide table {
  min-width: 700px;
}

.table-wrap--competition table {
  min-width: 920px;
}

.row-accent > * {
  background: var(--accent-soft);
}

.row-accent > *:first-child {
  box-shadow: inset 2px 0 var(--accent);
}

.row-total > * {
  background: #f2f2ef;
}

.row-muted > * {
  color: var(--text-3);
  background: #fbfbfa;
}

.split-callouts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 28px 0 38px;
}

.split-callouts > div {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-alt);
}

.split-callouts > div > span {
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.split-callouts p {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.62;
}

.method-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 32px 0 48px;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.method-list li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  padding: 19px 0;
  border-bottom: 1px solid var(--line);
}

.method-list li > span {
  padding-top: 2px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}

.method-list p {
  margin: 0;
  color: var(--text-2);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 34px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}

.metric-strip div {
  padding: 24px 18px;
  background: var(--paper);
}

.metric-strip strong {
  display: block;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.metric-strip span {
  display: block;
  margin-top: 7px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
}

.funnel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 30px 0 38px;
}

.funnel > div {
  position: relative;
  padding: 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.funnel > div:not(:nth-child(3))::after {
  content: '→';
  position: absolute;
  top: 50%;
  right: -10px;
  z-index: 2;
  width: 10px;
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
  transform: translateY(-50%);
}

.funnel > div > span,
.plan-highlight span {
  display: block;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.funnel > div > strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.funnel > div > p {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.funnel > div > small {
  display: block;
  margin-top: 7px;
  color: var(--text-3);
  font-size: 9px;
  line-height: 1.45;
}

.funnel .funnel__result {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 90px 150px 1fr;
  align-items: center;
  gap: 10px;
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.funnel .funnel__result strong,
.funnel .funnel__result p {
  margin: 0;
}

.funnel .funnel__result strong {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.evidence-list {
  margin: 26px 0 36px;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
  counter-reset: evidence;
}

.evidence-list li {
  position: relative;
  padding: 19px 0 19px 40px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  counter-increment: evidence;
}

.evidence-list li::before {
  content: counter(evidence, decimal-leading-zero);
  position: absolute;
  top: 21px;
  left: 0;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}

.key-readings {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 34px 0;
}

.key-readings > div {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-alt);
}

.key-readings > div > span {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}

.key-readings p {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

.penetration-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 28px;
  align-items: center;
  margin: 36px 0;
  padding: 28px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 169, 22, 0.055), rgba(255, 1, 115, 0.045));
}

.penetration-card__figure {
  padding-right: 24px;
  border-right: 1px solid var(--accent-line);
}

.penetration-card__figure strong {
  display: block;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 54px;
  line-height: 1;
  letter-spacing: -0.06em;
}

.penetration-card__figure span {
  display: block;
  margin-top: 9px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
}

.penetration-card p {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.65;
}

.plan-highlight {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 32px 0 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}

.plan-highlight > div {
  padding: 20px 18px;
  background: var(--paper);
}

.plan-highlight strong {
  display: block;
  margin-top: 7px;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.plan-highlight small {
  display: block;
  margin-top: 7px;
  color: var(--text-3);
  font-size: 9px;
  line-height: 1.35;
}

code {
  padding: 0.15em 0.42em;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper-alt);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.87em;
}

.som-table th {
  width: 52%;
  color: var(--text-2);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.som-table td {
  font-size: 12px;
}

.confidence-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 34px 0 42px;
}

.confidence {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.confidence header {
  display: grid;
  grid-template-columns: 10px auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-alt);
}

.confidence header > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.confidence--high header > span { background: var(--green); }
.confidence--mid header > span { background: var(--yellow); }
.confidence--low header > span { background: var(--red); }

.confidence header h3,
.confidence header small {
  margin: 0;
}

.confidence header h3 {
  font-size: 14px;
  line-height: 1.3;
}

.confidence header small {
  justify-self: end;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.confidence ul {
  margin: 0;
  padding: 18px 24px 18px 44px;
}

.confidence li {
  margin: 0 0 10px;
  padding-left: 4px;
  font-size: 14px;
  line-height: 1.65;
}

.confidence li:last-child {
  margin-bottom: 0;
}

.appendix {
  padding-top: clamp(72px, 9vw, 98px);
}

.appendix .chapter__header h2 {
  font-size: clamp(28px, 3.8vw, 38px);
}

.method-notes,
.bibliography {
  border-top: 1px solid var(--line);
}

.method-notes article,
.bibliography article {
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.method-notes h3,
.bibliography h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: -0.015em;
}

.bibliography h3 small {
  display: inline;
  margin-left: 6px;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.method-notes p,
.bibliography p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
}

.bibliography ul {
  margin: 0;
  padding-left: 20px;
}

.bibliography li {
  margin-bottom: 8px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.65;
}

.bibliography li:last-child {
  margin-bottom: 0;
}

.bibliography a {
  color: var(--accent);
  font-size: 0.9em;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.bibliography a:hover {
  text-decoration: underline;
}

.source-scale {
  margin-top: 34px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-alt);
}

.source-scale p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.7;
}

.document-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 42px 0 0;
  color: var(--text-3);
  font-size: 11px;
}

.document-footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.document-footer__brand img {
  width: 24px;
  height: 24px;
}

.document-footer a {
  grid-column: 2;
  grid-row: 1;
  color: var(--text-2);
  font-weight: 600;
  text-decoration: none;
}

.document-footer a:hover {
  color: var(--accent);
}

/* Auth: same visual language as the rest of the repository, adapted to this light document. */
.auth-overlay {
  background: var(--bg);
}

.auth-card {
  gap: 1.4rem;
}

.auth-lock {
  color: var(--accent);
}

.auth-title {
  color: var(--text);
  font-family: var(--font);
}

.auth-subtitle {
  color: var(--text-3);
  font-family: var(--font);
}

.auth-input {
  border-color: var(--line);
  background: var(--paper);
  color: var(--text);
  font-family: var(--font);
}

.auth-input::placeholder {
  color: var(--text-3);
}

.auth-input:focus {
  border-color: var(--accent);
}

.auth-submit {
  background: var(--gradient);
  font-family: var(--font);
}

.auth-error {
  font-family: var(--font);
}

.i18n-pending body {
  visibility: hidden;
}

@media (max-width: 1180px) {
  .toc {
    display: none;
  }
}

@media (max-width: 680px) {
  html {
    scroll-padding-top: 72px;
  }

  body {
    font-size: 15px;
  }

  .topbar {
    height: 56px;
    padding: 0 16px;
  }

  .topbar__type,
  .lang-toggle {
    font-size: 9px;
  }

  .page-shell {
    width: 100%;
  }

  .document {
    width: calc(100% - 32px);
    padding-bottom: 56px;
  }

  .document-hero {
    padding: 64px 0 72px;
  }

  .document-hero h1 {
    font-size: clamp(42px, 13vw, 60px);
  }

  .document-hero .lede {
    font-size: 19px;
  }

  .chapter {
    padding: 72px 0;
  }

  .chapter__header {
    margin-bottom: 36px;
  }

  .chapter__header h2 {
    font-size: 31px;
  }

  .chapter > h3 {
    margin-top: 46px;
    font-size: 19px;
  }

  .split-callouts,
  .key-readings {
    grid-template-columns: 1fr;
  }

  .metric-strip,
  .plan-highlight {
    grid-template-columns: 1fr;
  }

  .metric-strip div,
  .plan-highlight > div {
    padding: 18px;
  }

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

  .funnel > div::after {
    display: none;
  }

  .funnel .funnel__result {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .penetration-card {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .penetration-card__figure {
    padding: 0 0 20px;
    border-right: 0;
    border-bottom: 1px solid var(--accent-line);
  }

  .confidence header {
    grid-template-columns: 10px 1fr;
  }

  .confidence header small {
    display: none;
  }

  .confidence ul {
    padding-left: 36px;
  }

  .document-footer {
    grid-template-columns: 1fr;
  }

  .document-footer a {
    grid-column: 1;
    grid-row: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  :root {
    --bg: #fff;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 10pt;
  }

  .reading-progress,
  .topbar,
  .toc,
  .auth-overlay {
    display: none !important;
  }

  .page-shell {
    display: block;
    width: 100%;
  }

  .document {
    max-width: 100%;
  }

  .document-hero,
  .chapter {
    padding: 32px 0;
  }

  .chapter,
  .callout,
  .table-wrap,
  .confidence,
  .method-notes article,
  .bibliography article {
    break-inside: avoid;
  }

  .table-wrap {
    overflow: visible;
    box-shadow: none;
  }

  .table-wrap table {
    min-width: 0;
  }
}
