/**
 * TWE Banner CSS
 * NB : classes et nom de fichier sans « banner »/« promo » pour passer
 * sous les filtres des bloqueurs de pub (EasyList).
 */

/* Override theme container if the strip is present */
.header-strip {
    padding: 0 !important;
    overflow: hidden;
}

.twe-topbar {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    font-weight: 400;
    padding: 8px 0; /* Restore theme padding inside the colored area */
    min-height: 34px;
}

.twe-topbar a {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
}

.twe-topbar-wrapper {
    display: flex;
    width: max-content;
    /* Fallback duration; overridden per banner by topbar.js (px/s) */
    animation: twe-topbar-scroll 30s linear infinite;
}

.twe-topbar:hover .twe-topbar-wrapper.pause-on-hover {
    animation-play-state: paused;
}

.twe-topbar-wrapper.not-scrolling {
    animation: none !important;
    width: 100%;
    justify-content: center;
}

.twe-topbar-item {
    padding: 8px 50px; /* Space between repeated messages */
    flex-shrink: 0;
}

.twe-topbar-item a {
    display: inline;
    color: inherit;
    text-decoration: underline;
}

.not-scrolling .twe-topbar-item {
    padding: 8px 16px;
}

.twe-topbar-wrapper.not-scrolling .twe-topbar-item > * {
    margin: 0;
}

/* Mobile Fix: Allow text to wrap if it's static, so it stays fixed and centered */
@media (max-width: 767px) {
    .twe-topbar-wrapper.not-scrolling {
        width: 100%;
        justify-content: center;
        animation: none !important;
        white-space: normal; /* Allow text to wrap on multiple lines if too long */
        text-align: center;
    }

    .twe-topbar-wrapper.not-scrolling .twe-topbar-item {
        padding: 8px 16px;
        white-space: normal;
        width: 100%;
    }
}

@keyframes twe-topbar-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .twe-topbar-wrapper {
        animation: none !important;
        width: 100%;
        justify-content: center;
    }

    /* Hide loop copies so the visible message stays centered */
    .twe-topbar-item[aria-hidden="true"] {
        display: none;
    }
}
