/* ======================================================================
   Spacing pass v1 — loaded after style.css, changes ONLY spacing.
   Colours, type, layout and components are untouched.
   Rough rule: section rhythm ~1.5x, inner padding/gaps ~1.3x.
   ====================================================================== */

/* Layout gutter: a bit more side air, content width kept ~the same. */
:root { --wrap: 1264px; }
.wrap { padding: 0 32px; }

/* ---------- topbar + header ---------- */
.topbar-inner { padding: 12px 0; }
.header-inner { gap: 32px; padding: 20px 0; }
.brand { gap: 14px; }
.brand-tag { margin-top: 5px; }
.site-nav { gap: 32px; }
.header-actions { gap: 12px; }

/* ---------- masthead ---------- */
.masthead { padding-block: clamp(64px, 9vw, 112px) clamp(36px, 4.5vw, 56px); }
.masthead-eyebrow { margin-bottom: 32px; gap: 16px; }
.masthead-tag { margin: 26px 0 36px; }
.masthead-lead { margin-top: 36px; }
.masthead-cta { margin-top: 40px; gap: 28px; }
.masthead-sections { margin-top: 52px; gap: 12px 12px; padding-top: 28px; }
.masthead-sections a { padding: 10px 20px; }

/* ---------- ticker ---------- */
.tickerbar-label { padding: 0 24px; }
.tickerbar-item { padding: 14px 32px; gap: 12px; }

/* ---------- section labels ---------- */
.feed .section-label, .essentials .section-label {
  padding-bottom: 18px; margin-bottom: 36px;
}

/* ---------- essentials ---------- */
.essentials { padding: 80px 0 16px; }
.essentials-grid { gap: 28px; }
.essential-body { padding: 26px 28px 32px; gap: 12px; }
.essential-more { margin-top: 10px; }

/* ---------- front: lead + rail ---------- */
.front { padding: 80px 0 16px; }
.front .lead { padding-right: 64px; }
.front .rail { padding-left: 56px; }
.lead-figure { margin-bottom: 32px; }
.lead-kicker { margin-bottom: 16px; }
.lead-title { margin-bottom: 20px; }
.lead-dek { margin-bottom: 24px; }

.rail-head { padding-bottom: 16px; margin-bottom: 4px; }
.brief { margin-bottom: 56px; }
.brief-item a { padding: 22px 0; gap: 6px 20px; }
.rail-sections a { padding: 16px 0; }

/* ---------- feed ---------- */
.page-home .feed { margin-top: 80px; padding-top: 52px; }
.feed { padding-bottom: 96px; }
.grid { gap: 36px 28px; }
.card-body { padding: 28px 28px 30px; gap: 13px; }
.card-meta { padding-top: 14px; }
.pagination { margin-top: 64px; }
.pagination .pg { padding: 12px 22px; }

/* ---------- footer ---------- */
.site-footer { margin-top: 48px; padding: 80px 0 56px; }
.footer-grid { gap: 48px 64px; }
.footer-brand-col .footer-brand { margin-bottom: 22px; }
.footer-desc { margin-bottom: 20px; }
.footer-head { margin-bottom: 22px; }
.footer-col { gap: 14px; }
.footer-contact .footer-note { margin-top: 10px; }
.footer-bottom { margin-top: 64px; padding-top: 28px; }

/* ---------- tablet (≤ 860) ---------- */
@media (max-width: 860px) {
  .wrap { padding: 0 24px; }
  .header-inner { gap: 24px; padding: 16px 0; }
  .front { padding-top: 56px; }
  .front .lead { padding-right: 0; padding-bottom: 44px; margin-bottom: 44px; }
  .front .rail { padding-left: 0; }
  .essentials { padding-top: 64px; }
  .page-home .feed { margin-top: 64px; padding-top: 44px; }
  .footer-grid { gap: 40px 48px; }
}

/* ---------- phone (≤ 560) ---------- */
@media (max-width: 560px) {
  .wrap {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
  .header-inner { gap: 14px; padding: 12px 0; }
  .site-nav { gap: 22px; }
  .topbar-inner { padding: 8px 0; }

  .masthead { padding-block: 52px 32px; }
  .masthead-eyebrow { margin-bottom: 18px; }
  .masthead-tag { margin: 16px 0 22px; }
  .masthead-lead { margin-top: 22px; }
  .masthead-cta { margin-top: 30px; gap: 20px; }
  .masthead-sections { margin-top: 36px; padding-top: 20px; gap: 8px; }
  .masthead-sections a { padding: 9px 16px; }

  .tickerbar-label { padding: 0 14px; }
  .tickerbar-item { padding: 12px 22px; }

  .essentials { padding: 48px 0 8px; }
  .essentials-grid { gap: 20px; }
  .essential-body { padding: 20px 20px 24px; gap: 10px; }

  .front { padding: 44px 0 8px; }
  .front .lead { padding-bottom: 36px; margin-bottom: 36px; }
  .lead-figure { margin-bottom: 24px; }
  .brief { margin-bottom: 44px; }
  .brief-item a { padding: 18px 0; gap: 4px 14px; }
  .rail-sections a { padding: 14px 0; }

  .feed .section-label, .essentials .section-label { margin-bottom: 26px; }
  .page-home .feed { margin-top: 52px; padding-top: 36px; }
  .feed { padding-bottom: 64px; }
  .grid { gap: 22px; }
  .card-body { padding: 22px 20px 24px; gap: 10px; }
  .pagination { margin-top: 44px; }

  .site-footer { margin-top: 64px; padding: 52px 0 40px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
  .footer-grid { gap: 36px; }
  .footer-bottom { margin-top: 40px; padding-top: 22px; }
}

/* ---------- small phone (≤ 420) ---------- */
@media (max-width: 420px) {
  .wrap {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }
}

/* ---------- topic pills: now a standalone row above The Essentials ---------- */
main > .masthead-sections { margin-top: 8px; padding-top: 32px; }
main > .masthead-sections + .essentials { padding-top: 64px; }
@media (max-width: 560px) {
  main > .masthead-sections { margin-top: 4px; padding-top: 22px; }
  main > .masthead-sections + .essentials { padding-top: 44px; }
}

/* ======================================================================
   v2 — fewer dividers, horizontal Essentials cards
   ====================================================================== */

/* Dividers removed: section-label rules, pills rule, feed rule, lead/rail split. */
.section-label::after { display: none; }
.feed .section-label, .essentials .section-label { border-bottom: 0; padding-bottom: 0; margin-bottom: 28px; }
main > .masthead-sections { border-top: 0; padding-top: 0; margin-top: 0; }
.page-home .feed { border-top: 0; }
.front .lead { border-right: 0; }

/* Essentials: two cards fill the row, image left, text right, no excerpt. */
.essentials-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.essential-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; }
.essential-media { aspect-ratio: auto; height: 100%; min-height: 220px; border-bottom: 0; border-right: 1px solid var(--line); }
.essential-body { justify-content: center; padding: 28px 30px; gap: 12px; }
.essential-title { font-size: 1.32rem; }
.essential-more { margin-top: 4px; }

@media (max-width: 900px) {
  .essentials-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .essentials-grid { gap: 20px; }
  .essential-card { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
  .essential-media { min-height: 150px; }
  .essential-body { padding: 18px 18px 20px; gap: 8px; }
  .essential-title { font-size: 1.08rem; }
  .feed .section-label, .essentials .section-label { margin-bottom: 20px; }
}

/* Card height follows the text, not the photo's native ratio. */
.essential-media { position: relative; min-height: 240px; }
.essential-media img { position: absolute; inset: 0; }
@media (max-width: 560px) { .essential-media { min-height: 150px; } }
/* Stacked lead/rail on tablet & phone: no rule between them. */
@media (max-width: 860px) { .front .lead { border-bottom: 0; } }

/* ======================================================================
   v3 — "Explore by topic" section, sans eyebrows everywhere
   ====================================================================== */
.topics { padding: 72px 0 0; }
.topics .section-label {
  font-size: .74rem; letter-spacing: .16em; color: var(--muted);
  border-bottom: 0; padding-bottom: 0; margin-bottom: 28px;
}
.topic-pills { justify-content: flex-start; max-width: none; margin: 0; padding: 0; border-top: 0; }
.topics + .essentials { padding-top: 72px; }

/* Eyebrows / small caps labels always use the sans, never the serif. */
.rail-head { font-family: var(--sans); }

@media (max-width: 860px) { .topics { padding-top: 56px; } .topics + .essentials { padding-top: 56px; } }
@media (max-width: 560px) {
  .topics { padding-top: 44px; }
  .topics .section-label { margin-bottom: 20px; }
  .topic-pills { justify-content: flex-start; gap: 8px; }
  .topics + .essentials { padding-top: 44px; }
}

/* ======================================================================
   v4 — Display serif: Besley (brand, nameplate, tagline, lead headline).
   Card, essentials and brief titles in Inter.
   ====================================================================== */
:root { --serif: "Besley", "Source Serif 4", Georgia, serif; }

.brand-name, .footer-brand-col .brand-name { font-weight: 600; font-size: 1.35rem; letter-spacing: -0.02em; }
.nameplate { font-weight: 500; letter-spacing: -0.035em; line-height: .98; font-size: clamp(2.5rem, 6.8vw, 4.4rem); }
.masthead-tag { font-weight: 400; font-size: clamp(1.1rem, 2.1vw, 1.4rem); letter-spacing: 0; }
.lead-title { font-weight: 500; letter-spacing: -0.025em; font-size: clamp(2rem, 3.6vw, 2.8rem); line-height: 1.08; }
.footer-tagline { font-size: .95rem; }

.card-title, .essential-title, .brief-title, .related-title {
  font-family: var(--sans); font-weight: 600; letter-spacing: -0.018em; line-height: 1.3;
}
.card-title { font-size: 1.12rem; }
.essential-title { font-size: 1.2rem; }
.brief-title { font-size: .98rem; }
@media (max-width: 560px) {
  .card-title { font-size: 1.08rem; }
  .essential-title { font-size: 1.02rem; }
}

/* ======================================================================
   v6 — Topic pills carry their article count in a circle
   ====================================================================== */
.topic-pills a { display: inline-flex; align-items: center; gap: 10px; padding: 7px 8px 7px 18px; }
.pill-count {
  display: inline-grid; place-items: center;
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: .74rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1;
  transition: background-color .15s ease, color .15s ease;
}
.topic-pills a:hover .pill-count { background: var(--accent); color: #fff; }
@media (max-width: 560px) { .topic-pills a { padding: 6px 7px 6px 15px; gap: 8px; } }

/* ======================================================================
   v7 — Option A: full-width lead hero, The Brief as 3 columns below
   ====================================================================== */
.front { grid-template-columns: minmax(0, 1fr); gap: 0; }
.front .lead { padding: 0; border: 0; margin: 0; }
.front .rail { padding: 0; margin-top: 48px; }

.lead-link { position: relative; display: block; border-radius: var(--radius); overflow: hidden; }
.lead-figure { aspect-ratio: 21 / 9; margin: 0; border-radius: var(--radius); }
.lead-figure::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(11,17,27,.96) 0%, rgba(11,17,27,.9) 38%, rgba(11,17,27,.55) 66%, rgba(11,17,27,.1) 92%);
}
.lead-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: clamp(28px, 4vw, 52px); max-width: 860px;
}
.lead-overlay .lead-kicker { color: var(--pulse-300); }
.lead-overlay .lead-title { color: #fff; margin-bottom: 16px; font-size: clamp(2.2rem, 4.4vw, 3.6rem); }
.lead-overlay .lead-dek { color: rgba(255,255,255,.82); margin-bottom: 20px; }
.lead-overlay .lead-meta { color: rgba(255,255,255,.6); }
.lead-link:hover .lead-title { color: #fff; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }

/* The Brief: three columns */
.rail-head { border-bottom: 0; padding-bottom: 0; margin-bottom: 20px; }
.brief { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin: 0; }
.brief-item { border-bottom: 0; border-top: 1px solid var(--line); }
.brief-item a { padding: 20px 0 0; }

@media (max-width: 860px) {
  .lead-figure { aspect-ratio: 16 / 9; }
  .front .rail { margin-top: 40px; }
  .brief { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .brief-item a { padding: 18px 0; }
}
/* Phones: text drops below the image so it stays readable. */
@media (max-width: 640px) {
  .lead-link { overflow: visible; border-radius: 0; }
  .lead-figure::after { display: none; }
  .lead-overlay { position: static; padding: 22px 0 0; }
  .lead-overlay .lead-kicker { color: var(--accent); }
  .lead-overlay .lead-title { color: var(--ink); font-size: clamp(1.8rem, 7vw, 2.3rem); }
  .lead-overlay .lead-dek { color: var(--muted); }
  .lead-overlay .lead-meta { color: var(--faint); }
  .lead-link:hover .lead-title { color: var(--ink); }
}

/* ======================================================================
   v8 — Pagination: centered, numbered, pill buttons
   ====================================================================== */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 72px; }
.pager-pages { display: flex; gap: 6px; }
.pager-num, .pager-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; border-radius: 999px; font-weight: 600; font-size: .92rem;
  font-variant-numeric: tabular-nums; transition: background-color .15s, color .15s, border-color .15s;
}
.pager-num { width: 44px; color: var(--muted); }
.pager-num:hover { background: var(--surface); color: var(--ink); }
.pager-num.is-current { background: var(--ink); color: var(--bg); }
.pager-btn { padding: 0 22px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.pager-btn:hover { border-color: var(--accent); color: var(--accent); }
.pager-btn.is-off { color: var(--faint); background: transparent; border-color: transparent; cursor: default; }
.pager-info { text-align: center; margin: 16px 0 0; color: var(--faint); font-size: .82rem; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .pager { margin-top: 48px; gap: 8px; }
  .pager-btn { padding: 0 16px; }
  .pager-btn.is-off { display: none; }
}

/* ======================================================================
   v9 — Bigger, uniform gaps between sections (--section-gap)
   ====================================================================== */
:root { --section-gap: 120px; }
.topics { padding-top: calc(var(--section-gap) - 24px); }
.topics + .essentials { padding-top: var(--section-gap); }
.front { padding: var(--section-gap) 0 0; }
.page-home .feed { margin-top: var(--section-gap); padding-top: 0; }
.feed { padding-bottom: var(--section-gap); }
.site-footer { margin-top: 0; }
.front .rail { margin-top: 56px; }

@media (max-width: 860px) { :root { --section-gap: 88px; } }
@media (max-width: 560px) { :root { --section-gap: 64px; } .front .rail { margin-top: 40px; } }

/* v10 — Lead hero gradient runs left → right so the whole text column (incl. eyebrow) sits on dark */
.lead-figure::after {
  background: linear-gradient(to right, rgba(11,17,27,.96) 0%, rgba(11,17,27,.9) 38%, rgba(11,17,27,.6) 60%, rgba(11,17,27,.15) 85%, transparent 100%);
}
.lead-overlay { max-width: 720px; }
@media (max-width: 860px) {
  .lead-figure::after { background: linear-gradient(to right, rgba(11,17,27,.95) 0%, rgba(11,17,27,.85) 55%, rgba(11,17,27,.4) 100%); }
}
/* Flag now sits on the dark side: invert it. */
.lead-flag { background: #fff; color: var(--ink-950); top: 20px; left: 20px; }
@media (max-width: 640px) { .lead-flag { background: var(--ink); color: var(--bg); } }

/* ======================================================================
   v11 — Header: no Latest/About; pill search; "How we work" + CTA
   appear only after the hero scrolls out (html.past-hero, set by script)
   ====================================================================== */
.site-search input { border-radius: 999px; padding: 9px 18px; }

.site-nav { align-items: center; gap: 24px; }
.site-nav .hdr-link, .site-nav .hdr-cta {
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
}
.past-hero .site-nav .hdr-link, .past-hero .site-nav .hdr-cta {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .25s ease, transform .25s ease, visibility 0s;
}
.site-nav .hdr-cta {
  padding: 10px 20px; font-size: .88rem; color: #fff; letter-spacing: 0;
  background: linear-gradient(135deg, var(--pulse-600), var(--aurora-500));
  background-size: auto;
}
.site-nav .hdr-cta:hover { color: #fff; background: linear-gradient(135deg, var(--pulse-700), var(--aurora-600)); background-size: auto; }
.site-nav .hdr-cta::after { display: none; }
.past-hero .site-nav .hdr-cta:hover { transform: translateY(-1px); }

/* Keep the nav in the header row on small screens (overrides the old wrap-to-row-3). */
@media (max-width: 760px) {
  .site-nav { order: 0; flex-basis: auto; margin-left: auto; overflow: visible; padding-bottom: 0; -webkit-mask-image: none; mask-image: none; padding-right: 0; }
  .header-actions { margin-left: 0; }
  .site-nav .hdr-link { display: none; }
}
/* Phones: the CTA takes the search field's place once it shows. */
@media (max-width: 560px) {
  .site-nav .hdr-cta { padding: 9px 14px; font-size: .82rem; }
  .past-hero .site-search { display: none; }
  .site-nav { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  .site-nav .hdr-link, .site-nav .hdr-cta { transform: none !important; }
}
/* Round theme toggle to match the pill search. */
.icon-btn { border-radius: 999px; }
@media (max-width: 560px) {
  .header-inner { flex-wrap: nowrap; }
  .site-nav { display: none; }
  .past-hero .site-nav { display: flex; }
  /* Once the CTA shows, the logo collapses to its mark to make room. */
  .past-hero .brand-text { display: none; }
}
@media (max-width: 560px) { .header-actions { margin-left: auto; } .past-hero .site-nav { margin-left: auto; } .past-hero .header-actions { margin-left: 0; } }

/* v12 — Explore by topic centered (label + pills) */
.topics .section-label { justify-content: center; }
.topic-pills, .topics .topic-pills { justify-content: center; }
@media (max-width: 560px) { .topic-pills, .topics .topic-pills { justify-content: center; } }

/* v13 — Softer corners: cards 16px, lead hero 20px, phones 14px */
:root { --radius: 16px; }
.lead-link, .lead-figure { border-radius: 20px; }
.card::before { border-radius: var(--radius) var(--radius) 0 0; }
@media (max-width: 640px) { .lead-link { border-radius: 0; } .lead-figure { border-radius: 14px; } }
@media (max-width: 560px) { :root { --radius: 14px; } }

/* ======================================================================
   v14 — Scroll reveal: content rises in from below, in order
   (classes added by script; nothing hidden without JS or with reduced motion)
   ====================================================================== */
.js-reveal .rv {
  opacity: 0; transform: translateY(28px);
  transition: opacity .7s ease var(--d, 0ms), transform .8s cubic-bezier(.2,.7,.2,1) var(--d, 0ms), border-color .2s ease, background-color .2s ease;
}
.js-reveal .rv.in { opacity: 1; transform: none; }

/* ======================================================================
   v15 — Soft pointer-follow glow across the whole page (desktop only)
   ====================================================================== */
body { background: transparent; }   /* html carries the page colour, so the glow can sit behind content */
.page-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(460px circle at var(--mx, 50%) var(--my, 30%),
    color-mix(in srgb, var(--accent) 16%, transparent),
    color-mix(in srgb, var(--aurora-500) 8%, transparent) 42%,
    transparent 72%);
  opacity: 0; transition: opacity .6s ease;
}
.page-glow.on { opacity: 1; }

/* v16 — Hero headline is now a sentence: a bit smaller, balanced over two lines */
.nameplate { font-size: clamp(2.3rem, 5.6vw, 4rem); line-height: 1.05; max-width: 16ch; margin-inline: auto; text-wrap: balance; }

/* v17 — Shorter hero so topics + the start of Essentials show on first load */
.masthead { padding-block: clamp(40px, 5vw, 72px) 0; }
.masthead-tag { margin: 18px 0 24px; }
.masthead-lead { margin-top: 24px; }
.masthead-cta { margin-top: 32px; }
.topics { padding-top: 72px; }
.topics .section-label { margin-bottom: 20px; }
.topics + .essentials { padding-top: 80px; }
@media (max-width: 860px) { .topics { padding-top: 56px; } .topics + .essentials { padding-top: 64px; } }
@media (max-width: 560px) {
  .masthead { padding-block: 36px 0; }
  .topics { padding-top: 48px; }
  .topics + .essentials { padding-top: 52px; }
}
.masthead { padding-block: clamp(32px, 4vw, 56px) 0; }
.topics { padding-top: 56px; }
.topics + .essentials { padding-top: 56px; }
.topics + .essentials .section-label { margin-bottom: 20px; }
@media (max-width: 560px) { .masthead { padding-block: 28px 0; } .topics { padding-top: 40px; } .topics + .essentials { padding-top: 44px; } }
/* v18 — More air above Explore by topic */
.topics { padding-top: 96px; }
@media (max-width: 860px) { .topics { padding-top: 72px; } }
@media (max-width: 560px) { .topics { padding-top: 56px; } }

/* ----------------------------------------------------------------------
   Besley scoped to the hero and the lead headline only (design intent),
   so it stays a distinctive display face and the rest keeps Source Serif 4
   (avoids the whole page reading like a newspaper).
   ---------------------------------------------------------------------- */
:root { --serif: "Source Serif 4", "Source Serif Pro", "Iowan Old Style", Charter, Georgia, "Times New Roman", serif; }
.nameplate, .masthead-tag, .lead-title {
  font-family: "Besley", "Source Serif 4", Georgia, serif;
}
