/* Adastrum — système de base : polices, couleurs, typographie, tableau de tuiles. */

@font-face {
  font-family: 'Jost';
  src: url('../fonts/jost.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('../fonts/plexmono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('../fonts/plexmono-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

/* ---------- Couleurs ---------- */
/* Clair : trois pierres et un vert gris. */
/* Sombre (thème par défaut) : noir neutre, encre adoucie, vert phosphore. */
:root {
  color-scheme: dark;
  --bg: #0c0d0d;
  --tile: #151616;
  --tile-2: #1e1f1f;
  --field: #29302a;
  --ink: #d9d6d0;
  --muted: #96928c;
  --accent: #93c47d;
  --accent-ink: #0c0d0d;
  --rule: rgba(217, 214, 208, 0.16);
  --night-shade: rgba(0, 0, 0, 0.42);
  --img-filter: brightness(0.86);
  --action: #2c3f27;
  --action-ink: #d4ecc8;
  --sky-day: #77746b;
  --sky-civil: #55534d;
  --sky-naut: #3a3a36;
  --sky-astro: #262624;
  --sky-night: #0c0d0d;
  --moon-lit: #e6e3dc;
  --moon-dark: #262827;
  --map-sea: #0e0f0f;
  --map-land: #393c3a;
}

/* Rouge : rouge brique sombre sur noir, pour garder l'œil adapté à l'obscurité. */
:root[data-theme='night'] {
  color-scheme: dark;
  --bg: #000000;
  --tile: #090101;
  --tile-2: #120303;
  --field: #190404;
  --ink: #8a2e24;
  --muted: #5c1d16;
  --accent: #973327;
  --accent-ink: #000000;
  --rule: rgba(138, 46, 36, 0.22);
  --night-shade: rgba(0, 0, 0, 0.5);
  --img-filter: grayscale(1) brightness(0.2) sepia(1) hue-rotate(-50deg) saturate(3);
  --action: #190505;
  --action-ink: #973327;
  --sky-day: #2c0704;
  --sky-civil: #200503;
  --sky-naut: #150302;
  --sky-astro: #120202;
  --sky-night: #060000;
  --moon-lit: #8a2e24;
  --moon-dark: #160303;
  --map-sea: #030000;
  --map-land: #1d0505;
}

/* ---------- Typographie et mouvement ---------- */
:root {
  --font: 'Jost', 'Futura', 'Century Gothic', system-ui, sans-serif;
  --mono: 'Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* Cinq tailles, pas une de plus. */
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --step-display: clamp(3.5rem, 1rem + 9vw, 9rem);

  --gap: 8px;
  --pad: clamp(16px, 1.6vw, 24px);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-ui: 240ms;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-body);
  line-height: 1.5;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, canvas { display: block; max-width: 100%; }

/* ---------- Carte du monde (assets/js/map.js) ---------- */
.world-map { width: 100%; height: auto; aspect-ratio: 2 / 1; overflow: hidden; }
.wm-sea { fill: var(--map-sea); }
.wm-land { fill: var(--map-land); }
.wm-grid { fill: none; stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.wm-night { fill: var(--night-shade); }
.wm-aurora { fill: var(--accent); }
.wm-past { fill: none; stroke: var(--muted); }
.wm-future { fill: none; stroke: var(--accent); }
.wm-footprint { fill: none; stroke: var(--accent); stroke-opacity: 0.7; }
.wm-dot { fill: var(--ink); }
.wm-dot.accent { fill: var(--accent); }
.wm-halo, .wm-label-bg { fill: var(--tile); }
.wm-label { font-family: var(--mono); fill: var(--ink); }
.wm-label.strong { font-weight: 500; }
img { filter: var(--img-filter); }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

[hidden] { display: none !important; }
/* Le temps de traduire la page en anglais (voir theme.js). */
.i18n-pending body { visibility: hidden; }

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

/* Les chiffres, et seulement eux, sont en monospace. */
.num, time.num, .data {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums slashed-zero;
  letter-spacing: -0.01em;
}

.display {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 0.9;
}

.head { font-size: var(--step-head); font-weight: 600; line-height: 1.02; letter-spacing: -0.025em; }
.lead { font-size: var(--step-lead); line-height: 1.3; letter-spacing: -0.01em; }
.small { font-size: var(--step-small); line-height: 1.45; }
.muted { color: var(--muted); }

/* ---------- Le tableau ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
  padding: 0 var(--gap) var(--gap);
}

.tile {
  background: var(--tile);
  padding: var(--pad);
  min-width: 0;
  position: relative;
}
.tile--deep { background: var(--tile-2); }
.tile--field { background: var(--field); }
.tile--flush { padding: 0; overflow: hidden; }
.tile--accent { background: var(--action); color: var(--action-ink); }

.tile > h2:not(.head) { font-size: var(--step-lead); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h1.small { font-weight: 400; }

/* Phrase d'introduction de la page, et section « À propos de cet outil » (texte lisible sans JavaScript). */
.page-intro { max-width: 68ch; margin-top: 14px; }
.about-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 32px; margin-top: 14px; }
.about h3 { font-size: var(--step-small); font-weight: 600; margin: 0 0 4px; }
.about p { font-size: var(--step-small); line-height: 1.5; color: var(--muted); max-width: 60ch; }
@media (max-width: 860px) { .about-cols { grid-template-columns: 1fr; } }

/* Source et fraîcheur d'une donnée. */
.source { font-size: var(--step-small); color: var(--muted); }
.source[data-state='stale'] { color: var(--ink); }

.span-12 { grid-column: span 12; }
.span-9 { grid-column: span 9; }
.span-8 { grid-column: span 8; }
.span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }

@media (max-width: 1080px) {
  .span-9, .span-8, .span-7 { grid-column: span 12; }
  .span-5, .span-4, .span-3 { grid-column: span 6; }
}
@media (max-width: 640px) {
  .board { gap: 6px; padding: 0 6px 6px; --gap: 6px; }
  .span-6, .span-5, .span-4, .span-3 { grid-column: span 12; }
}

/* ---------- En-tête : rubriques, puis pages de la rubrique ---------- */
.masthead {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  padding: var(--gap);
}
.masthead a, .masthead button {
  background: var(--tile);
  text-decoration: none;
  border: 0;
  padding: 14px var(--pad) 16px;
  min-height: 56px;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background-color var(--t-hover) ease;
}
.masthead a:hover, .masthead button:hover { background: var(--tile-2); }
.masthead .wordmark {
  flex: 0 0 auto;
  min-width: clamp(160px, 15vw, 260px);
  font-weight: 700;
  font-size: var(--step-lead);
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
/* Les deux rubriques : grandes tuiles. */
.masthead .sections { display: flex; gap: var(--gap); flex: 1 1 auto; min-width: 0; }
.masthead .sections a, .masthead .sections button { flex: 1 1 0; font-size: var(--step-lead); font-weight: 500; }
.masthead .sections a[aria-current], .masthead .sections button[aria-expanded='true'] { background: var(--tile-2); font-weight: 700; }
.masthead .theme-toggle { flex: 0 0 auto; min-width: 150px; justify-content: space-between; gap: 12px; }
.masthead .lang-toggle { flex: 0 0 auto; font-weight: 600; }
/* Les pages de la rubrique en cours : une ligne plus basse. */
.masthead .subnav[hidden] { display: none; }
.masthead .subnav { display: flex; gap: var(--gap); flex: 1 1 100%; min-width: 0; }
.masthead .subnav a { flex: 1 1 auto; min-height: 48px; padding-block: 12px 13px; }
.masthead .subnav a[aria-current='page'] { background: var(--tile-2); font-weight: 600; }
.masthead .menu-toggle, .masthead .menu-panel { display: none; }

@media (max-width: 860px) {
  .masthead { gap: 6px; padding: 6px; }
  .masthead .wordmark { flex: 1 1 auto; }
  .masthead .menu-toggle { display: flex; flex: 0 0 34%; }
  .masthead .sections, .masthead .subnav, .masthead .theme-toggle, .masthead .lang-toggle { display: none; }
  .masthead[data-open] .menu-panel { display: grid; gap: 6px; flex: 1 1 100%; }
  .masthead[data-open] .theme-toggle { display: flex; flex: 1 1 auto; order: 10; }
  .masthead[data-open] .lang-toggle { display: flex; order: 11; }
  .menu-group { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .menu-title { grid-column: 1 / -1; font-weight: 700; padding: 10px 2px 2px; }
  .menu-group a[aria-current='page'] { background: var(--tile-2); font-weight: 600; }
}

/* Lien qui est en réalité un bouton (changer de lieu, etc.). */
.link-button {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

/* ---------- Boutons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 20px;
  border: 0;
  border-radius: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--t-press) var(--ease-out), opacity var(--t-hover) ease;
}
.button:hover { opacity: 0.88; }
.button:active { transform: translateY(1px) scale(0.985); }
.button--quiet { background: var(--tile-2); color: var(--ink); }
/* En rouge, pas d'aplat vif : le bouton principal reste sombre, son texte porte la couleur. */
[data-theme='night'] .button:not(.button--quiet) { background: #260906; color: var(--accent); }

/* Lien d'action plein écran dans une tuile accent. */
.action-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
  transition: transform var(--t-press) var(--ease-out);
}
.action-tile:active { transform: scale(0.99); }

/* Choix entre deux ou trois options. */
.segmented { display: inline-flex; gap: 4px; }
.segmented button {
  border: 0;
  background: var(--tile-2);
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  font-size: var(--step-small);
  transition: background-color var(--t-hover) ease;
}
.segmented button[aria-pressed='true'] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
[data-theme='night'] .segmented button[aria-pressed='true'] { background: #260906; color: var(--accent); }

/* Curseurs : rail sombre, partie parcourue et bouton dans l'accent. Le même dessin dans les deux thèmes
   (le bouton natif, clair, éblouissait en thème rouge). */
input[type='range'] {
  -webkit-appearance: none; appearance: none;
  background: transparent; min-height: 44px; margin: 0; cursor: pointer;
}
input[type='range']::-moz-range-track { height: 6px; background: var(--field); border: 0; }
input[type='range']::-moz-range-progress { height: 6px; background: var(--accent); }
input[type='range']::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--accent); }
input[type='range']::-webkit-slider-runnable-track { height: 6px; background: var(--field); }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--accent); }
input[type='range']:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Tableaux de données (instruments : filets autorisés) ---------- */
/* Un tableau trop large défile dans son cadre au lieu d'élargir la page. */
.table-wrap { overflow-x: auto; max-width: 100%; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step-small);
}
.data-table th {
  text-align: left;
  font-family: var(--font);
  font-weight: 500;
  color: var(--muted);
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--rule);
}
.data-table td {
  font-size: 1rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums slashed-zero;
  padding: 12px 12px 12px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  white-space: nowrap;
}
.data-table td.td-text { font-family: var(--font); }
.data-table tbody tr { cursor: pointer; transition: background-color var(--t-hover) ease; }
.data-table tbody tr:hover { background: var(--tile-2); }
.data-table tbody tr[aria-selected='true'] { background: var(--tile-2); }
.data-table tbody tr[aria-selected='true'] td:first-child { box-shadow: inset 4px 0 0 var(--accent); padding-left: 12px; }

/* ---------- Listes de valeurs ---------- */
.readout { display: grid; gap: 14px; }
.readout div { display: grid; gap: 2px; }
.readout dt { font-size: var(--step-small); color: var(--muted); }
.readout dd { font-family: var(--mono); font-variant-numeric: tabular-nums slashed-zero; font-size: var(--step-lead); line-height: 1.15; }

/* ---------- Dialogue de position ---------- */
dialog {
  border: 0;
  padding: 0;
  background: var(--tile);
  color: var(--ink);
  width: min(560px, calc(100vw - 24px));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog-body { display: grid; gap: 16px; padding: var(--pad); }
.field {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 0;
}
.field:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.choice-list { display: grid; gap: 4px; }
.choice-list button {
  width: 100%;
  text-align: left;
  border: 0;
  background: var(--tile-2);
  padding: 12px 14px;
  cursor: pointer;
  transition: background-color var(--t-hover) ease;
}
.choice-list button:hover { background: var(--field); }

/* ---------- Demande de position ---------- */
.loc-prompt {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 32px;
}
.loc-prompt-text { display: grid; gap: 6px; max-width: 68ch; }
.loc-prompt-text .lead { font-weight: 600; }
.loc-prompt-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.loc-prompt .button--quiet { background: var(--tile); }

/* ---------- Pied de page ---------- */
.foot {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
  padding: 0 var(--gap) var(--gap);
  margin-top: 64px;
}
.foot .tile { font-size: var(--step-small); }
.foot .foot-name {
  grid-column: span 12;
  overflow: hidden;
  white-space: nowrap;
  font-size: min(15rem, 15.5vw, calc((100vw - 48px) / 5.4));
  padding: 0;
  height: clamp(64px, 12vw, 190px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: var(--ink);
  background: var(--field);
}
.foot-name span { transform: translateY(0.12em); }
@media (max-width: 640px) {
  .foot { gap: 6px; padding: 0 6px 6px; }
  .foot .tile { grid-column: span 12 !important; }
}

/* ---------- États ---------- */
.empty-state { display: grid; gap: 12px; align-content: start; }

/* Une seule entrée : les tuiles se posent une fois, dans l'ordre de lecture. */
@media (prefers-reduced-motion: no-preference) {
  .js .board > .tile { animation: tile-in 520ms var(--ease-out) both; }
  .js .board > .tile:nth-child(2) { animation-delay: 60ms; }
  .js .board > .tile:nth-child(3) { animation-delay: 120ms; }
  .js .board > .tile:nth-child(4) { animation-delay: 180ms; }
  .js .board > .tile:nth-child(n+5) { animation-delay: 240ms; }
}
/* Menu (téléphone) et pages d'une rubrique (ordinateur) : une courte descente, lien après lien. */
@media (prefers-reduced-motion: no-preference) {
  .masthead[data-open] .menu-panel > *, .masthead[data-open] .theme-toggle, .masthead[data-open] .lang-toggle,
  .masthead .subnav[data-anim] a { animation: nav-in 220ms var(--ease-out) both; }
  .masthead[data-open] .menu-panel > :nth-child(2) { animation-delay: 50ms; }
  .masthead[data-open] .theme-toggle, .masthead[data-open] .lang-toggle { animation-delay: 90ms; }
  .masthead .subnav[data-anim] a:nth-child(2) { animation-delay: 25ms; }
  .masthead .subnav[data-anim] a:nth-child(3) { animation-delay: 50ms; }
  .masthead .subnav[data-anim] a:nth-child(4) { animation-delay: 75ms; }
  .masthead .subnav[data-anim] a:nth-child(5) { animation-delay: 100ms; }
}
@keyframes nav-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
@keyframes tile-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Hors ligne et page 404 ---------- */
.offline { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: baseline; }
.offline strong { font-weight: 600; }
.lost { display: grid; gap: 16px; align-content: start; }
.lost-code { font-size: clamp(5rem, 2rem + 10vw, 11rem); line-height: 0.85; letter-spacing: -0.06em; }
.lost-link { display: grid; gap: 6px; text-decoration: none; transition: background-color var(--t-hover) ease; }
.lost-link:hover { background: var(--tile-2); }

/* ---------- Signature et mentions légales ---------- */
.foot .foot-sign { grid-column: span 6; font-size: var(--step-body); }
.foot .foot-legal { grid-column: span 6; font-size: var(--step-body); text-align: right; }
.legal-head { display: grid; gap: 12px; }
.legal-block { display: grid; gap: 12px; align-content: start; }
.legal-block h2 { font-size: var(--step-lead); font-weight: 600; }
.legal-block p { max-width: 75ch; }
.legal-list { display: grid; gap: 6px; padding-left: 1.2em; list-style: disc; max-width: 75ch; }
@media (max-width: 640px) {
  .foot .foot-legal { text-align: left; }
}

/* Lien texte autonome dans une tuile. */
.text-link { justify-self: start; font-weight: 500; }

/* ---------- Bandeau « lancement en direct » ---------- */
.live-banner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 28px; position: relative; cursor: pointer; transition: opacity var(--t-hover) ease; }
.live-banner:hover { opacity: 0.92; }
/* Toute la bannière mène au suivi en direct ; le lien du webcast reste cliquable au-dessus. */
.live-banner .live-follow::after { content: ''; position: absolute; inset: 0; }
.live-banner .live-webcast { position: relative; z-index: 1; }
.live-banner .live-what { flex: 1 1 320px; font-size: var(--step-lead); }
.live-banner .live-count { font-size: var(--step-lead); font-weight: 500; }
.live-banner .live-links { display: flex; gap: 20px; font-weight: 600; }
.live-banner a { color: inherit; }
