/*
 * Statistiques de PentathlonMag (components/stats_site_vue.php), site et appli.
 * Site (fond clair) par défaut ; .pmst-appli reprend les variables jour / nuit de mobile/components/mobile_header.php.
 * Aucune ombre, aucun dégradé : filets, chiffres tabulaires et couleur de la discipline (--pmst-d).
 */
.pmst {
    --pmst-texte: #111418;
    --pmst-doux: #5b616b;
    --pmst-filet: #e6e8eb;
    --pmst-piste: #eef0f3;
    --pmst-barre: #1d4ed8;
    --pmst-attenue: #9db4ec;
    --pmst-f: #0f2a4a;
    --pmst-m: #8fa9c8;
    --pmst-bulle: #111418;
    --pmst-sur-bulle: #fff;
    color: var(--pmst-texte);
    font-variant-numeric: tabular-nums;
}
.pmst.pmst-appli {
    --pmst-texte: var(--white);
    --pmst-doux: color-mix(in srgb, var(--white) 68%, transparent);
    --pmst-filet: var(--rule);
    --pmst-piste: var(--ink2);
    --pmst-barre: var(--blue);
    --pmst-attenue: color-mix(in srgb, var(--blue) 45%, var(--ink2));
    --pmst-f: var(--blue);
    --pmst-m: color-mix(in srgb, var(--white) 38%, var(--ink2));
    --pmst-bulle: var(--white);
    --pmst-sur-bulle: var(--ink);
}

.pmst-bloc { margin: 0 0 40px; }
.pmst-titre {
    margin: 0 0 4px;
    font-family: 'Barlow Condensed', 'Bebas Neue', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.2;
    text-transform: uppercase;
    color: var(--pmst-texte);
}
.pmst-note, .pmst-source, .pmst-vide { margin: 0 0 16px; font-size: .875rem; line-height: 1.45; color: var(--pmst-doux); }
.pmst-source { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--pmst-filet); }

/* ── Chiffres clés ── */
.pmst-totaux { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 0; border-top: 1px solid var(--pmst-filet); border-bottom: 1px solid var(--pmst-filet); }
.pmst-totaux > div { padding: 16px 16px 16px 0; }
.pmst-totaux > div + div { padding-left: 16px; border-left: 1px solid var(--pmst-filet); }
.pmst-totaux dt { order: 2; font-size: .875rem; font-weight: 600; color: var(--pmst-doux); }
.pmst-totaux dd { margin: 0 0 4px; font-family: 'Barlow Condensed', 'Bebas Neue', sans-serif; font-weight: 800; font-size: 2.75rem; line-height: 1; }
.pmst-totaux > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
@media (max-width: 640px) {
    .pmst-totaux { grid-template-columns: 1fr 1fr; }
    .pmst-totaux > div:nth-child(3) { padding-left: 0; border-left: 0; }
    .pmst-totaux > div:nth-child(n+3) { border-top: 1px solid var(--pmst-filet); }
    .pmst-totaux dd { font-size: 2.25rem; }
}

/* ── Contrôle segmenté ── */
.pmst-segments { display: flex; gap: 4px; margin: 0 0 16px; padding: 4px; border-radius: 12px; background: var(--pmst-piste); overflow-x: auto; scrollbar-width: none; }
.pmst-segments button {
    flex: 1 0 auto;
    min-height: 40px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--pmst-doux);
    font: inherit;
    font-size: .875rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .15s ease-out;
}
@media (max-width: 480px) {
    .pmst-segments { display: grid; grid-template-columns: 1fr 1fr; }
}
.pmst-segments button[aria-selected="true"] { background: var(--pmst-texte); color: var(--pmst-sur-bulle); }
.pmst-appli .pmst-segments button[aria-selected="true"] { background: var(--blue); color: var(--sur-blue); }
.pmst-segments button:active { transform: scale(.98); }
.pmst button:focus-visible, .pmst a:focus-visible, .pmst summary:focus-visible { outline: 2px solid var(--pmst-barre); outline-offset: 2px; }

/* ── Colonnes ── */
.pmst-graphe { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.pmst-axe { position: relative; height: 200px; min-width: 2.5em; font-size: .75rem; line-height: 1; color: var(--pmst-doux); text-align: right; }
.pmst-axe span { position: absolute; right: 0; transform: translateY(-50%); }
.pmst-axe span:nth-child(1) { top: 0; }
.pmst-axe span:nth-child(2) { top: 50%; }
.pmst-axe span:nth-child(3) { top: 100%; }
.pmst-colonnes {
    display: grid;
    grid-template-columns: repeat(var(--pmst-n), minmax(0, 1fr));
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
    background-image: linear-gradient(var(--pmst-filet), var(--pmst-filet)), linear-gradient(var(--pmst-filet), var(--pmst-filet)), linear-gradient(var(--pmst-filet), var(--pmst-filet));
    background-size: 100% 1px;
    background-position: 0 0, 0 100px, 0 200px;
    background-repeat: no-repeat;
}
.pmst-col {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: transform .15s ease-out;
}
.pmst-col:active { transform: scale(.98); }
.pmst-barre-zone { position: relative; display: flex; align-items: flex-end; height: 200px; }
.pmst-barre { position: relative; display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--pmst-barre); }
.pmst-attenue .pmst-barre { background: var(--pmst-attenue); }
.pmst-col:hover .pmst-barre, .pmst-actif .pmst-barre { filter: brightness(1.15); }
.pmst-val { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding-bottom: 4px; font-size: .75rem; font-weight: 700; white-space: nowrap; color: var(--pmst-texte); }
.pmst-lib { display: block; min-height: 44px; padding-top: 8px; margin: 0 -12px; font-size: .75rem; color: var(--pmst-doux); text-align: center; white-space: nowrap; }
/* Téléphone : une étiquette sur deux quand les colonnes sont nombreuses (la dernière toujours montrée). */
@media (max-width: 640px) {
    .pmst-dense .pmst-lib-sec { visibility: hidden; }
}
.pmst-bulle {
    position: absolute;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 16rem;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--pmst-bulle);
    color: var(--pmst-sur-bulle);
    font-size: .8125rem;
    line-height: 1.35;
    pointer-events: none;
}
.pmst-bulle[hidden] { display: none; }
.pmst-bulle-valeur { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.5rem; line-height: 1.1; }
.pmst-bulle-detail { opacity: .8; }

.pmst-tableau { margin-top: 8px; font-size: .875rem; }
.pmst-tableau summary { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.pmst-tableau table { width: 100%; border-collapse: collapse; }
.pmst-tableau th, .pmst-tableau td { padding: 8px; border-bottom: 1px solid var(--pmst-filet); text-align: right; }
.pmst-tableau th:first-child { text-align: left; }
.pmst-tableau thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pmst-doux); }

/* ── Barres horizontales ── */
.pmst-lignes { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; list-style: none; }
.pmst-lignes-serrees { gap: 12px; }
.pmst-ligne { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; padding-left: 12px; border-left: 4px solid var(--pmst-d, var(--pmst-barre)); }
.pmst-lignes-serrees .pmst-ligne { border-left: 0; padding-left: 0; }
.pmst-ligne-nom { font-weight: 600; font-size: 1rem; }
.pmst-ligne-nom a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.pmst-ligne-chiffre { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.375rem; line-height: 1; }
.pmst-ligne-chiffre small { margin-left: 2px; font-size: .875rem; font-weight: 600; color: var(--pmst-doux); }
.pmst-ligne-piste { grid-column: 1 / -1; position: relative; display: block; height: 8px; border-radius: 4px; background: var(--pmst-piste); overflow: hidden; }
.pmst-ligne-piste > span:first-child:last-child { display: block; height: 100%; border-radius: 4px; background: var(--pmst-d, var(--pmst-barre)); }
.pmst-ligne-legende { grid-column: 1 / -1; font-size: .8125rem; color: var(--pmst-doux); }

/* PentaScore : plage du dernier au 1er, trait au 10e. */
.pmst-ps-piste { height: 12px; }
.pmst-ps-plage { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--pmst-d); }
.pmst-ps-dix { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--pmst-texte); }

/* Femmes / hommes */
.pmst-legende-cles { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: .875rem; font-weight: 600; }
.pmst-cle { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.pmst-cle + .pmst-cle, .pmst-legende-cles .pmst-cle:nth-of-type(2) { margin-left: 12px; }
.pmst-sexe { display: grid; grid-template-columns: 1fr; gap: 4px; }
.pmst-sexe-piste { display: flex; gap: 2px; height: 12px; }
.pmst-sexe-piste span { display: block; height: 100%; }
.pmst-sexe-piste span:first-child { border-radius: 4px 0 0 4px; }
.pmst-sexe-piste span:last-child { border-radius: 0 4px 4px 0; }
.pmst-f { background: var(--pmst-f); }
.pmst-m { background: var(--pmst-m); }
.pmst-sexe-chiffres { display: flex; justify-content: space-between; gap: 8px; font-size: .8125rem; color: var(--pmst-doux); }
.pmst-sexe-chiffres b { color: var(--pmst-texte); }

@media (min-width: 900px) {
    .pmst-deux { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; }
}
@media (prefers-reduced-motion: reduce) {
    .pmst-col, .pmst-segments button { transition: none; }
    .pmst-col:active, .pmst-segments button:active { transform: none; }
}
@media (forced-colors: active) {
    .pmst-barre, .pmst-ligne-piste > span, .pmst-f, .pmst-m, .pmst-ps-plage { background: CanvasText; forced-color-adjust: none; }
}
