/* ==========================================================
   Observatoire Kati Thanda – Lake Eyre
   Palette minérale : croûte de sel, eau de crue, halite rose
   ========================================================== */

:root {
  --salt: #F5F2EC;          /* fond — croûte de sel */
  --panel: #FFFFFF;
  --panel-edge: #E4DDD0;
  --basin: #241F1A;         /* encre — sédiment du fond */
  --dune: #7C7466;          /* texte secondaire */
  --grid: #E9E3D6;
  --flood: #1E5F6B;         /* eau de crue — données */
  --flood-deep: #134450;
  --halite: #C4536B;        /* rose halobactéries — observation courante */
  --ochre: #A8702D;

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Archivo", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius: 10px;
  --gap: 20px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--salt);
  color: var(--basin);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); }

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--grid);
  padding: 1px 6px;
  border-radius: 4px;
}

:focus-visible {
  outline: 2px solid var(--flood);
  outline-offset: 2px;
}

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

/* ── Bandeau démo ─────────────────────────────────────────── */

.demo-banner {
  background: var(--ochre);
  color: #FFF;
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 8px 28px;
}
.demo-banner code { background: rgba(255,255,255,.18); color: #FFF; }

/* ── En-tête ──────────────────────────────────────────────── */

.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--gap);
  padding: 34px 28px 22px;
  border-bottom: 1px solid var(--panel-edge);
}

.eyebrow {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--dune);
}

.site-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  letter-spacing: -0.015em;
  line-height: 1.05;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 12.5px;
  color: var(--dune);
  padding-bottom: 4px;
}
.header-label {
  font-size: 10.5px;
}
#generated-at { color: var(--basin); }

.header-update {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.refresh-btn {
  margin-top: 8px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: #FFF;
  background: var(--flood);
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.refresh-btn:hover { background: var(--flood-deep); }
.refresh-btn:disabled {
  background: var(--dune);
  cursor: progress;
}

.refresh-status {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--dune);
  text-align: right;
  max-width: 300px;
}
.refresh-status.error { color: var(--ochre); }

/* ── Onglets ──────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 28px;
  border-bottom: 1px solid var(--panel-edge);
  background: var(--salt);
}

.tab {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--dune);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 16px;
  margin-bottom: -1px;
  cursor: pointer;
}
.tab:hover { color: var(--basin); }
.tab.active {
  color: var(--basin);
  border-bottom-color: var(--flood);
}

/* ── Pages de texte (Methods, Publications) ───────────────── */

.prose .panel { padding-bottom: 8px; }

.prose-body {
  padding: 4px 28px 26px;
  max-width: 74ch;
}
.prose-body p { margin: 0 0 14px; }
.prose-body .lede {
  font-size: 16px;
  line-height: 1.6;
  color: var(--basin);
  margin-bottom: 22px;
}
.prose-body h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 26px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--grid);
}
.prose-body h3:first-of-type { border-top: none; padding-top: 0; }
.prose-body strong { font-weight: 600; }
.prose-body .reference {
  border-left: 3px solid var(--flood);
  background: rgba(30, 95, 107, 0.05);
  padding: 10px 14px;
  font-size: 13.5px;
}
.prose-body a { color: var(--flood-deep); }
.prose-body em { font-style: italic; }

/* Les réserves méthodologiques sont signalées, pas noyées */
.prose-body .caveat {
  border-left: 3px solid var(--ochre);
  background: rgba(168, 112, 45, 0.06);
  padding: 10px 14px;
  margin: 16px 0;
  font-size: 14px;
}

/* ── Structure générale ───────────────────────────────────── */

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--gap) 28px 40px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
}

.panel-head { padding: 18px 22px 0; }
.head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dl-btn {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--flood-deep);
  background: var(--salt);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 5px 11px;
  cursor: pointer;
  white-space: nowrap;
}
.dl-btn:hover { background: var(--grid); border-color: var(--flood); }
.dl-btn:disabled { color: var(--dune); cursor: default; }
.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

/* ── État vide ────────────────────────────────────────────── */

.empty-state {
  padding: 48px 32px;
  text-align: center;
}
.empty-state h2 {
  font-family: var(--font-display);
  margin: 0 0 8px;
}
.empty-state p { margin: 6px 0; color: var(--dune); }
.empty-state .mono { color: var(--basin); font-size: 13px; }

/* ── Volet 1 : niveau + carte ─────────────────────────────── */

/* La carte occupe toute la largeur : c'est la piece maitresse */
.map-card { margin-bottom: var(--gap); }

/* Niveau d'eau et chronique dans un meme panneau */
.level-series {
  display: grid;
  grid-template-columns: minmax(300px, 4fr) 8fr;
  gap: 0;
  margin-bottom: var(--gap);
  overflow: hidden;
}
.level-series .level-card { border-right: 1px solid var(--panel-edge); }
.level-series .chart-card { margin-bottom: 0; }

.level-card { padding: 20px 22px; display: flex; flex-direction: column; }

.level-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.site-select {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--basin);
  background: var(--salt);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 5px 8px;
}

.level-reading {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  flex: 1;
  align-items: stretch;
}

.level-value {
  margin: 6px 0 2px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.1rem, 6vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--flood-deep);
}
.level-unit {
  font-size: 0.42em;
  font-weight: 600;
  color: var(--dune);
  letter-spacing: 0;
}

.level-datum {
  margin: 0 0 16px;
  font-size: 11.5px;
  color: var(--dune);
}

.level-meta {
  margin: 0;
  display: grid;
  gap: 9px;
  font-size: 12.5px;
}
.level-meta div { display: flex; justify-content: space-between; gap: 12px; }
.level-meta dt {
  color: var(--dune);
  font-size: 10.5px;
  padding-top: 2px;
}
.level-meta dd { margin: 0; text-align: right; }

/* Échelle limnimétrique — élément signature */
.gauge-wrap {
  margin: 0;
  display: flex;
  align-items: stretch;
}
#gauge { height: 100%; min-height: 260px; width: 120px; }

.gauge-axis   { stroke: var(--basin); stroke-width: 1.4; }
.gauge-tick   { stroke: var(--basin); stroke-width: 1.1; }
.gauge-tick-minor { stroke: var(--dune); stroke-width: 0.7; }
.gauge-label  { font-family: var(--font-mono); font-size: 10px; fill: var(--dune); }
.gauge-range  { fill: var(--flood); opacity: 0.13; }
.gauge-now    { stroke: var(--halite); stroke-width: 2; }
.gauge-now-marker { fill: var(--halite); }
.gauge-now-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  fill: var(--halite);
}

.map-card {
  overflow: hidden;
  min-height: 700px;
  display: flex;
  flex-direction: column;
}
.map-wrap { position: relative; flex: 1; min-height: 620px; display: flex; }
#map { width: 100%; flex: 1; min-height: 620px; }

/* Lecture de la valeur sous le curseur */
.map-readout {
  position: absolute;
  right: 12px; top: 12px;
  z-index: 600;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--basin);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.map-readout b { font-weight: 600; }
.map-readout .dim { color: var(--dune); font-size: 10.5px; }

/* Message d'état du modèle, posé sur la carte */
.map-message {
  position: absolute;
  left: 50%; top: 14px;
  transform: translateX(-50%);
  z-index: 600;
  max-width: 82%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--ochre);
  border-left: 3px solid var(--ochre);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 11.5px;
  color: var(--basin);
}

/* Légende du modèle, posée sur la carte */
.map-legend {
  position: absolute;
  left: 12px; bottom: 22px;
  z-index: 500;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "title bar bar" "min bar bar";
  align-items: center;
  gap: 2px 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--panel-edge);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 10.5px;
  color: var(--basin);
}
.map-legend > span:first-child { grid-area: title; font-weight: 600; }
.legend-bar {
  grid-area: bar;
  display: block;
  width: 110px; height: 9px;
  border-radius: 2px;
  background: linear-gradient(to right, #30123b, #4145ab, #4675ed,
    #39a2fc, #1bcfd4, #62fc6b, #d2e935, #fe9b2d, #ea4a13, #7a0403);
}
#legend-min { grid-area: min; justify-self: start; }
#legend-max { grid-area: max; justify-self: end; }
.map-legend {
  grid-template-areas: "title title" "bar bar" "min max";
  grid-template-columns: auto auto;
  justify-content: stretch;
}
.legend-bar { width: 100%; }

/* Barre fond de carte / imagerie */
.map-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--panel-edge);
  background: var(--panel);
}

.seg {
  display: inline-flex;
  border: 1px solid var(--panel-edge);
  border-radius: 7px;
  overflow: hidden;
}
.seg-btn {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--dune);
  background: var(--panel);
  border: none;
  padding: 6px 12px;
  cursor: pointer;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--panel-edge); }
.seg-btn.active { background: var(--flood); color: #FFF; }
.seg-btn:not(.active):hover { color: var(--basin); background: var(--salt); }

.imagery-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.arrow-size-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--dune);
}
.arrow-size-wrap input[type="range"] { width: 78px; accent-color: var(--flood); }

.imagery-controls input[type="date"] {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--basin);
  background: var(--salt);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 4px 6px;
}
.date-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--basin);
  background: var(--salt);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 4px 9px;
  cursor: pointer;
}
.date-btn:hover { background: var(--grid); }
.date-btn:disabled { color: var(--dune); cursor: default; background: var(--salt); }
.date-btn-latest.active { background: var(--halite); border-color: var(--halite); color: #FFF; }

.leaflet-container { font-family: var(--font-body); }
.marker-halo { background: transparent; border: none; }
.marker-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--flood);
  border: 2.5px solid #FFF;
}
.marker-dot.selected { background: var(--halite); }

/* Stations meteo : losange ocre */
.marker-wx {
  width: 11px; height: 11px;
  background: var(--ochre);
  border: 2px solid #FFF;
  transform: rotate(45deg);
}

/* ── Volet 2 : météo BOM ──────────────────────────────────── */

.weather-card { margin-bottom: var(--gap); }
.weather-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.weather-updated { margin: 0; font-size: 11.5px; color: var(--dune); }
.weather-updated.warn { color: var(--ochre); }

.weather-history { padding: 4px 16px 14px; }

/* ── Roses des vents ──────────────────────────────────────── */

.rose-block { border-top: 1px solid var(--panel-edge); padding: 14px 22px 18px; }
.rose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}
.rose-head .eyebrow { margin: 0; }
.rose-note {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--dune);
}
.rose-note.warn { color: var(--ochre); }
.rose-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

/* min-width: 0 est indispensable — un élément de grille vaut
   min-width: auto par défaut, ce qui laisse un graphique trop large
   élargir sa colonne et déborder sur la voisine. */
.rose-cell {
  min-width: 0;
  overflow: hidden;
}
.rose-plot { width: 100%; }

.rose-title {
  margin: 0 0 2px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  color: var(--basin);
}

.rose-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: 2px 0 6px;
  font-size: 11px;
  color: var(--dune);
}
.rose-key { display: inline-flex; align-items: center; gap: 5px; }
.rose-key i {
  width: 11px; height: 11px;
  border-radius: 2px;
  display: inline-block;
}
.rose-key-unit { font-family: var(--font-mono); font-size: 10px; }

.rose-empty {
  display: grid;
  place-items: center;
  min-height: 200px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--dune);
  border: 1px dashed var(--panel-edge);
  border-radius: 8px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--basin);
  background: var(--salt);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
}
.toggle input { margin: 0; accent-color: var(--flood); }

.field-note {
  margin: 0;
  padding: 6px 22px 0;
  font-size: 12px;
  color: var(--dune);
}
.field-note.warn { color: var(--ochre); }

.weather-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  padding: 16px 22px 20px;
}
.weather-empty { color: var(--dune); font-size: 12.5px; margin: 0; }

.wx-card {
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--salt);
}
.wx-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.wx-name { font-weight: 600; font-size: 14px; }
.wx-age { font-size: 10.5px; color: var(--dune); }
.wx-age.warn { color: var(--ochre); }

.wx-wind {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.wx-arrow {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  display: grid;
  place-items: center;
  flex: none;
}
.wx-arrow svg { display: block; }
.wx-arrow .arr { fill: var(--flood-deep); }
.wx-wind-main { font-weight: 600; font-size: 14.5px; display: block; }
.wx-gust { font-size: 11px; color: var(--dune); display: block; }

.wx-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 11.5px;
  color: var(--dune);
}
.wx-meta b { color: var(--basin); font-weight: 500; }
.wx-error { font-size: 11.5px; color: var(--ochre); margin: 6px 0 0; }

/* ── Volet 2 : série temporelle ───────────────────────────── */

.chart-card { margin-bottom: var(--gap); }
.chart { width: 100%; height: 330px; padding: 4px 10px 0; }
.chart-note {
  margin: 0;
  padding: 0 22px 16px;
  font-size: 12.5px;
  color: var(--dune);
}

/* ── Volet 4 : scénario Delft3D ───────────────────────────── */

.model-card { padding-bottom: 20px; margin-bottom: var(--gap); }

.scenario-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.scenario-actions { display: flex; gap: 8px; align-items: center; }

.timeline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--panel-edge);
  background: var(--panel);
  font-size: 11.5px;
  color: var(--dune);
}
.timeline input[type="range"] {
  flex: 1;
  accent-color: var(--flood);
  height: 3px;
}
#tl-label {
  min-width: 132px;
  text-align: right;
  color: var(--basin);
  font-variant-numeric: tabular-nums;
}
#tl-play { min-width: 34px; }

.scenario-empty, .scenario-error {
  margin: 0;
  padding: 18px 22px;
  font-size: 12.5px;
  color: var(--dune);
}
.scenario-error { color: var(--ochre); }
.scenario-error code { background: var(--grid); color: var(--basin); }

/* Conditions -> paramètres du scénario */
.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  padding: 16px 22px 4px;
}
.match-item {
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--salt);
}
.match-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dune);
  display: block;
  margin-bottom: 5px;
}
.match-values {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-variant-numeric: tabular-nums;
}
.match-obs { font-size: 15px; font-weight: 600; }
.match-arrow { color: var(--dune); font-size: 12px; }
.match-sim { font-size: 15px; font-weight: 600; color: var(--flood-deep); }
.match-delta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dune);
  display: block;
  margin-top: 3px;
}
.match-item.out { border-color: var(--ochre); }
.match-item.out .match-delta { color: var(--ochre); }

.alt-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 22px 2px;
}
.alt-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dune);
  margin-right: 4px;
}
.alt-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--basin);
  background: var(--salt);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
}
.alt-chip:hover { background: var(--grid); }
.alt-chip.active {
  background: var(--flood);
  border-color: var(--flood);
  color: #FFF;
}
.alt-d { opacity: 0.65; font-size: 10px; }

.scenario-file {
  margin: 10px 22px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dune);
  word-break: break-all;
}
.scenario-warnings {
  margin: 10px 22px 0;
  padding: 9px 12px;
  border-left: 3px solid var(--ochre);
  background: rgba(168, 112, 45, 0.07);
  font-size: 12px;
  color: var(--basin);
  list-style: none;
}
.scenario-warnings li + li { margin-top: 4px; }


.field-note {
  margin: 0;
  padding: 6px 22px 0;
  font-size: 12px;
  color: var(--dune);
}

/* ── Pied de page ─────────────────────────────────────────── */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 32px;
  font-size: 11.5px;
  color: var(--dune);
}

/* ── Réactif ──────────────────────────────────────────────── */

@media (max-width: 940px) {
  .level-series { grid-template-columns: 1fr; }
  .level-series .level-card {
    border-right: none;
    border-bottom: 1px solid var(--panel-edge);
  }
  .map-card { min-height: 520px; }
  .map-wrap, #map { min-height: 440px; }
  .site-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .header-right { align-items: flex-start; }
}

@media (max-width: 560px) {
  main, .site-header, .site-footer, .tabs { padding-left: 16px; padding-right: 16px; }
  .prose-body { padding-left: 18px; padding-right: 18px; }
  .tab { padding: 11px 10px; font-size: 12.5px; }
  .level-reading { grid-template-columns: 1fr; }
  .gauge-wrap { justify-content: center; }
  #gauge { min-height: 220px; }
}

/* ── Deux parties : Natural History et Observatory ─────────── */

.sections {
  display: flex;
  gap: 10px;
  padding: 14px 28px 0;
  background: var(--salt);
}
.section-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dune);
  background: transparent;
  border: 1px solid var(--panel-edge);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 10px 20px 11px;
  cursor: pointer;
}
.section-btn:hover { color: var(--basin); }
.section-btn.active {
  color: var(--basin);
  background: var(--panel);
}
.section-kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--dune);
}

/* ── Natural History : lecture continue, sommaire fixe ──────── */

.nh-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 8px 28px;
  padding: 0 28px 10px;
}
.nh-toc {
  position: sticky;
  top: 16px;
  align-self: start;
  padding-top: 6px;
}
.nh-toc-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dune);
  margin: 0 0 8px;
}
.nh-toc ol { list-style: none; margin: 0; padding: 0; }
.nh-toc li { margin: 0; }
.nh-toc a {
  display: block;
  padding: 5px 0 5px 12px;
  border-left: 2px solid var(--grid);
  color: var(--basin);
  text-decoration: none;
  font-size: 13.5px;
}
.nh-toc a:hover { border-left-color: var(--flood); color: var(--flood-deep); }

.nh-body { padding: 0 0 26px; max-width: 72ch; }
.nh-body p { line-height: 1.68; }
.nh-section { scroll-margin-top: 16px; }
.nh-section h3 { scroll-margin-top: 16px; }

.nh-acknowledgement {
  border-left: 3px solid var(--ochre);
  background: rgba(168, 112, 45, 0.07);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 24px;
}

.nh-body a.cite {
  color: var(--flood-deep);
  text-decoration: none;
  border-bottom: 1px dotted var(--flood);
}
.nh-body a.cite:hover { border-bottom-style: solid; }

.nh-references {
  padding-left: 1.2em;
  font-size: 13px;
  line-height: 1.5;
}
.nh-references li {
  margin-bottom: 8px;
  scroll-margin-top: 16px;
}
.nh-references li:target { background: rgba(30, 95, 107, 0.09); }
.nh-references a { color: var(--flood-deep); word-break: break-word; }

@media (max-width: 900px) {
  .nh-layout { grid-template-columns: 1fr; }
  .nh-toc { position: static; }
  .nh-toc ol { display: flex; flex-wrap: wrap; gap: 4px 14px; }
  .nh-toc a { border-left: none; padding: 3px 0; }
  .sections { padding: 12px 16px 0; }
  .section-btn { padding: 8px 14px 9px; font-size: 1rem; }
}

/* ── Aboriginal Culture : tableau des nations ──────────────── */

.table-wrap {
  overflow-x: auto;
  margin: 6px 0 18px;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
}
.people-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.5;
}
.people-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--dune);
  background: var(--salt);
  padding: 9px 12px;
  border-bottom: 1px solid var(--panel-edge);
}
.people-table td {
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid var(--grid);
}
.people-table tr:last-child td { border-bottom: none; }
.people-table td:first-child { width: 17%; }
.people-table .alt { font-size: 12px; color: var(--dune); }

.nation-list {
  columns: 3 11em;
  column-gap: 24px;
  margin: 4px 0 18px;
  padding-left: 1.1em;
}
.nation-list li { break-inside: avoid; margin-bottom: 3px; }

/* ── Oiseaux (eBird) ───────────────────────────────────────── */

.birds-card .chart-note { padding: 0 22px; margin: 6px 0 12px; }
.birds-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 22px 14px;
}
.bird-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 150px;
  padding: 8px 12px;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  background: var(--salt);
  font-size: 13px;
}
.bird-chip b { font-weight: 600; }
.bird-chip .mono { font-size: 11.5px; color: var(--dune); }
.bird-chip.present { border-color: var(--flood); background: rgba(30, 95, 107, 0.07); }
.bird-chip.absent { opacity: 0.7; }

.birds-table-wrap { margin: 0 22px 10px; max-height: 420px; overflow-y: auto; }
.birds-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.birds-table th {
  position: sticky; top: 0;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--dune);
  background: var(--salt);
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-edge);
}
.birds-table td { padding: 7px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.birds-table .sci { display: block; font-size: 11.5px; color: var(--dune); font-style: italic; }
.birds-table a { color: var(--flood-deep); text-decoration: none; }
.birds-table a:hover { text-decoration: underline; }
.bird-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  vertical-align: 1px;
}
.bird-tag.indicator { background: rgba(30, 95, 107, 0.12); color: var(--flood-deep); }
.bird-tag.notable { background: rgba(196, 83, 107, 0.12); color: var(--halite); }
.birds-attribution { padding: 0 22px 16px; font-size: 11.5px; color: var(--dune); }
.birds-attribution a { color: var(--flood-deep); }


/* ════════════════════════════════════════════════════════════
   Refonte : un observatoire, pas un tableau de bord.

   Palette tirée du lac vu d'orbite : blanc froid de l'halite pour le
   fond, bleu-noir d'eau profonde pour l'encre, eau de crue pour les
   données, rose des saumures pour un seul élément, la ligne d'eau.
   Literata porte la lecture ; Archivo, élargi, les titres et
   l'interface, avec des chiffres tabulaires.
   ════════════════════════════════════════════════════════════ */

:root {
  --salt: #EEF1EF;
  --panel: #F9FBFA;
  --panel-edge: #D3DCDA;
  --basin: #16333B;
  --dune: #56696C;
  --grid: #E0E7E5;
  --flood: #1F6470;
  --flood-deep: #134450;
  --halite: #C0476A;
  --ochre: #946535;
  --font-display: "Archivo", system-ui, sans-serif;
  --font-body: "Archivo", system-ui, sans-serif;
  --font-read: "Literata", Georgia, "Times New Roman", serif;
  --font-mono: "Archivo", system-ui, sans-serif;
  --radius: 3px;
  --measure: 66ch;
  --page: 1180px;
}

body { background: var(--salt); color: var(--basin); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.eyebrow, .section-kicker { display: none; }
:focus-visible { outline: 2px solid var(--flood); outline-offset: 2px; }
a { color: var(--flood-deep); }

/* ── En-tête ──────────────────────────────────────────────── */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 32px;
  max-width: var(--page);
  margin: 0 auto;
  padding: 22px 28px 14px;
}
.wordmark {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--basin);
  text-decoration: none;
}
.wordmark span { font-weight: 400; color: var(--dune); margin-left: 0.45em; }
nav.sections {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 26px;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
}
.section-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 4px 0 6px;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--dune);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}
.section-btn:hover { color: var(--basin); }
.section-btn.active { color: var(--basin); border-bottom-color: var(--flood); }

/* Sous-navigation d'une partie : discrète, sous l'en-tête */
nav.tabs, .subbar {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 28px;
  background: none;
  border: none;
}
.subbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; }
.subbar[hidden] { display: none; }
.subbar nav.tabs { padding: 0; margin: 0; }
nav.tabs { display: flex; gap: 20px; border-top: 1px solid var(--panel-edge); padding-top: 8px; }
.subbar { border-top: 1px solid var(--panel-edge); padding-top: 8px; }
.subbar nav.tabs { border-top: none; padding-top: 0; }
nav.tabs[hidden] { display: none; }
.tab {
  background: none;
  border: none;
  border-radius: 0;
  padding: 4px 0;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--dune);
  cursor: pointer;
}
.tab.active { color: var(--basin); font-weight: 600; }
.data-status { font-size: 0.85rem; color: var(--dune); display: flex; gap: 14px; align-items: center; font-variant-numeric: tabular-nums; }
.refresh-btn {
  font-family: var(--font-display);
  font-size: 0.85rem;
  background: none;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: 4px 10px;
  color: var(--flood-deep);
  cursor: pointer;
}

/* ── Accueil ──────────────────────────────────────────────── */

.home { padding: 20px 0 56px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
  gap: 48px;
  align-items: start;
  padding-top: 24px;
}
.hero-title {
  font-family: var(--font-display);
  font-stretch: 118%;
  font-weight: 600;
  font-size: clamp(2.6rem, 5.4vw, 4.9rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
  margin: 0 0 28px;
  color: var(--basin);
}
.hero-lede, .lake-now p {
  font-family: var(--font-read);
  font-size: 1.12rem;
  line-height: 1.62;
  max-width: 34em;
  margin: 0 0 18px;
}
.lake-now {
  margin: 30px 0 22px;
  padding-left: 18px;
  border-left: 3px solid var(--halite);
}
.lake-now p { font-size: 1.04rem; margin-bottom: 10px; }
.hero-actions { margin: 0; }
.text-link {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--flood-deep);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.hero-plate { margin: 0; }
.plate-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 14px;
  align-items: stretch;
}
.plate-image {
  position: relative;
  aspect-ratio: 760 / 1170;
  max-height: 78vh;
  background: #20383E;
  overflow: hidden;
}
.plate-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.plate-fallback {
  position: absolute;
  inset: auto 16px 16px 16px;
  margin: 0;
  color: #CFDCDA;
  font-size: 0.9rem;
}
.hero-gauge { width: 96px; height: 100%; max-height: 78vh; overflow: visible; }
.hero-gauge text { font-family: var(--font-display); font-size: 12px; fill: var(--dune); font-variant-numeric: tabular-nums; }
.hero-gauge .g-end { font-size: 11px; }
.g-axis, .g-tick { stroke: var(--dune); stroke-width: 1; }
.g-water { fill: var(--flood); opacity: 0.18; }
.g-line line { stroke: var(--halite); stroke-width: 2.5; }
.g-line text { fill: var(--halite); font-weight: 600; font-size: 13px; }
@media (prefers-reduced-motion: no-preference) {
  .g-line { animation: rise 1.4s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes rise { from { transform: translateY(var(--rise)); opacity: 0.2; } }
}
.hero-plate figcaption {
  font-family: var(--font-read);
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--dune);
  margin-top: 10px;
  max-width: 44em;
}

.explore { margin-top: 64px; border-top: 1px solid var(--panel-edge); }
.explore-row {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 8px 32px;
  padding: 20px 0;
  border-bottom: 1px solid var(--panel-edge);
  text-decoration: none;
  color: inherit;
}
.explore-name {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--basin);
}
.explore-text { font-family: var(--font-read); font-size: 1.02rem; line-height: 1.55; color: var(--dune); max-width: 40em; }
.explore-row:hover .explore-name { color: var(--flood); }

/* ── Pages de lecture ─────────────────────────────────────── */

.tab-panel.prose { padding: 8px 0 64px; }
.nh-article.panel, .tab-panel.prose .panel { background: none; border: none; border-radius: 0; }
.nh-article .panel-head h2 {
  font-family: var(--font-display);
  font-stretch: 116%;
  font-weight: 600;
  font-size: clamp(2rem, 3.6vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 18px 0 8px;
}
.nh-body, .prose-body { font-family: var(--font-read); font-size: 1.06rem; line-height: 1.68; }
.nh-body p, .prose-body p { max-width: var(--measure); }
.nh-body h3 {
  font-family: var(--font-display);
  font-stretch: 110%;
  font-weight: 600;
  font-size: 1.35rem;
  margin: 2.2em 0 0.6em;
}
.nh-acknowledgement { font-style: italic; color: var(--dune); max-width: var(--measure); }
.nh-toc { font-family: var(--font-display); }
.nh-toc-title { font-weight: 600; color: var(--basin); font-size: 0.9rem; }
.nh-references { font-size: 0.92rem; line-height: 1.55; }
a.cite { text-decoration: none; border-bottom: 1px dotted currentColor; }

.people-table th, .birds-table th {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--basin);
  background: var(--grid);
}
.people-table, .birds-table { font-family: var(--font-display); }

.catchment-plate { margin: 26px 0 32px; }
.catchment-map { height: 460px; border: 1px solid var(--panel-edge); background: var(--grid); }
.catchment-plate figcaption, .nh-body figcaption {
  font-style: italic;
  font-size: 0.9rem;
  color: var(--dune);
  margin-top: 8px;
  max-width: var(--measure);
}

.story-list { list-style: none; padding: 0; margin: 10px 0 26px; max-width: var(--measure); }
.story-list li { padding: 12px 0; border-bottom: 1px solid var(--grid); }
.story-list li:first-child { border-top: 1px solid var(--grid); }
.story-title { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; color: var(--flood-deep); }
.story-meta { display: block; font-size: 0.95rem; color: var(--dune); margin-top: 2px; }

/* ── Observatory : des planches, pas des cartes à ombre ───── */


.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
}
.panel-head h2, .panel h2 {
  font-family: var(--font-display);
  font-stretch: 108%;
  font-weight: 600;
  letter-spacing: 0;
}
.chart-note { font-family: var(--font-read); font-style: italic; color: var(--dune); }
.seg-btn { font-family: var(--font-display); border-radius: var(--radius); }

footer { font-family: var(--font-display); color: var(--dune); }

/* ── Petits écrans ────────────────────────────────────────── */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .plate-image { max-height: 70vh; }
  .explore-row { grid-template-columns: 1fr; }
  .masthead { padding: 16px 18px 10px; }
  .home, .tab-panel.prose { padding-left: 18px; padding-right: 18px; }
  nav.tabs, .subbar { padding-left: 18px; padding-right: 18px; }
}

/* Alignement : l'en-tête et les sous-navigations suivent main */
.masthead, nav.tabs, .subbar { box-sizing: border-box; }
.plate-image img[hidden] { display: none; }

.demo-banner {
  background: var(--basin);
  color: #DDE6E4;
  font-family: var(--font-display);
  font-size: 0.88rem;
  text-align: left;
  padding: 8px 28px;
}
.demo-banner code { background: rgba(255, 255, 255, 0.12); color: #FFFFFF; }

/* ── Retouches après relecture des captures ───────────────── */

.section-btn, .section-btn:hover, .section-btn.active { background: none; box-shadow: none; }

.nh-article .panel-head, .nh-article .nh-layout { padding-left: 0; padding-right: 0; }
.nh-acknowledgement {
  background: none;
  border: none;
  border-left: 2px solid var(--panel-edge);
  border-radius: 0;
  padding: 2px 0 2px 16px;
}

/* Les filets des sous-navigations couvrent exactement la colonne de texte */
nav.tabs, .subbar { max-width: calc(var(--page) - 56px); padding-left: 0; padding-right: 0; }
.tab { font-weight: 500; border-bottom: 2px solid transparent; padding-bottom: 5px; }
.tab.active { font-weight: 600; border-bottom-color: var(--flood); }

.demo-banner { padding: 8px max(28px, calc((100% - var(--page)) / 2 + 28px)); }

.wordmark { white-space: nowrap; }

@media (max-width: 900px) {
  main { padding-left: 18px; padding-right: 18px; }
  nav.tabs, .subbar { max-width: none; margin-left: 18px; margin-right: 18px; }
  .wordmark span { display: block; margin-left: 0; font-size: 0.95rem; }
  nav.sections { gap: 2px 18px; }
  .demo-banner { padding: 8px 18px; }
}

/* Le rose des saumures est réservé à la ligne d'eau de l'accueil */
.date-btn-latest.active,
.marker-dot.selected {
  background: var(--flood);
  border-color: var(--flood);
}

.level-value { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* The dashboard views share one map and one set of data bindings. */
#tab-observatory[data-view="observatory"] [data-dashboard-view]:not([data-dashboard-view="observatory"]):not([data-dashboard-view="map"]),
#tab-observatory[data-view="modelling"] [data-dashboard-view]:not([data-dashboard-view="modelling"]):not([data-dashboard-view="map"]),
#tab-observatory[data-view="birds"] [data-dashboard-view]:not([data-dashboard-view="birds"]) {
  display: none;
}
