/* Ajustements d'alignement et d'interaction de la page Statistiques. */
.stats-page { padding-top: 0; }
.stats-intro.platform-hero.category-hero { padding-bottom: 24px; }
.stats-intro .title-line { position: relative; z-index: 1; }
.stats-intro > p:last-child { max-width: none; }
.stats-section > .section-heading {
  display: block;
  grid-template-columns: none;
}
.dashboard-grid { align-items: stretch; }
#makers-chart .bar-list { gap: 8px; }
.chart-mark, .bar-fill { transition-duration: .42s; }
.chart-host.has-focus .chart-mark:not(.is-active) { opacity: .28; }
#platform-breakdown-chart.has-focus .chart-mark.is-same-group:not(.is-active) { opacity: .7; }

/* Tuile "Répartition par écosystèmes et plateformes" : le chevron de
   défilement se pose au-dessus du graphique (haut droit) au lieu de
   prendre sa propre colonne, pour que le graphique utilise toute la
   largeur disponible de la tuile. */
#platform-breakdown-chart .platform-breakdown-layout {
  grid-template-columns: 32px minmax(0, 1fr);
}
#platform-breakdown-chart .timeline-axis {
  width: 32px;
  min-width: 32px;
}
#platform-breakdown-chart .timeline-chevron {
  top: 8px;
  transform: none;
}
#platform-breakdown-chart .timeline-chevron:hover,
#platform-breakdown-chart .timeline-chevron:focus-visible {
  transform: translateX(3px);
}
.chart-legend--geography {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  justify-content: center;
  column-gap: 24px;
  row-gap: 8px;
}
.chart-legend--geography .legend-row {
  grid-template-columns: 10px auto auto;
  justify-content: start;
  gap: 9px 5px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  white-space: nowrap;
}
.chart-legend--geography .legend-row strong {
  grid-column: auto;
  justify-self: start;
}
.chart-legend--status {
  grid-template-columns: repeat(3, max-content);
  justify-content: center;
  gap: 8px 12px;
}
.chart-legend--status .legend-row {
  grid-template-columns: 10px auto auto;
  justify-content: center;
  gap: 9px 5px;
  font-size: 13px;
  white-space: nowrap;
}
.chart-legend--status .legend-row strong {
  grid-column: auto;
  justify-self: start;
  font-size: 15px;
}
.chart-scroll { overflow: hidden; }
.timeline-layout {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  height: 360px;
}
.timeline-balance {
  width: 48px;
  background: var(--card);
}
.chart-host .timeline-axis {
  position: relative;
  z-index: 2;
  width: 48px;
  min-width: 48px;
  height: 360px;
  background: var(--card);
}
.timeline-viewport {
  height: 360px;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: grab;
  scrollbar-width: none;
  touch-action: pan-x;
}
.timeline-viewport::-webkit-scrollbar {
  display: none;
}
.timeline-viewport.is-dragging {
  cursor: grabbing;
  user-select: none;
}
.timeline-viewport svg {
  width: auto;
  height: 360px;
  min-width: 100%;
}
.timeline-chevron {
  position: absolute;
  z-index: 4;
  right: 10px;
  top: 37%;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 8px 22px rgba(30, 20, 20, .22);
  transform: translateY(-50%);
  transition: opacity .45s ease, transform .45s ease;
}
.timeline-chevron:hover, .timeline-chevron:focus-visible {
  transform: translateY(-50%) translateX(3px);
}
.timeline-chevron.is-hidden {
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) translateX(8px);
}
.timeline-chevron-icon {
  fill: #a14142;
}
:root[data-theme="dark"] .timeline-chevron-icon {
  fill: #ffffff;
}
@media (min-width: 1100px) {
  .stats-intro > p:last-child { white-space: nowrap; }
}
@media (max-width: 1050px) {
  .dashboard-grid { align-items: start; }
}
@media (max-width: 680px) {
  .stats-page { padding-top: 0; }
  .stats-intro.platform-hero.category-hero { padding-bottom: 24px; }
  .chart-legend--geography {
    grid-template-columns: repeat(2, max-content);
    justify-content: center;
    gap: 10px 22px;
  }
  .chart-legend--geography .legend-row {
    grid-template-columns: 8px auto auto;
    gap: 4px;
    font-size: 11px;
  }
  .chart-legend--geography .legend-row strong {
    font-size: 12px;
  }
  .chart-legend--status .legend-row {
    grid-template-columns: 8px auto auto;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
  }
  .chart-legend--status .legend-row strong {
    grid-column: auto;
    font-size: 12px;
  }
  .chart-legend--status {
    grid-template-columns: repeat(2, max-content);
    justify-content: center;
    gap: 10px 22px;
  }
  .chart-legend--status .legend-row:first-child {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

/* Tuile "Objets" regroupée (3 compteurs côte à côte, sans encadrés individuels). */
.counter-grid--inline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.counter-grid--inline .counter {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
  overflow: visible;
}
.counter-grid--inline .counter::after { content: none; }
.counter-grid--inline .counter strong {
  font-size: clamp(26px, 3.4vw, 38px);
}
.counter-grid--inline .counter span {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.counter-grid--inline .counter:nth-child(2) {
  text-align: center;
}
.counter-grid--inline .counter:nth-child(3) {
  justify-self: end;
}
@media (max-width: 560px) {
  .counter-grid--inline { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .counter-grid--inline .counter strong { font-size: clamp(19px, 6vw, 28px); }
}

/* Tuile "Objets" : centrer verticalement les compteurs dans la hauteur
   disponible de la tuile (qui peut être plus haute que son contenu, les
   tuiles voisines ayant davantage de matière). */
.chart-card--counters {
  display: flex;
  flex-direction: column;
}
.chart-card--counters .counter-grid--inline {
  margin-top: 20px;
  margin-bottom: auto;
}

/* Titre de section conservé pour l'accessibilité (lecteurs d'écran), mais
   retiré visuellement à la demande. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Légende "Répartition par écosystèmes" : texte à la suite (nom puis
   valeur, sans étirement), couleur du nom alignée sur les libellés de la
   tuile Complétion. */
#makers-donut-chart .legend-row {
  grid-template-columns: 10px auto auto;
  justify-content: start;
  gap: 6px;
}
#makers-donut-chart .legend-row span {
  color: var(--muted);
}

/* Tuiles "Jeux/Consoles par génération" : même présentation (axe gradué,
   coins arrondis) que les autres graphiques en barres, sans défilement
   horizontal (peu de barres, tiennent toujours dans la largeur). */
.generation-layout {
  grid-template-columns: 32px minmax(0, 1fr);
  height: auto;
}
.generation-layout .timeline-axis {
  width: 32px;
  min-width: 32px;
  height: 360px;
}
.generation-viewport {
  width: 100%;
  overflow: hidden;
}
.generation-viewport svg {
  display: block;
  width: 100%;
  height: 360px;
}

/* Écart de 8px entre le titre/période et les données dans les info-bulles
   des tuiles par génération. */
.chart-tooltip .tooltip-gap {
  height: 8px;
}

/* Chevron de défilement (mode mobile/étroit) pour les tuiles par génération,
   même position que sur la tuile Répartition par écosystèmes et plateformes. */
.generation-layout .timeline-chevron {
  top: 8px;
  transform: none;
}

/* Point de couleur par plateforme dans les info-bulles des tuiles par
   génération, pour identifier le constructeur en un coup d'œil. */
.chart-tooltip .tooltip-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: middle;
}

/* Micro-animations à l'entrée dans le viewport (une seule fois, jamais au
   scroll vers le haut / à la disparition). */

/* Barres horizontales (Top écosystèmes) : s'étirent depuis la gauche. */
.chart-card:not(.is-animated-in) .bar-fill {
  transform: scaleX(0);
  transform-origin: left;
}
.chart-card.is-growing .bar-fill {
  transform: scaleX(1);
  transform-origin: left;
  transition: transform 0.8s cubic-bezier(.2, .8, .2, 1);
}

/* Barres segmentées horizontales (Complétion, Statut d'avancement). */
.chart-card:not(.is-animated-in) .format-segment {
  transform: scaleX(0);
  transform-origin: left;
}
.chart-card.is-growing .format-segment {
  transform: scaleX(1);
  transform-origin: left;
  transition: transform 0.8s cubic-bezier(.2, .8, .2, 1);
}

/* Barres verticales SVG (Chronologie, générations, écosystèmes et
   plateformes) : croissent depuis le bas. */
.chart-card:not(.is-animated-in) .timeline-viewport path[fill],
.chart-card:not(.is-animated-in) .generation-viewport path[fill] {
  transform-box: fill-box;
  transform-origin: center bottom;
  transform: scaleY(0);
}
.chart-card.is-growing .timeline-viewport path[fill],
.chart-card.is-growing .generation-viewport path[fill] {
  transform-box: fill-box;
  transform-origin: center bottom;
  transform: scaleY(1);
  transition: transform 0.7s cubic-bezier(.2, .8, .2, 1);
}

/* Anneaux (donuts) : balayage progressif à l'entrée, un segment après
   l'autre (délai échelonné défini en ligne sur chaque segment). */
.donut-ring {
  transition: stroke-dasharray 0.9s cubic-bezier(.2, .8, .2, 1), opacity 0.32s ease-out, filter 0.32s ease-out;
}
