/* ==========================================================================
   GFPindex — design tokens
   ========================================================================== */
:root {
  --green: #1B6B4A;
  --green-dark: #0F4A32;
  --green-darker: #0A3323;
  --green-light: #E8F3EE;
  --green-pale: #F4F9F6;
  --text: #1A1F1C;
  --text-muted: #5C6B62;
  --border: #D8E3DD;
  --bg: #FFFFFF;
  --amber: #B8860B; /* réservé aux accents de données factices / warnings, usage rare */
  --font-display: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', 'Noto Serif', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --max: 1120px;
}

/* Pas de police externe (Google Fonts, etc.) chargée volontairement :
   RGPD (IP envoyée à un tiers) + fonctionne hors-ligne + charge plus vite. */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.6em;
  color: var(--green-darker);
}
h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 1.8rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }

a { color: var(--green); text-underline-offset: 2px; }
a:hover { color: var(--green-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

img { max-width: 100%; display: block; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   Top bar (petit bandeau institutionnel, façon Stanford)
   ========================================================================== */
.top-bar {
  background: var(--green-darker);
  color: #fff;
}
.top-bar__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.top-bar__text {
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.85);
}

/* ==========================================================================
   Nav
   ========================================================================== */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.nav__logos {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  flex-shrink: 0;
}
.nav__logos img {
  height: 42px;
  width: auto;
  display: block;
}

.nav__toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 1.1rem;
  cursor: pointer;
}

.nav__links {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav__links a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 1.1rem;
  padding-bottom: 2px;
}

.nav__links a[aria-current="page"] {
  color: var(--green-dark);
  border-bottom: 2px solid var(--green-dark);
  font-weight: 700;
}

@media (max-width: 720px) {
  .nav__logos img { height: 32px; }
  .nav__toggle { display: inline-flex; align-items: center; gap: 0.4rem; }
  .nav__links {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0.25rem;
    padding: 0.5rem 0 0.75rem;
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { display: block; padding: 0.6rem 0.2rem; }
  .nav { flex-wrap: wrap; }
}

/* ==========================================================================
   Layout / main
   ========================================================================== */
main { min-height: 50vh; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.5rem; }

.section { padding: 3rem 0; }
.section--tight { padding: 1.5rem 0; }
.section--alt { background: var(--green-pale); }

/* ==========================================================================
   Buttons / links
   ========================================================================== */
.btn {
  display: inline-block;
  background: var(--green);
  color: #fff;
  padding: 0.7rem 1.4rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn:hover { background: var(--green-dark); color: #fff; }
.btn--outline {
  background: transparent;
  color: var(--green-dark);
  border: 1.5px solid var(--green);
}
.btn--outline:hover { background: var(--green-light); color: var(--green-dark); }

.text-link {
  font-weight: 600;
  text-decoration: underline;
}
.text-link::after { content: " →"; }

/* ==========================================================================
   Homepage hero + map
   ========================================================================== */
.hero {
  padding: 2.5rem 0 1rem;
  text-align: center;
}
.hero h1 { max-width: 20ch; margin-inline: auto; }
.hero {
  padding: 1.75rem 0 0.5rem;
  text-align: center;
}
.hero .lead {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 55ch;
  margin: 0 auto 1.5rem;
}

.map-hero {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: linear-gradient(180deg, var(--green-pale) 0%, var(--green-light) 100%);
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.map-hero__image-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.map-hero__image-wrap img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 78vh;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(15, 74, 50, 0.14);
}
.map-hero__image-wrap img.is-missing { display: none; }

.map-hero__controls {
  margin-top: 1.5rem;
  text-align: center;
}

.map-missing-msg {
  display: none;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
  padding: 2.5rem 1rem;
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 6px;
}
.map-hero__image-wrap img.is-missing + .map-missing-msg { display: block; }
.map-hero__image-wrap img.is-missing ~ .map-missing-msg code {
  background: var(--green-light);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85em;
}
.map-year-slider {
  max-width: 420px;
  margin: 1.25rem auto 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.map-year-slider input[type="range"] { flex: 1; accent-color: var(--green); }
.map-legend {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.map-legend span {
  width: 34px; height: 14px;
  display: inline-block;
  font-size: 0;
}

.paper-block {
  max-width: 640px;
  margin: 2rem auto;
  text-align: center;
}
.paper-block h2 { margin-bottom: 0.5rem; }

.sponsor-block {
  max-width: 640px;
  margin: 2.5rem auto 0;
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.note {
  font-size: 0.85rem;
  color: var(--text-muted);
  border-left: 3px solid var(--green);
  padding-left: 0.75rem;
  margin-top: 1rem;
  text-align: left;
}
.placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* ==========================================================================
   Learn More page
   ========================================================================== */
.learn-more-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2.5rem;
  align-items: start;
}
.learn-more-grid .paper-photo {
  aspect-ratio: 3/4;
  background: var(--green-light);
  border-radius: 8px;
  overflow: hidden;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}
.learn-more-grid .paper-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.learn-more-grid .paper-photo span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 1rem;
}
.video-embed {
  margin-top: 2.5rem;
  aspect-ratio: 16/9;
  background: var(--green-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-style: italic;
  overflow: hidden;
}
.video-embed iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.learn-more-grid h1 {
  font-size: 1.35rem;
  line-height: 1.35;
}

@media (max-width: 680px) {
  .learn-more-grid { grid-template-columns: 1fr; }
  .learn-more-grid .paper-photo { max-width: 240px; margin: 0 auto; }
}

/* ==========================================================================
   About — hero + tabs
   ========================================================================== */
.about-hero {
  background: linear-gradient(rgba(10,51,35,0.72), rgba(10,51,35,0.72)), var(--green-dark);
  background-size: cover;
  background-position: center;
  color: #fff;
  padding: 3.5rem 1.5rem;
  text-align: center;
}
.about-hero h1 { color: #fff; max-width: 22ch; margin-inline: auto; }

.tabs {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.5rem;
  align-items: start;
}
.tabs__list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: sticky;
  top: 5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-left: 2px solid var(--border);
}
.tabs__list button {
  all: unset;
  cursor: pointer;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  margin-left: -2px;
}
.tabs__list button:hover { color: var(--green-dark); }
.tabs__list button[aria-selected="true"] {
  color: var(--green-dark);
  font-weight: 700;
  border-left: 2px solid var(--green-dark);
  background: var(--green-pale);
}
.tabs__panel { display: none; }
.tabs__panel.is-active { display: block; }
.tabs__panel h2:first-child { margin-top: 0; }

@media (max-width: 780px) {
  .tabs { grid-template-columns: 1fr; }
  .tabs__list {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    border-left: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.25rem;
  }
  .tabs__list button {
    border-left: none;
    border-bottom: 2px solid transparent;
    margin-left: 0;
    white-space: nowrap;
  }
  .tabs__list button[aria-selected="true"] {
    border-left: none;
    border-bottom: 2px solid var(--green-dark);
  }
}

.domain-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  background: var(--green-pale);
}
.domain-card h3 { margin-bottom: 0.4rem; color: var(--green-dark); }
.domain-card .instrument-groups {
  margin-top: 0.75rem;
  padding-left: 1.1rem;
}

.source-list {
  columns: 2;
  column-gap: 2rem;
  font-size: 0.92rem;
}
@media (max-width: 600px) { .source-list { columns: 1; } }

.key-facts-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1rem;
}
.key-facts-list li {
  padding: 1rem 1.25rem;
  background: var(--green-pale);
  border-radius: 8px;
  border-left: 3px solid var(--green);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.stat-card {
  background: var(--green-darker);
  color: #fff;
  border-radius: 8px;
  padding: 1.25rem 1rem;
  text-align: center;
}
.stat-card .num {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}
.stat-card .label {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.35rem;
  color: rgba(255,255,255,0.8);
}

.domain-mini-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.domain-mini {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}
.domain-mini .tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green-dark);
  background: var(--green-light);
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  margin-bottom: 0.4rem;
}
.domain-mini p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

.leaders-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 1.5rem;
}
.leader-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--green-pale);
  border-radius: 999px;
  padding: 0.4rem 0.9rem 0.4rem 0.5rem;
  font-size: 0.88rem;
}
.leader-chip .rank {
  background: var(--green-dark);
  color: #fff;
  width: 1.6em;
  height: 1.6em;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.leader-chip.outlier { background: transparent; border: 1px dashed var(--border); }
.leader-chip.outlier .rank { background: var(--text-muted); }

.correlates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}
.correlates-col h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.correlates-col ul { margin: 0; padding-left: 1.1rem; font-size: 0.9rem; }
.correlates-col li { margin-bottom: 0.3rem; }
@media (max-width: 560px) { .correlates-grid { grid-template-columns: 1fr; } }

.validation-note {
  background: var(--green-pale);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  margin: 1rem 0;
}
.validation-note strong { color: var(--green-dark); }

/* ==========================================================================
   People
   ========================================================================== */
.people-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.75rem;
}
.person-card {
  text-align: center;
}
.person-card img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 0.9rem;
  border: 3px solid var(--green-light);
}
.person-card h3 { margin-bottom: 0.15rem; }
.person-card .role {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.person-card .affil {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.person-card a { font-size: 0.88rem; }

.interns-list {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.dev-credit {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ==========================================================================
   Rankings / Cross-country comparison
   ========================================================================== */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: end;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--green-pale);
  border-radius: 8px;
}
.control-field { display: flex; flex-direction: column; gap: 0.3rem; }
.control-field label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.control-field select, .control-field input {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.92rem;
}
.control-field input[type="text"] { min-width: 200px; }

.table-toggle-row {
  text-align: center;
  margin: 1.25rem 0;
}

table.rankings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.rankings-table caption { text-align: left; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.rankings-table th, .rankings-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.rankings-table th {
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--green-darker);
  border-bottom: 2px solid var(--green);
}
.rankings-table td.num, .rankings-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rankings-table tbody tr:hover { background: var(--green-pale); }
.rankings-table tr.avg-row td { font-weight: 700; background: var(--green-light); }

.comparison-chart {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
}
.comparison-chart svg { min-width: 560px; width: 100%; height: auto; }
.comparison-chart .placeholder { margin: 0; padding: 1rem 0; }

.comparison-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 1rem;
}
.legend-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
}
.legend-chip .swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* ==========================================================================
   Data & citation — form
   ========================================================================== */
.request-form {
  display: grid;
  gap: 1.1rem;
  max-width: 720px;
}
.request-steps {
  background: var(--green-pale);
  border-radius: 8px;
  padding: 1.25rem 1.25rem 1.25rem 2.5rem;
  margin: 1.25rem 0 2rem;
  max-width: 720px;
}
.request-steps li { margin-bottom: 0.4rem; }
.request-steps li:last-child { margin-bottom: 0; }
.form-field { display: flex; flex-direction: column; gap: 0.35rem; }
.form-field label { font-weight: 600; font-size: 0.92rem; }
.form-field .hint { font-size: 0.8rem; color: var(--text-muted); }
.form-field input[type="text"],
.form-field input[type="email"],
.form-field textarea,
.form-field select {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  width: 100%;
}
.form-field textarea { resize: vertical; min-height: 5em; }
.radio-group { display: flex; gap: 1.5rem; }
.radio-group label { font-weight: 400; display: flex; align-items: center; gap: 0.4rem; }

.request-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.request-actions .status { font-size: 0.88rem; color: var(--green-dark); font-weight: 600; }

.citation-block {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.citation-text {
  background: var(--green-pale);
  border-left: 3px solid var(--green);
  padding: 1rem 1.25rem;
  font-size: 0.92rem;
  font-family: var(--font-mono);
  line-height: 1.5;
}
.copy-btn {
  background: var(--green-light);
  color: var(--green-dark);
  border: 1px solid var(--green);
  border-radius: 4px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.88rem;
}
.copy-btn:hover { background: var(--green); color: #fff; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2.5rem 1.5rem 2rem;
  background: var(--green-pale);
}
.site-footer__inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  text-align: center;
}
.footer-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
}
.footer-logos img { height: 44px; width: auto; }
.footer-contact { font-size: 0.95rem; }
.footer-contact a { font-weight: 600; }
.footer-legal {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-legal a { color: var(--text-muted); }
/* The `hidden` attribute must beat component classes that set `display`.
   Without this, .btn's `display: inline-block` overrides the browser default
   for [hidden], so scripts that hide a button by setting el.hidden had no
   visible effect — the "Show all N countries" toggle stayed on screen while
   a search was active. */
[hidden] { display: none !important; }

/* Rankings — countries with no implemented policy */
.rankings-table .nip {
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.rankings-table tr.is-nip td:first-child { color: var(--text-muted); }
.nip-note { margin-top: 0.75rem; }

.footer-version {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Legal pages */
.legal-page section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.legal-page section:last-child { border-bottom: none; }
.legal-page h2 { font-size: 1.1rem; }

/* ==========================================================================
   Skip link (RGAA)
   ========================================================================== */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--green-dark);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
  border-radius: 0 0 4px 0;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
