/* Styles pour les graphiques dynamiques de l'article "L'Afrique peut-elle gagner
   la Coupe du monde ?" — palette catégorielle validée CVD-safe, marques fines,
   légende + tooltip + vue tableau (voir docs/js/charts-afrique-cdm.js). */

/* Le corps d'article est un enfant de grille (.lgc-article-body-wrap,
   grid-template-columns: 200px 1fr) : sans min-width:0 explicite, un SVG
   width:100% contribue sa taille intrinsèque (viewBox) au calcul de la
   largeur minimale automatique de la piste et fait déborder toute la grille. */
.lgc-article-body {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.menara-chart-mount {
  min-width: 0;
  max-width: 100%;
}

.menara-chart-wrap {
  margin: 2.75rem 0;
  min-width: 0;
  max-width: 100%;
}

.menara-chart {
  margin: 0;
  padding: 1.5rem 1.5rem 1.25rem;
  background: #fcfcfb;
  border: 1px solid #e5e2d9;
  border-radius: 10px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.menara-chart-head { margin-bottom: 1rem; }

.menara-chart-eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9a916f;
  margin: 0 0 0.4rem;
}

.menara-chart-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #06122e;
  margin: 0 0 0.35rem;
  line-height: 1.3;
}

.menara-chart-sub {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  color: #6b7280;
  margin: 0;
  font-style: italic;
}

.menara-chart-svg-host {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  /* overflow non-visible fait que ce conteneur contribue sa taille spécifiée
     (et non celle, intrinsèque, du SVG en width:100%) au calcul de la taille
     minimale de la grille parente (.lgc-article-body-wrap) — sans quoi le
     SVG force un débordement horizontal de toute la page en mobile. */
  overflow: hidden;
}

.menara-chart-svg-host--scroll {
  overflow-x: auto;
  padding-bottom: 2px;
  min-width: 0;
  max-width: 100%;
}

.menara-chart-svg-host svg {
  width: 100%;
  height: auto;
  display: block;
  font-family: 'Inter', sans-serif;
  overflow: visible;
}

.menara-chart-svg-host--scroll svg {
  width: auto;
  max-width: none;
}

/* ── Grille / axes ── */
.menara-chart-grid { stroke: #e1e0d9; stroke-width: 1; }
.menara-chart-axis-line { stroke: #c3c2b7; stroke-width: 1; }
.menara-chart-axis-label { fill: #898781; font-size: 10px; }
.menara-chart-band { fill: #f1efe6; }
.menara-chart-band-label { fill: #9a916f; font-size: 9px; font-style: italic; }
.menara-chart-group-label { fill: #52514e; font-size: 11px; font-weight: 600; }

/* ── Lignes (graphique Elo) ── */
.menara-chart-line {
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: opacity 0.15s ease;
}
.menara-chart-line--ref {
  stroke: #898781;
  stroke-dasharray: 4 3;
  stroke-width: 1.5;
}
.menara-chart-series { transition: opacity 0.15s ease; }
.menara-chart-series.is-dimmed { opacity: 0.14; }
.menara-chart-line.is-dimmed { opacity: 0.14; }
.menara-chart-dot { pointer-events: none; }
.menara-chart-series-label {
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}
.menara-chart-hover-dot { pointer-events: none; }
.menara-chart-crosshair { stroke: #c3c2b7; stroke-width: 1; pointer-events: none; }
.menara-chart-hitlayer { cursor: crosshair; }

/* ── Barres (graphique binationaux) ── */
.menara-bar { transition: opacity 0.12s ease, filter 0.12s ease; cursor: pointer; }
.menara-bar--highlight { fill: #1741b8; }
.menara-bar--muted { fill: #9aa0a6; }
.menara-bar.is-hovered { filter: brightness(1.12); }
.menara-bar-value {
  fill: #52514e;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.menara-bar-name {
  fill: #6b7280;
  font-size: 10px;
  pointer-events: none;
}

/* ── Légende ── */
.menara-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid #eceae2;
}
.menara-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.76rem;
  color: #52514e;
  background: none;
  border: none;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.menara-chart-legend-item:hover { background: #f1efe6; }
.menara-chart-legend-item.is-active { background: #eef2fb; color: #1741b8; font-weight: 600; }
.menara-chart-legend-item--static { cursor: default; }
.menara-chart-legend-item--static:hover { background: none; }
.menara-chart-legend-swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}
.menara-chart-legend-swatch--ref {
  background: none;
  border-top: 2px dashed #898781;
  height: 0;
}
.menara-chart-legend-swatch--rect-highlight {
  width: 12px; height: 12px; border-radius: 3px; background: #1741b8;
}
.menara-chart-legend-swatch--rect-muted {
  width: 12px; height: 12px; border-radius: 3px; background: #9aa0a6;
}

/* ── Tooltip ── */
.menara-chart-tooltip {
  position: absolute;
  z-index: 20;
  min-width: 150px;
  max-width: 220px;
  background: #06122e;
  color: #fff;
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.76rem;
  line-height: 1.5;
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(0,0,0,0.22);
}
.menara-tt-title {
  font-weight: 700;
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
  color: #fff;
}
.menara-tt-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.menara-tt-key {
  width: 10px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}
.menara-tt-name { flex: 1; color: #cbd3e6; overflow: hidden; text-overflow: ellipsis; }
.menara-tt-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.menara-tt-flag {
  margin-top: 0.15rem;
  color: #9fc0ff;
  font-size: 0.68rem;
  white-space: normal;
}

/* ── Table de données (accessibilité) ── */
.menara-chart-table-toggle {
  margin-top: 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
}
.menara-chart-table-toggle summary {
  cursor: pointer;
  color: #1741b8;
  font-weight: 600;
}
.menara-chart-table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
}
.menara-chart-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.74rem;
}
.menara-chart-table th,
.menara-chart-table td {
  border: 1px solid #e5e2d9;
  padding: 0.35rem 0.55rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.menara-chart-table th:first-child,
.menara-chart-table td:first-child {
  text-align: left;
  font-variant-numeric: normal;
}
.menara-chart-table thead th {
  background: #f8f7f2;
  color: #52514e;
  font-weight: 700;
}

/* ── Légende / caption ── */
.menara-chart-caption {
  margin-top: 0.9rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  line-height: 1.55;
  color: #9a9689;
  font-style: italic;
}

@media (max-width: 640px) {
  .menara-chart { padding: 1.1rem 1rem 1rem; }
  .menara-chart-title { font-size: 1.02rem; }
  .menara-chart-legend { gap: 0.3rem 0.7rem; }
}
