/*
 * =========================================================
 * POPUP AJAX BST
 * =========================================================
 */

:root {
    --bst-primary: #163b50;
    --bst-primary-hover: #0f2d3d;
    --bst-primary-soft: rgba(22, 59, 80, 0.08);

    --bst-accent: #c6a15b;

    --bst-text: #211f1b;
    --bst-muted: #625f58;

    --bst-paper: #fbfaf6;
    --bst-surface: #ffffff;
    --bst-border: rgba(22, 59, 80, 0.18);
}

body.popup-open {
    overflow: hidden;
}

/*
 * Arrière-plan.
 */
.ajax-popup {
    position: fixed;
    inset: 0;
    z-index: 10000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 28px;

    background: var(--bst-popup-overlay);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 180ms ease,
        visibility 180ms ease;
}

.ajax-popup[hidden] {
    display: none !important;
}

.ajax-popup.is-open {
    opacity: 1;
    visibility: visible;
}

/*
 * Fenêtre principale.
 *
 * Les propriétés sont renforcées pour éviter que
 * l’ancien CSS de la newsletter modifie sa largeur.
 */
.ajax-popup .ajax-popup__modal {
    position: relative;

    width: min(100%, 780px);
    max-width: 780px;
    max-height: calc(100vh - 56px);

    margin: 0;
    padding: 48px 50px 42px;

    overflow-x: hidden;
    overflow-y: auto;

    color: var(--bst-popup-text);
    background:
        linear-gradient(
            145deg,
            rgba(182, 138, 67, 0.08),
            transparent 38%
        ),
        var(--bst-popup-paper);

    border: 1px solid rgba(123, 87, 31, 0.42);
    border-radius: 18px;

    box-shadow:
        0 22px 65px rgba(0, 0, 0, 0.34);

    box-sizing: border-box;

    transform: translateY(14px);

    transition: transform 180ms ease;
}

.ajax-popup.is-open .ajax-popup__modal {
    transform: translateY(0);
}

.ajax-popup .ajax-popup__modal::before {
    content: "";

    position: absolute;
    top: 0;
    left: 50%;

    width: 126px;
    height: 4px;

    background: var(--bst-popup-gold);

    border-radius: 0 0 4px 4px;

    transform: translateX(-50%);
}

/*
 * Bouton de fermeture.
 */
.ajax-popup .ajax-popup__close {
    position: absolute;
    top: 16px;
    right: 16px;
    left: auto;
    z-index: 20;

    width: 38px;
    height: 38px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin: 0;
    padding: 0;

    color: var(--bst-popup-text);
    background: transparent;

    border: 1px solid rgba(123, 87, 31, 0.5);
    border-radius: 50%;

    appearance: none;
    -webkit-appearance: none;

    font-family: Arial, sans-serif;
    font-size: 1.45rem;
    font-weight: 400;
    line-height: 1;

    cursor: pointer;
}

.ajax-popup .ajax-popup__close:hover {
    color: #ffffff;
    background: var(--bst-popup-gold);
    border-color: var(--bst-popup-gold);
}

/*
 * Contenu typographique.
 */
.ajax-popup .popup-form {
    width: 100%;
    max-width: 100%;

    margin: 0;
    padding: 0;

    color: var(--bst-popup-text);
    background: transparent;

    box-sizing: border-box;
}

.ajax-popup .section-kicker {
    margin: 0 50px 9px 0;

    color: var(--bst-popup-gold);

    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    line-height: 1.4;
    text-transform: uppercase;
}

.ajax-popup .popup-form h2 {
    margin: 0 50px 14px 0;

    color: var(--bst-popup-text);

    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.7rem, 4vw, 2.15rem);
    font-weight: 700;
    line-height: 1.2;
}

.ajax-popup .popup-form__description {
    max-width: 650px;

    margin: 0 0 30px;

    color: var(--bst-popup-muted);

    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
}

.ajax-popup .popup-form__logo {
    width: 68px;
    height: 68px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 0 22px;

    color: #ffffff;
    background: var(--bst-popup-gold);

    border: 1px solid #684514;
    border-radius: 50%;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
}

/*
 * Grille du formulaire.
 */
.ajax-popup .popup-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 20px;
}

.ajax-popup .popup-field {
    min-width: 0;
}

.ajax-popup .popup-field--full {
    grid-column: 1 / -1;
}

/*
 * Libellés.
 */
.ajax-popup .popup-field > label,
.ajax-popup .popup-field__label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;

    gap: 12px;

    margin: 0 0 8px;

    color: var(--bst-popup-text);

    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.4;
}

.ajax-popup #contact-character-count {
    color: var(--bst-popup-muted);

    font-size: 0.78rem;
    font-weight: 400;
    white-space: nowrap;
}

/*
 * Champs.
 *
 * Les sélecteurs précis écrasent les anciens styles,
 * notamment le fond bleu de la newsletter.
 */
.ajax-popup .popup-field input[type="text"],
.ajax-popup .popup-field input[type="email"],
.ajax-popup .popup-field textarea {
    display: block;

    width: 100%;
    min-width: 0;

    margin: 0;
    padding: 13px 15px;

    color: var(--bst-popup-text);
    background: var(--bst-popup-field);

    border: 1px solid var(--bst-popup-border);
    border-radius: 10px;

    outline: none;

    appearance: none;
    -webkit-appearance: none;

    box-shadow: none;

    box-sizing: border-box;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    line-height: 1.45;
}

.ajax-popup .popup-field input[type="email"]::placeholder {
    color: #898176;

    opacity: 1;
}

.ajax-popup .popup-field textarea {
    min-height: 160px;

    resize: vertical;
}

.ajax-popup .popup-field input:hover,
.ajax-popup .popup-field textarea:hover {
    border-color: var(--bst-popup-gold-light);
}

.ajax-popup .popup-field input:focus,
.ajax-popup .popup-field textarea:focus {
    border-color: var(--bst-popup-gold);

    box-shadow:
        0 0 0 3px rgba(182, 138, 67, 0.2);
}

/*
 * Consentement Newsletter.
 */
.ajax-popup .popup-consent {
    display: grid;
    grid-template-columns: 19px 1fr;
    align-items: start;

    gap: 11px;

    margin: 20px 0 24px;

    color: var(--bst-popup-muted);

    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.55;

    cursor: pointer;
}

.ajax-popup .popup-consent input {
    width: 18px;
    height: 18px;

    margin: 2px 0 0;

    accent-color: var(--bst-popup-gold);
}

/*
 * Partie inférieure du formulaire Contact.
 */
.ajax-popup .popup-form__footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 26px;

    margin-top: 24px;
}

.ajax-popup .popup-form__privacy {
    max-width: 470px;

    margin: 18px 0 0;

    color: var(--bst-popup-muted);

    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.82rem;
    line-height: 1.65;
}

.ajax-popup .popup-form__footer .popup-form__privacy {
    margin: 0;
}

.ajax-popup .popup-form__privacy a {
    color: var(--bst-popup-gold);

    text-decoration: underline;
    text-underline-offset: 3px;
}

/*
 * Boutons principaux.
 */
.ajax-popup .popup-form__submit {
    flex: 0 0 auto;

    min-height: 48px;

    margin: 0;
    padding: 12px 24px;

    color: #ffffff;
    background: var(--bst-popup-gold);

    border: 1px solid #684514;
    border-radius: 999px;

    appearance: none;
    -webkit-appearance: none;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;

    cursor: pointer;

    box-shadow: none;

    transition:
        background 160ms ease,
        transform 160ms ease;
}

.ajax-popup .popup-form__submit:hover {
    background: #654313;

    transform: translateY(-1px);
}

.ajax-popup .popup-form__submit--full {
    width: 100%;
}

.ajax-popup .popup-form__submit:disabled {
    opacity: 0.65;

    cursor: wait;
    transform: none;
}

/*
 * Bouton secondaire Newsletter.
 */
.ajax-popup .popup-form__later {
    display: block;

    margin: 22px auto 0;
    padding: 5px 0;

    color: var(--bst-popup-muted);
    background: transparent;

    border: 0;
    border-radius: 0;

    appearance: none;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.84rem;
    text-decoration: underline;
    text-underline-offset: 3px;

    cursor: pointer;
}

/*
 * Retours d’envoi.
 */
.ajax-popup .popup-feedback {
    display: none;

    margin: 0 0 22px;
    padding: 13px 15px;

    border: 1px solid transparent;
    border-radius: 8px;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.9rem;
    line-height: 1.55;
}

.ajax-popup .popup-feedback:not(:empty) {
    display: block;
}

.ajax-popup .popup-feedback.is-success {
    color: var(--bst-popup-success);
    background: #eef8f1;
    border-color: rgba(39, 100, 65, 0.3);
}

.ajax-popup .popup-feedback.is-error {
    color: var(--bst-popup-error);
    background: #fff1f1;
    border-color: rgba(139, 41, 41, 0.3);
}

/*
 * Protection antispam invisible.
 */
.ajax-popup .popup-honeypot {
    position: absolute !important;
    left: -10000px !important;

    width: 1px !important;
    height: 1px !important;

    overflow: hidden !important;

    opacity: 0 !important;
    pointer-events: none !important;
}

/*
 * Focus accessible.
 */
.ajax-popup button:focus-visible,
.ajax-popup input:focus-visible,
.ajax-popup textarea:focus-visible,
.ajax-popup a:focus-visible {
    outline: 2px solid var(--bst-popup-gold);
    outline-offset: 3px;
}

/*
 * Mobile et tablette.
 */
@media (max-width: 720px) {
    .ajax-popup {
        align-items: flex-end;

        padding: 0;
    }

    .ajax-popup .ajax-popup__modal {
        width: 100%;
        max-width: none;
        max-height: 94vh;

        padding:
            52px
            22px
            calc(26px + env(safe-area-inset-bottom));

        border-right: 0;
        border-bottom: 0;
        border-left: 0;

        border-radius: 18px 18px 0 0;
    }

    .ajax-popup .popup-form__grid {
        grid-template-columns: 1fr;
    }

    .ajax-popup .popup-field--full {
        grid-column: auto;
    }

    .ajax-popup .popup-form__footer {
        align-items: stretch;
        flex-direction: column;
    }

    .ajax-popup .popup-form__submit {
        width: 100%;
    }

    .ajax-popup .popup-form__description {
        font-size: 0.94rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ajax-popup,
    .ajax-popup__modal,
    .popup-form__submit {
        transition: none !important;
    }
}

.ajax-popup .popup-form__notice {
    margin: 22px 0 0;
    padding: 15px 17px;

    color: var(--bst-popup-text);
    background: rgba(182, 138, 67, 0.1);

    border: 1px solid rgba(123, 87, 31, 0.3);
    border-left: 4px solid var(--bst-popup-gold);
    border-radius: 8px;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.86rem;
    line-height: 1.55;
}

.ajax-popup .popup-form__notice strong {
    display: block;

    margin-bottom: 5px;

    color: var(--bst-popup-gold);
    font-size: 0.88rem;
}

.ajax-popup .popup-form__notice p {
    margin: 0;
}

/*
 * Le bloc des champs doit rester visible
 * lors de l’affichage initial du formulaire.
 */
.ajax-popup #contact-form:not([hidden]) .popup-form__grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 20px;

    visibility: visible !important;
    opacity: 1 !important;
}

/*
 * Les champs sur toute la largeur occupent
 * les deux colonnes.
 */
.ajax-popup #contact-form:not([hidden]) .popup-field--full {
    grid-column: 1 / -1;
}

/*
 * Le panneau de confirmation reste masqué
 * tant que le visiteur n’a pas validé le formulaire.
 */
.ajax-popup #contact-confirmation[hidden] {
    display: none !important;
}

/*
 * Adaptation pour les petits écrans.
 */
@media (max-width: 720px) {
    .ajax-popup #contact-form:not([hidden]) .popup-form__grid {
        grid-template-columns: 1fr;
    }

    .ajax-popup #contact-form:not([hidden]) .popup-field--full {
        grid-column: auto;
    }
}

/*
 * =========================================================
 * ÉTAPE DE CONFIRMATION DU CONTACT
 * =========================================================
 */

.ajax-popup .popup-form__confirmation-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;

    gap: 14px;

    margin-top: 26px;
}

/*
 * Bouton secondaire :
 * retour à la saisie du message.
 */
.ajax-popup .popup-form__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 48px;

    margin: 0;
    padding: 12px 22px;

    color: var(--bst-popup-gold);
    background: transparent;

    border: 1px solid var(--bst-popup-gold);
    border-radius: 999px;

    appearance: none;
    -webkit-appearance: none;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;

    cursor: pointer;

    transition:
        color 160ms ease,
        background 160ms ease,
        border-color 160ms ease,
        transform 160ms ease;
}

.ajax-popup .popup-form__back:hover {
    color: #ffffff;
    background: var(--bst-popup-gold);
    border-color: var(--bst-popup-gold);

    transform: translateY(-1px);
}

.ajax-popup .popup-form__back:active {
    transform: translateY(0);
}

.ajax-popup .popup-form__back:focus-visible {
    outline: 2px solid var(--bst-popup-gold);
    outline-offset: 3px;
}

/*
 * Bouton définitif :
 * légère mise en valeur par rapport au retour.
 */
.ajax-popup .popup-form__confirmation-actions
.popup-form__submit {
    min-width: 180px;
}

/*
 * Adaptation sur téléphone.
 */
@media (max-width: 560px) {
    .ajax-popup .popup-form__confirmation-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .ajax-popup .popup-form__back,
    .ajax-popup .popup-form__confirmation-actions
    .popup-form__submit {
        width: 100%;
    }
}


.ajax-popup {
    position: fixed;
    inset: 0;
    z-index: 10000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 28px;

    background: rgba(21, 20, 17, 0.72);

    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 180ms ease,
        visibility 180ms ease;
}

/*
 * =========================================================
 * PALETTE BLEU PÉTROLE DES POPUPS BST
 * À placer tout à la fin de ajax-popup.css
 * =========================================================
 */

.ajax-popup {
    --bst-popup-primary: #163b50;
    --bst-popup-primary-hover: #0f2d3d;
    --bst-popup-primary-light: #2b6079;
    --bst-popup-primary-soft: rgba(22, 59, 80, 0.07);

    --bst-popup-text: #211f1b;
    --bst-popup-muted: #625f58;

    --bst-popup-paper: #fbfaf6;
    --bst-popup-field: #ffffff;
    --bst-popup-border: rgba(22, 59, 80, 0.22);

    /*
     * Arrière-plan sombre légèrement bleuté.
     */
    --bst-popup-overlay: rgba(8, 23, 32, 0.72);

    background: var(--bst-popup-overlay);

    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/*
 * Fenêtre principale.
 */
.ajax-popup .ajax-popup__modal {
    color: var(--bst-popup-text);

    background:
        linear-gradient(
            145deg,
            var(--bst-popup-primary-soft),
            transparent 42%
        ),
        var(--bst-popup-paper);

    border-color: rgba(22, 59, 80, 0.30);

    box-shadow:
        0 24px 70px rgba(5, 18, 26, 0.38);
}

/*
 * Trait décoratif supérieur.
 */
.ajax-popup .ajax-popup__modal::before {
    background: var(--bst-popup-primary);
}

/*
 * Bouton de fermeture.
 */
.ajax-popup .ajax-popup__close {
    color: var(--bst-popup-primary);
    background: rgba(255, 255, 255, 0.78);

    border-color: rgba(22, 59, 80, 0.40);
}

.ajax-popup .ajax-popup__close:hover {
    color: #ffffff;
    background: var(--bst-popup-primary);
    border-color: var(--bst-popup-primary);
}

/*
 * Petits intitulés :
 * NEWSLETTER BST / ÉCRIRE À L’AUTEUR.
 */
.ajax-popup .section-kicker {
    color: var(--bst-popup-primary);
}

/*
 * Logo BST de la Newsletter.
 */
.ajax-popup .popup-form__logo {
    color: #ffffff;
    background: var(--bst-popup-primary);

    border-color: var(--bst-popup-primary-hover);

    box-shadow:
        0 8px 20px rgba(15, 45, 61, 0.18);
}

/*
 * Champs des formulaires.
 */
.ajax-popup .popup-field input[type="text"],
.ajax-popup .popup-field input[type="email"],
.ajax-popup .popup-field textarea {
    color: var(--bst-popup-text);
    background: var(--bst-popup-field);

    border-color: var(--bst-popup-border);
}

.ajax-popup .popup-field input:hover,
.ajax-popup .popup-field textarea:hover {
    border-color: rgba(22, 59, 80, 0.52);
}

.ajax-popup .popup-field input:focus,
.ajax-popup .popup-field textarea:focus {
    border-color: var(--bst-popup-primary);

    box-shadow:
        0 0 0 3px rgba(22, 59, 80, 0.14);
}

/*
 * Placeholder de l’adresse e-mail.
 */
.ajax-popup
.popup-field
input[type="email"]::placeholder {
    color: #777c7e;
}

/*
 * Case de consentement Newsletter.
 */
.ajax-popup .popup-consent input {
    accent-color: var(--bst-popup-primary);
}

/*
 * Liens de confidentialité.
 */
.ajax-popup .popup-form__privacy a {
    color: var(--bst-popup-primary);

    text-decoration-color:
        rgba(22, 59, 80, 0.48);
}

/*
 * Boutons principaux :
 * Vérifier mon message,
 * Confirmer l’envoi,
 * Je m’inscris.
 */
.ajax-popup .popup-form__submit {
    color: #ffffff;
    background: var(--bst-popup-primary);

    border-color: var(--bst-popup-primary-hover);

    box-shadow:
        0 10px 24px rgba(22, 59, 80, 0.17);

    transition:
        background 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
}

.ajax-popup .popup-form__submit:hover {
    color: #ffffff;
    background: var(--bst-popup-primary-hover);
    border-color: var(--bst-popup-primary-hover);

    box-shadow:
        0 13px 28px rgba(15, 45, 61, 0.25);

    transform: translateY(-1px);
}

.ajax-popup .popup-form__submit:active {
    transform: translateY(0);
}

/*
 * Bouton secondaire :
 * Retour au formulaire.
 */
.ajax-popup .popup-form__back {
    color: var(--bst-popup-primary);
    background: transparent;

    border-color: var(--bst-popup-primary);
}

.ajax-popup .popup-form__back:hover {
    color: #ffffff;
    background: var(--bst-popup-primary);
    border-color: var(--bst-popup-primary);
}

/*
 * Bloc d’avertissement avant confirmation.
 */
.ajax-popup .popup-form__notice {
    color: var(--bst-popup-text);
    background: rgba(22, 59, 80, 0.06);

    border-color: rgba(22, 59, 80, 0.20);
    border-left-color: var(--bst-popup-primary);
}

/*
 * Aperçu du message.
 */
.ajax-popup .popup-form__preview {
    color: var(--bst-popup-text);
    background: rgba(255, 255, 255, 0.82);

    border-color: var(--bst-popup-border);
}

.ajax-popup .popup-form__preview-label {
    color: var(--bst-popup-primary);
}

/*
 * Bouton discret de la Newsletter :
 * Non merci, continuer ma visite.
 */
.ajax-popup .popup-form__later {
    color: var(--bst-popup-muted);
}

.ajax-popup .popup-form__later:hover {
    color: var(--bst-popup-primary);
}

/*
 * Focus accessible.
 */
.ajax-popup button:focus-visible,
.ajax-popup input:focus-visible,
.ajax-popup textarea:focus-visible,
.ajax-popup a:focus-visible {
    outline-color: var(--bst-popup-primary);
}

/*
 * Chargement du formulaire.
 */
.ajax-popup .ajax-popup-spinner {
    border-color: rgba(22, 59, 80, 0.18);
    border-top-color: var(--bst-popup-primary);
}