/**
 * Simple Pop-Up — styles
 * Auteur : Serge Billon <serge@web54.fr> — https://www.web54.fr
 * Copyright : Serge Billon — web54.fr (C) 2026. Tous droits réservés.
 * Licence : GNU/GPL
 */

html.spu-lock { overflow: hidden; }

/* Le <dialog> occupe tout l'écran et sert de voile */
dialog.spu-dialog {
	position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
	margin: 0; padding: 16px; border: 0; box-sizing: border-box;
	background: var(--spu-overlay, rgba(102, 102, 102, .3)); color: inherit;
	overflow: auto;
}
dialog.spu-dialog[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; }
dialog.spu-dialog::backdrop { background: transparent; }

/* Boîte */
.spu-dialog .spu-box {
	position: relative; box-sizing: border-box; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px);
	display: flex; flex-direction: column;
	background: #fff; color: #333; padding: 10px; border-radius: 6px;
	box-shadow: 0 6px 30px rgba(0, 0, 0, .35);
	text-align: left;
}
.spu-dialog .spu-body { flex: 1 1 auto; min-height: 0; max-height: 100%; }
.spu-dialog .spu-body > :first-child { margin-top: 0; }
.spu-dialog .spu-body > :last-child { margin-bottom: 0; }
.spu-dialog .spu-body img { max-width: 100%; height: auto; }

/* Style historique du contenu (spustyle.css) */
.spu_content {
	margin: 5px; padding: 0 5px 5px;
	border: 1px solid #d2d2d2; box-shadow: 0 0 10px #ccc;
	background: linear-gradient(to bottom, #fff, #eee 1px, #fff 5px);
}

/* Bouton de fermeture (style FancyBox) */
.spu-dialog .spu-close {
	position: absolute; top: -15px; right: -15px; z-index: 2;
	width: 30px; height: 30px; padding: 0; border: 2px solid #fff; border-radius: 50%;
	background: #222; color: #fff; font: bold 20px/24px Arial, sans-serif; text-align: center; cursor: pointer;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}
.spu-dialog .spu-close:hover, .spu-dialog .spu-close:focus-visible { background: #000; }

/* Titre */
.spu-dialog .spu-title { font-weight: bold; font-size: 14px; line-height: 1.4; }
.spu-title-inside .spu-title { padding: 8px 2px 0; text-align: center; }
.spu-title-outside .spu-title { position: absolute; left: 0; right: 0; top: 100%; padding: 8px; color: #fff; text-align: center; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.spu-title-over .spu-title { position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 6px 10px; background: rgba(0, 0, 0, .6); color: #fff; }

/* Style LightBox : barre de titre avec « FERMER » et compteur */
.spu-style-lightbox .spu-box { border-radius: 0; }
.spu-lightbox-bar { display: block; padding: 8px 2px 0 !important; text-align: left !important; font-weight: normal !important; color: #666; overflow: hidden; }
.spu-lightbox-bar .spu-title-text { display: block; margin-right: 90px; color: #333; }
.spu-close-label { float: right; border: 0; background: none; padding: 2px 0; font: bold 14px Helvetica, Arial, sans-serif; color: #888; cursor: pointer; }
.spu-close-label:after { content: "\00d7"; display: inline-block; margin-left: 6px; width: 18px; height: 18px; line-height: 17px; text-align: center; border-radius: 50%; background: #888; color: #fff; }
.spu-close-label:hover { color: #333; }

/* Galerie */
.spu-dialog .spu-nav {
	position: absolute; top: 50%; z-index: 2; transform: translateY(-50%);
	width: 40px; height: 40px; border: 0; border-radius: 50%;
	background: rgba(0, 0, 0, .55); color: #fff; font: 24px/38px Arial, sans-serif; cursor: pointer;
}
.spu-dialog .spu-nav-prev { left: 8px; }
.spu-dialog .spu-nav-next { right: 8px; }
.spu-dialog .spu-nav:hover { background: rgba(0, 0, 0, .8); }
.spu-multi { padding-top: 6px; text-align: right; font-size: 13px; }

/* Vidéo */
.spu-is-video .spu-box { width: min(var(--spu-video-width, 800px), calc(100vw - 32px)); }
.spu-dialog .spu-video { display: block; width: 100%; height: 100%; min-height: 200px; border: 0; aspect-ratio: var(--spu-video-ratio, auto); }
.spu-is-video .spu-body { overflow: hidden !important; }

/* Animations d'ouverture / fermeture */
.spu-dialog[open].spu-in-elastic .spu-box { animation: spu-elastic-in var(--spu-speed-in, 300ms) ease-out; }
.spu-dialog[open].spu-in-fade .spu-box { animation: spu-fade-in var(--spu-speed-in, 300ms) ease-out; }
.spu-dialog[open] { animation: spu-fade-in var(--spu-speed-in, 300ms) ease-out; }
.spu-dialog.spu-in-none[open], .spu-dialog.spu-in-none[open] .spu-box { animation: none; }

.spu-dialog.spu-closing { animation: spu-fade-out var(--spu-speed-out, 300ms) ease-in forwards; }
.spu-dialog.spu-closing.spu-out-elastic .spu-box { animation: spu-elastic-out var(--spu-speed-out, 300ms) ease-in forwards; }
.spu-dialog.spu-closing.spu-out-fade .spu-box { animation: spu-fade-out var(--spu-speed-out, 300ms) ease-in forwards; }
.spu-dialog.spu-closing.spu-out-none, .spu-dialog.spu-closing.spu-out-none .spu-box { animation: none; }

@keyframes spu-elastic-in { from { transform: scale(.7); opacity: 0; } 70% { transform: scale(1.03); opacity: 1; } to { transform: scale(1); } }
@keyframes spu-elastic-out { from { transform: scale(1); opacity: 1; } to { transform: scale(.7); opacity: 0; } }
@keyframes spu-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes spu-fade-out { from { opacity: 1; } to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
	.spu-dialog, .spu-dialog .spu-box { animation: none !important; }
}

@media (max-width: 600px) {
	dialog.spu-dialog { padding: 10px; }
	.spu-dialog .spu-box { max-width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
	.spu-dialog .spu-close { top: 4px; right: 4px; }
}
