/*
 * LE DIAPORAMA DES PHOTOS D'UNE ÉQUIPE (lot 409, public/js/photos-diaporama.mjs).
 * Chargé par equipe.html et team.html. Tout est préfixé .dia- : rien ne touche le reste
 * de la page.
 */

.dia { display: grid; gap: 8px; min-width: 0; }
.dia-titre { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dia-titre small { color: var(--muted); font-weight: 600; font-size: 12px; }
.dia-tout { margin-left: auto; background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--cyan); cursor: pointer; }
.dia-tout:hover { color: var(--yellow); }

/* La scène : 16:9, les photos empilées, celle affichée en fondu. « contain » : une photo
   qui n'est pas en 16:9 se montre entière (l'overlay du bas ne doit jamais être coupé). */
.dia-scene { position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 10px; overflow: hidden; background: var(--surface2); }
.diap { position: absolute; inset: 0; padding: 0; border: 0; background: none; cursor: zoom-in; opacity: 0; transition: opacity .6s ease; pointer-events: none; }
.diap.on { opacity: 1; pointer-events: auto; }
.diap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dia-fl { position: absolute; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(13,10,20,.65);
  color: var(--text); font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; z-index: 1; }
.dia-fl.g { left: 8px; } .dia-fl.d { right: 8px; }
.dia-fl:hover { background: rgba(13,10,20,.85); }
/* Sur un écran à souris, les flèches n'apparaissent qu'au survol ; au doigt, toujours. */
@media (hover: hover) {
  .dia-scene .dia-fl, .dia-scene .dia-pause { opacity: 0; transition: opacity .2s; }
  .dia-scene:hover .dia-fl, .dia-scene:hover .dia-pause, .dia-scene :focus-visible { opacity: 1; }
  .dia.dia-arret .dia-pause { opacity: 1; }
}
.dia-cpt { position: absolute; top: 8px; right: 8px; z-index: 1; background: rgba(13,10,20,.65); color: var(--text); font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; pointer-events: none; }
.dia-pause { position: absolute; top: 6px; left: 8px; z-index: 1; border: 0; border-radius: 999px; background: rgba(13,10,20,.65); color: var(--text);
  font-size: 11px; width: 26px; height: 22px; cursor: pointer; }

/* La barre de 6 s : quand l'animation se termine, la page passe à la photo suivante
   (animationend). La mettre en pause suffit donc à arrêter le défilement. */
.dia-prog { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--accent); z-index: 1; pointer-events: none; }
.dia-prog.roule { animation: dia-prog 6s linear forwards; }
@keyframes dia-prog { from { width: 0; } to { width: 100%; } }
.dia:has(:focus-visible) .dia-prog,
.dia.dia-arret .dia-prog, .dia.dia-attente .dia-prog, .dia.dia-cache .dia-prog { animation-play-state: paused; }
/* Pause au survol, à la souris seulement : au doigt, :hover reste collé après un toucher. */
@media (hover: hover) { .dia-scene:hover .dia-prog { animation-play-state: paused; } }
@media (prefers-reduced-motion: reduce) {
  .dia-prog.roule { animation: none; }
  .diap { transition: none; }
}

/* La légende : d'où vient la photo. */
.dia-leg { display: grid; gap: 2px; min-height: 38px; min-width: 0; }
.dia-l1 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; min-width: 0; }
.dia-l1 b { color: var(--text); overflow-wrap: anywhere; }
.dia-l2 { font-size: 12px; color: var(--muted); }
.dia-comp { font-size: 10.5px; font-weight: 800; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.dia-comp.lg { color: #b9c7ff; background: rgba(120,140,255,.16); }
.dia-comp.tn { color: var(--cyan); background: rgba(18,224,224,.12); }
.dia-place { font-weight: 800; color: var(--text); }
.dia-place.r1 { color: var(--yellow); } .dia-place.r2 { color: #d9dbe8; } .dia-place.r3 { color: #e7a46a; }

/* Les vignettes, pour choisir ; « S20 » avant chaque saison (onglet Ligue). */
.dia-vign { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.dia-vign button { flex: 0 0 64px; aspect-ratio: 16 / 9; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden;
  background: var(--surface2); cursor: pointer; opacity: .55; transition: opacity .2s; }
.dia-vign button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dia-vign button.on { border-color: var(--accent); opacity: 1; }
.dia-vign button:hover { opacity: .9; }
.dia-sep { flex: 0 0 auto; align-self: center; font-size: 10px; font-weight: 800; color: var(--muted); letter-spacing: .04em; }

/* La vue en grand (une photo, ou la grille « Tout voir »). */
.dia-voile { position: fixed; inset: 0; z-index: 1000; background: rgba(5,4,10,.96); display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px)); overflow-y: auto; }
.dia-voile[hidden] { display: none; }
.dia-voile-bar { width: min(1280px, 100%); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--body); font-size: 13px; }
.dia-voile-bar > b { color: var(--text); }
.dia-voile-bar > span:last-child { display: flex; gap: 8px; flex-wrap: wrap; }
.dia-bt { border: 1px solid var(--panel-border, rgba(255,255,255,.1)); background: rgba(255,255,255,.06); color: var(--text); border-radius: 8px; padding: 6px 12px;
  font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.dia-bt:hover { background: rgba(255,255,255,.12); color: var(--text); }
.dia-voile-img { position: relative; width: min(1280px, 100%); flex: 1; min-height: 0; display: grid; place-items: center; }
.dia-voile-img img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; border-radius: 10px; }
.dia-album { width: min(1280px, 100%); display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.dia-album figure { margin: 0; display: grid; gap: 6px; min-width: 0; align-content: start; }
.dia-album figure button { display: block; width: 100%; line-height: 0; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--surface2); cursor: zoom-in; }
.dia-album figure img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.dia-album figcaption { font-size: 12.5px; color: var(--body); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dia-album figcaption b { color: var(--text); }
.dia-album figcaption small { color: var(--muted); }
.dia-album-s { grid-column: 1 / -1; margin: 6px 0 0; font-size: 14px; color: var(--text); }
