/* ==========================================================================
   Building Ithaca Better — site styles
   Bright earth-tone palette (greens, browns, ochre), layered gradients and
   a faint transit-map texture. Accessible, responsive, no JS needed.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light dark;

  /* Surfaces & text */
  --bg: #fdf9f0;
  --surface: #ffffff;
  --surface-2: #f6eedd;
  --ink: #1a150f;
  --ink-muted: #4a3f33;
  --border: #e3d3b8;

  /* Brand */
  --green-900: #143821;
  --green-800: #1b4d2c;
  --green-700: #226b36;
  --green-600: #2f8a45;
  --green-500: #4ea64a;
  --lime: #9cc84a;
  --green-100: #e2f2d8;
  --brown-900: #2e1c0f;
  --brown-800: #74390f;
  --brown-700: #8a4a1c;
  --brown-500: #c0702f;
  --ochre: #e7a83a;
  --gold: #f5c860;
  --brown-100: #fbe8cc;

  --link: var(--green-700);
  --link-hover: var(--brown-700);
  --focus: #c25e12;
  --button-ink: #2a1a08;

  /* Signature gradients */
  --grad-accent: linear-gradient(90deg, var(--green-600), var(--lime) 55%, var(--ochre));
  --grad-earth: linear-gradient(90deg, var(--brown-500), var(--ochre));
  /* Glows stay at 0.2 so hero text keeps AA contrast where it runs through them on phones. */
  --grad-canopy:
    radial-gradient(ellipse at 88% 12%, rgb(245 200 96 / 0.2), transparent 42%),
    radial-gradient(ellipse at 8% 100%, rgb(156 200 74 / 0.2), transparent 50%),
    linear-gradient(140deg, var(--green-900) 0%, #1d5930 45%, #266f37 100%);
  --grad-soil:
    radial-gradient(ellipse at 90% 100%, rgb(231 168 58 / 0.22), transparent 45%),
    linear-gradient(180deg, #3b2412 0%, var(--brown-900) 100%);
  --grad-meadow: linear-gradient(180deg, #f1dcae 0%, #ebcd94 100%);

  /* Colored bands */
  --hero-ink: #fffaf0;
  --hero-accent: #ffe3a3;
  --footer-ink: #f8eedf;
  --meadow-top: #f1dcae;
  --soil-top: #3b2412;
  --skyline-back: rgb(78 166 74 / 0.45);
  --texture-hero: rgb(255 255 255 / 0.045);
  --texture-meadow: rgb(138 74 28 / 0.045);
  --texture-soil: rgb(255 220 160 / 0.035);

  /* Charts */
  --chart-1: #287c3d;
  --chart-2: #b35a1f;
  --chart-grid: #e8dcc6;
  --chart-axis: #857663;

  /* Evidence badges */
  --badge-strong-bg: linear-gradient(135deg, #d4efc6, #bfe3a8);
  --badge-strong-ink: #133d20;
  --badge-moderate-bg: linear-gradient(135deg, #fbe7b4, #f5d58a);
  --badge-moderate-ink: #4d3509;
  --badge-emerging-bg: linear-gradient(135deg, #f8dcc8, #f0c6a8);
  --badge-emerging-ink: #5b2a0c;

  /* Type */
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --step--1: 0.889rem;
  --step-0: 1.125rem;
  --step-1: clamp(1.25rem, 1.15rem + 0.4vw, 1.4rem);
  --step-2: clamp(1.5rem, 1.3rem + 0.9vw, 1.9rem);
  --step-3: clamp(1.85rem, 1.5rem + 1.6vw, 2.6rem);
  --step-4: clamp(2.3rem, 1.7rem + 3vw, 3.75rem);

  /* Space & shape */
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 1rem;
  --radius-sm: 0.5rem;
  --shadow: 0 1px 2px rgb(40 30 15 / 0.06), 0 6px 20px rgb(60 45 20 / 0.08);
  --shadow-lift: 0 2px 4px rgb(40 30 15 / 0.08), 0 14px 34px rgb(34 107 54 / 0.18);
  --measure: 68ch;
  --container: 74rem;
  --edge-h: clamp(109px, 10.9vw, 153px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120e;
    --surface: #1f1a13;
    --surface-2: #29221a;
    --ink: #f8f1e4;
    --ink-muted: #d2c6b2;
    --border: #3f3629;

    --green-700: #86d494;
    --green-600: #6cc47c;
    --green-500: #58b068;
    --lime: #b5dc6a;
    --green-100: #1a2c1c;
    --brown-700: #f2b87c;
    --brown-500: #e38b4b;
    --ochre: #f0b44e;
    --brown-100: #35251a;

    --focus: #ffb35c;

    --grad-canopy:
      radial-gradient(ellipse at 88% 12%, rgb(240 180 78 / 0.22), transparent 42%),
      radial-gradient(ellipse at 8% 100%, rgb(120 180 60 / 0.22), transparent 50%),
      linear-gradient(140deg, #0b2213 0%, #143d22 50%, #1d5230 100%);
    --grad-soil:
      radial-gradient(ellipse at 90% 100%, rgb(240 180 78 / 0.12), transparent 45%),
      linear-gradient(180deg, #24170c 0%, #1a1009 100%);
    --grad-meadow: linear-gradient(180deg, #221c14 0%, #2b2217 100%);

    --meadow-top: #221c14;
    --soil-top: #24170c;
    --skyline-back: rgb(88 176 104 / 0.3);
    --texture-hero: rgb(255 255 255 / 0.035);
    --texture-meadow: rgb(242 184 124 / 0.04);

    --chart-1: #6cc47c;
    --chart-2: #eb9a5c;
    --chart-grid: #3f3629;
    --chart-axis: #a89a86;

    --badge-strong-bg: linear-gradient(135deg, #1f4a2a, #25583a);
    --badge-strong-ink: #d2f2d9;
    --badge-moderate-bg: linear-gradient(135deg, #4a3812, #5a4518);
    --badge-moderate-ink: #fbe6b0;
    --badge-emerging-bg: linear-gradient(135deg, #4a2c1a, #583420);
    --badge-emerging-ink: #fad8c0;

    --shadow: 0 1px 2px rgb(0 0 0 / 0.35), 0 6px 20px rgb(0 0 0 / 0.3);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.4), 0 14px 34px rgb(80 180 100 / 0.14);
  }
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  overflow-wrap: break-word;
}

img, svg { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
  margin: 0 0 0.5em;
}
h1 { font-size: var(--step-4); letter-spacing: -0.015em; font-weight: 700; }
h2 { font-size: var(--step-3); margin-top: 2.25em; letter-spacing: -0.01em; }
h3 { font-size: var(--step-1); margin-top: 1.75em; }

p, ul, ol, dl, table, figure, blockquote { margin: 0 0 1.25rem; }
p { text-wrap: pretty; }

a {
  color: var(--link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--link-hover); text-decoration-thickness: 0.14em; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

strong { font-weight: 700; }

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

/* Gradient text. Each element sets a solid `color` plus a --text-grad; the
   gradient is screen-only, so print (which drops backgrounds) and forced-colors
   modes fall back to the solid color instead of invisible text. */
@media screen and (forced-colors: none) {
  .brand-accent,
  .hero h1 .highlight,
  .stat-value,
  .pullquote::before {
    background: var(--text-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { position: relative; padding-block: clamp(3rem, 6vw, 5rem); }
.section > .container { position: relative; z-index: 1; }
main > article { position: relative; }
.section > .container > h2:first-child,
.eyebrow + h2 { margin-top: 0; }

/* Cream section with soft dappled light */
.section--dappled {
  background:
    radial-gradient(ellipse 45% 40% at 0% 55%, rgb(156 200 74 / 0.16), transparent 70%),
    radial-gradient(ellipse 50% 45% at 100% 100%, rgb(231 168 58 / 0.14), transparent 70%),
    var(--bg);
}

/* Warm meadow band with the transit-map texture */
.section--meadow { background: var(--grad-meadow); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brown-700);
  margin-bottom: 0.5rem;
}
.eyebrow::before {
  /* a transit-station marker */
  content: "";
  width: 0.75em;
  height: 0.75em;
  flex: none;
  border: 0.2em solid currentColor;
  border-radius: 50%;
}

.lead {
  font-size: var(--step-1);
  line-height: 1.55;
  max-width: 60ch;
}

/* ---------- Transit-map texture & skyline edges ---------- */
/* .has-texture paints a faint tiling transit map (masked, so it takes any color). */
.has-texture { position: relative; isolation: isolate; }
.has-texture::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--texture, transparent);
  -webkit-mask: url("/images/transit.svg") 0 0 / 360px 360px repeat;
  mask: url("/images/transit.svg") 0 0 / 360px 360px repeat;
}

/* A small, abstract city skyline at the bottom of a band, in the color of the
   band below, with distant hills and towers behind it. --skyline-x shifts the
   scene so each band shows a different stretch. */
.skyline {
  --skyline-x: 0%;
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: var(--edge-h);
  z-index: 2;
  pointer-events: none;
}
.skyline::before,
.skyline::after {
  content: "";
  position: absolute;
  inset: 0;
  -webkit-mask: url("/images/skyline.svg") var(--skyline-x) 100% / auto 100% repeat-x;
  mask: url("/images/skyline.svg") var(--skyline-x) 100% / auto 100% repeat-x;
}
.skyline::before {
  background: var(--skyline-back);
  -webkit-mask-image: url("/images/skyline-back.svg");
  mask-image: url("/images/skyline-back.svg");
}
.skyline::after { background: var(--edge-color, var(--bg)); }
.skyline--meadow { --edge-color: var(--meadow-top); --skyline-back: rgb(78 166 74 / 0.6); --skyline-x: 58%; }
.section--meadow .skyline { --skyline-back: rgb(47 138 69 / 0.55); }
.skyline--soil { --edge-color: var(--soil-top); --skyline-back: rgb(192 112 47 / 0.35); --skyline-x: 24%; }
.topic-hero .skyline { --skyline-x: 80%; }
@media (prefers-color-scheme: dark) {
  .skyline--soil { --skyline-back: rgb(227 139 75 / 0.4); }
  .skyline--meadow, .section--meadow .skyline { --skyline-back: rgb(88 176 104 / 0.22); }
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--focus);
  border-radius: var(--radius-sm);
  font-weight: 700;
}
.skip-link:focus { top: 1rem; }

/* ---------- Draft notice ---------- */
.draft-banner {
  background: linear-gradient(90deg, var(--brown-100), var(--surface-2), var(--brown-100));
  color: var(--ink);
  font-size: var(--step--1);
  text-align: center;
  padding: 0.5rem var(--gutter);
}

/* ---------- Site header ---------- */
.site-header {
  background: var(--bg);
  border-bottom: 4px solid transparent;
  border-image: var(--grad-accent) 1;
}
.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 0.875rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.1;
}
.brand:hover { color: var(--ink); }
.brand svg { width: 2.4rem; height: 2.4rem; flex: none; }
/* The house sits outside the circle's clip, filled with the header color so it reads as a cutout. */
.brand .brand-house { fill: var(--bg); }
.brand .brand-accent {
  color: var(--green-700);
  --text-grad: linear-gradient(90deg, var(--green-700), var(--green-600));
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0 -0.875rem; /* align pill text with the page edge */
  padding: 0;
}
.site-nav a {
  display: inline-block;
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  font-size: 1rem;
}
.site-nav a:hover { background: var(--green-100); color: var(--green-700); }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  border: 2px solid transparent;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  line-height: 1.2;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.button--primary {
  background: linear-gradient(135deg, #ffe08f, var(--gold) 40%, #e39a2c);
  color: var(--button-ink);
  box-shadow: 0 4px 14px rgb(227 154 44 / 0.35), inset 0 1px 0 rgb(255 255 255 / 0.5);
}
.button--primary:hover { color: var(--button-ink); filter: brightness(1.05); transform: translateY(-1px); }
.button--ghost { border-color: rgb(255 250 240 / 0.8); color: var(--hero-ink); background: rgb(255 255 255 / 0.06); }
.button--ghost:hover { background: rgb(255 255 255 / 0.16); color: var(--hero-ink); }
@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
  .button:hover { transform: none; }
}

/* ---------- Canopy bands (home hero + topic hero) ---------- */
.canopy {
  --texture: var(--texture-hero);
  background: var(--grad-canopy);
  color: var(--hero-ink);
}
.canopy h1, .canopy .lead { color: var(--hero-ink); }
.canopy .eyebrow { color: var(--hero-accent); }
.canopy a:not(.button) { color: var(--hero-accent); }
.canopy a:not(.button):hover { color: #fff; }
.canopy :focus-visible { outline-color: var(--gold); }

.hero .container {
  position: relative;
  padding-block: clamp(3.5rem, 9vw, 7rem) calc(clamp(3.5rem, 9vw, 6rem) + var(--edge-h));
}
.hero h1 { max-width: 16ch; }
.hero h1 .highlight {
  color: var(--gold);
  /* Ends on a pale lime: full --lime drops below 3:1 on the canopy's lighter areas. */
  --text-grad: linear-gradient(90deg, var(--gold), #ffe7a8 40%, #d9f0a8);
}
.hero .lead { opacity: 0.96; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }

/* ---------- Topic cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1.75rem;
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(180deg, var(--surface) 60%, var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card::before {
  /* gradient rule between the image and the text */
  content: "";
  order: 1;
  height: 5px;
  background: var(--card-accent, var(--grad-accent));
}
.card:has(a:hover) { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:has(a:hover) { transform: none; }
}
.card img { order: 0; aspect-ratio: 16 / 9; width: 100%; object-fit: cover; background: var(--surface-2); }
.card-body { order: 2; display: flex; flex-direction: column; flex: 1; padding: 1.25rem 1.5rem 1.5rem; }
.card h3 { margin-top: 0; font-size: var(--step-2); }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; z-index: 3; } /* whole card clickable */
.card h3 a:hover { color: var(--green-700); }
.card:has(a:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.card h3 a:focus-visible { outline: none; }
.card p { color: var(--ink-muted); }
.card-meta {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.card-cta { font-weight: 700; color: var(--green-700); }
.card--earth { --card-accent: var(--grad-earth); }
.card--water { --card-accent: linear-gradient(90deg, #2f8a6f, #7fbf9f 55%, var(--ochre)); }

/* ---------- Principles (home) ---------- */
.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
}
.principles li {
  background: linear-gradient(160deg, rgb(255 255 255 / 0.75), rgb(255 255 255 / 0.35));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
@media (prefers-color-scheme: dark) {
  .principles li { background: linear-gradient(160deg, rgb(255 255 255 / 0.06), rgb(255 255 255 / 0.02)); }
}
.principles h3 { margin-top: 0; }
.principles p { color: var(--ink-muted); margin: 0; }
.principle-icon {
  width: 3rem;
  height: 3rem;
  padding: 0.6rem;
  margin-bottom: 1rem;
  border-radius: 50%;
  color: #fff;
  /* Fixed (not theme) colors so the white glyph keeps 3:1 in both modes. */
  background: linear-gradient(135deg, #2f8a45, #1f5c31);
  box-shadow: 0 4px 12px rgb(34 107 54 / 0.3);
}
.principles li:nth-child(2) .principle-icon { background: linear-gradient(135deg, #b8701d, #8a4f12); }
.principles li:nth-child(3) .principle-icon { background: linear-gradient(135deg, #a8561f, #7a3d14); }

/* ---------- Topic page header ---------- */
.topic-hero .container {
  padding-block: clamp(2rem, 5vw, 3.5rem) calc(clamp(2rem, 5vw, 3rem) + var(--edge-h));
}
.topic-hero h1 { max-width: 22ch; }

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  font-size: var(--step--1);
}
.breadcrumb li:not(:last-child)::after {
  content: "/";
  content: "/" / "";
  margin-inline: 0.5rem;
  opacity: 0.7;
}
.breadcrumb [aria-current="page"] { opacity: 0.9; }

.topic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--step--1);
}
.topic-meta li {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  /* A dark tint (not a light one) keeps the gold labels above 4.5:1. */
  background: rgb(0 0 0 / 0.18);
  border: 1px solid rgb(255 255 255 / 0.25);
}
.topic-meta strong { color: var(--hero-accent); }

/* ---------- Topic layout: TOC + article ---------- */
.topic-layout {
  display: grid;
  gap: 2rem;
  padding-block: 2.5rem 4rem;
}
@media (min-width: 64rem) {
  .topic-layout { grid-template-columns: 15rem minmax(0, 1fr); gap: 3.5rem; }
  .toc { position: sticky; top: 1.5rem; align-self: start; }
}

.toc {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
  font-size: 1rem;
  box-shadow: var(--shadow);
}
.toc h2 {
  font-family: var(--font-body);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brown-700);
  margin: 0 0 0.75rem;
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: flex;
  gap: 0.6rem;
  padding: 0.4rem 0;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.35;
}
.toc a::before {
  content: counter(toc);
  content: counter(toc) / ""; /* the <ol> already announces position */
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-800), var(--green-900));
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.toc a:hover { color: var(--green-700); text-decoration: underline; }

/* ---------- Prose ---------- */
.prose { min-width: 0; }
.prose > * { max-width: var(--measure); }
.prose > figure,
.prose > .table-figure,
.prose > .stats,
.prose > .solutions { max-width: none; }
.prose > h2:first-child { margin-top: 0; }
.prose h2 { scroll-margin-top: 1.5rem; }
.prose h2::after {
  content: "";
  display: block;
  width: 4rem;
  height: 5px;
  margin-top: 0.6rem;
  border-radius: 999px;
  background: var(--grad-accent);
}
.prose ul, .prose ol { padding-left: 1.4em; }
.prose ul.stats, .prose ul.solutions, .prose ul.legend { padding-left: 0; }
.prose li + li { margin-top: 0.4em; }
.prose .stats li, .prose .solutions > li { margin-top: 0; }
.prose li::marker { color: var(--green-600); }

/* Citations */
.cite {
  font-size: 0.72em;
  line-height: 0;
  vertical-align: super;
  font-weight: 700;
  text-decoration: none;
  padding: 0.35em 0.25em; /* bigger tap target without moving the text */
}
.cite:hover { text-decoration: underline; }

/* ---------- Callouts ---------- */
.callout {
  background: linear-gradient(120deg, var(--green-100), var(--surface) 85%);
  border-left: 6px solid var(--green-600);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.25rem 1.5rem;
  margin-block: 0 2rem;
  box-shadow: var(--shadow);
}
.callout h2, .callout h3 {
  font-family: var(--font-body);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green-700);
  margin: 0 0 0.75rem;
}
.callout h2::after { content: none; }
.callout ul { margin: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout--note { background: linear-gradient(120deg, var(--brown-100), var(--surface) 85%); border-left-color: var(--brown-500); }
.callout--note h2, .callout--note h3 { color: var(--brown-700); }

/* ---------- Pull quote ---------- */
.pullquote {
  position: relative;
  margin: 3rem 0;
  padding: 1.75rem 1.75rem 1.5rem 4.25rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brown-100), var(--surface-2) 70%);
}
.prose > .pullquote { max-width: var(--measure); }
.pullquote::before {
  content: "“";
  content: "“" / "";
  position: absolute;
  left: 1rem;
  top: -0.35rem;
  font-family: var(--font-display);
  font-size: 6rem;
  line-height: 1;
  color: var(--brown-500);
  --text-grad: var(--grad-earth);
}
.pullquote blockquote { margin: 0; }
.pullquote p {
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.35;
  font-weight: 500;
  margin-bottom: 0.75rem;
}
.pullquote figcaption { margin: 0; }

/* ---------- Figures ---------- */
figure { margin-inline: 0; }
.figure { margin-block: 2rem; }
.figure img {
  width: 100%;
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}
figcaption {
  margin-top: 0.75rem;
  font-size: var(--step--1);
  color: var(--ink-muted);
  line-height: 1.5;
  max-width: var(--measure);
}
figcaption .credit { display: block; margin-top: 0.25rem; font-style: italic; }

/* ---------- Stat tiles ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin-block: 1.5rem 2rem;
}
.stats li {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgb(156 200 74 / 0.22), transparent 55%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem 1.25rem;
  margin: 0;
  box-shadow: var(--shadow);
}
.stats li::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--grad-accent);
}
.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 700;
  line-height: 1.1;
  color: var(--green-700);
  font-variant-numeric: tabular-nums;
  --text-grad: linear-gradient(120deg, var(--green-700), var(--green-600));
}
.stat-label { display: block; margin-top: 0.4rem; font-size: 1rem; color: var(--ink-muted); line-height: 1.45; }

/* ---------- Charts ---------- */
.chart {
  background:
    radial-gradient(ellipse at 100% 0%, rgb(231 168 58 / 0.10), transparent 50%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.5rem);
  margin-block: 2rem;
  box-shadow: var(--shadow);
}
.chart .chart-caption { margin: 0 0 1rem; max-width: none; }
.chart-title {
  display: block;
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.25rem;
}
.chart-subtitle { display: block; font-size: var(--step--1); color: var(--ink-muted); }
.chart svg { width: 100%; max-width: 44rem; font-family: var(--font-body); }
/* Chart text is in viewBox units: larger on phones, where the SVG is scaled down. */
.chart svg text { fill: var(--ink-muted); font-size: 22px; }
.chart svg .hide-narrow { display: none; }
@media (min-width: 40rem) {
  .chart svg text { font-size: 17px; }
  .chart svg .hide-narrow { display: inline; }
}
.chart svg .value-label { fill: var(--ink); font-weight: 700; }
.chart svg .series-label { font-weight: 700; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis { stroke: var(--chart-axis); stroke-width: 1.5; }
.chart .fill-1 { fill: url(#grad-1); }
.chart .fill-2 { fill: url(#grad-2); }
.chart .text-1 { fill: var(--chart-1); }
.chart .text-2 { fill: var(--chart-2); }
.chart .stop-1a { stop-color: var(--chart-1); }
.chart .stop-1b { stop-color: var(--green-500); }
.chart .stop-2a { stop-color: var(--chart-2); }
.chart .stop-2b { stop-color: var(--ochre); }
.chart .area-1 { fill: url(#grad-area); }
.chart .stop-area-a { stop-color: var(--chart-1); stop-opacity: 0.3; }
.chart .stop-area-b { stop-color: var(--chart-1); stop-opacity: 0; }
.chart .line-1 { stroke: var(--chart-1); stroke-width: 4; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-2 { stroke: var(--chart-2); stroke-width: 4; fill: none; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 9 7; }
.chart .dot-1 { fill: var(--chart-1); stroke: var(--surface); stroke-width: 3; }
.chart .dot-2 { fill: var(--chart-2); stroke: var(--surface); stroke-width: 3; }
.chart .partial { fill: url(#hatch); stroke: var(--chart-1); stroke-width: 2; }
.chart .hatch-bg { fill: var(--surface); }
.chart .hatch-line { stroke: var(--chart-1); stroke-width: 3; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  font-size: var(--step--1);
}
.legend li { display: inline-flex; align-items: center; gap: 0.5rem; }
.legend .swatch { width: 1.5rem; height: 0.3rem; border-radius: 2px; }
.legend .swatch--1 { background: var(--chart-1); }
.legend .swatch--2 { background: repeating-linear-gradient(90deg, var(--chart-2) 0 6px, transparent 6px 10px); }

.chart details { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: 0.75rem; }
.chart summary {
  cursor: pointer;
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--link);
  width: fit-content;
}
.chart details table { margin-top: 0.75rem; }
.chart-source { margin: 1rem 0 0; max-width: var(--measure); font-size: var(--step--1); color: var(--ink-muted); line-height: 1.5; }

/* ---------- Tables ---------- */
.table-figure {
  margin-block: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table-caption {
  margin: 0;
  max-width: none;
  padding: 1rem 1rem 0.75rem;
  font-weight: 700;
  font-size: var(--step-0);
  color: var(--ink);
}
.table-caption .caption-note { display: block; font-weight: 400; font-size: var(--step--1); color: var(--ink-muted); }
/* Only the grid scrolls; edge shadows hint that more columns are off-screen. */
.table-scroll {
  overflow-x: auto;
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left / 2.5rem 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right / 2.5rem 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgb(0 0 0 / 0.18), transparent) left / 0.9rem 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgb(0 0 0 / 0.18), transparent) right / 0.9rem 100% no-repeat scroll;
}
.table-scroll:focus-visible { outline-offset: -3px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.table-scroll table { margin: 0; min-width: 34rem; }
th, td { padding: 0.7rem 1rem; text-align: left; vertical-align: top; }
thead th {
  background: linear-gradient(180deg, var(--green-100), var(--surface-2));
  border-bottom: 3px solid var(--green-600);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
tbody tr + tr { border-top: 1px solid var(--border); }
tbody tr:hover { background: linear-gradient(90deg, var(--green-100), transparent); }
tbody th { font-weight: 700; }
td.num, th.num { text-align: right; }
tfoot td, tfoot th { border-top: 2px solid var(--border); font-weight: 700; background: var(--surface-2); }
.table-source { padding: 0.75rem 1rem 1rem; margin: 0; font-size: var(--step--1); color: var(--ink-muted); border-top: 1px solid var(--border); }

/* ---------- Solutions ---------- */
.solutions {
  display: grid;
  gap: 1.25rem;
  list-style: none;
  padding: 0;
  margin-block: 1.5rem 2rem;
}
@media (min-width: 48rem) {
  .solutions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.solutions > li {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface) 55%, var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 0;
  box-shadow: var(--shadow);
}
.solutions > li::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--grad-accent);
}
.solutions > li:has(.badge--moderate)::before { background: linear-gradient(90deg, var(--ochre), var(--gold)); }
.solutions > li:has(.badge--emerging)::before { background: var(--grad-earth); }
.solutions h3 { margin-top: 0.75rem; }
.solutions p { font-size: 1rem; margin-bottom: 0.75rem; }
.solutions p:last-child { margin-bottom: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: currentColor; }
.badge--strong { background: var(--badge-strong-bg); color: var(--badge-strong-ink); }
.badge--moderate { background: var(--badge-moderate-bg); color: var(--badge-moderate-ink); }
.badge--emerging { background: var(--badge-emerging-bg); color: var(--badge-emerging-ink); }

/* ---------- References ---------- */
.references {
  font-size: 1rem;
  padding-left: 1.75em;
}
.references li { padding-left: 0.25em; margin-bottom: 0.75rem; }
.references li:target { background: var(--brown-100); outline: 2px solid var(--brown-500); outline-offset: 4px; border-radius: 2px; }
.references .ref-type { font-size: 0.8rem; font-weight: 700; color: var(--brown-700); text-transform: uppercase; letter-spacing: 0.05em; }
.references a { overflow-wrap: anywhere; }
.backref { text-decoration: none; margin-left: 0.25rem; }

/* ---------- Prev / next ---------- */
.pager {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  padding-bottom: calc(3rem + var(--edge-h));
}
.pager a {
  display: block;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, var(--border), var(--border)) border-box;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.pager a:hover {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--grad-accent) border-box;
  color: var(--ink);
}
.pager .pager-label { display: block; font-size: var(--step--1); color: var(--ink-muted); }
.pager .pager-title { font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); color: var(--green-700); }
.pager .pager-next { text-align: right; }

/* ---------- Footer ---------- */
.site-footer {
  --texture: var(--texture-soil);
  background: var(--grad-soil);
  color: var(--footer-ink);
  font-size: 1rem;
}
.site-footer .container {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  padding-block: 3rem;
}
.site-footer h2 {
  font-family: var(--font-body);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin: 0 0 0.75rem;
}
.site-footer a { color: var(--footer-ink); }
.site-footer a:hover { color: var(--gold); }
.site-footer a[aria-current="page"] { color: var(--gold); font-weight: 700; text-decoration: none; }
.site-footer a[aria-current="page"]::before { content: "● "; content: "● " / ""; font-size: 0.7em; vertical-align: 0.15em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li + li { margin-top: 0.4rem; }
.site-footer p { margin: 0 0 0.75rem; opacity: 0.92; }
.site-footer :focus-visible { outline-color: var(--gold); }
.footer-bottom { border-top: 1px solid rgb(255 255 255 / 0.14); }
.footer-bottom .container { display: block; padding-block: 1.25rem; font-size: var(--step--1); opacity: 0.88; }

/* ---------- Print ---------- */
@media print {
  .draft-banner, .site-nav, .toc, .pager, .skip-link, .skyline { display: none !important; }
  .has-texture::before { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .canopy, .site-footer, .section--meadow { background: none !important; color: #000 !important; }
  .canopy h1, .canopy .lead, .canopy .eyebrow, .canopy a, .hero h1 .highlight,
  .topic-meta strong, .site-footer a, .site-footer h2 { color: #000 !important; }
  .legend .swatch { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .backref { display: none; }
  /* No skyline on paper, so drop the room reserved for it. */
  .hero .container, .topic-hero .container { padding-bottom: 1.5rem; }
  .section.section--edged { padding-bottom: 2rem; }
  /* Print chart data tables even when their <details> is closed. */
  .chart details::details-content { content-visibility: visible; display: block; }
  .chart summary { list-style: none; color: #000; }
  h2, h3, .chart-title { break-after: avoid; }
  .chart, .table-figure, figure, .solutions > li, .stats li, .callout { break-inside: avoid; }
}

/* Sections that end in a foliage edge need room for it */
.section--edged { padding-bottom: calc(clamp(3rem, 6vw, 5rem) + var(--edge-h)); }
.section--meadow { --texture: var(--texture-meadow); }
@media (prefers-color-scheme: light) {
  .section--meadow .eyebrow { color: var(--brown-800); }
  /* The default focus orange is under 3:1 on the meadow band. */
  .section--meadow :focus-visible { outline-color: var(--brown-800); }
}
/* Tone down the bright illustrations so they don't glare on dark pages. */
@media (prefers-color-scheme: dark) {
  .card img, .figure img { filter: brightness(0.85); }
}
