/* Pages candidats (candidats/*.html, candidats.html) et bloc « Sondages par
   candidat » de l'accueil. Chargé après styles.css et theme-da.css : mêmes
   panneaux arrondis, mêmes titres verts, mêmes pastilles de couleur. */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.candidate-page .site-footer a {
  color: var(--da-accent);
  font-weight: 600;
}

/* --- En-tête de page -------------------------------------------------------- */

.candidate-hero {
  max-width: 780px;
  margin-bottom: 26px;
}

/* Même titre que les sections de l'accueil (h2 de styles.css et theme-da.css). */
.candidate-hero h2 {
  margin: 0;
}

.candidate-lede {
  margin: 14px 0 0;
  color: #3f5c59;
  font-size: 1.08rem;
  line-height: 1.55;
}

.candidate-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

/* --- Chiffres clés ---------------------------------------------------------- */

.candidate-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 560px;
  gap: 14px;
  margin-bottom: 26px;
}

.candidate-stat {
  padding: 16px 18px 15px;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(46, 107, 98, 0.12);
}

.candidate-stat p {
  margin: 0;
}

.candidate-stat-label {
  color: #3f5c59;
  font-size: 0.8rem;
  font-weight: 600;
}

.candidate-stat-value {
  margin-top: 4px !important;
  color: var(--da-accent);
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.candidate-stat-value span {
  font-size: 1rem;
  font-weight: 600;
}

.candidate-stat-detail {
  margin-top: 3px !important;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

/* --- Panneaux --------------------------------------------------------------- */

.candidate-panel {
  margin-bottom: 26px;
  padding: 26px 28px 24px;
  border: 1px solid rgba(46, 107, 98, 0.10);
  border-radius: var(--da-radius);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(40, 61, 59, 0.05), 0 10px 28px rgba(40, 61, 59, 0.07);
}

.candidate-panel-head {
  max-width: 76ch;
  margin-bottom: 18px;
}

.candidate-panel h3,
.candidate-faq h3,
.candidate-others h3 {
  margin: 0;
  color: var(--da-accent);
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.candidate-panel-head p {
  margin: 8px 0 0;
  color: #3f5c59;
  font-size: 0.95rem;
  line-height: 1.55;
}

.candidate-panel h4 {
  margin: 0 0 8px;
  color: var(--da-accent);
  font-size: 1.02rem;
  font-weight: 800;
}

.candidate-panel-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  color: var(--da-accent);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.candidate-panel-link:hover {
  text-decoration: underline;
}

/* --- Graphiques ------------------------------------------------------------- */

/* styles.css donne à tout svg la hauteur du grand graphique de l'accueil
   (min-height 500 px) : ces petits graphiques suivent leur viewBox. Sans
   cela, la hauteur imposée élargissait la page mobile au-delà de l'écran. */
.candidate-chart svg,
.candidate-qualification-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
}

.candidate-chart .is-compact {
  display: none;
}

.cc-grid {
  stroke: rgba(46, 107, 98, 0.14);
  stroke-width: 1;
}

.cc-axis {
  fill: var(--muted);
  font-size: 13px;
}

.is-compact .cc-axis {
  font-size: 11px;
}

.cc-context {
  fill: none;
  stroke: rgba(40, 61, 59, 0.16);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cc-trend {
  fill: none;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cc-trend.is-thin {
  stroke-width: 2.4;
}

.cc-end {
  stroke: var(--panel);
  stroke-width: 2.5;
}

.cc-end-label {
  font-size: 15px;
  font-weight: 800;
}

.is-compact .cc-end-label {
  font-size: 12px;
}

/* --- Accès au second tour --------------------------------------------------- */

.candidate-qualification-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 24px;
  align-items: start;
}

.candidate-qualification-figure,
.candidate-qualification-history {
  padding: 14px 16px;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(46, 107, 98, 0.12);
}

.candidate-qualification-figure .nowcast-card-head strong {
  font-size: 1.5rem;
}

.candidate-qualification-score,
.candidate-qualification-caveat {
  margin: 12px 0 0;
  color: #3f5c59;
  font-size: 0.88rem;
  line-height: 1.5;
}

.candidate-qualification-caveat {
  color: var(--muted);
  font-size: 0.8rem;
}

.candidate-qualification-caveat a {
  color: var(--da-accent);
  font-weight: 600;
}

/* --- Duels ------------------------------------------------------------------ */

.candidate-duels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.candidate-duel {
  padding: 14px 16px 12px;
  border-radius: 18px;
  background: rgba(46, 107, 98, 0.06);
}

.candidate-duel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.candidate-duel-head h4 {
  margin: 0;
  color: var(--da-green);
  font-size: 0.95rem;
  font-weight: 600;
}

.candidate-duel-head h4 a {
  color: inherit;
  text-decoration: none;
}

.candidate-duel-head h4 a:hover {
  text-decoration: underline;
}

.candidate-duel-verdict {
  flex: none;
  color: var(--muted);
  font-size: 0.76rem;
}

.candidate-duel.is-win .candidate-duel-verdict {
  color: var(--da-accent);
  font-weight: 600;
}

.candidate-duel-bar {
  position: relative;
  display: flex;
  height: 10px;
  margin: 10px 0 6px;
  overflow: hidden;
  border-radius: 99px;
  gap: 2px;
}

/* Repère des 50 % : la lecture d'un duel est d'abord « au-dessus ou non ». */
.candidate-duel-bar::after {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 50%;
  width: 2px;
  background: var(--panel);
  content: "";
}

.candidate-duel-bar span {
  display: block;
  height: 100%;
}

.candidate-duel-scores {
  display: flex;
  justify-content: space-between;
  color: var(--da-green);
  font-size: 0.9rem;
}

.candidate-duel-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

/* --- Tableau des sondages --------------------------------------------------- */

/* position: relative retient les libellés masqués (.visually-hidden, en
   position absolue) dans le cadre défilant : sinon ils élargissaient toute la
   page sur mobile, au-delà de la largeur du tableau. */
.candidate-polls-wrap {
  position: relative;
  overflow-x: auto;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(46, 107, 98, 0.12);
}

.candidate-polls {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.candidate-polls th,
.candidate-polls td {
  padding: 10px 16px;
  text-align: left;
  white-space: nowrap;
}

.candidate-polls thead th {
  color: #3f5c59;
  font-size: 0.78rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(46, 107, 98, 0.14);
}

.candidate-polls tbody tr + tr td {
  border-top: 1px solid rgba(46, 107, 98, 0.08);
}

.candidate-polls .is-score,
.candidate-polls .is-count {
  text-align: right;
}

.candidate-polls td.is-score {
  color: var(--da-green);
  font-weight: 700;
}

.candidate-polls td.is-count {
  color: var(--muted);
}

.candidate-polls .is-link {
  text-align: right;
}

.candidate-polls a {
  color: var(--da-accent);
  font-weight: 600;
  text-decoration: none;
}

.candidate-polls a:hover {
  text-decoration: underline;
}

.candidate-polls .candidate-poll-notice {
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
}

/* --- Questions et liens ----------------------------------------------------- */

.candidate-faq {
  max-width: 780px;
  margin: 40px 0 10px;
}

.candidate-faq-item {
  padding: 18px 0 4px;
}

.candidate-faq-item + .candidate-faq-item {
  border-top: 1px solid rgba(46, 107, 98, 0.12);
}

.candidate-faq-item h4 {
  margin: 0 0 8px;
  color: var(--da-green);
  font-size: 1.02rem;
  font-weight: 700;
}

.candidate-faq-item p {
  margin: 0;
  color: #3f504d;
  line-height: 1.65;
}

.candidate-others {
  margin-top: 34px;
}

.candidate-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.candidate-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 15px 0 13px;
  border-radius: 999px;
  background: var(--da-pill-bg);
  color: var(--da-green);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
}

.candidate-link::before {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--candidate-color);
  content: "";
}

.candidate-link:hover {
  background: var(--da-pill-bg-hover);
}

/* --- Index des candidats ---------------------------------------------------- */

.candidate-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.candidate-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  height: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(46, 107, 98, 0.12), 0 6px 18px rgba(40, 61, 59, 0.05);
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.15s ease;
}

.candidate-card:hover {
  box-shadow: inset 0 0 0 2px var(--da-accent), 0 8px 22px rgba(40, 61, 59, 0.10);
}

.candidate-card .nowcast-candidate {
  font-size: 1rem;
}

.candidate-card-party,
.candidate-card-detail {
  color: var(--muted);
  font-size: 0.78rem;
}

.candidate-card-score {
  margin-top: 8px;
  color: var(--da-accent);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.candidate-card-score small {
  color: #3f5c59;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0;
}

/* --- Bloc de l'accueil ------------------------------------------------------ */

.candidate-links-panel {
  margin-top: 26px;
  padding: 26px 28px 24px;
  border: 1px solid rgba(46, 107, 98, 0.10);
  border-radius: var(--da-radius);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(40, 61, 59, 0.05), 0 10px 28px rgba(40, 61, 59, 0.07);
}

.candidate-links-head p {
  max-width: 70ch;
  margin: 8px 0 0;
  color: #3f5c59;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* --- Duels ------------------------------------------------------------------ */

.cc-threshold {
  stroke: var(--da-accent);
  stroke-width: 1.6;
  stroke-dasharray: 5 5;
  opacity: 0.6;
}

.cc-axis.is-threshold {
  fill: var(--da-accent);
  font-weight: 600;
}

.duel-score {
  max-width: 640px;
  margin-bottom: 20px;
}

.duel-score-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.duel-score-row.is-values strong {
  color: var(--da-green);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.candidate-duel-bar.is-large {
  height: 14px;
  margin: 10px 0 8px;
}

.candidate-duel-link {
  color: var(--da-accent);
  font-weight: 600;
  text-decoration: none;
}

.candidate-duel-link:hover {
  text-decoration: underline;
}

.candidate-link.is-duel {
  padding: 0 15px;
}

.candidate-link.is-duel::before {
  display: none;
}

.candidate-links-subtitle,
.candidate-others-next {
  margin: 22px 0 0 !important;
  color: var(--da-accent);
  font-size: 1.02rem !important;
  font-weight: 800;
}

.candidate-hub-duels {
  margin-top: 40px;
}

.candidate-hub-duels h2 {
  margin: 0 0 16px;
}

.duel-card-names {
  color: var(--da-green);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.duel-card-names span {
  color: var(--muted);
  font-weight: 400;
}

/* --- Mobile ----------------------------------------------------------------- */

@media (max-width: 860px) {
  .candidate-qualification-body {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

@media (max-width: 640px) {
  .candidate-panel,
  .candidate-links-panel {
    padding: 20px 16px 18px;
  }

  .candidate-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .candidate-stat {
    padding: 12px 14px;
  }

  .candidate-stat-value {
    font-size: 1.45rem;
  }

  .candidate-chart .is-wide {
    display: none;
  }

  .candidate-chart .is-compact {
    display: block;
  }

  .candidate-polls th,
  .candidate-polls td {
    padding: 9px 10px;
  }
}
