/* La fréquentation du wipe (layout/population.js) : en bref sur l'accueil, en détail dans le journal des wipes.
   Le pic de chaque jour, puis (journal) le jour choisi heure par heure. */
.population {
  max-width: 1240px;
  margin: 22px auto 0;
  padding: 26px 36px 22px;
  border: 1px solid #725b3b;
  background: linear-gradient(145deg, #201d18e8, #11100eea);
  box-shadow: 0 20px 60px #0007;
}
.population__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 30px;
}
.population__head h3 {
  margin: 0 0 6px;
  color: var(--cream);
  font: 900 15px "Roboto Condensed", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.population__periods {
  display: flex;
  gap: 4px;
}
.population__periods button {
  padding: 7px 12px;
  border: 1px solid #4e3d29;
  background: #15130f;
  color: #a99c89;
  font: 700 0.8rem Roboto, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.population__periods button[aria-pressed="true"] {
  border-color: var(--honey);
  background: linear-gradient(160deg, #3a2d1c, #17130d);
  color: var(--cream);
}

/* Les trois tuiles en tête : record, soirée, en ce moment */
.population__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 20px 0 18px;
}
.population__fact {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #4e3d29;
  background: linear-gradient(160deg, #241c12cc, #12100dcc);
}
.population__fact > svg {
  flex: none;
  width: 38px;
  height: 38px;
  padding: 8px;
  border: 1px solid #6c5232;
  fill: none;
  stroke: var(--honey);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.population__fact div {
  display: grid;
  gap: 1px;
}
.population__fact small {
  color: #c89146;
  font: 900 0.8rem Roboto;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.population__fact strong {
  color: var(--cream);
  font: 900 24px/1.1 "Roboto Condensed", sans-serif;
}
.population__fact span {
  color: #9f9381;
  font-size: 13px;
}
.population__fact.is-live > svg {
  border-color: #3f7a4f;
  stroke: #58c975;
}

/* La courbe des pics de chaque jour (layout/population.js, curve) */
.pop-curve {
  position: relative;
  height: 190px;
  margin: 26px 0 30px;
}
.pop-curve svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.pop-curve__grid {
  fill: none;
  stroke: #ffffff12;
  stroke-width: 1;
}
.pop-curve__line {
  fill: none;
  stroke: var(--honey);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
/* Le wipe précédent, au même jour (page fréquentation) : en pointillés crème, derrière */
.pop-curve__previous {
  fill: none;
  stroke: rgba(var(--parchment-rgb), 0.45);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
  stroke-linejoin: round;
}
.pop-curve__legend {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  margin: -14px 0 18px;
  color: var(--text-soft);
  font-size: 0.82rem;
}
.pop-curve__legend span::before {
  content: "";
  display: inline-block;
  width: 22px;
  margin-right: 8px;
  vertical-align: middle;
  border-top: 2px solid var(--honey);
}
.pop-curve__legend .is-then::before {
  border-top: 2px dashed rgba(var(--parchment-rgb), 0.55);
}
/* Le même chiffre au wipe précédent, sous une tuile */
.population__fact em {
  display: block;
  margin-top: 2px;
  color: #a99c89;
  font-size: 0.8rem;
  font-style: normal;
}
/* La courbe se dévoile de gauche à droite, la première fois qu'elle est à l'écran */
.pop-curve svg {
  clip-path: inset(-20px 0 -20px 0);
  transition: clip-path 1.4s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.population:not(.is-seen) .pop-curve svg {
  clip-path: inset(-20px 100% -20px 0);
}
.pop-curve__area {
  transition: opacity 0.8s ease 0.6s;
}
.population:not(.is-seen) .pop-curve__area {
  opacity: 0;
}
.pop-curve__days {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Chaque jour : une bande verticale (la zone de survol, plus large que le point) centrée sur le point */
.pop-curve__day {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--x);
  width: max(var(--w), 18px);
  transform: translateX(-50%);
}
.pop-curve__day::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 1px dashed rgba(var(--gold-rgb), 0.4);
  opacity: 0;
  transition: opacity 0.15s;
}
.pop-curve__day button {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  border: 0;
  background: none;
  cursor: pointer;
}
.pop-curve__dot {
  position: absolute;
  left: 50%;
  bottom: var(--y);
  width: 9px;
  height: 9px;
  border: 2px solid #12100d;
  border-radius: 50%;
  background: var(--honey);
  transform: translate(-50%, 50%);
  transition:
    transform 0.2s,
    opacity 0.3s ease calc(0.4s + var(--i) * 40ms);
}
.population:not(.is-seen) .pop-curve__dot,
.population:not(.is-seen) .pop-curve__best {
  opacity: 0;
}
.pop-curve__best {
  position: absolute;
  left: 50%;
  bottom: calc(var(--y) + 10px);
  color: var(--cream);
  font: 900 14px "Roboto Condensed", sans-serif;
  transform: translateX(-50%);
  transition: opacity 0.3s ease 1.2s;
}
.pop-curve__axis {
  position: absolute;
  right: 0;
  bottom: -22px;
  left: 0;
  height: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pop-curve__axis li {
  position: absolute;
  left: var(--x);
  color: #9f9381;
  font-size: 0.8rem;
  white-space: nowrap;
  transform: translateX(-50%);
}
.pop-curve__day small {
  position: absolute;
  left: 50%;
  bottom: -22px;
  color: #9f9381;
  font-size: 0.8rem;
  white-space: nowrap;
  transform: translateX(-50%);
}
.pop-curve__tip {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(var(--y) + 18px);
  width: max-content;
  max-width: 230px;
  padding: 7px 10px;
  border: 1px solid #6c5232;
  background: #12100d;
  box-shadow: 0 8px 22px #000a;
  color: var(--cream);
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  /* Cachée, réduite à rien : à sa taille, elle élargissait la page près du bord droit (mobile), comme les infobulles */
  transform: translate(-50%, 4px) scale(0);
  transition: opacity 0.15s;
}
.pop-curve__day:first-child .pop-curve__tip {
  transform: translate(-15%, 4px) scale(0);
}
.pop-curve__day:last-child .pop-curve__tip {
  transform: translate(-85%, 4px) scale(0);
}
.pop-curve__day:hover::before,
.pop-curve__day:focus-within::before,
.pop-curve__day:hover .pop-curve__tip,
.pop-curve__day:focus-within .pop-curve__tip {
  opacity: 1;
}
.pop-curve__day:hover .pop-curve__tip,
.pop-curve__day:focus-within .pop-curve__tip {
  transform: translate(-50%, 0);
}
.pop-curve__day:first-child:hover .pop-curve__tip,
.pop-curve__day:first-child:focus-within .pop-curve__tip {
  transform: translate(-15%, 0);
}
.pop-curve__day:last-child:hover .pop-curve__tip,
.pop-curve__day:last-child:focus-within .pop-curve__tip {
  transform: translate(-85%, 0);
}
.pop-curve__day:hover .pop-curve__dot,
.pop-curve__day.is-selected .pop-curve__dot {
  transform: translate(-50%, 50%) scale(1.5);
}
.pop-curve__day.is-selected .pop-curve__dot {
  background: var(--cream);
  box-shadow: 0 0 0 3px #dda23e88;
}
.pop-curve__day.is-selected::before {
  opacity: 1;
  border-left-style: solid;
}
.pop-curve__day button:focus-visible {
  outline: 2px solid var(--honey);
  outline-offset: -2px;
}
@media (prefers-reduced-motion: reduce) {
  .pop-curve svg,
  .pop-curve__area,
  .pop-curve__dot,
  .pop-curve__best {
    transition: none;
  }
}

/* Les barres : le nombre écrit au-dessus, la date (ou l'heure) dessous */
.population__chart {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  align-items: end;
  gap: 5px;
  height: 170px;
  padding: 18px 0 22px;
  border-bottom: 1px solid #4e3d29;
}
.population__chart.is-hours {
  height: 140px;
}
/* Les jours sont en courbe : le conteneur des barres ne sert qu'aux heures */
.population__chart.is-days {
  display: block;
  height: auto;
  padding: 0;
  border: 0;
}
.population__bar {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.population__bar:disabled {
  cursor: default;
}
.population__bar b {
  margin-bottom: 4px;
  color: var(--cream);
  font: 900 13px "Roboto Condensed", sans-serif;
  text-align: center;
}
/* La barre monte la première fois que le bloc est à l'écran (is-seen), l'une après l'autre. */
.population__track {
  position: relative;
  flex: 1;
}
/* La même heure au wipe précédent : un trait en pointillés crème à sa hauteur */
.population__before {
  position: absolute;
  right: 8%;
  bottom: var(--h);
  left: 8%;
  border-top: 2px dashed rgba(var(--parchment-rgb), 0.6);
  text-decoration: none;
  pointer-events: none;
}
.population:not(.is-seen) .population__before {
  opacity: 0;
}
.population__bar i {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  height: var(--h);
  background: linear-gradient(180deg, #8a6a3d, #4d3a22);
  transition:
    height 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--i, 0) * 28ms),
    background 0.2s;
}
.population:not(.is-seen) .population__bar i {
  height: 0;
}
.population__bar b {
  transition: opacity 0.4s ease calc(var(--i, 0) * 28ms + 0.35s);
}
.population:not(.is-seen) .population__bar b {
  opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
  .population__bar i,
  .population__bar b {
    transition: none;
  }
}
.population__bar:not(:disabled):hover i {
  background: linear-gradient(180deg, var(--honey), #7a5523);
}
.population__bar.is-selected i,
.is-hours .population__bar i {
  background: linear-gradient(180deg, var(--honey), #7a5523);
}
.population__bar.is-selected b {
  color: var(--honey);
}
.population__bar small {
  position: absolute;
  left: 50%;
  bottom: -20px;
  color: #9f9381;
  font-size: 0.8rem;
  white-space: nowrap;
  transform: translateX(-50%);
}
.population__detail {
  margin: 24px 0 0;
  color: var(--cream);
  font: 900 var(--fs-kicker) "Roboto Condensed", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.population__detail::first-letter {
  text-transform: uppercase;
}
.population__note {
  margin-top: 12px;
}
/* Accueil : le lien vers le détail, heure par heure, dans le journal */
.population__more {
  display: inline-flex;
  margin-top: 14px;
}
/* Pas encore de relevés : seulement le titre et la phrase */
.population.is-empty :is(.population__periods, .population__facts, .population__chart, .pop-curve, .population__detail, .population__note) {
  display: none;
}
@media (max-width: 900px) {
  .population {
    padding: 22px 16px 18px;
  }
  .population__chart {
    gap: 2px;
  }
  .population__bar b {
    font-size: 0.8rem;
  }
  /* Sur un téléphone, les heures n'ont la place que pour une étiquette sur six */
  .is-hours .population__bar b {
    display: none;
  }
}

/* En bref (accueil) : les trois chiffres en lignes à gauche, la courbe à droite */
.population.is-compact {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.6fr);
  align-items: center;
  column-gap: 30px;
  padding: 22px 28px 18px;
}
.population.is-compact .population__head,
.population.is-compact .population__more {
  grid-column: 1 / -1;
}
.population.is-compact .population__facts {
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 14px 0 6px;
}
.population.is-compact .population__fact {
  padding: 8px 12px;
}
.population.is-compact .population__fact > svg {
  width: 30px;
  height: 30px;
  padding: 6px;
}
.population.is-compact .population__fact strong {
  font-size: 18px;
}
.population.is-compact .pop-curve {
  height: 140px;
  margin: 18px 0 8px;
}
.population.is-compact .population__more {
  margin-top: 6px;
}
@media (max-width: 900px) {
  .population.is-compact {
    grid-template-columns: 1fr;
  }
}
