/* Météo Longes — habillage inspiré de l'app Météo d'iOS.
   Trois partis pris : un dégradé plein écran qui change avec la condition
   et l'heure, des cartes en « verre dépoli » (backdrop-filter), et une
   typographie très fine pour les grands nombres. */

:root {
  --sky-1: #1b4aa8;
  --sky-2: #3d7fd0;
  --sky-3: #7cc0f0;

  --ink: #fff;
  --ink-soft: rgba(255, 255, 255, .72);
  --ink-faint: rgba(255, 255, 255, .5);

  --card-bg: rgba(255, 255, 255, .14);
  --card-line: rgba(255, 255, 255, .18);
  --radius: 20px;

  --gap: 14px;
  --pad: 18px;

  /* Marges de sécurité iPhone (encoche, barre d'accueil). */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html {
  height: 100%;
  /* Fond réel de la page = haut du ciel. Safari (iOS 26) teinte la zone de la
     barre d'état et le dessous de la barre d'adresse avec cette couleur, pas
     avec la couche .sky : un fond fixe y laissait des bandes unies. */
  background-color: var(--sky-1);
  transition: background-color 1.1s ease;
  /* Zoom à deux doigts autorisé (accessibilité), mais pas le zoom au double
     tap, qui ferait sursauter la page quand on ouvre les jours d'une liste. */
  touch-action: manipulation;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  /* Le tiré-pour-rafraîchir est géré par l'app, pas par le navigateur. */
  overscroll-behavior-y: contain;
}

/* --- Fond ---------------------------------------------------------- */

/* Canevas des animations : mêmes dimensions que le ciel, juste au-dessus. */
.fx {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  pointer-events: none;
}

.sky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* lvh : hauteur écran barres escamotées. Avec inset: 0, le ciel s'arrêtait
     au-dessus de la barre d'adresse de Safari, qui laissait voir le fond. */
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  background: linear-gradient(175deg, var(--sky-1) 0%, var(--sky-2) 52%, var(--sky-3) 100%);
  transition: background 1.1s ease;
}

/* Voile sombre en bas : garde le texte lisible sur les dégradés clairs. */
.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .18) 0%, rgba(0, 0, 0, 0) 28%,
                                      rgba(0, 0, 0, 0) 62%, rgba(0, 0, 0, .28) 100%);
}

/* --- Mise en page --------------------------------------------------- */

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 10px) calc(var(--pad) + var(--safe-r))
           calc(var(--safe-b) + 28px) calc(var(--pad) + var(--safe-l));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.app[hidden] { display: none; }

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

.hero {
  position: relative;
  text-align: center;
  padding: 26px 0 12px;
}

/* Loupe : discrète, dans le coin, comme le bouton liste de l'app iOS. */
.search-btn {
  position: absolute;
  top: 4px;
  right: -6px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  cursor: pointer;
}

.search-btn svg { width: 19px; height: 19px; }

/* Étoile des favoris : même pastille que la loupe, à gauche. */
.fav-btn { right: auto; left: -6px; }
.fav-btn svg { width: 21px; height: 21px; }
.fav-btn[aria-pressed="true"] svg { fill: #FFD60A; stroke: #FFD60A; }

/* Points des favoris, sous l'en-tête. */
.fav-nav { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; }
.fav-nav[hidden] { display: none; }
.dots { display: flex; justify-content: center; gap: 7px; }
.fav-arrow {
  display: none;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, .14);
  cursor: pointer;
}
.fav-arrow svg { width: 15px; height: 15px; }
.fav-arrow:disabled { opacity: .3; cursor: default; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .35); }
.dots span.is-active { background: #fff; }

/* Apparition en cascade des blocs, au premier affichage et au changement de
   commune (pas à chaque actualisation). */
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } }
.app.is-entering > :not(.metrics),
.app.is-entering .metric { animation: rise-in .5s cubic-bezier(.2, .7, .3, 1) both; }
.app.is-entering > :nth-child(2) { animation-delay: .04s; }
.app.is-entering > :nth-child(3) { animation-delay: .08s; }
.app.is-entering > :nth-child(4) { animation-delay: .12s; }
.app.is-entering > :nth-child(5) { animation-delay: .16s; }
.app.is-entering .metric:nth-child(n) { animation-delay: .2s; }
.app.is-entering .metric:nth-child(n+3) { animation-delay: .24s; }
.app.is-entering .metric:nth-child(n+5) { animation-delay: .28s; }
.app.is-entering .metric:nth-child(n+7) { animation-delay: .32s; }

/* Changement de ville par balayage : le contenu reste affiché, estompé. */
.app { transition: opacity .2s ease; }
.app.is-switching { opacity: .45; }
.search-btn:active { background: rgba(255, 255, 255, .26); }

/* Commune qui suit la position du téléphone : petite flèche devant le nom. */
.place.is-following::before {
  content: "";
  display: inline-block;
  width: .5em;
  height: .5em;
  margin-right: .22em;
  vertical-align: .12em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 3 3 10.5l7.6 2.9L13.5 21 21 3Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 3 3 10.5l7.6 2.9L13.5 21 21 3Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.place {
  margin: 0;
  /* Place pour l'étoile et la loupe de part et d'autre. */
  padding: 0 38px;
  font-size: 34px;
  font-weight: 400;
  letter-spacing: .2px;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .22);
}

.temp-now {
  font-size: 92px;
  font-weight: 200;
  line-height: 1;
  letter-spacing: -4px;
  margin: 2px 0 0;
  text-shadow: 0 2px 22px rgba(0, 0, 0, .22);
}

/* Le « ° » ne doit pas hériter de l'interlettrage négatif du nombre. */
.temp-now .deg { letter-spacing: 0; }

.cond-now {
  margin: 4px 0 0;
  font-size: 20px;
  color: var(--ink-soft);
}

.range-now {
  margin: 2px 0 0;
  font-size: 19px;
  font-weight: 500;
  color: var(--ink-soft);
}

.stale {
  margin: 10px auto 0;
  padding: 5px 12px;
  width: max-content;
  border-radius: 100px;
  font-size: 13px;
  background: rgba(255, 183, 0, .22);
  border: 1px solid rgba(255, 183, 0, .38);
  color: #ffe6a8;
}

/* --- Cartes --------------------------------------------------------- */

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 12px 0 4px;
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .12);
}

.card-title {
  margin: 0 16px 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--card-line);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--ink-faint);
}


/* Tendances dépliées dans la carte des prévisions. */
.trends-block[hidden],
.trends-sep[hidden] { display: none; }

.trends-sep {
  margin: 0 16px;
  padding: 12px 0 4px;
  border-top: 1px solid var(--card-line);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.trends-sep + .trends-sep { border-top: 0; padding-top: 0; }
.stale-note { color: #ffe6a8; }

/* --- Radar de pluie ------------------------------------------------- */

.card[hidden] { display: none; }

.radar {
  position: relative;
  height: 230px;
  margin: 0 12px;
  overflow: hidden;
  border-radius: 14px;
  background: #1b1f24;
}

/* Origine du repère = la commune ; les tuiles sont placées autour, et
   l'ensemble agrandi de 1,5 (le radar ne va pas au-delà du zoom 7). */
.radar-map {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: scale(1.5);
  transform-origin: 0 0;
}

.radar-map img {
  position: absolute;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Fond OpenStreetMap assombri : la pluie ressort mieux sur une carte sombre. */
.radar-base { filter: grayscale(1) invert(1) brightness(.85) contrast(.9); }

.radar-frame { opacity: 0; transition: opacity .25s linear; }
.radar-frame.is-shown { opacity: .85; }

.radar-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px #0a84ff, 0 1px 6px rgba(0, 0, 0, .5);
}

.radar-pin::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid #0a84ff;
  animation: pin-pulse 2.4s ease-out infinite;
}
@keyframes pin-pulse {
  from { transform: scale(1); opacity: .9; }
  to { transform: scale(3.2); opacity: 0; }
}

.radar-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 2px;
}

.radar-play {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, .16);
  cursor: pointer;
}

.radar-play svg { width: 16px; height: 16px; }
.radar-play .icon-pause,
.radar-play.is-playing .icon-play { display: none; }
.radar-play.is-playing .icon-pause { display: inline; }

.radar-bar input { flex: 1 1 auto; min-width: 0; accent-color: #fff; }

.radar-time {
  flex: 0 0 auto;
  min-width: 44px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.radar-credit {
  margin: 4px 16px 8px;
  font-size: 11px;
  color: var(--ink-faint);
}

.radar-credit a { color: inherit; }

/* Bandeau de vigilance : couleur du niveau Météo-France. Opaque : en
   transparence, le jaune se mêle au ciel bleu et vire au vert. */
.vigilance {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 18px;
  text-decoration: none;
  color: #2e2600;
  background: rgba(255, 214, 10, .92);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .18);
}

/* Sans cette règle, display: flex l'emporte sur l'attribut hidden et un
   bandeau vide reste affiché quand la commune est au vert. */
.vigilance[hidden] { display: none; }

.vigilance[data-level="3"] { color: #fff; background: rgba(245, 124, 0, .94); }
.vigilance[data-level="4"] { color: #fff; background: rgba(215, 30, 40, .94); }

.vigilance-icon { flex: 0 0 auto; width: 26px; height: 26px; }
.vigilance-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.35; }
.vigilance-text strong { font-size: 15px; font-weight: 600; }

/* Phrase de résumé : prend la place du titre de la carte (gardé pour les
   lecteurs d'écran). */
.card-summary {
  margin: 0 16px 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--card-line);
  font-size: 15px;
  line-height: 1.35;
}

.has-summary .card-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Bouton en bas de carte : déplie / replie les tendances. */
.card-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - 32px);
  margin: 0 16px;
  padding: 12px 0 10px;
  border: 0;
  border-top: 1px solid var(--card-line);
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
}

.card-toggle[hidden] { display: none; }
.card-toggle:active { color: var(--ink); }

.card-toggle-chevron {
  width: 14px;
  height: 14px;
  transition: transform .25s ease;
}

.card-toggle[aria-expanded="true"] .card-toggle-chevron { transform: rotate(180deg); }

/* --- Bandeau horaire ------------------------------------------------ */

.hours {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 2px 12px 12px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.hours::-webkit-scrollbar { display: none; }

/* Graphique des prochaines heures, au-dessus du bandeau. */
.hours-chart { padding: 0 12px 2px; }
.hours-chart:empty { display: none; }
.hours-chart svg { display: block; width: 100%; height: auto; }
.chart-now { stroke: rgba(255, 255, 255, .35); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-extreme { font-size: 10px; font-weight: 600; text-anchor: middle; fill: var(--ink); }

.hour {
  flex: 0 0 auto;
  /* Largeur minimale : s'élargit pour « Lun. 02h » au changement de jour. */
  min-width: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 6px 4px;
  scroll-snap-align: start;
  border-radius: 14px;
}

.hour.is-now { background: rgba(255, 255, 255, .16); }

.hour-label { font-size: 14px; color: var(--ink-soft); }
.hour.is-now .hour-label { color: var(--ink); font-weight: 600; }
.hour.is-new-day .hour-label { color: var(--ink); font-weight: 600; }
/* Trait discret entre deux jours dans le bandeau. */
.hour.is-new-day { box-shadow: inset 1px 0 0 var(--card-line); border-radius: 0 14px 14px 0; }
.hour-temp { font-size: 20px; font-weight: 500; }
.hour-icon { width: 28px; height: 28px; }

.hour-rain { min-height: 18px; }

/* Précipitations : pastille bleu nuit à texte blanc. Un simple texte bleu clair
   disparaissait sur les ciels clairs (bas du dégradé « dégagé ») ; la pastille
   reste lisible sur tous les fonds, de jour comme de nuit. */
.rain-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(6, 52, 118, .62);
  box-shadow: inset 0 0 0 1px rgba(125, 205, 255, .55);
}
.rain-chip svg { width: 8px; height: 10px; margin-left: -1px; fill: #8fd8ff; }
.rain-chip small { font-size: 9.5px; font-weight: 500; opacity: .85; }

/* --- Liste des jours ------------------------------------------------ */

.days { padding: 0 6px 8px; }

.day { border-radius: 14px; }

.day + .day { border-top: 1px solid var(--card-line); }

.day-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 10px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.day-name {
  /* Assez large pour « Mer. 30 » des tendances : prévisions et tendances
     partagent la même carte, leurs colonnes doivent rester alignées. */
  flex: 0 0 72px;
  font-size: 17px;
  font-weight: 500;
}

.day-icon { flex: 0 0 auto; width: 26px; height: 26px; }

.day-rain {
  /* Assez large pour la pastille « 12.4mm ». */
  flex: 0 0 50px;
  display: flex;
  justify-content: center;
}

.day-min,
.day-max {
  flex: 0 0 34px;
  font-size: 17px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.day-min { color: var(--ink-faint); }

/* Barre de plage : position et largeur = min/max du jour rapportés à la
   plage de toute la période, comme dans l'app iOS. */
.day-bar {
  flex: 1 1 auto;
  height: 4px;
  border-radius: 100px;
  background: rgba(255, 255, 255, .22);
  position: relative;
  overflow: hidden;
}

.day-bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 100px;
  background: linear-gradient(90deg, #58c4f5, #ffd60a, #ff9f0a);
}

.day-chevron {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  opacity: .45;
  transition: transform .25s ease;
}

.day.is-open .day-chevron { transform: rotate(90deg); }

/* Détail 3 h d'un jour : replié par défaut. */
.day-detail {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .28s ease;
}

.day.is-open .day-detail { grid-template-rows: 1fr; }

.day-detail > div { overflow: hidden; }

.slot {
  display: grid;
  grid-template-columns: 46px 24px 44px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 14px;
  color: var(--ink-soft);
}

/* Graphique du détail d'un jour. */
.day-chart { display: block; width: 100%; height: auto; margin: 4px 0 6px; }
.chart-area { fill: rgba(255, 214, 10, .12); }
.chart-line { fill: none; stroke: #FFD60A; stroke-width: 2; stroke-linejoin: round; }
.chart-dot { fill: #FFD60A; }
.chart-base { stroke: rgba(255, 255, 255, .15); stroke-width: 1; }
/* Barres de pluie cerclées de blanc et valeurs détourées : lisibles sur ciel clair. */
.chart-rain { fill: #2f9fe6; stroke: rgba(255, 255, 255, .75); stroke-width: 1; }
.chart-temp,
.chart-hour { font-size: 10px; text-anchor: middle; fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart-hour { fill: var(--ink-faint); }
.chart-mm {
  font-size: 9px;
  font-weight: 600;
  text-anchor: middle;
  fill: #fff;
  paint-order: stroke;
  stroke: rgba(4, 36, 84, .7);
  stroke-width: 2.4px;
  stroke-linejoin: round;
}

.slot + .slot { border-top: 1px solid rgba(255, 255, 255, .08); }
.slot-temp { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.slot-extra .rain-chip { margin-left: 4px; }
.slot-icon { width: 22px; height: 22px; }
.slot-extra { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }


/* Flèches de vent, orientées vers où va le vent. */
.slot-wind,
.metric-wind {
  display: inline-block;
  vertical-align: -2px;
  width: 13px;
  height: 13px;
  margin-right: 3px;
  opacity: .85;
}

.metric-wind { width: 20px; height: 20px; margin-right: 6px; vertical-align: 0; }

/* Carte sur toute la largeur de la grille (Soleil). */
.metric-wide { grid-column: span 2; }

/* Carte Soleil : arc du jour au-dessus de l'horizon, arc de la nuit en dessous.
   Le soleil suit le premier, la lune (dans sa phase) le second. */
.sun-arc { width: 100%; height: auto; max-height: 124px; margin: 2px 0; overflow: visible; }
.sun-horizon { stroke: rgba(255, 255, 255, .3); stroke-width: 1; }
.sun-path { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 2; stroke-dasharray: 3 4; }
.sun-done { fill: none; stroke: #FFD60A; stroke-width: 2.5; stroke-linecap: round; }
.sun-dot { fill: #FFD60A; animation: sun-glow 3.2s ease-in-out infinite; }
@keyframes sun-glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 214, 10, .7)); }
  50% { filter: drop-shadow(0 0 10px rgba(255, 214, 10, 1)); }
}
.night-path { fill: none; stroke: rgba(160, 180, 255, .22); stroke-width: 2; stroke-dasharray: 3 4; }
.night-done { fill: none; stroke: #a9b8ff; stroke-width: 2.5; stroke-linecap: round; }
.night-sky { fill: rgba(20, 30, 80, .22); }
.twilight { fill: #ffb86b; }
.sun-moon { filter: drop-shadow(0 0 5px rgba(230, 235, 255, .7)); }
.sun-star { fill: #fffbe6; animation: twinkle 2.8s ease-in-out infinite; }
.sun-star:nth-child(2n) { animation-duration: 3.7s; animation-delay: -1.2s; }
.sun-star:nth-child(3n) { animation-duration: 2.3s; animation-delay: -.6s; }
@keyframes twinkle { 50% { opacity: .25; } }

.sun-times { display: flex; justify-content: space-between; font-size: 15px; }
.sun-times b { font-weight: 600; }
.sun-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sun-next { font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); }

.metric-moon { width: 26px; height: 26px; margin-right: 8px; vertical-align: -3px; }

/* --- Vignettes de mesures ------------------------------------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

.metric {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 13px 15px 15px;
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  min-height: 104px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.metric-value { font-size: 27px; font-weight: 300; letter-spacing: -.5px; }
.metric-unit { font-size: 16px; color: var(--ink-soft); margin-left: 2px; }
.metric-note { font-size: 13px; color: var(--ink-soft); margin-top: auto; }
.metric-note a { color: inherit; }
/* Unité en toutes lettres (« Faible », « Correcte ») : un peu d'air avant. */
.metric-word { margin-left: 6px; }

/* Échelle colorée (UV, qualité de l'air) et repère de la valeur. */
.scale { position: relative; display: block; height: 5px; margin: 4px 0 2px; border-radius: 100px; }
.scale span {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .35);
}

/* --- Pied de page --------------------------------------------------- */

.source {
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-faint);
  padding: 4px 0 8px;
}

.source a { color: inherit; }

/* Auteur et version, discrets sous la source. */
.credit {
  margin: 0;
  padding: 0 0 12px;
  text-align: center;
  font-size: 11px;
  color: var(--ink-faint);
  opacity: .75;
}
.credit a { color: inherit; text-decoration: none; }

.install { margin: 0; text-align: center; }
.install[hidden] { display: none; }
.install-btn {
  padding: 10px 20px;
  border: 0;
  border-radius: 100px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, .16);
  cursor: pointer;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  background: rgba(0, 0, 0, .45);
}
.sheet[hidden] { display: none; }
.sheet-body {
  width: 100%;
  max-width: 480px;
  padding: 20px 22px;
  border-radius: 22px;
  background: rgba(24, 36, 58, .96);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .4);
}
.sheet h2 { margin: 0 0 10px; font-size: 20px; font-weight: 600; }
.sheet ol { margin: 0 0 16px; padding-left: 20px; line-height: 1.6; color: var(--ink-soft); }
.sheet li svg { width: 17px; height: 17px; vertical-align: -3px; color: #0a84ff; }
.sheet b { color: var(--ink); }
.sheet button {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-weight: 600;
  color: #12305e;
  background: #fff;
  cursor: pointer;
}

/* « Actualiser » : indispensable à la souris (pas de tiré-pour-rafraîchir). */
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* --- Recherche de commune ------------------------------------------- */

.search {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-t) + 14px) calc(var(--pad) + var(--safe-r))
           calc(var(--safe-b) + 14px) calc(var(--pad) + var(--safe-l));
  /* Assez opaque pour rester lisible là où le flou n'est pas rendu. */
  background: rgba(8, 14, 30, .74);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  backdrop-filter: blur(30px) saturate(160%);
}

.search[hidden] { display: none; }

.search-home[hidden] { display: none; }

.search-home,
.search-heading { width: 100%; max-width: 560px; margin-left: auto; margin-right: auto; }

.locate-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 16px;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .12);
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.locate-btn svg { width: 18px; height: 18px; color: #5ac8fa; }

.search-heading {
  margin-top: 22px;
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.search-heading[hidden] { display: none; }

/* Ligne de favori : le nom, et une croix pour le retirer. */
/* Cartes des favoris : fond selon le temps de la ville (posé par app.js). */
.fav-item { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.search-results .fav-card {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--card-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
}
.fav-item.is-current .fav-card { border-color: rgba(255, 255, 255, .7); }
.fav-icon { width: 34px; height: 34px; }
.fav-left,
.fav-right { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fav-right { align-items: flex-end; }
.fav-name { font-size: 19px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-cond,
.fav-range { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.fav-temp { font-size: 30px; font-weight: 300; line-height: 1.1; }
.search-results .fav-remove {
  flex: 0 0 auto;
  width: auto;
  padding: 10px 6px;
  border: 0;
  color: var(--ink-faint);
  font-size: 15px;
}

.search-bar,
.search-status,
.search-results {
  width: 100%;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.search-bar { display: flex; align-items: center; gap: 12px; }

.search-bar input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  /* 16 px minimum : en dessous, Safari iOS zoome sur le champ. */
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: rgba(255, 255, 255, .16);
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}

.search-bar input::placeholder { color: var(--ink-faint); }

.search-cancel {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  cursor: pointer;
}

.search-status {
  margin-top: 16px;
  margin-bottom: 0;
  font-size: 14px;
  color: var(--ink-soft);
  text-align: center;
}

.search-status:empty { display: none; }

.search-results {
  list-style: none;
  padding: 0;
  margin-top: 12px;
  margin-bottom: 0;
  overflow-y: auto;
}

.search-results button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 4px;
  border: 0;
  border-bottom: 1px solid var(--card-line);
  background: none;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.search-results button:active { background: rgba(255, 255, 255, .08); }

.search-detail { font-size: 14px; color: var(--ink-faint); }

/* --- Chargement, erreur, rafraîchissement --------------------------- */

.splash,
.failure {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  color: var(--ink-soft);
}

.failure[hidden],
.splash[hidden] { display: none; }

.welcome-icon { width: 84px; height: 84px; margin-bottom: 4px; }
.welcome h2 { font-size: 30px; }
.welcome button { min-width: 250px; }
.welcome-status { min-height: 1.4em; font-size: 14px; }

.failure h2 { margin: 0; font-size: 22px; font-weight: 500; color: var(--ink); }
.failure p { margin: 0; max-width: 30ch; font-size: 15px; }

.failure button {
  margin-top: 6px;
  padding: 11px 26px;
  border: 0;
  border-radius: 100px;
  font: inherit;
  font-weight: 600;
  color: #12305e;
  background: #fff;
  cursor: pointer;
}

.failure button.secondary {
  margin-top: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, .16);
}

.splash-spin,
.pull-spin {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 34 22;
  animation: spin 1s linear infinite;
}

.pull {
  position: fixed;
  top: calc(var(--safe-t) + 8px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  color: var(--ink-soft);
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
  z-index: 5;
}

.pull.is-active { opacity: 1; }

/* Le spinner ne tourne que pendant la requête : avant, il indique juste
   qu'en lâchant, l'app va rafraîchir. */
.pull .pull-spin { animation-play-state: paused; }
.pull.is-loading .pull-spin { animation-play-state: running; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Écrans larges : les vignettes tiennent sur quatre colonnes. */
/* PC et tablette : même colonne centrée, un peu plus large ; les cartes
   restent sur deux colonnes (à quatre, leurs textes s'écrasaient). */
@media (min-width: 900px) {
  .app { max-width: 620px; padding-top: 28px; }
}

/* Souris ou grand écran : flèches entre favoris, survols (au doigt sur une
   tablette, les flèches restent simplement cliquables). */
@media (hover: hover) and (pointer: fine), (min-width: 900px) {
  .fav-arrow { display: grid; }
  .search-btn:hover,
  .fav-arrow:hover:not(:disabled),
  .radar-play:hover,
  .locate-btn:hover { background: rgba(255, 255, 255, .26); }
  .day-row:hover,
  .search-results button:hover { background: rgba(255, 255, 255, .07); }
  .card-toggle:hover,
  .link-btn:hover { color: var(--ink); }
  .hours { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .3) transparent; }
}

/* Navigation au clavier : focus bien visible. */
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
input:focus-visible { outline-offset: 0; }

/* --- Extrêmes en France ---------------------------------------------- */

/* La vignette est un bouton (elle ouvre le Top 8) : mêmes allures qu'une vignette. */
button.metric {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
button.metric:active { background: rgba(255, 255, 255, .22); }
.extremes-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.extreme { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 15px; }
.extreme b { flex: 0 0 auto; font-size: 22px; font-weight: 400; letter-spacing: -.3px; }
.extreme span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.extreme-hot b, h3.extreme-hot { color: #ff8a70; }
.extreme-cold b, h3.extreme-cold { color: #8fc4ff; }

.extremes-when { margin: -4px 0 14px; font-size: 14px; color: var(--ink-soft); }
.extremes-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.extremes-cols h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; }
.sheet ol.extremes-list { margin: 0; padding: 0; list-style: none; line-height: 1.35; }
.extremes-list li { display: flex; justify-content: space-between; gap: 6px; padding: 5px 0; font-size: 14px; border-top: 1px solid rgba(255, 255, 255, .1); }
.extremes-list a { min-width: 0; color: var(--ink); text-decoration: none; }
.extremes-list b { flex: 0 0 auto; font-weight: 600; }
.extreme-dep { color: var(--ink-faint); }
.extremes-src { margin: 14px 0 16px; font-size: 13px; text-align: center; }
.extremes-src a { color: var(--ink-soft); }

/* --- « Utiliser ma position » en cours : roue à la place de la flèche ---- */

.btn-spin {
  display: none;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.is-loading .btn-spin { display: inline-block; }
.locate-btn.is-loading svg { display: none; }
.locate-btn .btn-spin { margin-right: 0; color: #5ac8fa; }
button.is-loading { cursor: progress; opacity: .85; }

/* --- Carte plein écran (radar et prévisions AROME) -------------------- */

.radar { cursor: zoom-in; }
.radar-expand {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, .45);
  cursor: pointer;
}
.radar-expand svg { width: 16px; height: 16px; }

body.has-carte { overflow: hidden; }
.carte {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #1b1f24;
}
.carte[hidden] { display: none; }
.carte-map { position: absolute; inset: 0; background: #1b1f24; }
.carte-map.leaflet-container { font: inherit; }
/* Fond sombre (pluie, nuages) ou clair légèrement estompé (températures, vent). */
.carte-map .carte-base { filter: grayscale(.6) brightness(.95) contrast(.95); }
.carte-map.is-dark .carte-base { filter: grayscale(1) invert(1) brightness(.85) contrast(.9); }
.carte-radar { transition: opacity .25s linear; }
.carte-overlay { image-rendering: auto; }

.carte-top {
  position: absolute;
  z-index: 1000;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + 12px) 10px calc(var(--safe-l) + 12px);
  background: linear-gradient(rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.carte-top > * { pointer-events: auto; }
.carte-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(30, 36, 48, .8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
}
.carte-close svg { width: 18px; height: 18px; }
.carte-layers {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.carte-layers::-webkit-scrollbar { display: none; }
.carte-layers button {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 0;
  border-radius: 100px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: rgba(30, 36, 48, .8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
}
.carte-layers button[aria-pressed="true"] { color: #12305e; background: #fff; }

.carte-status {
  position: absolute;
  z-index: 1000;
  top: calc(var(--safe-t) + 64px);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 7px 14px;
  border-radius: 100px;
  font-size: 13px;
  white-space: nowrap;
  color: #fff;
  background: rgba(30, 36, 48, .85);
}
.carte-status[hidden] { display: none; }

.carte-bottom {
  position: absolute;
  z-index: 1000;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px calc(var(--safe-r) + 16px) calc(var(--safe-b) + 10px) calc(var(--safe-l) + 16px);
  color: #fff;
  background: rgba(24, 30, 42, .88);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-radius: 20px 20px 0 0;
}
.carte-scale { height: 8px; border-radius: 4px; }
.carte-scale-labels { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; color: var(--ink-soft); }
.carte-bar { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.carte-bar input { flex: 1 1 auto; min-width: 0; accent-color: #fff; }
.carte-time { flex: 0 0 auto; min-width: 82px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.carte-credit { margin: 8px 0 0; font-size: 11px; color: var(--ink-faint); text-align: center; }
.carte-credit a { color: inherit; }

/* Valeur sur une ville : pastille lisible sur tous les fonds. */
.carte-ville { width: 0; height: 0; }
.carte-ville-in {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  pointer-events: none;
}
.carte-ville b {
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: rgba(20, 26, 38, .78);
}
.carte-ville span { font-size: 10px; font-weight: 600; color: #1d2433; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.is-dark .carte-ville span { color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; }

