:root {
  color-scheme: light;
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  color: #23222b;
  background: #f4f1eb;
  --fond: #f4f1eb;
  --surface: #fff;
  --texte: #23222b;
  --discret: #5f5969;
  --ligne: #e9e4de;
  --violet: #5c3a87;
  --lavande: #f0e8fb;
  --rose: #f8e7ee;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
button, select { font: inherit; }
h1, h2, h3, p, dl, ol, ul { margin: 0; }
dd { margin: 0; }
dt { color: var(--discret); font-size: .83rem; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }
.acces-rapide { position: absolute; left: 1rem; top: .5rem; z-index: 2; padding: .6rem; background: white; transform: translateY(-150%); }
.acces-rapide:focus { transform: none; }

.page {
  display: grid;
  grid-template-columns: 12.5rem minmax(0, 1fr);
  max-width: 1500px;
  min-height: 100vh;
  margin-inline: auto;
}
.barre {
  position: sticky;
  align-self: start;
  top: 0;
  min-height: 100vh;
  padding: 2rem .9rem;
  border-right: 1px solid #e4ddd3;
  background: #f8f5ef;
}
.marque { display: flex; align-items: center; gap: .65rem; padding-inline: .35rem; font-weight: 750; line-height: 1.2; text-decoration: none; }
.marque small { display: block; margin-top: .23rem; color: var(--discret); font-size: .74rem; font-weight: 500; }
.marque-symbole {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: .67rem;
  background: #2b2337;
  color: #f8e7ee;
  font-family: Georgia, serif;
  font-size: 1.4rem;
}
nav { display: grid; gap: .28rem; margin-top: 2.15rem; }
nav a { padding: .64rem .7rem; border-radius: .55rem; font-size: .9rem; text-decoration: none; }
nav a[aria-current="location"] { background: var(--lavande); color: #492c70; font-weight: 670; }
nav a:hover { background: #eee7f3; }
main { min-width: 0; padding: 2rem clamp(1rem, 3vw, 2.8rem) 1.5rem; }
h1 { font-size: clamp(1.8rem, 4.4vw, 3.15rem); letter-spacing: -.046em; line-height: 1.08; }
.intro { margin-top: .55rem; color: var(--discret); line-height: 1.5; }
.indicateurs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-block: 1.3rem 1rem; }
.indicateurs > div, .panneau { min-width: 0; border: 1px solid var(--ligne); border-radius: .9rem; background: var(--surface); }
.indicateurs > div { padding: .8rem .9rem; border-top: 3px solid #eac5dc; }
.indicateurs > div:nth-child(2) { border-top-color: #d8c8ee; }
.indicateurs > div:nth-child(3) { border-top-color: #e9dcaf; }
.indicateurs > div:nth-child(4) { border-top-color: #d9cde7; }
.indicateurs dd { margin-top: .36rem; font-size: clamp(1.16rem, 2.8vw, 1.9rem); font-weight: 750; letter-spacing: -.035em; }
dd, .ligne-valeur, .population strong { font-variant-numeric: tabular-nums; }

.explorateur { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); grid-template-areas: "analyses carte"; gap: 1rem; align-items: start; }
.analyses { grid-area: analyses; display: grid; gap: 1rem; min-width: 0; }
.panneau { padding: clamp(.85rem, 1.7vw, 1.25rem); scroll-margin-top: 1rem; }
.carte { grid-area: carte; align-self: stretch; display: flex; flex-direction: column; }
h2 { font-size: 1.08rem; letter-spacing: -.017em; }
.aide { margin-top: .32rem; font-size: .84rem; color: var(--discret); line-height: 1.35; }
.cadre-carte {
  flex: 1;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-items: center;
  margin-block: .8rem;
  padding: .55rem;
  border-radius: .65rem;
  background: #f7f4fa;
}
#togo { display: block; width: 100%; height: clamp(25rem, 43vw, 32rem); }
.zone { cursor: pointer; stroke: #564368; stroke-width: .7; stroke-linejoin: round; }
.zone:hover { stroke: #432463; stroke-width: 1.8; }
.zone[aria-pressed="true"] { stroke: #7b285a; stroke-width: 2.6; }
.zone:focus-visible { outline: none; stroke: #271438; stroke-width: 3; }
.repere-carte { max-width: 100%; padding: .45rem .65rem; border-radius: .45rem; background: white; color: #462e5f; font-size: .79rem; font-weight: 650; text-align: center; }
.legende { display: flex; flex-wrap: wrap; gap: .42rem .85rem; list-style: none; padding: 0; color: var(--discret); font-size: .74rem; }
.legende li { display: flex; align-items: center; gap: .35rem; }
.nuance { width: .7rem; height: .7rem; border: 1px solid #776486; border-radius: 2px; }

.lignes-classement { list-style: none; padding: 0; margin-top: .65rem; }
.lignes-classement li + li { border-top: 1px solid #f0ebf2; }
.ligne-classement {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .25rem .55rem;
  padding: .43rem .42rem;
  border: 0;
  border-radius: .42rem;
  background: transparent;
  color: var(--texte);
  font-size: .82rem;
  text-align: left;
  cursor: pointer;
}
.ligne-classement:hover, .ligne-classement[aria-pressed="true"] { background: #f6effb; }
.ligne-nom { font-weight: 650; }
.ligne-valeur { color: var(--discret); }
.ligne-barre { grid-column: 1 / -1; height: .36rem; border-radius: 1rem; background: #f1edf5; }
.ligne-barre span { display: block; height: 100%; border-radius: inherit; background: #b8a0da; }
.ligne-classement[aria-pressed="true"] .ligne-barre span { background: #7552a5; }

.choix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-top: .75rem; }
label { display: block; font-size: .79rem; font-weight: 650; }
select { width: 100%; margin-top: .28rem; padding: .45rem .5rem; border: 1px solid #d8cddd; border-radius: .45rem; color: inherit; background: white; font-size: .85rem; }
.fiche { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .3rem .9rem; margin-top: .75rem; padding: .7rem .75rem; border-radius: .62rem; background: var(--lavande); }
.identite { min-width: 0; }
.territoire { color: #5c4873; font-size: .72rem; font-weight: 640; }
h3 { font-size: 1.08rem; margin-block: .15rem; overflow-wrap: anywhere; }
.population { margin-top: .3rem; font-size: .75rem; color: #554264; }
.population strong { color: var(--texte); font-size: 1.06rem; white-space: nowrap; }
.repartition { display: grid; align-content: center; gap: .22rem; }
.repartition div { display: flex; align-items: baseline; justify-content: space-between; gap: .3rem; }
.repartition dt { font-size: .72rem; color: #5b476b; }
.repartition dd { white-space: nowrap; font-size: .78rem; font-weight: 700; }
.comparaison { min-height: 1.15em; margin-top: .6rem; color: #492e55; font-size: .81rem; }
details { margin-top: .6rem; padding-top: .45rem; border-top: 1px solid var(--ligne); font-size: .78rem; color: var(--discret); }
summary { cursor: pointer; }
details p { margin-top: .4rem; }
footer { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; margin-top: 1rem; color: var(--discret); font-size: .77rem; }
footer a { text-underline-offset: .2em; }

@media (max-width: 1050px) {
  .page { grid-template-columns: 9.6rem minmax(0, 1fr); }
  .barre { padding-inline: .6rem; }
}
@media (max-width: 820px) {
  .page { display: block; }
  .barre { position: static; min-height: auto; padding: .75rem 1rem; border: 0; border-bottom: 1px solid #e4ddd3; }
  .marque { padding: 0; }
  nav { display: flex; flex-wrap: wrap; gap: .22rem; margin-top: .65rem; }
  nav a { padding: .42rem .5rem; font-size: .79rem; }
  main { padding-top: 1.15rem; }
}
@media (max-width: 640px) {
  .indicateurs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .explorateur { grid-template-columns: minmax(0, 1fr); grid-template-areas: "carte" "details" "classement"; gap: .75rem; }
  .analyses { display: contents; }
  .classement { grid-area: classement; }
  .details { grid-area: details; }
  #togo { height: clamp(18rem, 80vw, 25rem); }
}
@media (max-width: 360px) {
  .fiche { grid-template-columns: minmax(0, 1fr); }
  .repartition { margin-top: .25rem; }
}
