/* Palette : lac de Monteynard, ardoise, brume, mélèze, glacier */
:root {
  --lake: #14857f;
  --lake-soft: #d5ecea;
  --ink: #1c2b35;
  --ink-2: #4c5d68;
  --mist: #edf1f2;
  --paper: #ffffff;
  --paper-2: #f4f7f7;
  --line: #dbe2e4;
  --larch: #d98a2b;
  --glacier: #7fb6d6;
  --good: #2f9e6b;
  --mid: #d9a12b;
  --bad: #d5513f;
  --consensus: #1c2b35;
  --focus: #14857f;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --lake: #43bdb4;
    --lake-soft: #173b3b;
    --ink: #e4ecef;
    --ink-2: #9aaab3;
    --mist: #0d1820;
    --paper: #13212b;
    --paper-2: #182934;
    --line: #243844;
    --larch: #f0a94e;
    --glacier: #8cc4e2;
    --consensus: #e4ecef;
    --focus: #43bdb4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --lake: #43bdb4;
  --lake-soft: #173b3b;
  --ink: #e4ecef;
  --ink-2: #9aaab3;
  --mist: #0d1820;
  --paper: #13212b;
  --paper-2: #182934;
  --line: #243844;
  --larch: #f0a94e;
  --glacier: #8cc4e2;
  --consensus: #e4ecef;
  --focus: #43bdb4;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font: 16px/1.55 Barlow, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--lake); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.error { color: var(--bad); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { font-family: "Barlow Condensed", Barlow, sans-serif; }

/* --- Barre du haut --------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink);
  font: 600 22px/1 "Barlow Condensed", sans-serif;
}
.brand svg { width: 30px; height: 30px; fill: var(--lake); }
.search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search-icon {
  position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%);
  fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; pointer-events: none;
}
.search input {
  width: 100%; height: 42px; padding: 0 14px 0 40px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper-2); color: var(--ink); font: inherit;
  transition: border-color .15s, background .15s;
}
.search input:focus { outline: none; border-color: var(--lake); background: var(--paper); }
.search-results {
  position: absolute; top: 50px; left: 0; right: 0; margin: 0; padding: 6px;
  list-style: none; background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 18px 40px rgba(16, 32, 40, .18); max-height: 60vh; overflow: auto;
}
.search-results li { padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.search-results li small { color: var(--ink-2); display: block; }
.search-results li:hover, .search-results li.active { background: var(--lake-soft); }

/* --- Bandeau paysage ------------------------------------------------------- */
/* Le ciel suit la météo du moment (data-sky posé par app.js) */
.hero {
  --sky-top: #3b86c8; --sky-bottom: #a8d6ee;
  --ridge-far: #7d9bb2; --ridge-mid: #4d7187; --lake-water: #2aa39b;
  --sky-ink: #ffffff; --sky-ink-2: rgba(255, 255, 255, .85);
  position: relative; overflow: hidden;
  color: var(--sky-ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%);
}
.hero[data-sky="clear"]  { --sky-top: #2f7fc6; --sky-bottom: #9fd3ef; }
.hero[data-sky="cloudy"] { --sky-top: #6f8597; --sky-bottom: #c4d0d8; --ridge-far: #889aa6; --ridge-mid: #5a6e7b; --lake-water: #4f9893; }
.hero[data-sky="rain"]   { --sky-top: #4a5e6d; --sky-bottom: #8fa1ac; --ridge-far: #677985; --ridge-mid: #43555f; --lake-water: #3d7f7b; }
.hero[data-sky="storm"]  { --sky-top: #262f3b; --sky-bottom: #5b6672; --ridge-far: #4b5763; --ridge-mid: #2f3a44; --lake-water: #2d5f5c; }
.hero[data-sky="snow"]   { --sky-top: #8ea5b8; --sky-bottom: #e2eaf0; --ridge-far: #c9d6df; --ridge-mid: #9fb2c0; --lake-water: #6aa8a6; }
.hero[data-sky="fog"]    { --sky-top: #a6b3bb; --sky-bottom: #dfe5e8; --ridge-far: #c3ccd1; --ridge-mid: #a2afb6; --lake-water: #8bb3b1;
                           --sky-ink: #1c2b35; --sky-ink-2: rgba(28, 43, 53, .75); }
.hero[data-sky="dusk"]   { --sky-top: #4d6fa8; --sky-bottom: #f2b07a; --ridge-far: #7a6b86; --ridge-mid: #4b4a66; --lake-water: #c98a6a; }
.hero[data-sky="night"]  { --sky-top: #0b1729; --sky-bottom: #26405f; --ridge-far: #1d2e44; --ridge-mid: #132236; --lake-water: #1d4a57; }

.hero-inner {
  position: relative; z-index: 2;
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px;
  padding-top: 40px; padding-bottom: 150px;
}
.hero h1 {
  margin: 0; font-size: clamp(44px, 7vw, 78px); font-weight: 700; line-height: .95; letter-spacing: -.01em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .12);
}
.hero-place p { margin: 8px 0 0; color: var(--sky-ink-2); font-size: 16px; }
.hero-now { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.now-main { display: flex; align-items: center; gap: 14px; }
.now-icon { font-size: 54px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .15)); }
.now-temp { font: 600 clamp(66px, 10vw, 106px)/.85 "Barlow Condensed", sans-serif; letter-spacing: -.02em; }
.now-label { font-size: 17px; color: var(--sky-ink-2); }
.now-details {
  display: grid; grid-template-columns: auto auto; gap: 3px 14px; font-size: 14.5px;
  padding: 12px 16px; border-radius: 16px;
  background: rgba(255, 255, 255, .16); backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .24);
}
.hero[data-sky="fog"] .now-details, .hero[data-sky="snow"] .now-details { background: rgba(255, 255, 255, .35); }
.now-details span:nth-child(odd) { color: var(--sky-ink-2); }
.now-details span:nth-child(even) { font-weight: 600; }

.ridges { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 170px; z-index: 1; display: block; }
.ridge-far { fill: var(--ridge-far); }
.ridge-mid { fill: var(--ridge-mid); }
.lake { fill: var(--lake-water); }
.shore { fill: var(--mist); }

/* Vigilance */
.vigilance { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.vig {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px;
  font-size: 14px; color: var(--sky-ink); text-decoration: none;
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3); backdrop-filter: blur(6px);
}
.vig:hover { background: rgba(255, 255, 255, .3); }
.vig i { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }
.vig-1 { background: #3cb371; } .vig-2 { background: #f6d32d; } .vig-3 { background: #f08a24; } .vig-4 { background: #d7263d; }

/* --- Navigation des sections ---------------------------------------------- */
.anchors {
  display: flex; gap: 6px; overflow-x: auto; padding-top: 4px; padding-bottom: 6px; scrollbar-width: none;
}
.anchors a {
  flex: none; padding: 7px 14px; border-radius: 999px; background: var(--paper);
  border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14.5px; font-weight: 500;
}
.anchors a:hover { border-color: var(--lake); color: var(--lake); }

/* --- Sections ---------------------------------------------------------------- */
.block { background: var(--paper); border-radius: 22px; padding: 26px; margin: 16px 0; }
.block-head { margin-bottom: 18px; }
.block-head.row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.block-head h2 { margin: 0; font-size: 31px; font-weight: 600; line-height: 1.05; }
.block-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; max-width: 70ch; }
h3.sub { font-size: 21px; font-weight: 600; margin: 24px 0 10px; }
h3.sub:first-child { margin-top: 0; }
h3.sub span { font: 400 14px Barlow, sans-serif; color: var(--ink-2); margin-left: 6px; }

.seg { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); font: 500 14px Barlow, sans-serif;
  padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s;
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--lake); color: #fff; }

/* --- Sept jours : échelle de température commune --------------------------- */
.days { display: grid; grid-template-columns: repeat(7, minmax(118px, 1fr)); overflow-x: auto; }
.day { text-align: center; padding: 4px 10px 6px; border-left: 1px solid var(--line); }
.day:first-child { border-left: 0; }
.day h3 { margin: 0; font-size: 21px; font-weight: 600; }
.day .date { font-size: 13px; color: var(--ink-2); }
.day .icon { font-size: 38px; margin: 8px 0 0; line-height: 1.2; }
.day .desc { font-size: 13px; color: var(--ink-2); min-height: 2.5em; line-height: 1.25; }
.thermo { display: flex; flex-direction: column; align-items: center; gap: 5px; margin: 10px 0; }
.thermo .tmax { font: 600 25px/1 "Barlow Condensed", sans-serif; }
.thermo .tmin { font: 500 20px/1 "Barlow Condensed", sans-serif; color: var(--ink-2); }
.range { position: relative; width: 8px; height: 80px; border-radius: 99px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); }
.range .fill { position: absolute; left: 0; right: 0; border-radius: 99px; background: linear-gradient(180deg, var(--larch), var(--glacier)); }
.day .extra { font-size: 13.5px; display: grid; gap: 1px; }
.conf { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.conf i { width: 8px; height: 8px; border-radius: 50%; }
.conf.good i { background: var(--good); } .conf.mid i { background: var(--mid); } .conf.bad i { background: var(--bad); }

/* --- Tableaux --------------------------------------------------------------- */
.table-scroll { overflow-x: auto; }
table.compare { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 780px; font-size: 14.5px; }
.compare th, .compare td { padding: 10px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.compare thead th { font: 600 18px/1.15 "Barlow Condensed", sans-serif; color: var(--ink); border-bottom: 2px solid var(--line); }
.compare thead th .muted { font: 400 13px Barlow, sans-serif; }
.compare th.model { text-align: left; white-space: nowrap; font-weight: 600; padding-right: 14px; }
.compare th.model small { display: block; font-weight: 400; color: var(--ink-2); font-size: 12.5px; }
.compare .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; }
.compare tbody tr:hover td, .compare tbody tr:hover th { background: var(--paper-2); }
.compare tr.consensus td, .compare tr.consensus th { background: var(--lake-soft); font-weight: 600; border-bottom: 0; }
.compare tr.consensus th { border-radius: 12px 0 0 12px; }
.compare tr.consensus td:last-child { border-radius: 0 12px 12px 0; }
.compare td .ic { font-size: 22px; display: block; line-height: 1.3; }
.compare td .rain { color: var(--lake); font-size: 13px; }
.compare td.na { color: var(--ink-2); }
.compare.mtn th.model { font-weight: 500; }

/* --- Graphiques ------------------------------------------------------------- */
.charts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.charts.two { grid-template-columns: repeat(2, 1fr); margin-top: 18px; }
.chart-card { margin: 0; background: var(--paper-2); border-radius: 16px; padding: 14px 14px 10px; min-width: 0; }
.chart-card figcaption { font: 600 20px/1.2 "Barlow Condensed", sans-serif; margin-bottom: 8px; }
.chart-card figcaption span { font: 400 13.5px Barlow, sans-serif; color: var(--ink-2); margin-left: 4px; }
.chart-box { position: relative; height: 230px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 18px; height: 4px; border-radius: 2px; display: inline-block; }

/* --- Montagne ---------------------------------------------------------------- */
.mtn-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.stat { padding: 14px 16px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat .label { font-size: 14px; color: var(--ink-2); }
.stat .value { font: 600 36px/1.05 "Barlow Condensed", sans-serif; margin: 2px 0; }
.stat .sub { font-size: 13px; color: var(--ink-2); }

.bra { border-radius: 16px; padding: 18px; margin-bottom: 18px; background: var(--paper-2); border-left: 5px solid var(--lake); }
.bra-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.bra-head h3 { margin: 0; font-size: 22px; font-weight: 600; }
.bra-body { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.risk {
  flex: none; width: 72px; height: 72px; border-radius: 16px; display: grid; place-items: center;
  font: 700 40px/1 "Barlow Condensed", sans-serif; color: #1c2b35;
}
.risk-1 { background: #ccff66; } .risk-2 { background: #ffff00; } .risk-3 { background: #ff9900; }
.risk-4 { background: #ff0000; color: #fff; }
.risk-5 { background: repeating-conic-gradient(#ff0000 0 25%, #1c2b35 0 50%) 0 0 / 18px 18px; color: #fff; text-shadow: 0 0 6px #000; }
.bra-text { flex: 1; min-width: 220px; font-size: 15px; max-width: 75ch; }
.bra-text p { margin: 4px 0; }
.bra .seg button { font-size: 13.5px; padding: 5px 12px; }

/* --- En direct --------------------------------------------------------------- */
.obs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ob { background: var(--paper-2); border-radius: 16px; padding: 14px 16px; }
.ob .name { font: 600 20px/1.15 "Barlow Condensed", sans-serif; }
.ob .meta { font-size: 13px; color: var(--ink-2); }
.ob .temp { font: 600 44px/1 "Barlow Condensed", sans-serif; margin: 8px 0 6px; }
.ob .grid { display: grid; grid-template-columns: auto 1fr; gap: 1px 12px; font-size: 14px; }
.ob .grid span:nth-child(odd) { color: var(--ink-2); }

.stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px; }
.station {
  display: flex; gap: 12px; align-items: center; text-align: left; width: 100%;
  background: var(--paper-2); border: 2px solid transparent; border-radius: 16px; padding: 12px 14px;
  color: var(--ink); font: inherit; cursor: pointer; transition: border-color .15s;
}
.station:hover { border-color: var(--line); }
.station.active { border-color: var(--lake); background: var(--paper); }
.station.stale { opacity: .5; }
.station .arrow {
  flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--lake-soft); color: var(--lake); font-size: 20px; font-weight: 700;
}
.station .name { font-weight: 600; font-size: 14.5px; line-height: 1.2; }
.station .speed { font: 600 25px/1.1 "Barlow Condensed", sans-serif; }
.station .speed small { font: 400 13px Barlow, sans-serif; color: var(--ink-2); }
.station .meta { font-size: 13px; color: var(--ink-2); }
.station-chart { margin-top: 14px; }

/* --- Liens -------------------------------------------------------------------- */
.links { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.link-card {
  display: block; padding: 14px 16px; border-radius: 16px; background: var(--paper-2);
  text-decoration: none; color: var(--ink); border: 2px solid transparent; transition: border-color .15s;
}
.link-card:hover { border-color: var(--lake); }
.link-card strong { display: block; font: 600 20px/1.2 "Barlow Condensed", sans-serif; }
.link-card span { font-size: 14px; color: var(--ink-2); }

.footer { font-size: 13.5px; color: var(--ink-2); padding-top: 8px; padding-bottom: 48px; max-width: 900px; text-align: center; }
.footer a { color: var(--ink-2); }

body.loading main { opacity: .55; transition: opacity .2s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media (max-width: 900px) {
  .charts, .charts.two { grid-template-columns: 1fr; }
  .links { grid-template-columns: repeat(2, 1fr); }
  .mtn-stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .brand span { display: none; }
  .hero-inner { padding-top: 26px; padding-bottom: 110px; gap: 16px; }
  .ridges { height: 120px; }
  .block { padding: 18px 16px; border-radius: 18px; }
  .block-head h2 { font-size: 27px; }
  .days { grid-template-columns: repeat(7, 104px); }
  .links { grid-template-columns: 1fr; }
}
