/* ==========================================================================
   Popups du site (module Popup)
   Trois gabarits en modale Bootstrap (centrée, image + texte, annonce) et deux
   encarts qui ne bloquent pas la page (bandeau bas, coin bas-gauche : le lecteur
   Twitch flottant occupe le coin droit).
   ========================================================================== */

.popup {
    --popup-radius: 1rem;
    --popup-accent: var(--primary-color);
    --popup-accent-rgb: var(--primary-rgb);
    --popup-fg: var(--bs-dark);
    --popup-bg: #fff;
    --popup-gap: 0.75rem;
}

/* ------------------------------------------------------------------ Contenu commun */

.popup__card {
    position: relative;
    overflow: hidden;
    border: 0;
    border-radius: var(--popup-radius);
    background: var(--popup-bg);
    color: var(--popup-fg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.popup__content {
    padding: 2rem 1.75rem 1.75rem;
}

.popup__eyebrow {
    margin: 0 0 0.35rem;
    color: var(--secondary-color);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.popup__title {
    margin: 0 0 0.6rem;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.25;
    color: inherit;
}

.popup__text {
    color: var(--bs-dark-subtle);
    font-size: 0.975rem;
    line-height: 1.55;
}

.popup__text > :last-child { margin-bottom: 0; }
.popup__text a { color: var(--popup-accent); }
.popup__text img { max-width: 100%; height: auto; }

.popup__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1.25rem;
}

.text-center .popup__actions { justify-content: center; }

.popup__dismiss {
    color: var(--bs-dark-subtle);
    text-decoration: underline;
}

.popup__icon {
    display: inline-grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: rgba(var(--popup-accent-rgb), 0.12);
    color: var(--popup-accent);
    font-size: 1.5rem;
}

.popup__icon--sm {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    font-size: 1.1rem;
}

.popup__close {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: var(--bs-dark);
    font-size: 1rem;
    transition: background-color 0.15s ease;
}

.popup__close:hover { background: var(--bs-light-gray); }
.popup__close:focus-visible { outline: 2px solid var(--popup-accent); outline-offset: 2px; }

/* ------------------------------------------------------------------ Modales */

.popup .popup__dialog { max-width: 30rem; }
.popup--split .popup__dialog { max-width: 52rem; }
.popup--hero .popup__dialog { max-width: 34rem; }

.popup--split .popup__split {
    display: grid;
    grid-template-columns: 1fr;
}

.popup__media img,
.popup__banner img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup__media { max-height: 14rem; overflow: hidden; }
.popup__banner { aspect-ratio: 16 / 9; overflow: hidden; }

@media (min-width: 768px) {
    .popup--split .popup__split { grid-template-columns: 5fr 6fr; }
    .popup--split .popup__media { max-height: none; min-height: 22rem; }
    .popup--split .popup__content {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 2.5rem 2.25rem;
    }
}

/* ------------------------------------------------------------------ Encarts non bloquants */

.popup--bar,
.popup--corner {
    position: fixed;
    z-index: 1045;
    color: var(--popup-fg);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.popup--bar[hidden],
.popup--corner[hidden] { display: none !important; }

.popup--bar.is-visible,
.popup--corner.is-visible { opacity: 1; transform: none; }

.popup--bar {
    right: 0;
    bottom: 0;
    left: 0;
    padding: 0.85rem 0 calc(0.85rem + env(safe-area-inset-bottom, 0px));
    border-top: 3px solid var(--popup-accent);
    background: var(--popup-bg);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
}

.popup__bar-inner {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    align-items: center;
    padding-right: 3rem;
}

.popup--bar .popup__content { flex: 1 1 18rem; padding: 0; }
.popup--bar .popup__eyebrow { margin-bottom: 0.1rem; }
.popup--bar .popup__title { margin: 0; font-size: 1.05rem; }
.popup--bar .popup__text { font-size: 0.9rem; }
.popup--bar .popup__actions { margin: 0; }
.popup--bar .popup__close { top: 50%; right: 0.5rem; transform: translateY(-50%); background: transparent; }

.popup--corner {
    left: var(--popup-gap);
    bottom: calc(var(--popup-gap) + env(safe-area-inset-bottom, 0px));
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    width: min(23rem, calc(100vw - 2 * var(--popup-gap)));
    padding: 1.1rem 1.1rem 1.1rem 1.1rem;
    border-left: 4px solid var(--popup-accent);
    border-radius: 0.75rem;
    background: var(--popup-bg);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
    transform: translateY(1rem);
}

.popup--corner .popup__content { flex: 1; min-width: 0; padding: 0 1.5rem 0 0; }
.popup--corner .popup__title { font-size: 1.05rem; }
.popup--corner .popup__text { font-size: 0.88rem; }
.popup--corner .popup__actions { margin-top: 0.75rem; }
.popup--corner .popup__actions .btn { padding: 0.35rem 0.85rem; font-size: 0.85rem; }
.popup--corner .popup__close { top: 0.35rem; right: 0.35rem; width: 2rem; height: 2rem; background: transparent; }

.popup__thumb {
    flex: 0 0 4.5rem;
    width: 4.5rem;
    height: 4.5rem;
    overflow: hidden;
    border-radius: 0.5rem;
}

.popup__thumb img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 575.98px) {
    .popup__content { padding: 1.75rem 1.25rem 1.25rem; }
    .popup__title { font-size: 1.25rem; }
    .popup--bar .popup__actions { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .popup--bar,
    .popup--corner { transition: none; transform: none; }
}

/* Contraste élevé (préférence d'accessibilité du site) */
[data-contrast="high"] .popup__text,
[data-contrast="high"] .popup__dismiss { color: var(--bs-dark); }
[data-contrast="high"] .popup__card,
[data-contrast="high"] .popup--bar,
[data-contrast="high"] .popup--corner { outline: 2px solid var(--bs-dark); }
