/* ==========================================================================
   Home page sections below the hero (src/features/home/views.js).
   Loaded on the home page only. Uses the site tokens from site.css: purple
   ink, the #6E42A6 accent, and the editorial type from site.css: Newsreader
   for headlines, kickers (small caps), deks and figures; Inter for links
   that act as buttons.
   ========================================================================== */

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------ Shared pieces */

.h-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem 1.5rem; margin-bottom: var(--s-4); padding-bottom: var(--s-2); border-bottom: 1px solid var(--line); }
.h-head .dateline { margin-bottom: 0.6rem; }
.h-title { margin: 0; font-size: clamp(1.75rem, 2.6vw, 2.3rem); }

.h-more {
  display: inline-flex; align-items: center; gap: 0.5em; white-space: nowrap;
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-dark);
}
.h-more:hover { color: var(--ink); }
.h-arrow { flex-shrink: 0; transition: transform 0.2s ease; }
.h-more:hover .h-arrow, a:hover > .h-read .h-arrow, .h-read:hover .h-arrow, .h-region:hover .h-arrow, .h-pk:hover .h-arrow { transform: translateX(3px); }

.h-kicker { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.9rem; margin: 0 0 0.45rem; font-family: var(--font-serif); font-size: 0.94rem; line-height: 1.3; font-variant-caps: all-small-caps; letter-spacing: var(--kicker-track); color: var(--muted); }
.h-type { font-weight: 650; color: var(--accent-dark); }

/* Kickers and small headings: Newsreader small caps, as in The Long Arc. */
.h-col-title, .h-stats-title, .h-map-caption, .h-pk-kicker, .h-tracker-meta dt, .h-region-count, .h-date-m, .h-live, .h-byline {
  font-family: var(--font-serif); font-variant-caps: all-small-caps; text-transform: none; letter-spacing: var(--kicker-track);
}
/* Deks and summaries in the serif, with old-style figures. */
.h-lead-summary, .h-latest-list p, .h-explainer p, .h-tracker p, .h-pk-intro, .h-map-body, .h-event-meta, .h-expert-title {
  font-family: var(--font-serif); font-variant-numeric: var(--nums-text);
}

/* Headlines in the editorial serif; underline on hover, like a newspaper. */
.h-lead-title, .h-latest-list h3, .h-explainer h3, .h-tracker h3, .h-event h3, .h-map-title, .h-pk-title, .h-expert-name {
  font-family: var(--font-serif); font-optical-sizing: auto; font-weight: var(--hed-weight); letter-spacing: -0.012em;
  font-variant-numeric: lining-nums proportional-nums; text-wrap: balance;
}
.h-lead-title a, .h-latest-list h3 a, .h-explainer h3 a, .h-tracker h3 a, .h-event h3 a {
  background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size 0.25s ease, color 0.15s ease;
}
.h-lead-title a:hover, .h-latest-list h3 a:hover, .h-explainer h3 a:hover, .h-tracker h3 a:hover, .h-event h3 a:hover { background-size: 100% 1px; color: var(--accent-dark); }

.h-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.h-map-actions { align-items: center; gap: var(--s-2) var(--s-3); }
.h-map-actions .h-more { color: var(--accent-soft); }
.h-map-actions .h-more:hover { color: #fff; }

/* ------------------------------------------------------ Lead + latest */

.h-lead-section { padding-top: var(--s-5); }
.h-lead-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.h-lead-grid.no-lead { grid-template-columns: minmax(0, 1fr); }

.h-lead-media { display: block; position: relative; aspect-ratio: 16 / 9; overflow: hidden; margin-bottom: var(--s-3); background: var(--ink); border-radius: var(--radius); }
.h-lead-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.h-lead-media:hover img { transform: scale(1.02); }

/* A lead story without a picture shows its designed cover (src/lib/covers.js). */
.h-lead-media.is-cover .cv { transition: transform 0.6s ease; }
.h-lead-media.is-cover:hover .cv { transform: scale(1.015); }

.h-lead-title { margin: 0 0 0.6rem; font-size: clamp(2rem, 3.5vw, 3.1rem); line-height: 1.04; letter-spacing: -0.02em; color: var(--ink); max-width: 24ch; }
.h-lead-title a { color: inherit; }
.h-lead-summary { max-width: 62ch; margin: 0 0 0.7rem; font-size: 1.24rem; font-style: italic; line-height: 1.45; color: var(--ink-2); }
.h-byline { margin: 0; font-size: 0.98rem; font-weight: 600; color: var(--ink); }

.h-latest { position: relative; padding-left: var(--s-4); border-left: 1px solid var(--line); }
.h-col-title {
  display: flex; align-items: center; gap: 0.6em; margin: 0 0 var(--s-2);
  font-size: 1.02rem; font-weight: 650; color: var(--accent-dark);
}
.h-col-title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(110, 66, 166, 0.16); }
.h-latest-list { list-style: none; margin: 0 0 var(--s-3); padding: 0; counter-reset: latest; }
.h-latest-list li { padding: var(--s-2) 0; border-bottom: 1px solid var(--line); }
.h-latest-list li:first-child { padding-top: 0.4rem; }
.h-latest-list h3 { margin: 0; font-size: 1.28rem; line-height: 1.22; }
.h-latest-list h3 a { color: var(--ink); }

/* ------------------------------------------------------ Issue Map band */

.h-map-band {
  position: relative; overflow: hidden;
  padding: var(--s-5) 0;
  background: radial-gradient(80% 120% at 85% 40%, #2F1F4D 0%, #1B1130 55%, #120B21 100%);
  color: var(--on-ink);
}
.h-map-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.55fr); gap: var(--s-5); align-items: center; }
.h-map-band .dateline { color: var(--accent-soft); }
.h-map-title { margin: 0 0 var(--s-2); font-size: clamp(1.8rem, 2.8vw, 2.5rem); line-height: 1.12; color: #fff; }
.h-map-body { margin: 0 0 var(--s-3); font-size: 1.1rem; line-height: 1.55; color: var(--on-ink); }
.h-map-count { margin: 0 0 0.8rem; font-size: 0.9rem; color: var(--on-ink); }
.h-map-count strong { font-family: var(--font-serif); font-optical-sizing: auto; font-size: 2.6rem; font-weight: 500; line-height: 1; color: #fff; margin-right: 0.15em; vertical-align: -0.12em; }
.h-map-count.is-empty { padding-left: var(--s-2); border-left: 2px solid var(--accent); }
.h-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; list-style: none; margin: 0 0 var(--s-4); padding: 0; font-size: 0.82rem; color: var(--on-ink); }
.h-legend li { display: inline-flex; align-items: center; gap: 0.45em; }
.h-legend b { font-weight: 600; color: #fff; }

.h-dot { display: inline-block; flex-shrink: 0; width: 9px; height: 9px; border-radius: 50%; background: #9AA0A6; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.5); }
/* Status colours: the same as the Issue Map (src/features/issues/data.js STATUSES). */
.h-dot.is-worsening { background: #E8663D; }
.h-dot.is-unchanging { background: #6A9BE0; }
.h-dot.is-improving { background: #3DBE8B; }
.h-dot.is-developing { background: #9AA0A6; }

.h-map-figure { margin: 0; min-width: 0; }
.h-map-canvas { position: relative; display: block; aspect-ratio: 10000 / 4160; }
.h-map-canvas img, .hmap-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.hmap-overlay { overflow: visible; }
.hmap-arc { fill: none; stroke: rgba(255, 255, 255, 0.8); stroke-width: 22; stroke-linecap: round; stroke-dasharray: 3 4; }
/* Drawn once the map scrolls into view (site.js adds .is-visible to .h-reveal elements). */
.js .reveal .hmap-arc { stroke-dashoffset: 500; }
.js .reveal.is-visible .hmap-arc { animation: h-draw 2.6s ease-out 0.3s forwards; }
.hmap-city { fill: #fff; }
.hmap-marker { stroke: #120B21; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
@keyframes h-draw { to { stroke-dashoffset: 0; } }

.h-map-figure figcaption { margin-top: var(--s-3); padding-top: var(--s-2); border-top: 1px solid rgba(255, 255, 255, 0.12); }
.h-map-caption { display: block; margin-bottom: 0.6rem; font-size: 0.94rem; font-weight: 600; color: var(--on-ink-muted); }
.h-issue-list { columns: 2; column-gap: var(--s-4); list-style: none; margin: 0 0 0.6rem; padding: 0; }
.h-issue-list li { break-inside: avoid; margin-bottom: 0.45rem; font-size: 0.9rem; line-height: 1.35; }
.h-issue-list a { display: inline-flex; align-items: baseline; gap: 0.55em; color: #fff; }
.h-issue-list a .h-dot { transform: translateY(-1px); }
.h-issue-list a:hover { color: var(--accent-soft); text-decoration: underline; text-underline-offset: 3px; }
.h-more-light { color: var(--accent-soft); }
.h-more-light:hover { color: #fff; }

/* The founder's quote, larger on the home page (the serif is set in site.css). */
.pull-quote { font-optical-sizing: auto; font-size: 1.85rem; line-height: 1.34; }
@media (max-width: 640px) { .pull-quote { font-size: 1.4rem; } }

/* ------------------------------------------------------- CUPA Explains */

.h-explainers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.h-explainer {
  position: relative; display: flex; flex-direction: column;
  padding: var(--s-3) var(--s-3) var(--s-3);
  background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.section-alt .h-explainer { background: var(--mist); }
.h-explainer:hover { box-shadow: 0 14px 34px rgba(42, 27, 69, 0.12); }
.h-explainer:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.h-explainer-img { aspect-ratio: 16 / 9; overflow: hidden; margin: calc(var(--s-3) * -1) calc(var(--s-3) * -1) var(--s-3); }
.h-explainer-img img { width: 100%; height: 100%; object-fit: cover; }
.h-q { font-family: var(--font-serif); font-size: 2.6rem; font-style: italic; line-height: 0.9; color: var(--accent-soft); margin-bottom: 0.4rem; }
.h-explainer h3 { margin: 0 0 0.7rem; font-size: 1.45rem; line-height: 1.2; }
.h-explainer h3 a { color: var(--ink); }
/* The whole card is clickable through the headline link. */
.h-explainer h3 a::after { content: ""; position: absolute; inset: 0; }
.h-explainer p { flex: 1; margin: 0 0 var(--s-2); font-size: 1.06rem; line-height: 1.5; color: var(--muted); }
.h-read { display: inline-flex; align-items: center; gap: 0.5em; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-dark); }
.h-explainer:hover .h-read .h-arrow { transform: translateX(3px); }

/* --------------------------------------------------- Live data + events */

.h-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-5); }
.h-split.is-single { grid-template-columns: minmax(0, 1fr); }
.h-col .h-head { margin-bottom: var(--s-3); }
.h-col .h-title { font-size: clamp(1.4rem, 1.9vw, 1.7rem); }

.h-trackers, .h-events { list-style: none; margin: 0; padding: 0; }
.h-split.is-single .h-trackers { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s-3); }

.h-tracker { padding: var(--s-3); margin-bottom: var(--s-2); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.section-alt .h-tracker { background: var(--mist); }
.h-live { display: inline-flex; align-items: center; gap: 0.5em; margin-bottom: 0.5rem; font-size: 0.94rem; font-weight: 650; line-height: 1.2; color: #1F7A57; }
.h-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #2BAA78; box-shadow: 0 0 0 0 rgba(43, 170, 120, 0.5); animation: h-pulse 2.4s ease-out infinite; }
@keyframes h-pulse { 0% { box-shadow: 0 0 0 0 rgba(43, 170, 120, 0.5); } 70%, 100% { box-shadow: 0 0 0 7px rgba(43, 170, 120, 0); } }
.h-tracker h3 { margin: 0 0 0.35rem; font-size: 1.3rem; line-height: 1.22; }
.h-tracker h3 a { color: var(--ink); }
.h-tracker p { margin: 0 0 0.8rem; font-size: 1.04rem; line-height: 1.48; color: var(--muted); }
.h-tracker-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 2rem; margin: 0; padding-top: 0.8rem; border-top: 1px dashed var(--line); }
.h-tracker-meta div { display: flex; flex-direction: column; }
.h-tracker-meta dt { font-size: 0.9rem; color: var(--muted); }
.h-tracker-meta dd { margin: 0; font-family: var(--font-serif); font-optical-sizing: auto; font-size: 1.25rem; color: var(--ink); }

.h-event { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: var(--s-3); align-items: start; padding: var(--s-2) 0 var(--s-3); border-bottom: 1px solid var(--line); }
.h-event:first-child { padding-top: 0; }
.h-date { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.65rem 0.25rem 0.55rem; background: var(--ink); color: #fff; border-radius: var(--radius); text-align: center; }
.h-date-d { font-family: var(--font-serif); font-optical-sizing: auto; font-size: 2rem; font-weight: 500; line-height: 1; }
.h-date-m { margin-top: 0.2rem; font-size: 0.92rem; font-weight: 600; line-height: 1.1; color: var(--accent-soft); }
.h-event h3 { margin: 0.25rem 0 0.3rem; font-size: 1.22rem; line-height: 1.25; }
.h-event h3 a { color: var(--ink); }
.h-event-meta { margin: 0; font-size: 1rem; color: var(--muted); }

/* ------------------------------------------------------------- Regions */

.h-regions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); gap: var(--s-3); align-items: stretch; }
.h-pk {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 0.6rem;
  min-height: 300px; padding: var(--s-4) var(--s-3) var(--s-3);
  background: linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 70%, var(--pine) 100%); color: var(--on-ink);
  border-radius: var(--radius);
}
.h-pk:hover { color: var(--on-ink); box-shadow: 0 18px 40px rgba(42, 27, 69, 0.3); }
.h-pk-kicker { font-size: 0.96rem; font-weight: 600; color: var(--accent-soft); }
.h-pk-title { font-size: clamp(1.7rem, 2.5vw, 2.2rem); line-height: 1.1; color: #fff; max-width: 14ch; }
.h-pk-intro { max-width: 40ch; font-size: 1.06rem; line-height: 1.5; }
.h-pk-counts { font-size: 0.8rem; letter-spacing: 0.02em; color: #fff; }
.h-pk-cta { display: inline-flex; align-items: center; gap: 0.5em; margin-top: auto; padding-top: var(--s-2); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #fff; }
.h-pk-arc { position: absolute; right: -40px; bottom: -26px; width: 300px; opacity: 0.28; pointer-events: none; }
.h-pk-arc path { fill: none; stroke: #fff; stroke-width: 1.5; stroke-dasharray: 4 6; }
.h-pk-arc circle { fill: #fff; }

.h-region-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0; padding: 0; list-style: none; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.h-region-list li { display: flex; }
.h-region {
  flex: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 0.6rem;
  min-height: 72px; padding: 1rem var(--s-3) 0.95rem; background: var(--paper);
  transition: background 0.15s ease;
}
.section-alt .h-region { background: var(--mist); }
.h-region:hover { background: var(--ink); }
.h-region-name { font-family: var(--font-serif); font-weight: 600; font-size: 1.16rem; line-height: 1.2; color: var(--ink); }
.h-region-count { display: inline-flex; align-items: center; gap: 0.5em; font-size: 0.94rem; font-weight: 600; line-height: 1.2; color: var(--accent-dark); }
.h-region:hover .h-region-name { color: #fff; }
.h-region:hover .h-region-count { color: var(--accent-soft); }

/* --------------------------------------------------------------- Stats */

.h-stats { margin-top: var(--s-5); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.h-stats-title { margin: 0 0 var(--s-3); font-size: 1.02rem; font-weight: 650; color: var(--accent-dark); }
.h-stats-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-3); margin: 0; }
.h-stat { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 0.4rem; padding-left: var(--s-2); border-left: 2px solid var(--accent); }
.h-stat dd { margin: 0; font-family: var(--font-serif); font-optical-sizing: auto; font-size: clamp(2.4rem, 3.6vw, 3.2rem); font-weight: 500; line-height: 1; letter-spacing: -0.02em; color: var(--ink); }
.h-stat dt { font-size: 0.78rem; line-height: 1.35; letter-spacing: 0.04em; color: var(--muted); max-width: 22ch; }
.h-stats-note { margin: var(--s-2) 0 0; font-size: 0.78rem; color: var(--muted); }

/* ------------------------------------------------------------- Experts */

.h-experts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); margin: 0; padding: 0; list-style: none; }
.h-expert a { display: block; color: var(--ink); }
.h-expert-photo { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; overflow: hidden; margin-bottom: 0.9rem; background: var(--ink); border-radius: var(--radius); }
.h-expert-photo img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(25%); transition: filter 0.3s ease, transform 0.5s ease; }
.h-expert a:hover img { filter: none; transform: scale(1.03); }
.h-expert-photo:has(.h-initials) { background: linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 70%, var(--pine) 100%); }
.h-initials { font-family: var(--font-serif); font-size: 3rem; color: var(--accent-soft); }
.h-expert-name { display: block; font-size: 1.25rem; line-height: 1.2; }
.h-expert a:hover .h-expert-name { color: var(--accent-dark); }
.h-expert-title { display: block; margin-top: 0.3rem; font-size: 0.98rem; font-style: italic; line-height: 1.35; color: var(--muted); }

/* ---------------------------------------------------------- Responsive */

@media (max-width: 1020px) {
  .h-lead-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
  .h-latest { padding-left: 0; border-left: 0; padding-top: var(--s-3); border-top: 2px solid var(--ink); }
  .h-map-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
  .h-explainers { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .h-explainers > :nth-child(3) { display: none; }
  .h-split { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
  .h-regions { grid-template-columns: minmax(0, 1fr); }
  .h-pk { min-height: 0; }
  .h-experts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .h-lead-section { padding-top: var(--s-4); }
  .h-head { align-items: flex-start; flex-direction: column; margin-bottom: var(--s-3); }
  .h-lead-title { font-size: 1.85rem; }
  .h-lead-summary { font-size: 1.02rem; }
  .h-explainers { grid-template-columns: minmax(0, 1fr); }
  .h-explainers > :nth-child(3) { display: flex; }
  .h-issue-list { columns: 1; }
  .h-map-figure { margin: 0 calc(var(--s-2) * -1); }
  .h-map-figure figcaption { margin-left: var(--s-2); margin-right: var(--s-2); }
  .h-region-list { grid-template-columns: minmax(0, 1fr); }
  .h-region { min-height: 0; flex-direction: row; align-items: center; padding: 0.85rem var(--s-2); }
  .h-event { grid-template-columns: 64px minmax(0, 1fr); gap: var(--s-2); }
  .h-stats-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h-stat dd { font-size: 2.3rem; }
  .h-experts { gap: var(--s-2); }
  .h-expert-name { font-size: 1.08rem; }
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal .hmap-arc, .js .reveal.is-visible .hmap-arc { animation: none; stroke-dashoffset: 0; }
  .h-live-dot { animation: none; }
}
