*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root { --black: #000; --white: #fff; --grey: #888; --light: #e0e0e0; }
html { scroll-behavior: smooth; }
body { font-family:'Proto Slab', 'IBM Plex Mono', monospace; background: var(--white); color: var(--black); font-size: 12px; line-height: 1.5; }

/* NAV */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: var(--white); border-bottom: 1px solid var(--black);
  height: 40px; display: flex; align-items: center; padding: 0 20px;
}
nav .brand { font-size: 11px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; margin-right: auto; }
nav a {
  color: var(--black); text-decoration: none; font-size: 11px;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0 16px; height: 40px; display: flex; align-items: center;
  border-left: 1px solid var(--black); transition: background 0.1s, color 0.1s;
}
nav a:hover { background: var(--black); color: var(--white); }

/* PAGE */
.page { margin-top: 40px; }

/* HERO */
.hero { border-bottom: 1px solid var(--black); display: grid; grid-template-columns: 1fr 1fr; }
.hero-title { padding: 40px 20px; border-right: 1px solid var(--black); }
.hero-title h1 { font-size: clamp(32px, 5vw, 60px); font-weight: 300; line-height: 1; letter-spacing: -0.02em; text-transform: uppercase; }
.hero-title h1 i { font-style: italic; }
.hero-title .meta { margin-top: 24px; color: var(--black); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; line-height: 2; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.stat { padding: 20px; border-right: 1px solid var(--black); border-bottom: 1px solid var(--black); min-height: 80px; display: flex; flex-direction: column; justify-content: space-between; }
.stat:nth-child(3n) { border-right: none; }
.stat:nth-last-child(-n+3) { border-bottom: none; }
.stat .n { font-size: 28px; font-weight: 300; line-height: 1; letter-spacing: -0.02em; }
.stat .l { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--grey); margin-top: 6px; }

/* SECTION */
.section { border-bottom: 1px solid var(--black); }
.section-header {
  border-bottom: 1px solid var(--black); padding: 10px 20px;
  display: flex; align-items: center; gap: 16px;
  background: var(--black); color: var(--white);
}
.section-header .num { font-size: 10px; letter-spacing: 0.1em; opacity: 0.45; }
.section-header .title { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.section-header .hint { margin-left: auto; font-size: 10px; letter-spacing: 0.04em; opacity: 0.4; font-style: italic; }

/* GRID */
.grid { display: grid; }
.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-1 { grid-template-columns: 1fr; }
.row-sep { border-top: 1px solid var(--black); }

/* CHART CELL */
.chart-cell { border-right: 1px solid var(--black); border-bottom: 1px solid var(--black); padding: 20px; min-height: 220px; display: flex; flex-direction: column; }
.cols-3 .chart-cell:nth-child(3n) { border-right: none; }
.cols-2 .chart-cell:nth-child(2n) { border-right: none; }
.cols-1 .chart-cell { border-right: none; }
.cell-label { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--black); margin-bottom: 16px; }
.placeholder { flex: 1; border: 1px dashed var(--light); display: flex; align-items: center; justify-content: center; color: var(--light); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }

/* BAR CHART */
.bar-chart { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-row .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--grey); min-width: 80px; text-align: right; }
.bar-row .track { flex: 1; height: 18px; background: var(--light); }
.bar-row .fill { height: 100%; background: var(--black); display: flex; align-items: center; padding-left: 6px; font-size: 10px; color: var(--white); }
.bar-row .cnt { font-size: 10px; color: var(--grey); min-width: 20px; }

/* DONUT */
.donut-wrap { flex: 1; display: flex; align-items: center; gap: 24px; }
.donut-leg { display: flex; flex-direction: column; gap: 8px; }
.donut-leg-row { display: flex; align-items: center; gap: 8px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--grey); }
.donut-sq { width: 10px; height: 10px; flex-shrink: 0; }

/* MAP */
.map-shell { display: flex; height: 560px; }
.map-sidebar { width: 220px; border-left: 1px solid var(--black); display: flex; flex-direction: column; background: var(--white); overflow: hidden; }
.sb-block { padding: 12px 16px; border-bottom: 1px solid var(--black); }
.sb-block h4 { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--grey); margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { padding: 3px 8px; border: 1px solid var(--black); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; background: var(--white); color: var(--black); font-family: 'IBM Plex Mono', monospace; transition: background 0.1s, color 0.1s; }
.chip.active { background: var(--black); color: var(--white); }
.chip:hover:not(.active) { background: var(--light); }
.map-info { flex: 1; overflow-y: auto; padding: 12px 16px; }
.map-info h4 { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--black); margin-bottom: 8px; }
.info-empty { font-size: 10px; color: var(--light); font-style: italic; line-height: 1.7; }
.info-card { border: 1px solid var(--black); padding: 10px; }
.info-card .ic-head { font-size: 11px; font-weight: 500; margin-bottom: 8px; }
.info-card .ic-row { font-size: 10px; color: var(--grey); margin-bottom: 3px; display: flex; gap: 8px; }
.ic-row .k { color: var(--black); min-width: 52px; }
.map-legend { display: flex; flex-direction: column; gap: 6px; }
.leg-row { display: flex; align-items: center; gap: 8px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--grey); }
.leg-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* FOOTER */
footer { padding: 14px 20px; display: flex; justify-content: space-between; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--grey); }

/* LEAFLET */
.leaflet-popup-content-wrapper { background: var(--white); border: 1px solid var(--black); border-radius: 0; box-shadow: 3px 3px 0 var(--black); font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--black); }
.leaflet-popup-tip { background: var(--black); }
.leaflet-popup-content { margin: 10px 14px; line-height: 1.7; }
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-thumb { background: var(--light); }
/* TEXT CELLS */
.text-cell {
  border-right: 1px solid var(--black);
  border-bottom: 1px solid var(--black);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cols-2 .text-cell:nth-child(2n) { border-right: none; }

.chart-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.body-text {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.8;
  color: var(--black);
}

/* ISOLATION CARTE — évite que les règles grid/cols affectent map-shell */
.map-shell { display: flex !important; grid-template-columns: none !important; }
.map-shell > * { border-bottom: none !important; }
#map { flex: 1 !important; min-width: 0; height: 560px; filter: grayscale(0%) contrast(1.1); }

/* Taille harmonieuse des graphiques Plot */
.chart-cell figure,
.chart-cell svg {
  max-width: 100%;
  height: auto;
}

/* Légende couleur Plot */
[class*="plot-legend"] {
  font-family: 'IBM Plex Mono', monospace !important;
  font-size: 10px !important;
}

/* SVG row — profil des observés */
.svg-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  flex: 1;
  padding: 8px 0;
}

.svg-row img {
  flex: 1;
  min-width: 0;
  max-height: 120px;
  width: 100%;
  object-fit: contain;
}
