/* ------------------------------------------------------------------
   Header Banner - styles front-office
   ------------------------------------------------------------------ */

.headerbanner {
    position: relative;
    width: 100%;
    line-height: 0;          /* supprime l'espace blanc sous l'image */
    text-align: center;
    overflow: hidden;
}

/* Pleine largeur : on casse le conteneur du thème si besoin */
.headerbanner--full {
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
    max-width: 100vw;
}

.headerbanner-inner {
    width: 100%;
    line-height: normal;
}

.headerbanner-link {
    display: block;
    line-height: 0;
}

.headerbanner-picture {
    display: block;
    line-height: 0;
}

.headerbanner-img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    margin: 0 auto;
    object-fit: contain;
}

/* Le code publicitaire (AdSense) est centré et ne déborde jamais */
.headerbanner--code .headerbanner-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    overflow: hidden;
}

.headerbanner--code iframe,
.headerbanner--code ins {
    max-width: 100%;
}

/* ------------------------------------------------------------------
   BANNIÈRE FIGÉE (STICKY)
   La classe --is-fixed est posée par headerbanner.js une fois la
   hauteur mesurée : sans JS, la bannière reste dans le flux normal.
   ------------------------------------------------------------------ */

.headerbanner--is-fixed {
    position: fixed;
    left: 0;
    right: 0;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
    z-index: var(--hb-z, 9990);
    background: #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .18);
    transform: translateZ(0);   /* évite le scintillement sur iOS */
}

.headerbanner--is-fixed.headerbanner--sticky-top {
    top: 0;
    bottom: auto;
}

.headerbanner--is-fixed.headerbanner--sticky-bottom {
    bottom: 0;
    top: auto;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, .18);
}

/* Sur iPhone, on évite la barre de gestes en bas */
.headerbanner--is-fixed.headerbanner--sticky-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ------------------------------------------------------------------
   BOUTON DE FERMETURE
   ------------------------------------------------------------------ */

.headerbanner-close {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    line-height: 26px;
    font-size: 20px;
    font-weight: 400;
    text-align: center;
    color: #333;
    background: rgba(255, 255, 255, .85);
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 50%;
    cursor: pointer;
    opacity: .75;
    transition: opacity .15s ease, background .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.headerbanner-close:hover,
.headerbanner-close:focus {
    opacity: 1;
    background: #fff;
    color: #000;
    outline: none;
}

.headerbanner-close:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Bannière collée en bas : la croix passe en haut à droite du bandeau */
.headerbanner--sticky-bottom .headerbanner-close {
    top: 4px;
    bottom: auto;
}

/* Bannière masquée par le visiteur */
.headerbanner--closed {
    display: none !important;
}

/* Impression : on masque la publicité */
@media print {
    .headerbanner {
        display: none !important;
    }
}
