/* Atlas Pacifica — thème unique "salle de prévision" (sombre, choisi volontairement pour l'imagerie satellite) */
@font-face { font-family: "IBM Plex Sans Condensed"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-condensed-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
:root {
  color-scheme: dark;
  --fond: #0b1216;
  --panneau: #111c21;
  --panneau-2: #16242a;
  --ligne: #243640;
  --texte: #e8eef0;
  --texte-2: #9bb0b8;
  --texte-3: #6d828a;
  --accent: #f2b445;
  --accent-encre: #1b1305;
  --nino: #e5604a;
  --nina: #4f97de;
  --neutre: #7d8b91;
  --pluie: #6fb7d6;
  --ui: "IBM Plex Sans Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --rail: 330px;
  --tiroir: 400px;
  --r: 6px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.45 var(--ui); -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.etiquette {
  font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--texte-3); margin: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  height: 100%; display: grid; grid-template-columns: 1fr auto;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Rail ---------- */
.rail {
  background: var(--panneau); border-right: 1px solid var(--ligne);
  overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 16px 16px; z-index: 1000;
  /* Panneau rétractable, superposé à la carte (ordinateur comme téléphone) : la carte garde toute la largeur. */
  position: fixed; top: 0; bottom: 0; left: 0; width: min(88vw, var(--rail));
  transform: translateX(-102%); transition: transform .25s ease; box-shadow: 8px 0 30px rgba(0, 0, 0, .5);
  padding-top: calc(18px + env(safe-area-inset-top, 0px)); visibility: hidden;
}
.rail.ouvert { transform: none; visibility: visible; }
.marque { display: grid; gap: 4px; }
.marque-ligne { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.marque h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: .01em; text-wrap: balance; }
.marque-sous { margin: 0; font-size: 13px; color: var(--texte-2); }
.marque-titre { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marque-logo { width: 44px; height: 44px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px var(--ligne); }
.installer { justify-self: start; margin-top: 4px; font-size: 13px; }
.enso-texte .enso-type { color: var(--texte-3); font-size: 11px; }
.hors-ligne {
  position: absolute; z-index: 1200; left: 50%; top: 64px; transform: translateX(-50%);
  max-width: min(520px, calc(100% - 24px)); margin: 0; padding: 8px 14px; border-radius: var(--r);
  background: var(--accent); color: var(--accent-encre); font-size: 13px; font-weight: 500; text-align: center;
}
.rail-fermer { display: inline-block; }

.enso {
  margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: var(--panneau-2); border-radius: var(--r);
}
.enso[hidden] { display: none; }
.enso-texte { display: grid; gap: 1px; justify-items: start; }
.pourquoi {
  margin-top: 4px; padding: 2px 8px; border: 1px solid var(--ligne); border-radius: 999px; background: transparent;
  color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer;
}
.pourquoi:hover { border-color: var(--accent); }
.mjo-diagramme { width: 64px; height: 64px; flex: none; }
.couches-groupe { margin: 8px 0 0; font-size: 12px; font-weight: 600; color: var(--texte-2); }
.couches-groupe:first-child { margin-top: 0; }
.fiche-section h3 { margin: 14px 0 4px; }
.fiche-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.enso-texte strong { font-size: 16px; }
.enso-texte .mono { font-size: 12px; color: var(--texte-2); }
.enso-spark { width: 120px; height: 32px; flex: none; }

.groupe { display: grid; gap: 8px; }
.couches { display: grid; gap: 6px; }
.couche {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; text-align: left;
  width: 100%; padding: 9px 11px; border-radius: var(--r); cursor: pointer;
  background: transparent; border: 1px solid var(--ligne);
  transition: border-color .15s, background .15s;
}
.couche:hover { border-color: var(--texte-3); background: var(--panneau-2); }
.couche strong { font-size: 15px; font-weight: 600; }
.couche small { grid-column: 1; font-size: 12.5px; color: var(--texte-2); }
.couche .pastille {
  grid-row: 1 / span 2; grid-column: 2; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--texte-3);
}
.couche[aria-checked="true"] { border-color: var(--accent); background: rgba(242, 180, 69, .08); }
.couche[aria-checked="true"] .pastille { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2px var(--panneau); }

.bascule {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; cursor: pointer;
  padding: 8px 2px;
}
.bascule input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); }
.bascule span { display: grid; }
.bascule small { font-size: 12.5px; color: var(--texte-2); }
.echeance { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 0 2px 6px 29px; }
.echeance .mono { font-size: 12px; color: var(--accent); min-width: 88px; text-align: right; }
input[type="range"] { accent-color: var(--accent); width: 100%; }

.episode { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 6px 2px; cursor: pointer; }
.episode input { margin-top: 3px; accent-color: var(--accent); }
.episode small { display: block; font-size: 12.5px; color: var(--texte-2); }

.rail-pied { margin-top: auto; font-size: 12px; color: var(--texte-3); display: grid; gap: 6px; }
.rail-pied p { margin: 0; }

/* ---------- Scène carte ---------- */
.scene { position: relative; min-width: 0; }
.carte { position: absolute; inset: 0; background: #06101a; }
.leaflet-container { font: 13px var(--ui); background: #06101a; }
.leaflet-control-attribution { background: rgba(11, 18, 22, .8) !important; color: var(--texte-3) !important; font-size: 11px; }
.leaflet-control-attribution a { color: var(--texte-2) !important; }
.leaflet-bar a { background: var(--panneau) !important; color: var(--texte) !important; border-color: var(--ligne) !important; }

.rail-ouvrir {
  position: absolute; top: 12px; left: 12px; z-index: 900; display: inline-flex; align-items: center; gap: 8px;
  max-width: calc(100% - 300px); background: rgba(17, 28, 33, .94);
}
.rail-ouvrir-couche { font-weight: 500; color: var(--texte-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.astuce {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 800; margin: 0;
  max-width: min(560px, calc(100% - 140px)); padding: 7px 12px; border-radius: 999px;
  background: rgba(11, 18, 22, .82); color: var(--texte-2); font-size: 13px; text-align: center;
  pointer-events: none; transition: opacity .4s;
}
.astuce.efface { opacity: 0; }

/* Légende : superposée, se replie seule après quelques secondes ; la puce « Légende » la rouvre. */
.legende {
  position: absolute; left: 12px; top: 62px; z-index: 800; display: grid; gap: 8px; align-content: start;
  max-width: min(360px, calc(100% - 24px)); max-height: calc(100% - 180px); overflow-y: auto;
  transition: opacity .3s, transform .3s;
}
.legende:empty { display: none; }
.legende.repliee { opacity: 0; transform: translateY(8px); pointer-events: none; visibility: hidden; }
.legende-fermer {
  justify-self: end; border: 1px solid var(--ligne); background: rgba(17, 28, 33, .92); color: var(--texte-2);
  border-radius: 999px; padding: 2px 10px; font-size: 12px; cursor: pointer;
}
.legende-puce {
  position: absolute; left: 12px; top: 62px; z-index: 800; background: rgba(17, 28, 33, .94);
  font-size: 13px; padding: 6px 12px; border-radius: 999px;
}
.legende-bloc {
  background: rgba(17, 28, 33, .92); border: 1px solid var(--ligne); border-radius: var(--r);
  padding: 9px 11px; display: grid; gap: 6px;
}
.legende-bloc strong { font-size: 13.5px; }
.legende-bloc p { margin: 0; font-size: 12px; color: var(--texte-2); }
.legende-bloc img { width: 100%; height: auto; background: #f4f6f6; border-radius: 3px; padding: 2px; }
.legende-degrade { height: 10px; border-radius: 2px; }
.legende-ticks { display: flex; justify-content: space-between; font: 11px var(--mono); color: var(--texte-2); }
.legende-cases { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--texte-2); }
.legende-cases span { display: inline-flex; align-items: center; gap: 5px; }
.legende-cases i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }

.temps {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 850;
  width: min(640px, calc(100% - 24px)); display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center;
  background: rgba(17, 28, 33, .94); border: 1px solid var(--ligne); border-radius: 12px; padding: 10px 14px;
}
.temps-corps { display: grid; gap: 4px; min-width: 0; }
.temps-haut { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.temps-date { font-size: 13.5px; color: var(--texte); }
.temps-etat { font-size: 12px; color: var(--texte-2); }

/* ---------- Boutons ---------- */
.btn {
  border: 1px solid var(--ligne); background: var(--panneau); border-radius: var(--r);
  padding: 7px 12px; cursor: pointer; font-weight: 600;
}
.btn:hover { border-color: var(--accent); }
.btn-rond {
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); display: grid; place-items: center;
}
.btn-rond svg { width: 20px; height: 20px; fill: var(--accent-encre); }
.btn-icone { border: 0; background: transparent; cursor: pointer; font-size: 16px; color: var(--texte-2); padding: 4px 8px; }

/* ---------- Tiroir d'analyse ---------- */
.tiroir {
  width: var(--tiroir); background: var(--panneau); border-left: 1px solid var(--ligne);
  overflow-y: auto; z-index: 1000; display: flex; flex-direction: column;
}
.tiroir[hidden] { display: none; }
.tiroir-tete {
  position: sticky; top: 0; z-index: 2; background: var(--panneau); border-bottom: 1px solid var(--ligne);
  display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 0 16px;
}
.onglets { display: flex; gap: 4px; }
.onglets button {
  border: 0; background: none; cursor: pointer; padding: 8px 10px 10px; font-weight: 600; color: var(--texte-2);
  border-bottom: 2px solid transparent;
}
.onglets button[aria-selected="true"] { color: var(--texte); border-bottom-color: var(--accent); }
.vue { padding: 14px 16px 24px; display: grid; gap: 14px; }
.vue[hidden] { display: none; }
.vue h3 { margin: 0; font-size: 14px; font-weight: 500; color: var(--texte-2); }
.vide { color: var(--texte-2); margin: 0; }
.note { font-size: 12px; color: var(--texte-3); margin: 0; }
#point-contenu, #cyc-contenu { display: grid; gap: 14px; }
#point-contenu[hidden], #cyc-contenu[hidden] { display: none; }

.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.tuile { background: var(--panneau-2); border-radius: var(--r); padding: 9px 10px; display: grid; gap: 2px; }
.tuile span { font-size: 11.5px; color: var(--texte-2); }
.tuile strong { font: 500 20px var(--mono); font-variant-numeric: tabular-nums; }
.tuile em { font-style: normal; font-size: 11.5px; color: var(--texte-3); }

.graphe { margin: 0; display: grid; gap: 6px; }
.graphe figcaption { font-size: 12.5px; color: var(--texte-2); }
.graphe canvas { width: 100% !important; }

.champ { display: grid; gap: 5px; font-size: 12.5px; color: var(--texte-2); }
.champ select {
  background: var(--panneau-2); border: 1px solid var(--ligne); border-radius: var(--r); padding: 8px 10px; font-size: 15px;
}
.saison-info { display: flex; flex-wrap: wrap; gap: 6px; }
.puce {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  background: var(--panneau-2); font-size: 12.5px;
}
.puce i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cyc-lecture { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cyc-lecture .mono { font-size: 13px; color: var(--accent); }
.cyc-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cyc-liste li { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; padding: 5px 0; border-bottom: 1px solid var(--ligne); }
.cyc-liste .mono { color: var(--texte-2); font-size: 12.5px; }
.echelle { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--texte-2); }
.echelle span { display: inline-flex; align-items: center; gap: 5px; }
.echelle i { width: 18px; height: 4px; border-radius: 2px; display: inline-block; }

/* Flèches de vent et étiquettes de cyclones */
.fleche { display: grid; place-items: center; }
.fleche svg { overflow: visible; filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, .9)); }
.nom-cyclone {
  background: rgba(11, 18, 22, .85); color: var(--texte); border: 0; border-radius: 4px; padding: 1px 6px;
  font: 600 12px var(--ui); box-shadow: none;
}
.nom-cyclone::before { display: none; }

/* ---------- Téléphone ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .rail-ouvrir { max-width: calc(100% - 270px); overflow: hidden; }
  .astuce { top: auto; bottom: 96px; max-width: calc(100% - 24px); font-size: 12px; border-radius: 10px; }
  .hors-ligne { top: 150px; }
  .tiroir {
    position: fixed; inset: auto 0 0 0; width: 100%; max-height: 72vh; border-left: 0;
    border-top: 1px solid var(--ligne); border-radius: 14px 14px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .5);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .legende { max-width: calc(100% - 24px); max-height: 50vh; }
  .legende-bloc p { display: none; }
  .temps { bottom: 14px; padding: 6px 10px; gap: 8px; }
  .temps-date { font-size: 12px; }
  .temps-etat { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}
@media (max-width: 560px) { .rail-ouvrir-couche { display: none; } }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Vue carte / globe ---------- */
.carte[hidden] { display: none; }
.vues {
  position: absolute; top: 12px; right: 56px; z-index: 900; display: flex;
  background: rgba(17, 28, 33, .94); border: 1px solid var(--ligne); border-radius: 999px; padding: 3px;
}
.vues button {
  border: 0; background: transparent; cursor: pointer; padding: 6px 14px; border-radius: 999px;
  font-weight: 600; font-size: 13.5px; color: var(--texte-2);
}
.vues button[aria-pressed="true"] { background: var(--accent); color: var(--accent-encre); }
#actualiser { font-size: 18px; line-height: 1; padding-inline: 12px; }
.maj-dispo {
  position: absolute; z-index: 1250; left: 50%; top: 64px; transform: translateX(-50%); margin: 0;
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r);
  background: var(--panneau); border: 1px solid var(--accent); color: var(--texte); font-size: 13px; max-width: calc(100% - 24px);
}
.maj-dispo[hidden] { display: none; }
.globe-actif .leaflet-control-zoom { display: none; }
.globe-actif .vues { right: 12px; }
.maplibregl-ctrl-attrib { background: rgba(11, 18, 22, .8) !important; color: var(--texte-3) !important; font-size: 11px; }
.maplibregl-ctrl-attrib a { color: var(--texte-2) !important; }
.maplibregl-ctrl-group { background: var(--panneau) !important; }
.maplibregl-ctrl-group button span { filter: invert(1); }

/* ---------- Noms de lieux ---------- */
.lieu {
  font: 500 12px var(--ui); color: #f3f6f7; white-space: nowrap; pointer-events: none;
  text-shadow: 0 0 3px #04090c, 0 0 3px #04090c, 0 0 2px #04090c;
  transform: translate(-50%, -50%); width: max-content;
}
.lieu-1 { font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.lieu-2 { font-size: 12px; font-style: italic; color: #d9e7ec; }
.lieu-3 { font-size: 11.5px; }
.lieu-3::before { content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: #f3f6f7; margin-right: 4px; vertical-align: middle; }
.leaflet-div-icon.lieu-conteneur { background: none; border: 0; }

/* ---------- Cyclones en cours ---------- */
.actif {
  display: grid; place-items: center; width: 34px; height: 34px;
}
.actif svg { width: 34px; height: 34px; animation: tourne 3s linear infinite; filter: drop-shadow(0 0 3px rgba(0,0,0,.9)); }
@keyframes tourne { to { transform: rotate(-360deg); } }
.actif-nom {
  background: rgba(11, 18, 22, .92); color: var(--texte); border: 1px solid var(--nino); border-radius: 4px;
  padding: 2px 7px; font: 600 12.5px var(--ui); box-shadow: none;
}
.actif-nom::before { display: none; }
.globe-etiquette { transform: translate(14px, -50%); pointer-events: none; }

.leaflet-div-icon.actif, .leaflet-div-icon.fleche { background: none; border: 0; }

/* ---------- Confidentialité ---------- */
.rail-pied .lien-bouton { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: inherit; }
.notice {
  position: absolute; z-index: 1300; right: 12px; bottom: 12px; max-width: min(380px, calc(100% - 24px));
  margin: 0; padding: 12px 14px; border: 1px solid var(--ligne); border-radius: var(--r);
  background: var(--panneau); color: var(--texte-2); font-size: 13px; display: grid; gap: 8px;
}
.notice[hidden] { display: none; }
.notice strong { color: var(--texte); }
.notice-actions { display: flex; gap: 8px; justify-content: flex-end; }
.fenetre {
  width: min(640px, calc(100% - 24px)); max-height: calc(100% - 48px); padding: 0;
  border: 1px solid var(--ligne); border-radius: var(--r); background: var(--panneau); color: var(--texte);
}
.fenetre::backdrop { background: rgba(0, 0, 0, .6); }
.fenetre-tete { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--ligne); position: sticky; top: 0; background: var(--panneau); }
.fenetre-tete h2 { margin: 0; font-size: 18px; }
.fenetre-corps { padding: 4px 16px 16px; font-size: 14px; color: var(--texte-2); }
.fenetre-corps h3 { color: var(--texte); font-size: 15px; margin: 16px 0 4px; }
.fenetre-corps p, .fenetre-corps ul { margin: 4px 0; }

/* Sans réseau : on masque les images NASA (indisponibles) pour laisser voir le fond hors ligne. */
.sans-reseau .leaflet-tile-pane, .sans-reseau .leaflet-donnees-pane, .sans-reseau .leaflet-reperes-pane { visibility: hidden; }
.legende-bloc .pourquoi { justify-self: start; }

/* ---------- Exports ---------- */
.exports { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.exports .btn { font-size: 13px; }
.graphe figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.exp-png, .legende-exports button {
  flex: none; padding: 1px 8px; border: 1px solid var(--ligne); border-radius: 999px; background: transparent;
  color: var(--texte-2); font-size: 11px; font-weight: 600; cursor: pointer;
}
.exp-png:hover, .legende-exports button:hover { color: var(--accent); border-color: var(--accent); }
.legende-exports { display: flex; flex-wrap: wrap; gap: 6px; }
.impression-entete { display: none; }

/* ---------- Rapport PDF (impression) ---------- */
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  html, body { height: auto; background: #0b1216 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.impression-point .app { display: block; padding: 0; }
  body.impression-point .rail, body.impression-point .scene, body.impression-point .tiroir-tete,
  body.impression-point .exports, body.impression-point .exp-png, body.impression-point .notice,
  body.impression-point #vue-cyclones, body.impression-point #point-vide { display: none !important; }
  body.impression-point .tiroir { display: block !important; position: static; width: 100%; max-height: none; overflow: visible; border: 0; box-shadow: none; }
  body.impression-point .impression-entete { display: block; color: #e8eef0; margin-bottom: 8mm; }
  .impression-entete h1 { font-size: 18pt; margin: 0 0 2mm; }
  .impression-entete p { margin: 0 0 1.5mm; font-size: 9.5pt; color: #9bb0b8; }
  .impression-entete .avertissement { color: #f2b445; }
  body.impression-point .graphe { break-inside: avoid; }
}
