@font-face {
  font-family: "Inter";
  src: url("vendor/fonts/inter-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #f4f5f7;
  --surface: #ffffff;
  --ink: #0f1115;
  --ink-2: #4a4f59;
  --muted: #8a8f98;
  --grid: #eceef1;
  --axis: #d5d8de;
  --border: rgba(15, 17, 21, 0.06);
  --shadow: 0 1px 2px rgba(15, 17, 21, 0.04), 0 8px 28px rgba(15, 17, 21, 0.05);
  --rain: #2a78d6;
  --rain-wash: rgba(42, 120, 214, 0.12);
  --t-max: #eb6834;
  --t-min: #2a78d6;
  --t-avg: #4a4f59;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
  --chip: #f1f3f6;
  --warn: #d03b3b;
  --hot: #eb6834; --cold: #2a78d6; --wet: #2a78d6; --dry: #d99000;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b0d12;
    --surface: #15181f;
    --ink: #f1f2f4;
    --ink-2: #b9bec8;
    --muted: #7d838f;
    --grid: #232731;
    --axis: #333845;
    --border: rgba(255, 255, 255, 0.07);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 28px rgba(0, 0, 0, 0.25);
    --rain: #3987e5;
    --rain-wash: rgba(57, 135, 229, 0.16);
    --t-max: #e8693a;
    --t-min: #3987e5;
    --t-avg: #b9bec8;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
    --chip: #1e222b;
    --hot: #e8693a; --cold: #3987e5; --wet: #3987e5; --dry: #c98500;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.badge { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); color: #fff; backdrop-filter: blur(6px); white-space: nowrap; }
.badges { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.error { color: #ffd2cc; }

/* ---------- Bandeau « maintenant » ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 22px 28px 18px;
  color: #fff;
  background: var(--sky);
  box-shadow: 0 18px 50px -20px var(--sky-glow, rgba(42, 120, 214, 0.6));
  isolation: isolate;
}
.hero::after { /* halo lumineux */
  content: "";
  position: absolute;
  top: calc(var(--sun-size, 520px) / -2);
  right: calc(var(--sun-size, 520px) / -2.4);
  width: var(--sun-size, 520px); height: var(--sun-size, 520px);
  background: radial-gradient(circle, var(--sun, rgba(255, 255, 255, 0.28)), transparent 65%);
  z-index: -1;
  pointer-events: none;
}
.hero[data-sky="night"] { --sky: linear-gradient(160deg, #1b2550 0%, #0e1430 100%); --sky-glow: rgba(27, 37, 80, 0.7); --sun: rgba(160, 180, 255, 0.16); }
.hero[data-sky="rain"]  { --sky: linear-gradient(160deg, #4a5a78 0%, #273247 100%); --sky-glow: rgba(39, 50, 71, 0.65); --sun: rgba(200, 215, 240, 0.14); }
.hero[data-sky="cold"]  { --sky: linear-gradient(160deg, #8bb0d8 0%, #4a6fa0 100%); --sky-glow: rgba(70, 101, 143, 0.55); --sun: rgba(225, 240, 255, 0.3); }
.hero[data-sky="mild"]  { --sky: linear-gradient(160deg, #3d9be9 0%, #2462c4 100%); --sky-glow: rgba(36, 98, 196, 0.55); --sun: rgba(255, 244, 200, 0.35); }
.hero[data-sky="warm"]  { --sky: linear-gradient(160deg, #1c8ae6 0%, #3aa4ee 100%); --sky-glow: rgba(28, 138, 230, 0.5); --sun: rgba(255, 249, 228, 0.62); }
.hero[data-sky="warm"], .hero[data-sky="hot"] { --sun-size: 620px; }
.hero[data-sky="hot"]   { --sky: linear-gradient(160deg, #f6a740 0%, #e4543a 100%); --sky-glow: rgba(228, 84, 58, 0.55); --sun: rgba(255, 240, 180, 0.55); }

.rain-fx { position: absolute; inset: 0; z-index: -1; opacity: 0; pointer-events: none; }
.hero[data-raining="true"] .rain-fx {
  opacity: 0.35;
  background-image:
    repeating-linear-gradient(105deg, transparent 0 22px, rgba(255, 255, 255, 0.55) 22px 23px, transparent 23px 61px),
    repeating-linear-gradient(105deg, transparent 0 37px, rgba(255, 255, 255, 0.35) 37px 38px, transparent 38px 89px);
  background-size: 100% 140px, 100% 210px;
  animation: rain 0.9s linear infinite;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
}
@keyframes rain { to { background-position: -38px 140px, -57px 210px; } }
@media (prefers-reduced-motion: reduce) { .hero[data-raining="true"] .rain-fx { animation: none; } }

.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.place { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; font-size: 15px; letter-spacing: 0.01em; }
.hero-main { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.6fr); gap: 24px; align-items: end; margin-top: 10px; }
.now-date { margin: 0; font-size: 14px; opacity: 0.85; }
.now-date::first-letter { text-transform: uppercase; }
.now-temp { margin: 0; font-size: 104px; line-height: 1; font-weight: 300; letter-spacing: -0.04em; }
.now-temp .deg { font-weight: 250; opacity: 0.85; }
.range { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; max-width: 300px; }
.range-bar { position: relative; flex: 1; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #9cc8ff, #ffd08a); opacity: 0.95; }
.range-bar i { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3); }
.now-sub { margin: 6px 0 0; font-size: 13px; opacity: 0.8; }
.rain-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.rs {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 14px 16px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
}
.rs-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; opacity: 0.9; }
.rs-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; white-space: nowrap; }
.rs-value small { font-size: 14px; font-weight: 500; opacity: 0.8; margin-left: 3px; letter-spacing: 0; }
.rs-sub { font-size: 12px; opacity: 0.8; }
.sync { margin: 16px 0 0; font-size: 12px; opacity: 0.75; }

/* ---------- Records ---------- */

.section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 28px 4px 10px; }
.highlights { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hl {
  display: flex; gap: 12px; align-items: center; min-width: 0;
  padding: 14px 16px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.hl-hot { --c: var(--hot); } .hl-cold { --c: var(--cold); } .hl-wet { --c: var(--wet); } .hl-dry { --c: var(--dry); }
.hl-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.hl-icon .i { width: 20px; height: 20px; }
.hl-text { min-width: 0; }
.hl-label { margin: 0; font-size: 12px; color: var(--muted); font-weight: 500; }
.hl-value { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.hl-date { margin: 0; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Filtres ---------- */

.filters {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 24px -16px 12px; padding: 10px 16px;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.segmented { display: inline-flex; background: var(--chip); border-radius: 12px; padding: 4px; gap: 2px; }
.segmented button, .stepper button { font: inherit; color: var(--ink-2); background: none; border: 0; cursor: pointer; }
.segmented button { border-radius: 9px; padding: 7px 18px; font-weight: 500; font-size: 14px; transition: background 0.15s, color 0.15s; }
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.segmented button:hover:not([aria-selected="true"]) { color: var(--ink); }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 36px; height: 36px; border-radius: 50%; font-size: 20px; line-height: 1; background: var(--chip); color: var(--ink); }
.stepper button:hover:not(:disabled) { background: var(--axis); }
.stepper button:disabled { opacity: 0.35; cursor: default; }
.period { min-width: 160px; text-align: center; font-weight: 650; font-size: 16px; }
.period::first-letter { text-transform: uppercase; }

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

.card { padding: 20px 22px; margin-bottom: 14px; border-radius: 24px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.stat { font-size: 13px; color: var(--ink-2); background: var(--chip); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.stat b { color: var(--ink); font-weight: 600; }
.chart { position: relative; height: 290px; }
.hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.legend { display: flex; gap: 16px; list-style: none; margin: 0 0 10px; padding: 0; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.card-head .legend { margin: 0; }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.sw { display: inline-block; width: 14px; height: 4px; border-radius: 2px; }
.sw-max { background: var(--t-max); }
.sw-min { background: var(--t-min); }
.sw-avg { background: var(--t-avg); }

.table-wrap { overflow-x: auto; margin: 0 -8px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 10px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 500; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--grid); }
tbody tr { border-bottom: 1px solid var(--grid); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--chip); }
td.today { font-weight: 650; }
td .muted { color: var(--muted); font-size: 12px; }
tr.clickable { cursor: pointer; }
.rain-cell { position: relative; }
.rain-cell .bar { position: absolute; right: 10px; bottom: 3px; height: 3px; border-radius: 2px; background: var(--rain); opacity: 0.55; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px 0 4px; }

/* ---------- Téléphone ---------- */

@media (max-width: 860px) {
  .hero-main { grid-template-columns: 1fr; gap: 18px; }
  .highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .page { padding-top: max(12px, env(safe-area-inset-top)); }
  .hero { border-radius: 24px; padding: 18px 18px 14px; }
  .now-temp { font-size: 88px; }
  .rain-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .rs { padding: 10px 12px; border-radius: 14px; }
  .rs-label { font-size: 12px; }
  .rs-label .i { display: none; }
  .rs-value { font-size: 21px; }
  .rs-value small { font-size: 12px; }
  .rs-sub { font-size: 11px; }
  .hl { padding: 12px; gap: 10px; border-radius: 16px; }
  .hl-icon { width: 34px; height: 34px; border-radius: 10px; }
  .hl-value { font-size: 17px; }
  .card { padding: 16px 14px; border-radius: 20px; }
  .chart { height: 240px; }
  .filters { flex-direction: column; align-items: stretch; gap: 8px; }
  .segmented button { flex: 1; }
  .stepper { justify-content: space-between; }
  th, td { padding: 8px 6px; }
  table { font-size: 13px; }
  .time { display: none; }
}
