/* ============================================================
   Charte DATA BOOST · site « Clustering en santé »
   ============================================================ */
:root {
  --ink: #253246; --ink-2: #5B6780; --ink-3: #8A94A8;
  --line: #E1E5EE; --paper: #FFFFFF; --ground: #F6F7FA;
  --blue: #4169E1; --blue-soft: #EBF1FD; --title: #00347A;
  --orange: #FF914D; --orange-soft: #FFEEE4;
  --grey: #9C9C9C; --grey-soft: #F0F0F0;
  --ok: #1F9D6B; --warn: #E1B941; --ko: #E14169;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --shadow: 0 6px 24px rgba(37,50,70,.06);
  --shadow-pop: 0 10px 30px rgba(37,50,70,.16);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 15.5px; line-height: 1.55; }
[hidden] { display: none !important; }
a { color: var(--blue); }

/* Mise en page */
.app { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
aside { background: var(--paper); border-right: 1px solid var(--line); padding: 20px 16px; display: flex; flex-direction: column; gap: 16px;
        position: sticky; top: 0; height: 100vh; overflow: auto; scrollbar-width: thin; scrollbar-color: #B6BFCE transparent; }
.marque { font-weight: 600; color: var(--blue); font-size: 19px; letter-spacing: .02em; text-decoration: none; padding: 2px 6px; }
.marque span { color: var(--grey); }
main { padding: 28px 34px 30px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.espace { flex: 1; }
.mention { padding: 0 6px; }

/* Navigation */
nav#nav { display: flex; flex-direction: column; gap: 2px; }
nav#nav .groupe { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); margin: 12px 8px 4px; }
nav#nav a { display: block; text-decoration: none; color: var(--ink-2); padding: 7px 10px; border-radius: 10px; font-size: 14px; line-height: 1.3; }
nav#nav a small { display: block; color: var(--ink-3); font-size: 11.5px; }
nav#nav a:hover { background: var(--ground); }
nav#nav a.on { background: var(--blue-soft); color: var(--blue); font-weight: 500; }
nav#nav a:focus-visible, .seg button:focus-visible, .tuile:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

/* Contrôles */
#controles { display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.bloc h3 { margin: 0 0 7px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
.seg { display: flex; flex-direction: column; gap: 3px; }
.seg button { all: unset; cursor: pointer; padding: 6px 11px; border-radius: 10px; color: var(--ink-2); font-size: 14px; }
.seg button:hover { background: var(--ground); }
.seg button.on { background: var(--blue-soft); color: var(--blue); font-weight: 500; }
select, input[type=text] { width: 100%; font-family: var(--sans); font-size: 14px; color: var(--ink); padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
input[type=text] { margin-top: 6px; }
input[type=range] { width: 100%; accent-color: var(--blue); }
label.chk { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); margin: 4px 0; }
.petit { font-size: 12.5px; color: var(--ink-3); }

/* Titres */
.sur { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
h1 { margin: 6px 0 8px; font-weight: 600; color: var(--title); letter-spacing: -.01em; line-height: 1.1; font-size: clamp(27px, 3vw, 42px); }
.sous { color: var(--ink-2); max-width: 920px; font-size: 16px; }
.hero { padding: 10px 0 4px; }
.hero .sous { max-width: none; }

/* Cartes */
.carte { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.carte h2 { margin: 0 0 10px; font-size: 19px; font-weight: 600; }
.carte h4 { margin: 14px 0 4px; font-size: 15px; font-weight: 600; color: var(--ink); }
.carte p { margin: 4px 0 8px; }

/* Accueil */
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.tuile { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 20px 16px; text-decoration: none; color: var(--ink);
         display: flex; flex-direction: column; gap: 8px; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.tuile:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); border-color: #C9D6F7; }
.tuile .tag { align-self: flex-start; background: var(--blue-soft); color: var(--blue); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; padding: 3px 9px; border-radius: 6px; }
.tuile .tag.peda { background: var(--orange-soft); color: #B85C1E; }
.tuile h3 { margin: 2px 0 0; font-size: 20px; font-weight: 600; color: var(--title); }
.tuile p { margin: 0; color: var(--ink-2); font-size: 14.5px; flex: 1; }
.tuile .pied { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 9px; font-variant-numeric: tabular-nums; }
.tuile .pied b { color: var(--ink-2); font-weight: 500; }
.tuile svg { width: 100%; height: 70px; }

/* Page sujet */
#graph { height: 720px; }
#map { height: 640px; }
.stat { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.stat b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.aide { margin-top: 4px; }
.tablewrap { overflow: auto; max-height: 480px; scrollbar-width: thin; }
table { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; width: 100%; }
th { position: sticky; top: 0; background: var(--blue-soft); color: var(--ink); font-weight: 500; text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 6px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num { text-align: right; white-space: nowrap; }
td:first-child { min-width: 200px; }
td.long { min-width: 380px; }
.pastille { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
/* Panneau dépliable du jeu de données */
.jeu { padding: 0; }
.jeu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 20px 14px 46px; position: relative; border-radius: 16px; }
.jeu summary::-webkit-details-marker { display: none; }
.jeu summary::before { content: ""; position: absolute; left: 22px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--blue); border-bottom: 2px solid var(--blue);
                       transform: translateY(-70%) rotate(-45deg); transition: transform .25s ease; }
.jeu[open] summary::before { transform: translateY(-60%) rotate(45deg); }
.jeu summary:hover { background: var(--ground); }
.jeu summary:focus-visible { outline: 2px solid var(--blue); }
.jeu-titre { font-size: 17px; font-weight: 600; color: var(--ink); }
.jeu-resume { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.jeu-corps { padding: 0 20px 18px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 14.5px; }
.jeu-corps p { margin: 14px 0 10px; max-width: none; }
.jeu-corps code { font-family: var(--mono); font-size: 12.5px; background: var(--ground); padding: 1px 5px; border-radius: 5px; }
.jeu-sources { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.jeu-sources a, .jeu-sources span { font-size: 12.5px; background: var(--blue-soft); color: var(--blue); padding: 3px 10px; border-radius: 6px; text-decoration: none; }
.jeu-sources span { background: var(--orange-soft); color: #B85C1E; }
.jeu-sources a:hover { text-decoration: underline; }
#jeu-extrait td { font-size: 12.5px; white-space: nowrap; }
#jeu-extrait td.texte { white-space: normal; min-width: 340px; }
#jeu-extrait td:first-child { min-width: 0; }
.suite { display: flex; justify-content: space-between; gap: 16px; }
.suite a { flex: 1; max-width: 48%; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; text-decoration: none; color: var(--ink); }
.suite a:hover { border-color: #C9D6F7; box-shadow: var(--shadow); }
.suite a small { display: block; color: var(--ink-3); font-size: 12px; }
.suite a.droite { text-align: right; margin-left: auto; }

/* Chargement */
.chargement { text-align: center; color: var(--ink-2); padding: 40px 20px; }
.barre-prog { height: 6px; background: var(--blue-soft); border-radius: 3px; overflow: hidden; max-width: 360px; margin: 0 auto 12px; }
.barre-prog span { display: block; height: 100%; width: 35%; background: var(--blue); border-radius: 3px; animation: glisse 1.1s ease-in-out infinite; }
@keyframes glisse { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

footer { color: var(--ink-3); font-size: 11.5px; text-align: center; margin-top: 6px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  aside { position: static; height: auto; }
  main { padding: 20px 16px; }
  #graph { height: 500px; } #map { height: 460px; }
}
#s-corps { display: flex; flex-direction: column; gap: 22px; }

/* Aperçu des photos au survol et galerie (cas d'images) */
.cgraph { position: relative; }
#apercu { position: absolute; top: 44px; right: 18px; width: 200px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
          box-shadow: var(--shadow-pop); padding: 8px; z-index: 5; font-size: 12px; color: var(--ink-2); line-height: 1.4; }
#apercu img { width: 100%; border-radius: 8px; display: block; margin-bottom: 6px; }
.galerie-groupe { margin: 10px 0 16px; }
.galerie-groupe h4 { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.vignettes { display: flex; flex-wrap: wrap; gap: 6px; }
.vignettes img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 3px solid transparent; }
img.mini { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; display: block; }
