/* ════════════════════════════════════════════════════════════════
   Dashboard public — styles spécifiques aux visualisations
   En complément de style.css (mêmes variables de couleurs)
   ════════════════════════════════════════════════════════════════ */

:root {
  --scale-0: #f4efe3;
  --scale-1: #d9e4ee;
  --scale-2: #a8c4dd;
  --scale-3: #6f9fc6;
  --scale-4: #3a78ad;
  --scale-5: #1e5fb8;
  --scale-6: #0a3b5c;
  --scale-7: #061f33;
}

/* Layout plus large pour le dashboard */
.container-wide {
  max-width: 1280px;
}

/* Grain papier renforcé sur le dashboard */
body::before {
  opacity: .35;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(139, 122, 87, .08) 0, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(30, 95, 184, .05) 0, transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.55  0 0 0 0 0.48  0 0 0 0 0.34  0 0 0 0.18 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
}

/* ─────────────── HERO ─────────────── */
header.hero {
  border-bottom: 1px solid var(--rule);
  padding-bottom: clamp(28px, 4vw, 48px);
  padding-top: clamp(24px, 4vw, 56px);
}
.hero .eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.hero .eyebrow::before, .hero .eyebrow::after {
  content: "";
  height: 1px;
  background: var(--rule);
  flex: 1;
  max-width: 80px;
}
.hero h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 350;
  font-variation-settings: "SOFT" 50;
  font-size: clamp(48px, 9vw, 124px);
  line-height: .92;
  letter-spacing: -.03em;
  margin: 0 0 4px;
}
.hero h1 em {
  font-style: italic;
  font-weight: 300;
  color: var(--cobalt);
}
.hero .sub {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 56px;
  margin-top: clamp(32px, 5vw, 56px);
  align-items: end;
}
.hero .place {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
  max-width: 460px;
  line-height: 1.35;
}
.hero .place .pin {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--rust);
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
  transform: translateY(-2px);
}
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 24px;
  flex: 1;
  min-width: 280px;
}
.kpi {
  border-left: 1px solid var(--rule);
  padding-left: 18px;
}
.kpi-num {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: clamp(36px, 4.5vw, 56px);
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--ink);
}
.kpi-num .unit {
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  margin-left: 4px;
  font-weight: 500;
}
.kpi-label {
  margin-top: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 500;
}

/* ─────────────── SECTIONS du dashboard ─────────────── */
main > .container > section {
  padding: clamp(48px, 7vw, 96px) 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0;
}
main > .container > section:last-of-type {
  border-bottom: none;
}
.section-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--rust);
  letter-spacing: .15em;
}
main > .container > section .section-head {
  align-items: baseline;
  gap: 24px;
  margin-bottom: clamp(28px, 4vw, 44px);
}
main > .container > section .section-head h2 {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: -.02em;
  margin: 0;
}
main > .container > section .section-head .lede {
  font-style: italic;
  color: var(--muted);
  font-size: 15px;
  max-width: 480px;
  margin-left: auto;
}

.card {
  background: rgba(255, 255, 255, .35);
  border: 1px solid var(--rule);
  padding: clamp(20px, 3vw, 32px);
  border-radius: 2px;
}

/* ─────────────── CHARTS ─────────────── */
.chart-wrap {
  position: relative;
  height: 360px;
}
@media (max-width: 600px) {
  .chart-wrap { height: 280px; }
}

/* ─────────────── HEATMAP ─────────────── */
.heatmap-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
.heatmap {
  display: grid;
  grid-template-columns: 56px repeat(12, minmax(56px, 1fr));
  gap: 4px;
  min-width: 760px;
}
.heatmap .hcell {
  aspect-ratio: 1.1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--ink);
  border-radius: 2px;
  transition: transform .15s ease;
  cursor: default;
  position: relative;
}
.heatmap .hcell:hover {
  transform: scale(1.08);
  z-index: 2;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
}
.heatmap .hcell.empty {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 5px,
    rgba(139, 122, 87, .15) 5px,
    rgba(139, 122, 87, .15) 6px
  );
  color: transparent;
  cursor: not-allowed;
}
.heatmap .label {
  background: transparent;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  justify-content: flex-end;
  padding-right: 8px;
  cursor: default;
}
.heatmap .label:hover { transform: none; box-shadow: none; }
.heatmap .label.colhead {
  justify-content: center;
  padding-right: 0;
  align-items: flex-end;
  aspect-ratio: auto;
  height: 24px;
}
.heatmap .label.rowhead {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
}
.heat-light { color: var(--ink); }
.heat-dark { color: var(--paper); }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  font-size: 12px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  flex-wrap: wrap;
}
.heatmap-legend .scale {
  display: flex;
  gap: 2px;
}
.heatmap-legend .scale span {
  width: 28px; height: 14px;
  display: block;
  border-radius: 1px;
}

/* ─────────────── PROFILE ─────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
}
.profile-note {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.profile-note .drop {
  float: left;
  font-size: 64px;
  line-height: .85;
  font-weight: 400;
  color: var(--cobalt);
  padding: 6px 10px 0 0;
  font-style: normal;
}

/* ─────────────── SEASONS ─────────────── */
.season-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.season {
  border: 1px solid var(--rule);
  padding: 24px;
  background: rgba(255,255,255,.4);
  position: relative;
  overflow: hidden;
}
.season h3 {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 20px;
  margin: 0 0 4px;
  letter-spacing: -.01em;
}
.season .glyph {
  font-size: 22px;
  margin-right: 6px;
}
.season-num {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -.02em;
  margin: 16px 0 4px;
}
.season-num .unit {
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  margin-left: 4px;
}
.season-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.season-months {
  font-style: italic;
  color: var(--muted);
  font-size: 13px;
  margin-top: 14px;
  font-family: 'Fraunces', serif;
}
.season.hiver h3 { color: var(--cobalt-dark); }
.season.printemps h3 { color: var(--ok); }
.season.ete h3 { color: var(--rust); }
.season.automne h3 { color: var(--warn); }

/* ─────────────── EXTREMES ─────────────── */
.extreme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.extreme {
  padding: 24px;
  border: 1px solid var(--rule);
  background: rgba(255,255,255,.4);
}
.extreme .ex-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.extreme .ex-label .dot {
  width: 6px; height: 6px; border-radius: 50%;
}
.extreme .ex-label .dot.wet { background: var(--cobalt); }
.extreme .ex-label .dot.dry { background: var(--rust); }
.extreme .ex-num {
  font-family: 'Fraunces', serif;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -.02em;
  margin-bottom: 10px;
}
.extreme .ex-num .unit {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  margin-left: 4px;
}
.extreme .ex-cap {
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
  font-family: 'Fraunces', serif;
}

/* ─────────────── YEAR DETAIL ─────────────── */
.year-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.year-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 2px;
  transition: all .15s ease;
  letter-spacing: .05em;
}
.year-btn:hover {
  border-color: var(--cobalt);
  color: var(--cobalt);
}
.year-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.year-btn.partial::after {
  content: "·";
  color: var(--rust);
  margin-left: 4px;
  font-weight: 700;
}
.year-detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}
@media (max-width: 900px) {
  .year-detail-grid { grid-template-columns: 1fr; }
}
.year-summary {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.year-stat {
  border-bottom: 1px dashed var(--rule);
  padding-bottom: 14px;
}
.year-stat:last-child { border: none; }
.year-stat .lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.year-stat .val {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  line-height: 1.1;
  margin-top: 4px;
}
.year-stat .val .unit {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  margin-left: 4px;
}
.partial-warning {
  background: rgba(194, 99, 43, .08);
  border-left: 3px solid var(--rust);
  padding: 12px 16px;
  font-size: 13px;
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 24px;
  display: none;
}
.partial-warning.active { display: block; }

/* ─────────────── TOOLTIP ─────────────── */
.tip {
  position: fixed;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 100;
  border-radius: 2px;
  white-space: nowrap;
  transform: translate(-50%, -130%);
}
.tip.visible { opacity: 1; }
.tip strong {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  color: #fff;
  display: block;
  font-size: 16px;
  margin-bottom: 2px;
}

/* Footer custom */
.footer-glyph {
  display: block;
  margin: 0 auto 18px;
  color: var(--cobalt);
  opacity: .5;
}

/* ════════════════════════════════════════════════════════════════
   NOUVELLES SECTIONS
   ════════════════════════════════════════════════════════════════ */

/* Sous-titres de section */
.subsection-title {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 22px;
  margin: 48px 0 4px;
  color: var(--ink-soft);
  letter-spacing: -.01em;
}
.subsection-lede {
  font-style: italic;
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 24px;
  max-width: 720px;
}

/* ─────────────── §1 · Cette année ─────────────── */
.cy-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .cy-grid { grid-template-columns: 1fr; }
}
.cy-summary {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: clamp(20px, 3vw, 32px);
  background: rgba(255, 255, 255, .35);
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.cy-rank {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 18px;
}
.cy-rank-num {
  font-family: 'Fraunces', serif;
  font-size: 72px;
  font-weight: 350;
  line-height: 1;
  letter-spacing: -.04em;
  color: var(--cobalt);
}
.cy-rank-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}
.cy-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cy-stat .lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: inherit;
  opacity: .7;
  margin-bottom: 4px;
}
.cy-stat .val {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -.02em;
}

/* ─────────────── §2 · Annual + Ranking ─────────────── */
.annual-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .annual-grid { grid-template-columns: 1fr; }
}
.ranking-card {
  background: rgba(255, 255, 255, .35);
  border: 1px solid var(--rule);
  padding: clamp(20px, 3vw, 28px);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
}
.ranking-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.ranking-head h3 {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  margin: 0;
  font-weight: 400;
}
.ranking-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
}
.ranking-row {
  display: grid;
  grid-template-columns: 28px 52px 1fr 64px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.ranking-row .rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}
.ranking-row .rank-year {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  color: var(--ink-soft);
}
.ranking-row .rank-year .partial {
  color: var(--rust);
  font-weight: 700;
}
.ranking-row .rank-bar-wrap {
  height: 8px;
  background: rgba(217, 209, 189, .4);
  border-radius: 1px;
  overflow: hidden;
}
.ranking-row .rank-bar {
  height: 100%;
  background: var(--cobalt);
  border-radius: 1px;
  transition: width .3s;
}
.ranking-row .rank-total {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink);
  text-align: right;
}
.ranking-row.current {
  background: rgba(30, 95, 184, .07);
  padding: 6px 8px;
  margin: -6px -8px;
  border-radius: 2px;
}
.ranking-row.current .rank,
.ranking-row.current .rank-year,
.ranking-row.current .rank-total { color: var(--cobalt-dark); font-weight: 600; }
.ranking-row.current .rank-bar { background: var(--cobalt-dark); }

/* ─────────────── §4b · Tendances mensuelles ─────────────── */
.trends-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 900px) {
  .trends-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .trends-grid { grid-template-columns: repeat(2, 1fr); }
}
.trend-card {
  background: rgba(255, 255, 255, .4);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 14px 16px;
}
.trend-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.trend-month {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
}
.trend-slope {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .03em;
}
.trend-slope .trend-unit {
  font-weight: 400;
  color: var(--muted);
  font-size: 10px;
}
.trend-up   .trend-slope { color: var(--cobalt); }
.trend-down .trend-slope { color: var(--rust); }
.trend-flat .trend-slope { color: var(--muted); }
.trend-spark {
  width: 100% !important;
  height: 40px !important;
  margin-top: 4px;
}

/* ─────────────── §6 · Anomalies ─────────────── */
.anomaly-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 720px) {
  .anomaly-grid { grid-template-columns: 1fr; }
}
.anomaly-col {
  background: rgba(255, 255, 255, .35);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 20px 24px;
}
.anomaly-col-head {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4px;
}
.anomaly-col-head.wet { color: var(--cobalt); }
.anomaly-col-head.dry { color: var(--rust); }
.anomaly-row {
  display: grid;
  grid-template-columns: 92px 1fr 72px;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(217, 209, 189, .6);
}
.anomaly-row:last-child { border-bottom: none; }
.anomaly-when {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 15px;
  color: var(--ink-soft);
}
.anomaly-vals {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.anomaly-vals .actual { color: var(--ink); font-weight: 500; }
.anomaly-vals .vs { color: var(--muted); font-size: 11px; font-style: italic; }
.anomaly-pct {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 500;
  text-align: right;
  letter-spacing: -.02em;
}
.anomaly-pct.wet { color: var(--cobalt); }
.anomaly-pct.dry { color: var(--rust); }

/* ─────────────── §7 · Comparateur ─────────────── */
.compare-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 28px;
}
.compare-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 2px;
  transition: all .15s ease;
  letter-spacing: .05em;
}
.compare-btn:hover {
  border-color: var(--cobalt);
  color: var(--cobalt);
}
.compare-btn.active {
  background: var(--cobalt);
  color: var(--paper);
  border-color: var(--cobalt);
}
.compare-btn.partial::after {
  content: "·";
  color: var(--rust);
  margin-left: 4px;
  font-weight: 700;
}
.compare-btn.active.partial::after { color: var(--paper); }
.compare-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  margin-left: 8px;
  letter-spacing: .1em;
}
