/* Cap Météo — pages « météo des cols ». Mêmes couleurs et polices que l'appli (public/styles.css),
   dans une feuille à part : ces pages se lisent comme un article, sans la carte ni les panneaux. */

@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/barlow-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/barlow-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/barlow-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/barlow-condensed-latin-700-normal.woff2) format('woff2'); }

:root {
  --bg: #e9eeec; --surface: #fbfcfb; --surface-2: #f1f5f3; --ink: #13211e; --ink-2: #3a4b47; --muted: #61716c; --line: #d4ddd9;
  --brand: #0e4f7a; --brand-arrow: #f28c3a; --accent: #0e5f92; --accent-ink: #ffffff; --accent-soft: #dbe9f2;
  --g4: #24804f; --g3: #5e9b45; --g2: #c39417; --g1: #d5702b; --g0: #be3e2c;
  --p0: #4f9d6b; --p1: #9bb23f; --p2: #d8a521; --p3: #d5702b; --p4: #b23a2a;
  --warn-soft: #fbefd6; --info-soft: #e2ebf3; --past: #dde4e1;
  --shadow: 0 1px 2px rgba(19, 33, 30, 0.06), 0 8px 24px -14px rgba(19, 33, 30, 0.28);
  --font-body: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', system-ui, sans-serif;
  color-scheme: light;
}
/* Thème choisi dans l'appli (data-theme, src/ui/themeboot.js) ; sinon celui de l'appareil. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1412; --surface: #121c1a; --surface-2: #192522; --ink: #e3ece8; --ink-2: #bccac5; --muted: #8b9c96; --line: #26332f;
    --brand: #1c6a9c; --brand-arrow: #f39a52; --accent: #62b1e4; --accent-ink: #06202f; --accent-soft: #14303f;
    --g4: #3fb873; --g3: #83c062; --g2: #dcb23a; --g1: #ee8f4c; --g0: #ec6450;
    --p0: #3f9a63; --p1: #8fae45; --p2: #d3a52c; --p3: #e08444; --p4: #e2533f;
    --warn-soft: #3a3016; --info-soft: #182a38; --past: #1f2b28;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0c1412; --surface: #121c1a; --surface-2: #192522; --ink: #e3ece8; --ink-2: #bccac5; --muted: #8b9c96; --line: #26332f;
    --brand: #1c6a9c; --brand-arrow: #f39a52; --accent: #62b1e4; --accent-ink: #06202f; --accent-soft: #14303f;
    --g4: #3fb873; --g3: #83c062; --g2: #dcb23a; --g1: #ee8f4c; --g0: #ec6450;
    --p0: #3f9a63; --p1: #8fae45; --p2: #d3a52c; --p3: #e08444; --p4: #e2533f;
    --warn-soft: #3a3016; --info-soft: #182a38; --past: #1f2b28;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font-body); }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(30px, 6.4vw, 44px); font-weight: 700; letter-spacing: 0.005em; }
h2 { font-size: clamp(22px, 4.4vw, 27px); font-weight: 600; }
h3 { font-size: 19px; font-weight: 600; margin-top: 18px; }
p { margin: 10px 0 0; }
small { font-size: 0.82em; color: var(--muted); font-weight: 400; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(16px, env(safe-area-inset-left)) 10px max(16px, env(safe-area-inset-right)); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; }
.brand-name { font: 700 22px/1 var(--font-display); letter-spacing: 0.01em; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 14px var(--font-body); text-decoration: none; white-space: nowrap; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); border-color: var(--accent); }
.btn-lg { min-height: 48px; padding: 0 20px; font-size: 16px; }

main { max-width: 860px; margin: 0 auto; padding: 14px 16px 8px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px 7px; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.hero { margin-top: 14px; }
.sub { margin-top: 6px; color: var(--ink-2); font-size: 16.5px; max-width: 62ch; }
.lead { color: var(--ink-2); max-width: 68ch; }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 0; }
.facts div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px 8px; min-width: 0; }
.facts dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts dd { margin: 1px 0 0; font: 700 clamp(21px, 5.2vw, 28px)/1.1 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 520px) { .facts { grid-template-columns: repeat(2, 1fr); } }

.notice { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--info-soft); font-size: 14.5px; line-height: 1.45; }
.notice-road { background: var(--warn-soft); }

.block { margin-top: 26px; padding: 18px 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
@media (max-width: 520px) { .block { margin-inline: -8px; padding-inline: 12px; } }

/* ------------------------------------------------------------ Allure */
.levels { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 12px; margin-top: 14px; }
.levels-t { font-weight: 600; font-size: 14px; }
.levels-n { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); max-width: 440px; }
.seg button { display: grid; gap: 0; justify-items: center; padding: 5px 4px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font: inherit; cursor: pointer; min-width: 0; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.08); }
.lv-name { font-size: 13.5px; font-weight: 600; }
.lv-time { font: 600 15px/1.1 var(--font-display); color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .levels { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ Prévisions */
.forecast { margin-top: 14px; min-height: 520px; display: grid; gap: 12px; align-content: start; }
.loading, .wx-error { margin: 0; padding: 22px 12px; text-align: center; color: var(--muted); background: var(--surface-2); border-radius: 10px; }
.wx-error .btn { margin-top: 10px; }
.stamp { margin: 0; font-size: 12.5px; color: var(--muted); }

.day { border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 10px; background: var(--surface); min-width: 0; }
.day-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.day-name { margin: 0; font-size: 22px; }
.day-name span { font: 500 14px var(--font-body); color: var(--muted); margin-left: 6px; }
.best { display: flex; align-items: center; gap: 9px; }
.note { flex: none; min-width: 44px; padding: 3px 8px; border-radius: 9px; background: var(--g4); color: #fff; font: 700 24px/1.15 var(--font-display); text-align: center; font-variant-numeric: tabular-nums; }
.note[data-level="3"], .cell[data-level="3"] { background: var(--g3); }
.note[data-level="2"], .cell[data-level="2"] { background: var(--g2); }
.note[data-level="1"], .cell[data-level="1"] { background: var(--g1); }
.note[data-level="0"], .cell[data-level="0"] { background: var(--g0); }
.best-t { display: grid; line-height: 1.25; }
.best-t strong { font-size: 15.5px; }
.best-t span { font-size: 13px; color: var(--muted); }
.why { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }

.strip { margin-top: 10px; }
.cells { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
.cell { height: 22px; border: 0; padding: 0; border-radius: 3px; background: var(--g4); cursor: pointer; min-width: 0; }
.cell.is-past, .cell.is-none { background: var(--past); cursor: default; }
.cell.is-best { box-shadow: 0 0 0 2px var(--ink); position: relative; z-index: 1; }
.cell.is-sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.hours { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; margin-top: 2px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hours span { white-space: nowrap; overflow: visible; width: 0; }
.readout { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }
.readout:empty { display: none; }

.wx { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; table-layout: fixed; }
.wx th, .wx td { padding: 6px 4px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.wx thead th { border-top: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); padding-bottom: 3px; }
.wx thead th small { display: block; }
.wx tbody th { width: 27%; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.wx td small { display: block; line-height: 1.25; }
.wx td.is-off { color: var(--muted); }
.t-val { font: 600 18px/1.15 var(--font-display); }
.arrow { display: inline-block; width: 14px; height: 14px; margin-right: 3px; vertical-align: -2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.chips li { padding: 2px 9px; border-radius: 999px; background: var(--warn-soft); font-size: 13px; }
.conf { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }

.cta { margin-top: 16px; display: grid; gap: 4px; justify-items: start; }
.cta p { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); max-width: 60ch; }

/* ------------------------------------------------------------ Profil */
.profile-fig { margin: 14px 0 0; }
.profile { padding-left: 46px; }
.profile-plot { position: relative; height: clamp(170px, 42vw, 300px); }
.profile-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pg { stroke: var(--surface); stroke-width: 1; vector-effect: non-scaling-stroke; }
.pg0 { fill: var(--p0); background: var(--p0); }
.pg1 { fill: var(--p1); background: var(--p1); }
.pg2 { fill: var(--p2); background: var(--p2); }
.pg3 { fill: var(--p3); background: var(--p3); }
.pg4 { fill: var(--p4); background: var(--p4); }
.pline { fill: none; stroke: var(--ink); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.pgrid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.py-wrap, .pk-wrap { position: absolute; inset: 0; pointer-events: none; }
.py { position: absolute; right: calc(100% + 6px); transform: translateY(50%); font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pk { position: absolute; bottom: 5px; transform: translateX(-50%); font: 600 12.5px/1 var(--font-display); color: #fff; text-shadow: 0 0 3px rgba(0, 0, 0, 0.55); font-variant-numeric: tabular-nums; }
.ptop { position: absolute; right: 0; top: -2px; transform: translateY(-100%); font: 600 14px/1 var(--font-display); color: var(--ink-2); }
.px-wrap { position: relative; height: 20px; margin-top: 4px; }
.px { position: absolute; transform: translateX(-50%); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.px0 { transform: none; }
@media (max-width: 700px) { .pk-dense.pk-odd { display: none; } .pk { font-size: 11px; } }
@media (max-width: 460px) { .pk-dense { display: none; } }
figcaption { margin-top: 8px; }
.plegend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink-2); }
.plegend span { display: inline-flex; align-items: center; gap: 5px; }
.plegend-t { color: var(--muted); }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; }
.plegend .dot { margin-right: 0; }
.kmtable { margin-top: 12px; }
.kmtable summary { cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--accent); }
.kmtable table { width: 100%; max-width: 460px; margin-top: 8px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.kmtable th, .kmtable td { padding: 5px 6px; border-top: 1px solid var(--line); text-align: left; }
.kmtable thead th { border-top: 0; font-size: 12.5px; color: var(--muted); }
.kmtable tbody th { font-weight: 600; }
.gpx { font-size: 14.5px; }

/* ------------------------------------------------------------ Cartes des cols */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.card { position: relative; display: grid; gap: 1px; padding: 54px 12px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink); text-decoration: none; overflow: hidden; }
.card:hover { border-color: var(--muted); }
.spark { position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 48px; }
.spark polygon { fill: var(--accent); opacity: 0.28; }
.card-name { font: 600 20px/1.15 var(--font-display); }
.card-from { font-size: 13px; color: var(--muted); }
.card-facts { margin-top: 3px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.more { font-size: 14.5px; }
@media (max-width: 460px) { .cards { grid-template-columns: repeat(2, 1fr); gap: 8px; } .card { padding-inline: 10px; } .card-name { font-size: 18px; } }

.foot { max-width: 860px; margin: 26px auto 0; padding: 0 16px max(26px, env(safe-area-inset-bottom)); font-size: 13.5px; color: var(--ink-2); }
.foot p { margin: 8px 0 0; }
.credits { font-size: 12.5px; color: var(--muted); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 14px; }

@media print { .top .btn, .cta, .levels, .foot-links { display: none; } .block { box-shadow: none; } }
