/* ---------- self-hosted faces (OFL); no third-party font CDN ---------- */
@font-face {
  font-family: "Source Serif 4 Variable"; font-style: normal;
  font-weight: 200 900; font-display: swap;
  src: url("assets/fonts/source-serif-4-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Source Serif 4 Variable"; font-style: italic;
  font-weight: 200 900; font-display: swap;
  src: url("assets/fonts/source-serif-4-latin-wght-italic.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Inter Variable"; font-style: normal;
  font-weight: 100 900; font-display: swap;
  src: url("assets/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}

/* ---------- paper typography ---------- */
body { -webkit-font-smoothing: antialiased; }

h1, h2, h3, h4, .navbar-brand, .sidebar, #TOC, .toc-actions {
  font-family: "Inter Variable", system-ui, sans-serif;
  letter-spacing: -0.012em;
}
h1.title { font-weight: 640; line-height: 1.12; letter-spacing: -0.022em; }
h2 { font-weight: 600; margin-top: 3.2rem; font-size: 1.32rem; }
h3 { font-weight: 600; margin-top: 2.2rem; font-size: 1.06rem; }

/* section numbers recede - they orient, they don't shout */
h2 .header-section-number, h3 .header-section-number {
  color: var(--cs-muted); font-weight: 400;
  font-variant-numeric: tabular-nums; margin-right: 0.5em;
}

p { margin-bottom: 1.15rem; }

.subtitle {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-weight: 400; font-size: 1.02rem; line-height: 1.5;
  color: var(--cs-muted); max-width: 34rem;
}

/* opening paragraph carries a little more weight */
.lead-in > p:first-of-type { font-size: 1.12rem; line-height: 1.6; }

/* ---------- the claim: a stated position, set apart ---------- */
.claim {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-weight: 500; font-size: 1.12rem; line-height: 1.45;
  border-left: 2px solid var(--cs-accent);
  padding: 0.1rem 0 0.1rem 1.1rem;
  margin: 2.2rem 0; color: var(--cs-ink);
}

/* ---------- figures ---------- */
figure, .quarto-figure { margin: 2.6rem 0; }

.cs-fig {
  background: var(--cs-paper);
  border: 1px solid var(--cs-rule);
  border-radius: 4px;
  padding: 1.5rem 1.25rem 1.1rem;
}
.cs-fig svg { display: block; width: 100%; height: auto; max-width: 100%; overflow: visible; }

.cs-fig-head {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--cs-muted); margin-bottom: 1rem;
}

/* captions state the claim, so give them real presence */
figcaption, .figure-caption, .quarto-float-caption {
  font-family: "Inter Variable", system-ui, sans-serif !important;
  font-size: 0.85rem !important; line-height: 1.5;
  color: var(--cs-muted); margin-top: 0.9rem;
  max-width: 36rem;
}
figcaption strong, .quarto-float-caption strong { color: var(--cs-ink); font-weight: 600; }

/* SVG type scale */
.cs-label { font-family: "Inter Variable", system-ui, sans-serif; font-size: 12px; font-weight: 500; fill: var(--cs-ink); }
.cs-sub   { font-family: "Inter Variable", system-ui, sans-serif; font-size: 11px; font-weight: 400; fill: var(--cs-muted); }
.cs-panel { font-family: "Inter Variable", system-ui, sans-serif; font-size: 11px; font-weight: 600; fill: var(--cs-muted); letter-spacing: 0.07em; text-transform: uppercase; }
.cs-num   { font-family: "IBM Plex Mono", monospace; font-size: 11px; fill: var(--cs-muted); }

/* ---------- margin notes ---------- */
.column-margin {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.78rem !important; line-height: 1.5; color: var(--cs-muted);
}

/* ---------- small caps run-in for the FAQ ---------- */
.objection {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-weight: 600; font-size: 0.98rem; color: var(--cs-ink);
  margin-bottom: 0.35rem; margin-top: 2rem;
}

/* ---------- narrow screens ---------- */
@media (max-width: 620px) {
  .cs-fig { padding: 1.1rem 0.85rem 0.8rem; }
  h1.title { font-size: 1.9rem; }
}

/* standalone counts inside figures: small numbers do not need a chart */
.cs-stat { font-family: "Inter Variable", system-ui, sans-serif; font-size: 27px; font-weight: 620; fill: var(--cs-ink); letter-spacing: -0.02em; }

/* ---------- masthead: the site says what it is before the paper starts ---------- */
.cs-masthead {
  padding-block: 0.6rem 2.2rem;
  border-bottom: 1px solid var(--cs-rule);
  margin-bottom: 2.4rem;
}
.cs-eyebrow {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--cs-muted);
}
.cs-wordmark {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 2.7rem; font-weight: 660; letter-spacing: -0.032em;
  line-height: 1; margin: 0.4rem 0 1rem;
}
.cs-standfirst {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 1.06rem; line-height: 1.55; max-width: 34rem;
  color: var(--cs-ink);
}
.cs-meta {
  display: grid; gap: 1.2rem; margin: 1.9rem 0 0;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.cs-meta dt {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--cs-muted); margin-bottom: 0.32rem;
}
.cs-meta dd {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.84rem; line-height: 1.45; margin: 0; color: var(--cs-ink);
}

/* ---------- definition cards ---------- */
.cs-cards {
  display: grid; gap: 1rem; margin: 1.7rem 0 1rem;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}
.cs-card {
  border: 1px solid var(--cs-rule); border-radius: 4px;
  padding: 1.05rem 1.05rem 1.15rem; background: var(--cs-wash);
}
.cs-card h3 {
  font-size: 0.7rem !important; font-weight: 600;
  letter-spacing: 0.085em; text-transform: uppercase;
  color: var(--cs-muted); margin: 0 0 0.6rem !important;
}
.cs-card p {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.85rem; line-height: 1.5; margin: 0;
}

/* ---------- where the website ends and the paper begins ---------- */
.cs-paper-open {
  border-top: 2px solid var(--cs-v1);
  padding-top: 1.3rem; margin: 3.4rem 0 2.2rem;
}
.cs-paper-title {
  font-family: "Source Serif 4 Variable", Georgia, serif;
  font-size: 2.05rem; font-weight: 600; line-height: 1.14;
  letter-spacing: -0.02em; margin: 0.45rem 0 0.85rem;
}
.cs-paper-byline {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.78rem; color: var(--cs-muted);
}
.cs-paper-sub {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.98rem; line-height: 1.55; color: var(--cs-muted);
  max-width: 34rem; margin-bottom: 0.9rem;
}

@media (max-width: 620px) {
  .cs-wordmark { font-size: 2.1rem; }
  .cs-paper-title { font-size: 1.6rem; }
}


/* ---------- choropleth ---------- */
.csm { stroke: var(--cs-paper); stroke-width: 0.4; stroke-linejoin: round; }
.csm.b0 { fill: var(--cs-b0); }
.csm.b1 { fill: var(--cs-b1); }
.csm.b2 { fill: var(--cs-b2); }
.csm.b3 { fill: var(--cs-b3); }

/* ---------- attribution under a figure ---------- */
.cs-source {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.72rem; line-height: 1.45; color: var(--cs-muted);
  margin-top: 0.85rem; padding-top: 0.7rem;
  border-top: 1px solid var(--cs-rule);
}
.cs-source a { color: var(--cs-muted); text-decoration: underline; text-underline-offset: 2px; }
.cs-source a:hover { color: var(--cs-accent); }

/* ---------- sources list ---------- */
.cs-refs { margin: 1.4rem 0 0; }
.cs-refs dt {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--cs-muted); margin: 1.7rem 0 0.6rem;
}
.cs-refs dd {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.85rem; line-height: 1.55; margin: 0 0 0.5rem;
  padding-left: 1rem; text-indent: -1rem;
}

/* ---------- author note ---------- */
.cs-about {
  display: grid; gap: 1.5rem; align-items: start;
  grid-template-columns: 132px 1fr;
  border-top: 1px solid var(--cs-rule);
  padding-top: 1.6rem; margin-top: 1rem;
}
.cs-portrait {
  display: block; width: 100%; height: auto;
  border-radius: 3px; background: var(--cs-wash);
}
.cs-about p {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.9rem; line-height: 1.55; margin: 0 0 0.7rem;
}
.cs-about p:last-child { margin-bottom: 0; }
@media (max-width: 620px) {
  .cs-about { grid-template-columns: 104px 1fr; gap: 1.1rem; }
}

/* the anecdote now sits under the title as a kicker, not as the title */
.cs-paper-kicker {
  font-family: "Source Serif 4 Variable", Georgia, serif;
  font-style: italic; font-size: 1.15rem;
  color: var(--cs-muted); margin-bottom: 0.55rem;
}

.cs-paper-byline a { color: var(--cs-accent); text-decoration: underline; text-underline-offset: 2px; }

/* download / version line above the references */
.cs-meta-line {
  font-family: "Inter Variable", system-ui, sans-serif;
  font-size: 0.82rem; color: var(--cs-muted);
  padding-bottom: 0.9rem; margin-bottom: 0.2rem;
  border-bottom: 1px solid var(--cs-rule);
}
.cs-meta-line a { color: var(--cs-accent); text-decoration: underline; text-underline-offset: 2px; }

/* Quarto appends its own format entry labelled "Typst" next to our custom "PDF"
   one, both pointing at the same file. It cannot be turned off through
   format-links, so hide it by its icon class; ours uses bi-file-earmark-pdf. */
.quarto-alternate-formats li:has(.bi-file-pdf) { display: none; }

/* the masthead is the page identity. Repeated here because styles.css
   loads last; the copy in the theme prevents a flash on first paint. */
#title-block-header.quarto-title-block { display: none !important; }

/* ---------- the mark ---------- */
.navbar-logo { height: 26px; width: auto; image-rendering: pixelated; }
.cs-masthead-head { display: flex; align-items: center; gap: 0.8rem; }
.cs-logo { height: 46px; width: 46px; image-rendering: pixelated; flex: none; }
@media (max-width: 620px) { .cs-logo { height: 36px; width: 36px; } }

/* ---- Floating contents menu (phones and tablets) ----
   Quarto hides the contents sidebar below 992px; _contents-menu.html adds a
   floating button that opens the same list of sections. */
.cs-toc-fab, .cs-toc-panel, .cs-toc-backdrop { display: none; }

@media (max-width: 991.98px) {
  .cs-toc-fab {
    display: inline-flex; align-items: center; gap: 0.5rem;
    position: fixed; z-index: 1040;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    min-height: 48px; padding: 0.7rem 1.1rem;
    font-family: "Inter Variable", system-ui, sans-serif; font-size: 0.9rem; font-weight: 600;
    color: var(--cs-paper); background: var(--cs-ink);
    border: 0; border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.12);
    cursor: pointer;
  }
  .cs-toc-fab .bi { font-size: 1.1rem; line-height: 1; }
  .cs-toc-fab:focus-visible { outline: 3px solid var(--cs-accent); outline-offset: 3px; }

  .cs-toc-backdrop {
    display: block; position: fixed; inset: 0; z-index: 1041;
    background: rgba(10, 12, 20, 0.35);
    opacity: 0; visibility: hidden;
    transition: opacity 0.18s ease, visibility 0s linear 0.18s;
  }

  .cs-toc-panel {
    display: flex; flex-direction: column;
    position: fixed; z-index: 1042;
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 60px);
    width: min(22rem, calc(100vw - 32px));
    max-height: min(70vh, calc(100dvh - 150px));
    background: var(--cs-paper); color: var(--cs-ink);
    border: 1px solid var(--cs-rule); border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
    opacity: 0; visibility: hidden;
    transform: translateY(8px) scale(0.98); transform-origin: bottom right;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
  }
  .cs-toc-panel.is-open, .cs-toc-backdrop.is-open {
    opacity: 1; visibility: visible; transform: none; transition-delay: 0s;
  }

  .cs-toc-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.4rem 0.4rem 0.4rem 1rem;
    border-bottom: 1px solid var(--cs-rule);
    font-family: "Inter Variable", system-ui, sans-serif;
    font-size: 0.74rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
    color: var(--cs-muted);
  }
  .cs-toc-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border: 0; border-radius: 8px;
    background: transparent; color: var(--cs-ink); cursor: pointer;
  }
  .cs-toc-close:hover, .cs-toc-close:focus-visible { background: var(--cs-wash); }

  .cs-toc-list {
    list-style: none; margin: 0; padding: 0.35rem 0 0.5rem;
    overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: var(--cs-rule) transparent;
  }
  .cs-toc-list a {
    display: flex; align-items: baseline; gap: 0.6rem;
    min-height: 44px; padding: 0.62rem 1rem;
    font-family: "Inter Variable", system-ui, sans-serif; font-size: 0.92rem; line-height: 1.35;
    color: var(--cs-ink); text-decoration: none;
  }
  .cs-toc-list a:hover, .cs-toc-list a:focus-visible { background: var(--cs-wash); outline: none; }
  .cs-toc-list a.is-current {
    background: var(--cs-wash); font-weight: 600;
    box-shadow: inset 3px 0 0 var(--cs-accent);
  }
  .cs-toc-num {
    flex: 0 0 1.4rem; color: var(--cs-muted);
    font-size: 0.82rem; font-variant-numeric: tabular-nums;
  }
}

/* sections receive focus after a jump; keep that invisible */
section[tabindex="-1"]:focus { outline: none; }

@media (prefers-reduced-motion: reduce) {
  .cs-toc-panel, .cs-toc-backdrop { transition: none; }
}
@media print {
  .cs-toc-fab, .cs-toc-panel, .cs-toc-backdrop { display: none !important; }
}

/* ---- Call to action (work with us) ---- */
.cs-masthead-cta { margin: 1.4rem 0 0; }
.cs-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem 1.5rem; margin: 2.2rem 0 1rem; padding: 1.4rem 1.5rem;
  background: var(--cs-wash); border: 1px solid var(--cs-rule); border-radius: 8px;
}
.cs-cta-text { flex: 1 1 16rem; }
.cs-cta-title {
  font-family: "Inter Variable", system-ui, sans-serif; font-size: 1.05rem; font-weight: 600;
  color: var(--cs-ink); margin-bottom: 0.3rem;
}
.cs-cta-text p { margin: 0; color: var(--cs-muted); font-size: 0.95rem; }
a.cs-cta-button {
  display: inline-flex; align-items: center; gap: 0.55rem;
  min-height: 44px; padding: 0.65rem 1.15rem;
  font-family: "Inter Variable", system-ui, sans-serif; font-size: 0.92rem; font-weight: 600;
  color: var(--cs-paper); background: var(--cs-ink);
  border-radius: 6px; text-decoration: none; white-space: nowrap;
}
a.cs-cta-button:hover { color: var(--cs-paper); opacity: 0.88; }
a.cs-cta-button:focus-visible { outline: 3px solid var(--cs-accent); outline-offset: 3px; }
a.cs-cta-button .bi { font-size: 1.05rem; line-height: 1; }
@media (max-width: 575.98px) {
  a.cs-cta-button { white-space: normal; }
}
