/* ============================================================
   IFSM PAGE-TYPE STYLESHEET — topic pages + system landings
   One shared file for every IFSM page (per TOPIC_PAGE_CONVENTIONS:
   no per-page stylesheet copies). Extends the canonical
   Design-System/styles.css, which must be linked first.
   Blueprint: topic-biodiversity-v4 (approved 2026-06).
   ============================================================ */

.topic-first-look .eyebrow, .topic-section .eyebrow, .topic-facts .eyebrow,
.topic-actions .eyebrow, .topic-resources .eyebrow, .topic-related .eyebrow,
.topic-news .eyebrow, .system-topics .eyebrow, .system-connects .eyebrow {
  font-size: 14px; letter-spacing: 0.22em;
}
.eyebrow.harvest { color: var(--harvest-text, #A6581F); }
.eyebrow.lagoon { color: var(--lagoon-text, #257877); }

/* ===== HERO ===== */
/* Hero treatment (Design System 2026-09-02/03): banded eyebrow + half-strength pixel-anchored wash. Band fitted per page as --band. */
.topic-hero { --band: .35; position: relative; min-height: 72vh; color: #fff; overflow: hidden; }
.topic-hero .inner {
  max-width: var(--max); margin: 0 auto; padding: 120px 32px 72px;
  display: flex; flex-direction: column; justify-content: flex-end; min-height: inherit;
}
.topic-hero .crumb {
  font-family: var(--sans); font-weight: 600; font-size: 15px;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--honey); margin-bottom: 26px;
  align-self: flex-start; width: fit-content; background: rgba(0,0,0, var(--band, .35)); padding: 7px 14px 8px; border-radius: 2px;
}
.topic-hero .crumb a { color: var(--honey); }
.topic-hero h1 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(56px, 7.5vw, 96px); line-height: 0.96; color: #fff;
  margin: 0 0 22px; letter-spacing: -0.025em;
}
.topic-hero .subtitle {
  font-family: var(--sans); font-weight: 400; font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.4; color: rgba(255,255,255,0.92); max-width: 620px; margin: 0;
}
/* Photo credit: lower-right of the hero photo, clear of the title area */
/* Photo credit: below the photo, not on it. The hero has no bottom wash — white type over a
   bright photograph measured 1.43:1, which no alpha fixes — so the credit sits on the cream band
   beneath, at 4.54:1. Selected as the hero's next sibling rather than as its descendant: the
   element has left the hero, and a descendant rule would silently stop applying. */
.topic-hero + .hero-credit {
  font-family: var(--sans); font-weight: 500; font-size: 12px;  /* 25 Sep: every hero credit is 12px (Kirk) */
  letter-spacing: 0.04em; color: #716C63;
  background: var(--cream); margin: 0;
  padding: 12px 32px 0; text-align: right;
}

/* ===== FIRST LOOK ===== */
.topic-first-look { background: var(--cream); padding: 96px 0 80px; }
.topic-first-look .inner { max-width: 880px; margin: 0 auto; padding: 0 32px; }
.topic-first-look .eyebrow { display: block; margin-bottom: 7px; }  /* eyebrow to text equal by eye to every other eyebrow (Kirk, 14 Oct; was 20px) */
@media (max-width: 700px) { .topic-first-look .eyebrow { margin-bottom: 3px; } }
.topic-first-look p {
  font-family: var(--sans); font-weight: 300; font-size: clamp(22px, 2.3vw, 30px);
  line-height: 1.45; color: var(--soil); margin: 0; letter-spacing: -0.005em; max-width: 800px;
}
.topic-first-look p em { font-style: normal; font-weight: 500; color: var(--harvest-text, #A6581F); } /* K1, Kirk 23 Sep: bright Harvest was 2.65:1 */
.system-intro p + p { margin-top: 26px; }
.system-intro p { font-size: clamp(19px, 1.8vw, 24px); }

/* Inline glossary terms (desktop hover/focus; retired on touch by the responsive layer) */
.g-term { position: relative; border-bottom: 1.5px dotted var(--lagoon); cursor: help; color: inherit; }
.g-term:focus { outline: 2px solid var(--lagoon); outline-offset: 2px; border-radius: 2px; }
.g-term::after {
  content: attr(data-def); position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%); background: var(--soil); color: var(--cream);
  padding: 12px 16px; font-family: var(--sans); font-style: normal; font-weight: 400;
  font-size: 13px; line-height: 1.5; width: 300px; max-width: 80vw; white-space: normal;
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease; z-index: 10;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
}
.g-term::before {
  content: ""; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--soil);
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease; z-index: 10;
}
.g-term:hover::after, .g-term:focus::after,
.g-term:hover::before, .g-term:focus::before { opacity: 1; }
@media (hover: none), (max-width: 900px) {
  .g-term { border-bottom: none; cursor: inherit; }
  .g-term::after, .g-term::before { display: none; }
}

/* ===== CHALLENGE & OPPORTUNITY ===== */
.topic-section { padding: 96px 0; }
.topic-section .inner {
  max-width: var(--max); margin: 0 auto; padding: 0 32px;
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 88px; align-items: center;
}
.topic-section.flip .inner { grid-template-columns: 1fr 1.05fr; }
.topic-section.flip .text { order: 2; min-width: 0; }
.topic-section.flip .figure { order: 1; }
.topic-section .text { min-width: 0; }
.topic-section .text .eyebrow { margin-bottom: 18px; display: block; }
.topic-section .text h2 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(36px, 4.5vw, 54px); line-height: 1.02; color: var(--soil);
  margin: 0 0 28px; letter-spacing: -0.022em;
}
.topic-section .text p {
  font-family: var(--sans); font-weight: 400; font-size: 17px; line-height: 1.7;
  color: var(--soil); margin: 0; max-width: 560px;
}
.topic-section .figure {
  position: relative; aspect-ratio: 4/5; margin: 0;
  background-size: cover; background-position: center; background-color: var(--mist);
}
/* Photo credit: below the photo, not on it (Kirk, 9 Oct 2026), in the hero credit's style. The
   figure is a background-image box, so the caption hangs just under it and the figure reserves
   the room with a bottom margin rather than changing the photo's 4:5 / 4:3 shape. */
.topic-section .figure figcaption {
  position: absolute; top: 100%; left: 0; right: 0; padding-top: 10px;
  font-family: var(--sans); font-weight: 500; font-size: 12px; letter-spacing: 0.04em;
  line-height: 1.4; color: #716C63; text-align: right;
}
.topic-section .figure:has(figcaption) { margin-bottom: 34px; }
.figure-empty { display: flex; align-items: center; justify-content: center; }
.figure-empty span {
  font-family: var(--sans); font-weight: 600; font-size: 12px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--muted-text, #716C63);
}

/* ===== FACTS BAND ===== */
.topic-facts { background: var(--lagoon); color: #fff; padding: 96px 0; position: relative; overflow: hidden; }
.topic-facts .facts-deco-icon {
  position: absolute; right: -40px; top: -9px; width: 460px; height: 460px;
  color: #fff; opacity: 0.13; pointer-events: none; user-select: none;
}
.topic-facts .inner { max-width: var(--max); margin: 0 auto; padding: 0 32px; position: relative; }
.topic-facts .head { margin-bottom: 48px; max-width: 680px; }
.topic-facts .head .eyebrow { color: var(--honey-on-teal, #fad88f); font-size: 19px; font-weight: 700;  /* 2026-09-17 option C: 19px bold clears the 3:1 that large text needs, and the honey lifts to #fad88f because #f2c06a is 2.46:1 on this teal and fails 3:1 too. */}
.topic-facts .head h2 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(32px, 4vw, 44px); line-height: 1.05; color: #fff;
  margin: 14px 0 0; letter-spacing: -0.02em;
}
.topic-facts .stats {
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 48px;
  border-top: 1px solid rgba(255,255,255,0.22); padding-top: 44px;
}
.topic-facts .stat .num {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(52px, 5.5vw, 80px); line-height: 1; color: var(--honey-on-teal, #fad88f);
  letter-spacing: -0.025em; margin-bottom: 18px;
  /* 2026-09-17 option C: 19px bold clears the 3:1 that large text needs, and the honey lifts to #fad88f because #f2c06a is 2.46:1 on this teal and fails 3:1 too. */}
/* Lowercase suffix (e.g. the s in "100s") set smaller so it can't read as a capital */
.topic-facts .stat .num .num-suffix { font-size: 0.55em; }
.topic-facts .stat .body {
  font-family: var(--sans); font-weight: 400; font-size: 16px; line-height: 1.5;
  color: #fff; margin: 0 0 14px; max-width: 320px;
  /* 2026-09-17 panel C: solid, because 4.13:1 is the ceiling on this lagoon */}
.topic-facts .stat .src {
  font-family: var(--sans); font-weight: 600; font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase; color: #fff;
  /* 2026-09-17 panel C: solid, because 4.13:1 is the ceiling on this lagoon */}

/* ===== ACTIONS ===== */
.topic-actions { background: var(--paper); padding: 96px 0; position: relative; overflow: hidden; }
.topic-actions .inner {
  max-width: var(--max); margin: 0 auto; padding: 0 32px;
  display: grid; grid-template-columns: 1fr 1.5fr; gap: 72px; align-items: start; position: relative;
}
.topic-actions .head { position: relative; }
.topic-actions .head .eyebrow, .topic-actions .head h2, .topic-actions .head p { position: relative; z-index: 1; }
.topic-actions ol { position: relative; z-index: 1; }
.topic-actions .deco-wrap {
  position: absolute; top: 125px; left: 20px; margin: 0; line-height: 0;
  pointer-events: none; z-index: 0;
}
.topic-actions .deco-icon {
  width: 460px; height: 460px; color: var(--harvest); opacity: 0.15;
  pointer-events: none; user-select: none; display: block;
  transform: rotate(-18deg); transform-origin: center center;
}
.topic-actions .head .eyebrow { display: block; margin-bottom: 16px; }
.topic-actions .head h2 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(36px, 4.5vw, 52px); line-height: 1.02; color: var(--soil);
  margin: 0 0 16px; letter-spacing: -0.022em;
}
.topic-actions .head p {
  font-family: var(--sans); font-weight: 400; font-size: 16px; line-height: 1.55;
  color: var(--muted-text, #716C63); max-width: 320px; margin: 0;
}
.topic-actions ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 28px; }
.topic-actions ol li {
  display: grid; grid-template-columns: 52px 1fr; gap: 24px; align-items: start;
  padding-bottom: 28px; border-bottom: 1px solid var(--line);
}
.topic-actions ol li:last-child { border-bottom: none; padding-bottom: 0; }
.topic-actions ol .n {
  width: 44px; height: 44px; border-radius: 50%; background: var(--fern); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-weight: 600; font-size: 18px; line-height: 1; flex-shrink: 0;
}
.topic-actions ol p {
  font-family: var(--sans); font-weight: 400; font-size: 17px; line-height: 1.55;
  color: var(--soil); margin: 0; padding-top: 10px; min-width: 0;
}

/* ===== RESOURCES ===== */
.topic-resources { background: #EBF3EC; padding: 96px 0; }
.topic-resources .inner { max-width: var(--max); margin: 0 auto; padding: 0 32px; }
.topic-resources .head { margin-bottom: 48px; }
.topic-resources .head .eyebrow { display: block; }
.topic-resources .head h2 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(32px, 4vw, 44px); line-height: 1.05; color: var(--soil);
  margin: 14px 0 0; letter-spacing: -0.02em;
}
.resources-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 22px; }
.resource-card {
  background: #fff; overflow: hidden; display: flex; flex-direction: column;
  text-decoration: none; color: var(--soil); transition: transform 0.18s ease;
}
.resource-card:hover { transform: translateY(-3px); }
.resource-card .thumb { aspect-ratio: 4/3; background-size: cover; background-position: center; background-color: var(--mist); position: relative; }
.resource-card .thumb-tint { background: linear-gradient(140deg, #DDEBDD, #C2DCD9); }
.resource-card .thumb .play {
  position: absolute; left: 14px; bottom: 14px; width: 40px; height: 40px;
  border-radius: 999px; background: rgba(255,255,255,0.95);
  display: flex; align-items: center; justify-content: center; color: var(--fern);
}
.resource-card .thumb .play svg { width: 16px; height: 16px; }
.resource-card .body { padding: 18px 20px 22px; flex: 1; min-width: 0; }
.resource-card .kind {
  font-family: var(--sans); font-weight: 600; font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--harvest-text, #A6581F); display: block; margin-bottom: 8px;
}
.resource-card .kind.lesson { color: var(--lagoon-text, #257877); }
.resource-card .kind.qa { color: var(--fern-text, #367A46); }
.resource-card h3 {
  font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 20px;
  line-height: 1.15; color: var(--soil); margin: 0 0 6px; letter-spacing: -0.01em;
}
.resource-card .byline { font-family: var(--sans); font-weight: 400; font-size: 13px; color: var(--muted-text, #716C63); margin: 0; line-height: 1.4; }

/* ===== RELATED TOPICS + SYSTEM TOPIC CARDS ===== */
.topic-related { padding: 104px 0; background: var(--paper); }
.topic-related .inner, .system-topics .inner { max-width: var(--max); margin: 0 auto; padding: 0 32px; }
.topic-related .head, .system-topics .head { margin-bottom: 44px; }
.topic-related .head .eyebrow, .system-topics .head .eyebrow { display: block; }
.topic-related .head h2, .system-topics .head h2 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(32px, 4vw, 44px); line-height: 1.05; color: var(--soil);
  margin: 14px 0 0; letter-spacing: -0.02em;
}
.topic-related .grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 24px; }
.system-topics { padding: 104px 0; background: var(--paper); }
.system-topics .grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 18px; }
.topic-related .card, .system-topics .card {
  position: relative; aspect-ratio: 4/5; overflow: hidden;
  background-size: cover; background-position: center; background-color: var(--mist);
  text-decoration: none;
}
/* Card scrim: solid behind the full meta block (eyebrow included),
   feathering out just above it — keeps honey eyebrows legible on busy
   or warm-toned photos. */
.topic-related .card::after, .system-topics .card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.45) 72%, rgba(0,0,0,0.85) 100%);  /* the site's card scrim, as on Stories and Perspectives (Kirk, 8 Oct) */
}
.topic-related .card .meta, .system-topics .card .meta {
  position: absolute; left: 24px; right: 24px; bottom: 24px; z-index: 2; color: #fff;
}
.topic-related .card .meta .lbl, .system-topics .card .meta .lbl {
  font-family: var(--sans); font-weight: 600; font-size: 12px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--honey); display: block; margin-bottom: 8px;
}
.topic-related .card .meta h3 {
  font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 30px;
  line-height: 1.08; color: #fff; margin: 0 0 8px; letter-spacing: -0.01em;
}
.system-topics .card .meta h3 {
  font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 26px;
  line-height: 1.08; color: #fff; margin: 0 0 8px; letter-spacing: -0.01em;
}
.topic-related .card .meta p, .system-topics .card .meta p {
  font-family: var(--sans); font-weight: 400; font-size: 14px;
  color: rgba(255,255,255,0.86); margin: 0; max-width: 280px;
}

/* ===== SYSTEM CONNECTS BAND ===== */
.system-connects { padding: 96px 0; position: relative; overflow: hidden; }
.system-connects .connects-burst {
  position: absolute; right: -90px; top: -110px; width: 460px;
  opacity: 0.09; pointer-events: none; user-select: none;
}
.system-connects .inner { max-width: 880px; margin: 0 auto; padding: 0 32px; position: relative; }
.system-connects .eyebrow { color: var(--honey); display: block; margin-bottom: 14px; }
.system-connects h2 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(32px, 4vw, 44px); line-height: 1.05; margin: 0 0 22px; letter-spacing: -0.02em;
}
.system-connects p {
  font-family: var(--sans); font-weight: 300; font-size: clamp(18px, 1.8vw, 22px);
  line-height: 1.6; margin: 0; color: rgba(255,255,255,0.94);
}

/* ===== NEWSLETTER ===== */
.topic-news { background: var(--soil); color: var(--cream); padding: 88px 0; position: relative; overflow: hidden; }
.topic-news .news-burst {
  position: absolute; right: -90px; top: -110px; width: 460px;
  opacity: 0.09; pointer-events: none; user-select: none;
}
.topic-news .inner { position: relative; z-index: 1; }
.topic-news .inner { max-width: 880px; margin: 0 auto; padding: 0 32px; text-align: center; }
.topic-news .eyebrow { color: var(--honey); display: block; margin-bottom: 14px; }
.topic-news h2 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(28px, 3.5vw, 40px); line-height: 1.1; color: #fff;
  margin: 0 0 14px; letter-spacing: -0.02em;
}
.topic-news p { color: #d7d1c1; max-width: 560px; margin: 0 auto 28px; font-size: 15px; }
.topic-news form { display: flex; flex-wrap: wrap; gap: 12px; max-width: 540px; margin: 0 auto; }
.topic-news input {
  flex: 1; min-width: 0; padding: 14px 18px; border: none;
  background: rgba(255,255,255,0.08); color: #fff;
  font-family: var(--sans); font-size: 15px;
  border-bottom: 1.5px solid rgba(255,255,255,0.3);
}
.topic-news input::placeholder { color: rgba(255,255,255,0.5); }

/* Footer: Nourish burst as reversed bleed element (Foundation §6, Riff 03 —
   white burst on Soil for footer signatures; the page's one burst moment) */
.site-footer { position: relative; overflow: hidden; }
.site-footer .foot-burst {
  position: absolute; right: -90px; top: -110px; width: 460px;
  opacity: 0.08; pointer-events: none; user-select: none;
}
.site-footer .wrap { position: relative; z-index: 1; }

/* Brand mark fallback + footer mark */
.site-nav .brand .mark {
  font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 32px;
  color: var(--fern); letter-spacing: -0.02em; line-height: 1;
}
.foot-mark {
  font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 30px;
  color: var(--honey); letter-spacing: -0.02em;
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .system-topics .grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 1100px) {
  .resources-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 960px) {
  .topic-section .inner, .topic-section.flip .inner { grid-template-columns: 1fr; gap: 40px; }
  .topic-section.flip .text { order: 1; }
  .topic-section.flip .figure { order: 2; }
  .topic-section .figure { aspect-ratio: 4/5; width: 100%; max-width: 560px; }  /* the desktop frame at every width; 4:3 cut off faces (Kirk, 14 Oct 2026, option B) */
  .topic-facts .stats { grid-template-columns: 1fr; gap: 36px; }
  .topic-actions .inner { grid-template-columns: 1fr; gap: 32px; }
  .resources-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .topic-related .grid { grid-template-columns: 1fr; }
  .system-topics .grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .topic-news form { flex-direction: column; }
}
@media (max-width: 560px) {
  .system-topics .grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   SECTION HEADINGS: EYEBROW, TITLE, TEXT, TWO EQUAL GAPS (Kirk, 14 Oct 2026, option B)
   Every section heading on the Food System Map pages sits the same gap below its eyebrow as its
   text sits below it: about 30px on a laptop and 24px on a phone, measured on the letters. Where no
   text follows (By the numbers, Go deeper, Stay on the map, Five topics) only the first gap applies,
   so every heading on a page sits the same distance under its eyebrow.
   The tokens are measured as check_section_spacing.py measures them: --fsm-g1 from the eyebrow's
   baseline to the title's cap height, --fsm-g2 from the title's baseline to the text's cap height.
   Visible gaps come out equal because Playfair's ascenders rise above its cap height and its
   descenders drop below the baseline. Font arithmetic: Playfair Display ascent 1.082, descent 0.251,
   cap 0.708; Source Sans 3 ascent 1.024, descent 0.400, cap 0.660 (em).
   ========================================================================== */
:root { --fsm-g1: 34.25px; --fsm-g2: 36.5px; }
@media (max-width: 700px) { :root { --fsm-g1: 26.5px; --fsm-g2: 29px; } }
:root:root:root :is(.topic-section, .topic-actions, .topic-facts, .topic-resources, .topic-related, .system-topics, .why, .inputs, .spheres) :is(.eyebrow, .eyebrow-line) + h2 {
  margin-top: calc(var(--fsm-g1) - 0.5lh + 0.295em);
}
:root:root:root :is(.topic-section, .topic-actions, .topic-facts, .topic-resources, .topic-related, .system-topics, .why, .inputs, .spheres) :is(.eyebrow, .eyebrow-line) + h2:has(+ p) {
  margin-bottom: calc(var(--fsm-g2) - 0.5lh + 0.4155em);
}
:root:root:root :is(.topic-section, .topic-actions, .topic-facts, .topic-resources, .topic-related, .system-topics, .why, .inputs, .spheres) :is(.eyebrow, .eyebrow-line) + h2 + p {
  margin-top: calc(0.348em - 0.5lh);
}

/* Related topics cards on phones take the hero crops (Kirk, 23 Oct 2026): Food Access 30% across; Global Trade with the
   ship's bow on the card text's left edge (24px). Bow at 10.5% of a 1800 x 1296 photo; a 4:5 card shows it 1.736 x the
   card's width, so 24.77% + 24px holds at any width. Food Sovereignty stays centred (all five women in frame). */
@media (max-width: 700px) {
  .topic-related .card[style*="hero-food-access.jpg"], .system-topics .card[style*="hero-food-access.jpg"] { background-position: 30% 50%; }
  .topic-related .card[style*="hero-global-trade.jpg"], .system-topics .card[style*="hero-global-trade.jpg"] { background-position: calc(24.77% + 24px) 50%; }
}
