/* Vidéos des ouvrages Spartacus-IDH — même allure que les compléments
   numériques (webApps/052, 060) et le lecteur PDF. */

@font-face { font-family: "Manrope"; src: url(polices/manrope-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manrope"; src: url(polices/manrope-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url(polices/manrope-800.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
    --bordeaux: #973c3e;
    --bordeaux-fonce: #7a2f31;
    --rose: #fbeeee;
    --papier: #f7f3ec;
    --carte: #ffffff;
    --texte: #232323;
    --discret: #6b6560;
    --trait: #e3dcd1;
    --fond-doux: #f1ece3;
    --ombre: 0 1px 2px rgba(60, 40, 30, .06), 0 4px 16px rgba(60, 40, 30, .07);
    --rayon: 12px;
    color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0; min-height: 100vh; display: flex; flex-direction: column;
    background: var(--papier); color: var(--texte);
    font: 16px/1.45 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button { font: inherit; color: inherit; }
a { color: var(--bordeaux); }
:focus-visible { outline: 3px solid #f0b429; outline-offset: 2px; }

/* ---------- Bandeau ---------- */
.bandeau {
    position: sticky; top: 0; z-index: 20;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
    padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
    background: var(--bordeaux); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.bandeau-papier {
    justify-self: start; color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap;
    padding: 7px 12px; border: 1px solid rgba(255, 255, 255, .55); border-radius: 999px;
}
.bandeau-papier:hover { background: rgba(255, 255, 255, .12); }
.bandeau-titre { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.2; min-width: 0; }
.bandeau-livre { font-weight: 800; font-size: 18px; margin: 0; }
.bandeau-auteur { font-size: 13px; opacity: .85; }
.bandeau-compte { justify-self: end; font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px; background: rgba(255, 255, 255, .16); white-space: nowrap; }

/* ---------- Grille ---------- */
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 16px 32px; }
.videos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
/* Peu de vidéos : des cartes plus grandes. */
.videos2 { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); max-width: 900px; margin: 0 auto; }
.carte-video {
    display: flex; flex-direction: column; height: 100%; overflow: hidden; color: var(--texte); text-decoration: none;
    background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre);
}
.carte-video:hover { box-shadow: 0 0 0 2px var(--bordeaux), var(--ombre); }
/* Vignettes montrées entières, à leur format (pas toutes en 16/9) ; l'arrondi
   léger ne mord que dans le blanc des cadres arrondis (outils/coins-blancs). */
.vignette { position: relative; margin: 10px 10px 0; border-radius: 8px; overflow: hidden; transition: transform .25s; }
.vignette img { width: 100%; height: auto; display: block; }
/* Zoom de toute la vignette, arrondi compris : elle grandit dans la marge
   blanche de la carte, sans rogner le bord de l'image. */
.carte-video:hover .vignette { transform: scale(1.03); }
@media (prefers-reduced-motion: reduce) { .vignette { transition: none; } }
.lecture {
    position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
    display: grid; place-items: center; background: rgba(151, 60, 62, .92); box-shadow: 0 2px 12px rgba(0, 0, 0, .3);
}
.lecture svg { width: 24px; height: 24px; fill: #fff; margin-left: 3px; }
.carte-video:hover .lecture { background: var(--bordeaux-fonce); }
.legende { padding: 12px 14px 14px; font-size: 14px; color: var(--discret); }
.legende h4 { margin: 0 0 3px; font-size: 15px; font-weight: 800; color: var(--texte); line-height: 1.25; }
.legende .num { display: block; font-size: 12px; font-weight: 800; color: var(--bordeaux); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }

/* ---------- Visionneuse ---------- */
/* Un panneau sombre qui porte la vidéo et ses commandes, aussi grand que
   l'écran le permet en gardant le 16/9 (160 px : en-tête, pied et marges). */
dialog.visionneuse {
    border: 0; padding: 12px 14px 14px; border-radius: 16px;
    width: min(96vw, calc((100dvh - 160px) * 16 / 9 + 28px)); max-width: none; max-height: 98dvh;
    background: #1c1617; color: #fff; box-shadow: 0 16px 60px rgba(0, 0, 0, .6);
}
dialog.visionneuse::backdrop { background: rgba(20, 12, 10, .82); }
.visionneuse-tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.visionneuse-compte { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .6); padding-left: 4px; }
.cadre { position: relative; aspect-ratio: 16 / 9; width: 100%; background: #000; border-radius: 8px; overflow: hidden; }
.cadre iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.visionneuse-pied { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin-top: 12px; }
.visionneuse-legende { text-align: center; font-size: 15px; color: rgba(255, 255, 255, .8); }
.visionneuse-legende h4 { margin: 0 0 2px; font-size: 17px; color: #fff; }
.visionneuse-legende a { color: #fff; }
.rond {
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08);
    display: grid; place-items: center; cursor: pointer; color: #fff; padding: 0; flex: none;
}
.rond:hover:not(:disabled) { background: var(--bordeaux); border-color: var(--bordeaux); }
.rond:disabled { opacity: .3; cursor: default; }
.rond svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.fermer { width: 36px; height: 36px; }

/* ---------- Pied ---------- */
.pied { text-align: center; font-size: 13px; color: var(--discret); padding: 16px; border-top: 1px solid var(--trait); }

@media (max-width: 860px) {
    .bandeau { grid-template-columns: auto 1fr auto; }
    .bandeau-livre { font-size: 15px; }
    .bandeau-auteur { display: none; }
    .videos2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .bandeau-papier .libelle, .bandeau-compte { display: none; }
    .videos { grid-template-columns: 1fr; }
    dialog.visionneuse { width: 100vw; padding: 10px; border-radius: 0; }
}
