/* Partie de styles.css : modèle de qualification (nowcast) : panneau, jetons, vue d'ensemble, historique.
   Chargée après les parties précédentes, dans l'ordre de scripts/app_sources.js
   (STYLESHEETS) : l'ordre de la cascade est celui de l'ancien fichier unique. */

.nowcast-panel,
.nowcast-score-panel {
  margin-top: 64px;
  padding: 30px 28px 32px;
  border: 2px solid var(--frame);
  border-radius: 2px;
  background: var(--panel);
}

.nowcast-score-panel {
  margin-top: 0;
}

/* `display` posé par une classe l'emporte sur l'attribut `hidden` de la
   feuille de style du navigateur : sans ces règles, masquer un conteneur du
   panneau le laisse visible et les deux modes s'empilent. */
.nowcast-panel[hidden],
.nowcast-scenarios-cta[hidden],
.nowcast-score-panel[hidden],
.nowcast-warning[hidden],
.nowcast-cards[hidden] {
  display: none;
}

.nowcast-interpretation {
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.55;
}

.nowcast-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.nowcast-head h2 {
  max-width: 720px;
  margin: 0 0 7px;
}
.nowcast-head p,
.nowcast-method-note p {
  color: var(--muted);
  line-height: 1.5;
}
.nowcast-scenario-button:focus-visible {
  border-color: var(--accent-ink);
  background: rgba(var(--accent-rgb), 0.045);
  outline: 2px solid rgba(var(--accent-rgb), 0.18);
  outline-offset: 1px;
}

.nowcast-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.nowcast-card-head strong {
  flex: none;
  color: var(--heading);
  font-size: 1.08rem;
}

.nowcast-candidate {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: var(--heading);
  font-size: 0.89rem;
  font-weight: 750;
}

.nowcast-candidate::before {
  width: 9px;
  height: 9px;
  margin-right: 8px;
  flex: none;
  border-radius: 2px;
  background: var(--candidate-color);
  content: "";
}

/* La liste et son évolution sont lues ensemble : les deux colonnes partagent
   titre, note et contenu. La distribution de scores reste ensuite dans son
   propre bloc, pour ne pas mélanger les deux unités. */
.nowcast-overview {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  grid-auto-flow: column;
  gap: 0 18px;
  margin-top: 26px;
  align-items: start;
}

.nowcast-overview[hidden] {
  display: none;
}

.nowcast-tokens {
  margin-top: 14px;
}

.nowcast-tokens[hidden],
.nowcast-timeline[hidden] {
  display: none;
}

.nowcast-timeline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  background: var(--panel);
}

.nowcast-timeline.is-open {
  position: sticky;
  top: 74px;
  z-index: 20;
}

.nowcast-timeline-player[hidden] {
  display: none;
}

.nowcast-timeline-player {
  display: flex;
  flex: 0 1 380px;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border-radius: 16px;
  background: rgba(var(--accent-rgb), 0.07);
  padding: 6px 16px 6px 6px;
}

.nowcast-timeline-play {
  flex: none;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.nowcast-timeline-track {
  flex: 0 1 280px;
  min-width: 0;
}

.nowcast-timeline .nowcast-candidate-toolbar {
  margin-left: auto;
}

#nowcastTokenTooltip {
  position: fixed;
  z-index: 30;
  max-width: 240px;
}

#nowcastTokenTooltip[hidden] {
  display: none;
}

.nowcast-timeline-date {
  min-height: 1.3em;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.nowcast-timeline input[type="range"] {
  display: block;
  width: 100%;
  height: 16px;
  margin: 0;
  background: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.nowcast-timeline input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--progress, 100%), var(--line) var(--progress, 100%));
}

.nowcast-timeline input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: var(--line);
}

.nowcast-timeline input[type="range"]::-moz-range-progress {
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.nowcast-timeline input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5.5px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.nowcast-timeline input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.nowcast-timeline .nowcast-candidate-toolbar {
  flex: none;
  margin-block: 0;
}

.nowcast-tokens .nowcast-overview-list {
  display: block;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  padding: 8px 0 0;
}

.nowcast-token-sides {
  display: grid;
  grid-template-columns: 190px 367px;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding-bottom: 4px;
}

.nowcast-token-sides span:first-child {
  grid-column: 2;
  grid-row: 1;
  width: 50%;
  padding-right: 10px;
  text-align: right;
}

.nowcast-token-sides span:last-child {
  grid-column: 2;
  grid-row: 1;
  margin-left: 50%;
  padding-left: 10px;
}

.nowcast-tokens .nowcast-overview-row,
.nowcast-tokens .nowcast-overview-row + .nowcast-overview-row {
  display: grid;
  grid-template-columns: 190px 367px;
  justify-content: center;
  align-items: center;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.nowcast-token-sides.is-second {
  display: none;
}

.nowcast-token-band {
  position: relative;
  height: 178px;
}

@media (min-width: 1180px) {
  .nowcast-tokens .nowcast-overview-list {
    display: grid;
    grid-template-columns: repeat(2, auto);
    justify-content: space-between;
  }

  .nowcast-token-sides.is-second {
    display: grid;
  }

  .nowcast-token-sides,
  .nowcast-tokens .nowcast-overview-row,
  .nowcast-tokens .nowcast-overview-row + .nowcast-overview-row {
    grid-template-columns: 178px 309px;
    justify-content: start;
  }

  .nowcast-token-band {
    height: 150px;
  }
}

.nowcast-token-who {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 5px 0;
}

.nowcast-token-who img,
.nowcast-token-initial {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--soft);
  object-fit: cover;
  object-position: top;
}

.nowcast-token-initial {
  display: grid;
  place-items: center;
  font-weight: 800;
}

.nowcast-token-who h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

.nowcast-token-who strong {
  display: block;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nowcast-token-who strong small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.nowcast-tokens .nowcast-token-who p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.nowcast-tokens .nowcast-token-who p:empty {
  display: none;
}

.nowcast-token-band::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(var(--ink-rgb), 0.45);
}

.nowcast-token-band svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: visible;
  transition: opacity 0.25s;
}

.nowcast-token-band.is-absent svg {
  opacity: 0;
}

.nowcast-token {
  transition: transform 0.26s ease;
}

.nowcast-token-face {
  fill: var(--token-inert);
  transition: fill 0.3s;
}

.nowcast-token.is-qualified .nowcast-token-face {
  fill: var(--candidate-color);
}

#nowcastPanel .nowcast-interpretation {
  border-top: 0;
}

@media (max-width: 640px) {
  .nowcast-timeline.is-open {
    top: 64px;
  }

  .nowcast-timeline {
    flex-wrap: wrap;
  }

  .nowcast-timeline-player {
    order: 3;
    flex: 1 1 100%;
  }

  .nowcast-timeline-track {
    flex: 1 1 0;
  }

  .nowcast-timeline-play {
    width: 34px;
    height: 34px;
  }

  .nowcast-timeline {
    gap: 6px;
  }

  .nowcast-timeline-date {
    font-size: 12px;
  }

  #nowcastQualificationCandidateSummary {
    padding: 6px 10px;
    font-size: 12px;
  }

  .nowcast-token-sides {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }

  .nowcast-token-sides span:first-child,
  .nowcast-token-sides span:last-child {
    grid-column: 1;
  }

  .nowcast-tokens .nowcast-overview-row,
  .nowcast-tokens .nowcast-overview-row + .nowcast-overview-row {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }

  .nowcast-tokens .nowcast-overview-row + .nowcast-overview-row {
    margin-top: 26px;
  }

  .nowcast-token-band {
    height: min(178px, calc((100vw - 58px) * 170 / 350));
  }
}

@media (prefers-reduced-motion: reduce) {
  .nowcast-token,
  .nowcast-token-face,
  .nowcast-token-band svg {
    transition: none;
  }
}

.nowcast-overview-column {
  display: contents;
}

.nowcast-overview-title {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 720;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nowcast-overview-intro {
  min-width: 0;
  margin-bottom: 10px;
}

.nowcast-overview-note {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.nowcast-history-chart-wrap,
.nowcast-overview-chart-wrap {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  padding: 6px 8px;
}

.nowcast-history-chart-wrap svg,
.nowcast-overview-chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
}

/* Les scores ont leur propre encadré : ils ne sont pas une autre vue de
   l'indice, et les violons peuvent donc prendre toute la largeur. */
.nowcast-score-ranges {
  margin: 0;
  padding: 0;
  border: 0;
}

.nowcast-score-ranges > div:first-child {
  margin-bottom: 12px;
}

/* La légende est tracée dans le SVG, sur une bande réservée en haut du
   graphique : hors de lui, elle décalait les deux colonnes l'une par rapport à
   l'autre pour deux lignes de texte. */
/* Zones de survol : elles couvrent toute la colonne (ou la rangée) du candidat,
   pas seulement sa forme, qui est trop étroite pour être visée au doigt. */
.nowcast-violin-hit {
  fill: transparent;
  cursor: pointer;
}

.nowcast-violin-hit:focus-visible {
  outline: 2px solid var(--stormy-teal);
  outline-offset: -2px;
}

.nowcast-overview-tooltip[hidden] {
  display: none;
}

.history-tooltip[hidden] {
  display: none;
}

.history-tooltip {
  width: max-content;
  max-width: min(250px, calc(100% - 16px));
}

.history-tooltip b {
  color: var(--heading);
}

.history-hover-rule {
  stroke: var(--heading);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.28;
  pointer-events: none;
}

.history-hover-marker {
  stroke: var(--halo);
  stroke-width: 2.5;
  pointer-events: none;
}

.history-hover-rule[hidden],
.history-hover-marker[hidden] {
  display: none;
}

.nowcast-history-raw-point[tabindex],
.nowcast-history-point[tabindex] {
  cursor: pointer;
}

.nowcast-history-raw-point[tabindex]:focus-visible,
.nowcast-history-point[tabindex]:focus-visible {
  outline: none;
  stroke: var(--heading);
  stroke-width: 2;
}

.nowcast-overview-tooltip strong {
  display: block;
  margin-bottom: 4px;
}

.nowcast-overview-tooltip dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 12px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.nowcast-overview-tooltip dd {
  margin: 0;
  color: var(--heading);
  font-weight: 700;
  text-align: right;
}

.nowcast-violin-legend-label {
  fill: var(--muted);
  font-size: 0.7rem;
}

.nowcast-violin-legend-swatch {
  fill: var(--heading);
  stroke: none;
}

.nowcast-violin-legend-swatch.nowcast-violin-band {
  fill-opacity: 0.9;
}

.nowcast-violin-legend-swatch.nowcast-violin-tail {
  fill-opacity: 0.16;
  stroke: none;
}

.nowcast-overview-list {
  display: grid;
  min-height: 259px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  padding: 4px;
}

.nowcast-overview-row {
  min-width: 0;
  padding: 7px 8px;
}

.nowcast-overview-row + .nowcast-overview-row {
  border-top: 1px solid var(--line);
}

.nowcast-overview-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

/* Le chiffre est déjà là, à droite du nom : cette ligne dit ce qu'il faut en
   penser. Elle reste dans l'encre courante pour ne pas suggérer une précision
   supplémentaire par sa couleur. */
.nowcast-outlook {
  display: block;
  margin: 3px 0 0;
  font-size: 0.74rem;
  color: var(--ink);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.005em;
}

.nowcast-outlook.is-strong {
  color: var(--ink);
}

.nowcast-outlook.is-uncertain {
  color: var(--ink);
}

.nowcast-outlook.is-weak {
  color: var(--ink);
}

.nowcast-outlook.is-marginal {
  color: var(--ink);
  font-weight: 400;
}

/* La probabilité affichée est une valeur unique : une jauge remplie depuis 0 %
   en est la lecture directe, aux deux formats. */
.nowcast-overview-gauge {
  display: block;
  height: 6px;
  margin: 7px 0 6px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--track);
}

.nowcast-overview-gauge span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

/* La distribution complète, effilée sur ses deux queues : c'est elle qui donne
   au violon sa silhouette. */
.nowcast-violin-tail {
  fill-opacity: 0.16;
  stroke-opacity: 0.5;
  stroke-width: 1;
  stroke-linejoin: round;
}

/* La fourchette à 80 % en plein, à l'intérieur. Toutes les formes partagent une
   seule échelle de densité, donc ces surfaces pleines sont égales entre elles. */
.nowcast-violin-band {
  fill-opacity: 0.9;
  stroke: none;
}

.nowcast-violin-cap {
  stroke: #ffffff;
  stroke-opacity: 0.55;
  stroke-width: 1;
}

/* La médiane du mélange : elle peut tomber dans un creux quand les hypothèses
   se contredisent, et c'est justement ce que la forme sert à montrer. */
.nowcast-violin-median {
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Les bornes chiffrées se posent hors de la partie pleine, sur l'aplat léger :
   une encre unique, sombre, y est lisible pour toutes les couleurs. */
.nowcast-range-bound {
  fill: var(--heading);
  font-size: 0.68rem;
  font-weight: 750;
}

.nowcast-range-name {
  fill: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.nowcast-history[hidden] {
  display: none;
}

.nowcast-grid-line {
  stroke: var(--grid-line-alt);
  stroke-width: 1;
}

.nowcast-axis-label,
.nowcast-single-notice {
  fill: var(--muted);
  font-family: inherit;
  font-size: 11px;
}

.nowcast-history-trend {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.nowcast-history-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.nowcast-history-point {
  stroke: var(--halo);
  stroke-width: 1.2;
}

.nowcast-history-raw-point {
  stroke: var(--halo);
  stroke-width: 1.2;
  opacity: 0.55;
}

.nowcast-history-raw-point.is-current {
  opacity: 1;
  stroke: var(--halo);
  stroke-width: 1.7;
}

.nowcast-history-legend-marker {
  fill: var(--heading);
}

.nowcast-history-legend-trend {
  stroke: var(--heading);
}

.nowcast-history-legend-label {
  fill: var(--muted);
  font-family: inherit;
  font-size: 10px;
}

.nowcast-history-end-label {
  font-weight: 720;
}

.nowcast-method-note {
  margin-top: 10px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.nowcast-method-note summary {
  color: var(--heading);
  cursor: pointer;
  font-weight: 700;
}

.nowcast-method-note p {
  max-width: 900px;
  margin: 10px 0 0;
}

.nowcast-method-note a {
  color: var(--accent-ink);
  font-weight: 700;
}

/* Onglets du bloc de qualification : Fixe, Animation, Évolution. */
.segmented.nowcast-view-tabs {
  flex: none;
  grid-template-columns: repeat(3, auto);
  min-height: 0;
  padding: 3px;
}

.segmented.nowcast-view-tabs[hidden] {
  display: none;
}

.segmented.nowcast-view-tabs button {
  min-height: 32px;
  padding: 0 14px;
  font-size: 0.82rem;
}

.nowcast-tokens .nowcast-overview-list[hidden],
.nowcast-evolution[hidden] {
  display: none;
}

.nowcast-evolution {
  padding-top: 10px;
}

.nowcast-evolution-wrap {
  border: 0;
  padding: 0;
}

.nowcast-evolution-wrap svg:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.35);
  outline-offset: 2px;
}

.nowcast-evolution-note {
  margin-top: 8px;
  max-width: none;
}

.nowcast-evolution-half {
  stroke-dasharray: 4 4;
}

.nowcast-evolution-tick {
  stroke: var(--line);
  stroke-width: 1;
}

.nowcast-evolution-unit {
  font-weight: 600;
}

.nowcast-evolution-label {
  font-size: 12px;
  font-weight: 700;
}

.is-narrow .nowcast-evolution-label {
  font-size: 11px;
}

.nowcast-evolution-label-value {
  fill: var(--ink);
  font-weight: 600;
}

.nowcast-evolution-tooltip {
  position: absolute;
  z-index: 5;
  display: grid;
  gap: 3px;
  min-width: 190px;
  pointer-events: none;
}

.nowcast-evolution-tooltip[hidden] {
  display: none;
}

.nowcast-evolution-tooltip .nowcast-evolution-row {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
}

.nowcast-evolution-tooltip .nowcast-evolution-row i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.nowcast-evolution-row b {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.nowcast-evolution-row small {
  font-weight: 500;
}

.nowcast-evolution-tooltip .nowcast-evolution-absent {
  color: var(--muted);
  font-size: 0.72rem;
}

@media (max-width: 640px) {
  .segmented.nowcast-view-tabs button {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
  }
}
