/* ==========================================================================
   BIOFIN Workbook 2024 — Online Summary
   Static stylesheet. No external dependencies; works from file:// or any host.
   ========================================================================== */

:root {
  --ink:        #14181c;
  --ink-soft:   #3d474f;
  --ink-mute:   #6b767f;
  --line:       #d9dde1;
  --line-soft:  #e9ecee;
  --paper:      #ffffff;
  --paper-alt:  #f2f3f4;
  --dark:       #08090a;

  --undp:       #0468b1;   /* UNDP blue */
  --undp-deep:  #01497f;
  --teal:       #2f9e9e;
  --green:      #1fd08a;   /* accent green from the cover lockup */
  --green-deep: #12a86d;
  --orange:     #d9481e;   /* primary call-to-action */
  --orange-hot: #ef5b30;

  --shell:      1240px;
  --gutter:     clamp(20px, 5vw, 64px);

  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue",
          "Nimbus Sans", Arial, sans-serif;

  --shadow-sm: 0 1px 2px rgba(8, 9, 10, .06), 0 4px 14px rgba(8, 9, 10, .05);
  --shadow-md: 0 2px 6px rgba(8, 9, 10, .07), 0 18px 44px rgba(8, 9, 10, .10);

  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* --------------------------------------------------------------- reset --- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* clears the sticky masthead (84) + chapter rail (52) */
  scroll-padding-top: 152px;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.68;
  color: var(--ink-soft);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p { margin: 0; }
img { max-width: 100%; height: auto; display: block; }
a   { color: var(--undp); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--undp-deep); }

h1, h2, h3, h4 {
  color: var(--ink);
  line-height: 1.18;
  margin: 0 0 .6em;
  font-weight: 700;
  letter-spacing: -.015em;
}

::selection { background: var(--green); color: var(--dark); }

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

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 200;
  background: var(--dark); color: #fff; padding: 12px 20px;
  border-radius: 0 0 6px 6px; font-weight: 700; text-decoration: none;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 0; color: #fff; }

/* -------------------------------------------------------------- header --- */

.masthead {
  position: sticky; top: 0; z-index: 100;
  background: var(--dark);
  border-bottom: 1px solid rgba(255, 255, 255, .10);
}
.masthead__inner {
  display: flex; align-items: center; gap: 28px;
  min-height: 84px;
}
.masthead__logo { flex: 0 0 auto; }
.masthead__logo img { height: 56px; width: auto; }

.nav { margin-left: auto; }
.nav__list {
  display: flex; align-items: center; gap: 6px;
  list-style: none; margin: 0; padding: 0;
}
.nav__link {
  display: block; padding: 10px 14px;
  color: rgba(255, 255, 255, .84);
  font-size: 13px; font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase;
  text-decoration: none; border-radius: 4px;
  transition: color .16s var(--ease), background-color .16s var(--ease);
  white-space: nowrap;
}
.nav__link:hover { color: #fff; background: rgba(255, 255, 255, .09); }
.nav__link[aria-current="page"],
.nav__link.is-active { color: var(--green); }

/* chapter dropdown */
.nav__group { position: relative; }
.nav__toggle {
  display: inline-flex; align-items: center; gap: 8px;
  /* family only — size/weight/tracking/case come from .nav__link on this same
     element, and a `font` shorthand here would reset all of them */
  font-family: inherit; line-height: inherit;
  background: none; border: 0; cursor: pointer;
}
.nav__toggle::after {
  content: ""; width: 7px; height: 7px; margin-top: -3px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform .2s var(--ease);
}
.nav__group.is-open .nav__toggle::after { transform: rotate(-135deg); margin-top: 2px; }

.nav__menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 30;
  min-width: 340px; padding: 10px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-md);
  list-style: none; margin: 0;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
}
.nav__group.is-open .nav__menu { opacity: 1; visibility: visible; transform: none; }
.nav__menu a {
  display: flex; gap: 12px; align-items: baseline;
  padding: 9px 12px; border-radius: 6px;
  color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none;
}
.nav__menu a:hover { background: var(--paper-alt); color: var(--undp-deep); }
.nav__menu a[aria-current="page"] { color: var(--undp); background: #eef6fc; }
.nav__menu .num {
  flex: 0 0 auto; width: 22px;
  font-size: 12px; font-weight: 800; letter-spacing: .06em;
  color: var(--ink-mute);
}

/* ---------------------------------------------------- language switch --- */
/* Sits OUTSIDE .nav so it stays reachable on mobile without opening the
   burger — switching language is a top-level need, not a menu item. */

.langswitch {
  flex: 0 0 auto; display: flex; align-items: center;
  margin-left: 22px; padding: 3px;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 999px;
}
.langswitch__opt {
  display: block; padding: 5px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: .08em;
  color: rgba(255, 255, 255, .68); text-decoration: none;
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.langswitch__opt:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.langswitch__opt[aria-current] { background: var(--green); color: var(--dark); }

.burger {
  display: none; margin-left: auto;
  width: 46px; height: 46px; padding: 0;
  background: none; border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 6px; cursor: pointer;
}
.burger span {
  display: block; width: 20px; height: 2px; margin: 4px auto;
  background: #fff; transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* -------------------------------------------------- chapter rail ------- */
/* Always-visible jump-to-any-chapter bar. Sticks directly under the masthead,
   so `top` here must equal the masthead height (and track it at breakpoints). */

.chapterbar {
  position: sticky; top: 84px; z-index: 95;
  background: #101315;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
}
.chapterbar__inner {
  display: flex; align-items: center;
  min-height: 52px;
}
.chapterbar__list {
  display: flex; align-items: center; gap: 2px;
  list-style: none; margin: 0; padding: 0;
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none; -ms-overflow-style: none;
}
.chapterbar__list::-webkit-scrollbar { display: none; }
.chapterbar__link {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 8px 12px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  color: rgba(255, 255, 255, .74); text-decoration: none;
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.chapterbar__link:hover { background: rgba(255, 255, 255, .10); color: #fff; }
.chapterbar__num {
  font-size: 11px; font-weight: 800; letter-spacing: .06em;
  color: rgba(255, 255, 255, .45);
}
.chapterbar__link:hover .chapterbar__num { color: rgba(255, 255, 255, .7); }
.chapterbar__link[aria-current="page"] { background: var(--green); color: var(--dark); }
.chapterbar__link[aria-current="page"] .chapterbar__num { color: rgba(8, 9, 10, .55); }

/* reading progress */
.progress {
  position: fixed; inset: 0 0 auto 0; z-index: 120;
  height: 3px; background: transparent; pointer-events: none;
}
.progress__bar {
  /* scaleX, not width — this updates on every scroll frame, so it must stay
     on the compositor and off the layout path. */
  height: 100%; width: 100%;
  transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--green), var(--undp));
  transition: transform .08s linear;
}

/* ---------------------------------------------------------------- hero --- */

.hero {
  position: relative; overflow: hidden;
  background: var(--dark); color: #fff;
  min-height: min(78vh, 660px);
  display: flex; align-items: center;
}
/* Fit by HEIGHT (not cover) and anchor right: the photo's own black background
   blends into --dark, so the leftover space becomes the text field instead of
   the composition being cropped. Keeps the butterfly clear of the headline. */
.hero__media {
  position: absolute; inset: 0;
  background: var(--dark) url("../img/hero-butterfly.jpg") no-repeat right center / auto 100%;
}
.hero__media::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(95deg, #08090a 32%, rgba(8, 9, 10, .8) 44%, rgba(8, 9, 10, 0) 58%),
    linear-gradient(0deg, rgba(8, 9, 10, .5), rgba(8, 9, 10, 0) 40%);
}
/* padding-block only — the .shell class on the same element owns padding-inline */
.hero__inner { position: relative; z-index: 2; padding-block: clamp(56px, 9vw, 110px); }

.hero__eyebrow {
  display: inline-block; margin-bottom: 22px;
  font-size: 12px; font-weight: 800; letter-spacing: .24em; text-transform: uppercase;
  color: rgba(255, 255, 255, .72);
}
.hero__title {
  margin: 0 0 8px;
  font-size: clamp(46px, 7.4vw, 92px);
  font-weight: 800; line-height: .98; letter-spacing: -.03em;
  color: #fff; text-transform: uppercase;
}
.hero__sub {
  margin: 0 0 38px;
  font-size: clamp(24px, 3.6vw, 46px);
  font-weight: 700; line-height: 1.05; letter-spacing: -.02em;
  color: var(--green); text-transform: uppercase;
}
.hero__blurb {
  max-width: 46ch; margin: -18px 0 36px;
  font-size: 18px; color: rgba(255, 255, 255, .8);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: center; }

/* ------------------------------------------------------------- buttons --- */

.btn {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 17px 26px; border: 0; border-radius: 2px;
  font-size: 13px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  transition: background-color .18s var(--ease), transform .18s var(--ease),
              color .18s var(--ease), box-shadow .18s var(--ease);
}
.btn svg { flex: 0 0 auto; transition: transform .18s var(--ease); }
.btn:hover svg { transform: translateX(4px); }

.btn--primary { background: var(--orange); color: #fff; }
.btn--primary:hover { background: var(--orange-hot); color: #fff; transform: translateY(-1px); }

.btn--ghost { background: transparent; color: #fff; padding-inline: 4px; }
.btn--ghost:hover { color: var(--green); }

.btn--outline {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); padding: 15px 24px;
}
.btn--outline:hover { border-color: var(--ink); color: var(--ink); background: var(--paper-alt); }

/* ------------------------------------------------------------ contents --- */

.contents {
  background: var(--paper-alt);
  padding: clamp(56px, 8vw, 104px) 0;
}
.contents__grid {
  display: grid;
  grid-template-columns: minmax(200px, 300px) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 72px);
  align-items: start;
}
.contents__heading {
  font-size: clamp(34px, 4.4vw, 52px);
  font-weight: 800; letter-spacing: -.025em; margin: 0;
  position: sticky; top: 172px;
}
.contents__note {
  margin: 18px 0 0; font-size: 15px; color: var(--ink-mute);
  max-width: 30ch;
}

.toc-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.toc-list__item { border-bottom: 1px solid var(--line); }
.toc-list__link {
  display: flex; align-items: center; gap: 20px;
  padding: 22px 4px; text-decoration: none; color: var(--ink);
  transition: color .18s var(--ease);
}
.toc-list__link:hover { color: var(--undp); }
.toc-list__label {
  flex: 1 1 auto; font-size: clamp(17px, 1.7vw, 20px); font-weight: 600;
  /* slide the label on transform rather than the row's padding-left, which
     would relayout the flex row on every frame of the hover */
  transition: transform .22s var(--ease);
}
.toc-list__link:hover .toc-list__label { transform: translateX(12px); }
.toc-list__meta {
  flex: 0 0 auto; font-size: 12px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute);
}
.toc-list__arrow {
  flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--ink-mute);
  display: grid; place-items: center; color: var(--ink);
  transition: background-color .2s var(--ease), color .2s var(--ease),
              border-color .2s var(--ease), transform .2s var(--ease);
}
.toc-list__link:hover .toc-list__arrow {
  background: var(--ink); border-color: var(--ink); color: #fff;
  transform: rotate(45deg);
}

/* --------------------------------------------------------- key figures --- */

.stats { padding: clamp(56px, 8vw, 96px) 0; background: #fff; }
.stats__head { max-width: 62ch; margin-bottom: 44px; }
.stats__grid {
  display: grid; gap: 2px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  background: var(--line-soft); border: 1px solid var(--line-soft);
}
.stat { background: #fff; padding: 32px 28px 34px; }
.stat__value {
  display: block; font-size: clamp(34px, 4vw, 46px); font-weight: 800;
  letter-spacing: -.03em; color: var(--undp); line-height: 1;
}
.stat__label { display: block; margin-top: 14px; font-size: 15px; color: var(--ink-soft); }

/* ----------------------------------------------------- chapter heading --- */

.chapter-hero {
  background: var(--dark); color: #fff;
  padding: clamp(48px, 7vw, 88px) 0 clamp(40px, 6vw, 68px);
  position: relative; overflow: hidden;
}
.chapter-hero::after {
  content: ""; position: absolute; right: -80px; bottom: -140px;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 208, 138, .22), transparent 68%);
}
.chapter-hero__inner { position: relative; z-index: 2; }
.chapter-hero__inner > * { max-width: 62ch; }
.chapter-hero__eyebrow {
  display: block; margin-bottom: 18px;
  font-size: 12px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase;
  color: var(--green);
}
.chapter-hero__title {
  margin: 0; color: #fff;
  font-size: clamp(34px, 5.2vw, 60px); font-weight: 800; letter-spacing: -.03em;
}
.chapter-hero__standfirst {
  margin: 22px 0 0; font-size: 19px; line-height: 1.6;
  color: rgba(255, 255, 255, .78);
}

/* ------------------------------------------------------- chapter layout -- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: clamp(28px, 5vw, 72px);
  /* padding-block only — the .shell class on the same element owns padding-inline */
  padding-block: clamp(40px, 6vw, 72px) clamp(56px, 8vw, 96px);
  align-items: start;
}

.sidebar { position: sticky; top: 164px; }
.sidebar__title {
  font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-mute); margin: 0 0 14px;
}
.sidebar__list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.sidebar__list a {
  display: block; padding: 8px 0 8px 16px; margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--ink-soft); font-size: 14.5px; line-height: 1.42;
  text-decoration: none; transition: color .16s var(--ease), border-color .16s var(--ease);
}
.sidebar__list a:hover { color: var(--undp); }
.sidebar__list a.is-current { color: var(--undp); border-left-color: var(--undp); font-weight: 700; }

/* --------------------------------------------------------------- prose --- */

.prose { max-width: 74ch; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 {
  margin-top: 2.1em; padding-top: 1.1em; border-top: 1px solid var(--line-soft);
  font-size: clamp(26px, 3vw, 34px); letter-spacing: -.02em;
}
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { margin-top: 1.9em; font-size: clamp(19px, 2.1vw, 23px); }
.prose h4 {
  margin-top: 1.7em; font-size: 16px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink-mute);
}
.prose strong { color: var(--ink); font-weight: 700; }
.prose ul, .prose ol { margin: 1.1em 0 0; padding-left: 1.35em; }
.prose li { margin-bottom: .6em; }
.prose li::marker { color: var(--undp); font-weight: 700; }
.prose ul ul, .prose ol ol, .prose ul ol, .prose ol ul { margin-top: .55em; }

.lead { font-size: 20px; line-height: 1.6; color: var(--ink); }

/* --------------------------------------------------------- prose parts --- */

.callout {
  margin: 2em 0; padding: 26px 28px;
  background: #f4f9fd; border-left: 4px solid var(--undp); border-radius: 0 8px 8px 0;
}
.callout--green { background: #f0fbf6; border-left-color: var(--green-deep); }
.callout > * + * { margin-top: .85em; }
.callout__title {
  margin: 0 0 8px; font-size: 12px; font-weight: 800;
  letter-spacing: .16em; text-transform: uppercase; color: var(--undp-deep);
}
.callout--green .callout__title { color: var(--green-deep); }
.callout > p:last-child, .callout > ul:last-child { margin-bottom: 0; }

.figure {
  margin: 2.4em 0; padding: 0;
  border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden;
  background: #fff;
}
/* never upscale past the source resolution — these diagrams come from the PDF */
.figure img {
  width: auto; max-width: 100%; margin-inline: auto;
  padding: 8px; cursor: zoom-in; background: #fff;
}
.figure figcaption {
  padding: 14px 20px; font-size: 14px; color: var(--ink-mute);
  background: var(--paper-alt); border-top: 1px solid var(--line-soft);
}
.figure figcaption b { color: var(--ink-soft); font-weight: 700; }

.steps { list-style: none; margin: 2em 0 0; padding: 0; counter-reset: step; }
.steps > li {
  position: relative; counter-increment: step;
  padding: 0 0 26px 62px; margin: 0;
  border-left: 2px solid var(--line);
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  content: counter(step);
  position: absolute; left: -20px; top: -3px;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--undp); color: #fff;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800;
}
.steps__title { display: block; margin-bottom: 5px; color: var(--ink); font-weight: 700; font-size: 18px; }

.cards {
  display: grid; gap: 18px; margin: 2em 0 0;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.card {
  padding: 24px 24px 26px; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.card:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.card__kicker {
  display: block; margin-bottom: 8px; font-size: 11px; font-weight: 800;
  letter-spacing: .16em; text-transform: uppercase; color: var(--teal);
}
.card__title,
.prose .card__title {
  margin: 0 0 8px; font-size: 18px; color: var(--ink);
  text-transform: none; letter-spacing: -.01em;
}
.card p { margin: 0; font-size: 15.5px; }
.cards--wide { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }

.table-wrap { margin: 2em 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 15.5px; min-width: 560px; }
th, td { padding: 15px 18px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
thead th {
  background: var(--paper-alt); color: var(--ink);
  font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 700; color: var(--ink); white-space: nowrap; }

/* ---------------------------------------------------------- pager/next --- */

.pager {
  border-top: 1px solid var(--line);
  padding: clamp(40px, 6vw, 72px) 0 clamp(48px, 7vw, 80px);
}
.pager__grid { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.pager__link {
  display: block; text-decoration: none; color: var(--ink);
  max-width: 46ch;
}
.pager__link--next { margin-left: auto; text-align: right; }
.pager__dir {
  display: block; margin-bottom: 6px;
  font-size: clamp(26px, 3.4vw, 40px); font-weight: 800; letter-spacing: -.02em;
  color: var(--line); text-transform: uppercase;
  transition: color .2s var(--ease);
}
.pager__title {
  display: inline-flex; align-items: center; gap: 12px;
  font-size: clamp(19px, 2.4vw, 27px); font-weight: 500; letter-spacing: -.01em;
}
.pager__title svg { color: var(--green-deep); transition: transform .2s var(--ease); }
.pager__link:hover .pager__dir { color: var(--ink-mute); }
.pager__link--next:hover .pager__title svg { transform: translate(4px, -4px); }
.pager__link--prev:hover .pager__title svg { transform: translate(-4px, 4px); }

/* -------------------------------------------------------------- footer --- */

.funders { padding: clamp(40px, 6vw, 64px) 0; background: #fff; border-top: 1px solid var(--line-soft); }
.funders__label {
  text-align: center; margin: 0 0 26px;
  font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink);
}
.funders__grid {
  list-style: none; margin: 0 auto; padding: 0;
  max-width: 1000px;
  /* flex, not grid — 9 logos leave an orphan row, and flex centres it */
  display: flex; flex-wrap: wrap;
  justify-content: center; align-items: center;
  gap: clamp(18px, 2.6vw, 34px) clamp(16px, 2.5vw, 32px);
}
.funders__item {
  flex: 0 1 168px;
  display: grid; place-items: center;
  min-height: 70px; margin: 0;
}
/* Each source PNG bakes in a different amount of empty margin, so cap by width
   and let --h tune the optical height per logo. */
.funders__item img {
  max-width: 100%;
  max-height: var(--h, 46px);
  width: auto; object-fit: contain;
}
.funders__item:nth-child(1) img { --h: 48px; }  /* GEF                        */
.funders__item:nth-child(2) img { --h: 38px; }  /* Belgium                    */
.funders__item:nth-child(3) img { --h: 42px; }  /* Canada                     */
.funders__item:nth-child(4) img { --h: 44px; }  /* EU flag — solid block      */
.funders__item:nth-child(5) img { --h: 44px; }  /* Flanders                   */
.funders__item:nth-child(6) img { --h: 58px; }  /* France — near-square       */
.funders__item:nth-child(7) img { --h: 54px; }  /* Germany — long strapline   */
.funders__item:nth-child(8) img { --h: 70px; }  /* Norway — ~60% empty margin */
.funders__item:nth-child(9) img { --h: 58px; }  /* Switzerland — dense text   */
.funders__item:nth-child(10) img { --h: 96px; } /* UK Int Dev — ~60% margin   */

/* two-up on phones — a 168px basis only fits one per line under ~360px */
@media (max-width: 620px) {
  .funders__grid { max-width: 400px; }
  .funders__item { flex-basis: 132px; min-height: 58px; }
  .funders__item img { max-height: calc(var(--h, 46px) * .8); }
}

.colophon {
  background: var(--dark); color: rgba(255, 255, 255, .62);
  padding: clamp(40px, 6vw, 64px) 0;
  font-size: 14.5px;
}
.colophon__grid {
  display: grid; gap: 32px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.colophon h2 {
  color: #fff; font-size: 12px; font-weight: 800;
  letter-spacing: .16em; text-transform: uppercase; margin: 0 0 14px;
}
.colophon ul { list-style: none; margin: 0; padding: 0; }
.colophon li { margin-bottom: 8px; }
.colophon a { color: rgba(255, 255, 255, .78); text-decoration: none; }
.colophon a:hover { color: var(--green); text-decoration: underline; }
.colophon__fine {
  margin: 40px 0 0; padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: 13px; color: rgba(255, 255, 255, .48);
}

/* ------------------------------------------------------------ lightbox --- */

.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(8, 9, 10, .93);
  display: grid; place-items: center; padding: 4vmin;
  opacity: 0; visibility: hidden; transition: opacity .2s var(--ease), visibility .2s;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox img { max-width: 100%; max-height: 90vh; width: auto; background: #fff; border-radius: 6px; }
.lightbox__close {
  position: absolute; top: 18px; right: 18px;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); border: 0; color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer;
}
.lightbox__close:hover { background: rgba(255, 255, 255, .24); }

/* ------------------------------------------------------------ to-top ----- */

.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--ink); color: #fff; border: 0; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--undp); }

/* --------------------------------------------------------- reveal-in ----- */

.reveal { opacity: 0; transform: translateY(14px); }
.reveal.is-in { opacity: 1; transform: none; transition: opacity .6s var(--ease), transform .6s var(--ease); }

/* ---------------------------------------------------------- responsive --- */

@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static; order: -1;
    padding: 20px 22px; background: var(--paper-alt); border-radius: 10px;
  }
  .sidebar__list { columns: 2; column-gap: 28px; border-left: 0; }
  .sidebar__list a { padding-left: 0; border-left: 0; }
  .sidebar__list a.is-current { border-left: 0; }
}

@media (max-width: 980px) {
  /* Text stacks and spans the full width here, so the photo can no longer sit
     beside it — it becomes a full-bleed backdrop, scrimmed top-down instead. */
  .hero__media { background-size: cover; background-position: 68% center; }
  .hero__media::after {
    background:
      linear-gradient(180deg, rgba(8, 9, 10, .88) 0%, rgba(8, 9, 10, .70) 52%, rgba(8, 9, 10, .86) 100%),
      linear-gradient(0deg, rgba(8, 9, 10, .55), rgba(8, 9, 10, 0) 60%);
  }
}

@media (max-width: 860px) {
  html { scroll-padding-top: 128px; }   /* masthead 68 + rail 46 */
  .masthead__inner { min-height: 68px; }
  .masthead__logo img { height: 42px; }
  .langswitch { margin-left: auto; }        /* sits right of the logo */
  .burger { margin-left: 12px; }            /* ...burger after it */

  /* rail follows the shorter masthead; label dropped to buy scroll width */
  .chapterbar { top: 68px; }
  .chapterbar__inner { min-height: 46px; }
  .chapterbar__link { padding: 7px 11px; }
  .chapterbar__list { margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .burger { display: block; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--dark); border-bottom: 1px solid rgba(255, 255, 255, .12);
    padding: 10px var(--gutter) 22px;
    display: none;
  }
  .nav.is-open { display: block; }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__link { padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, .09); }
  .nav__group { position: static; }
  .nav__toggle { width: 100%; justify-content: space-between; text-align: left; }
  .nav__menu {
    position: static; min-width: 0; opacity: 1; visibility: visible;
    transform: none; display: none; box-shadow: none;
    background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .12);
    margin: 6px 0 10px;
  }
  .nav__group.is-open .nav__menu { display: block; }
  .nav__menu a { color: rgba(255, 255, 255, .84); }
  .nav__menu a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
  .nav__menu a[aria-current="page"] { background: rgba(31, 208, 138, .14); color: var(--green); }
  .nav__menu .num { color: rgba(255, 255, 255, .5); }

  .contents__grid { grid-template-columns: minmax(0, 1fr); }
  .contents__heading { position: static; }
  .sidebar__list { columns: 1; }
  .pager__grid { flex-direction: column; }
  .pager__link--next { margin-left: 0; text-align: left; }
  .to-top { right: 14px; bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------- print --- */

@media print {
  .masthead, .chapterbar, .sidebar, .pager, .to-top, .progress, .colophon, .hero__actions { display: none !important; }
  body { font-size: 11pt; color: #000; }
  .layout { display: block; padding: 0; }
  .prose { max-width: none; }
  .chapter-hero { background: none; color: #000; padding: 0 0 18pt; }
  .chapter-hero__title, .chapter-hero__standfirst { color: #000; }
  .chapter-hero__eyebrow { color: #444; }
  .figure { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
