/* ==========================================
   ANNOUNCEMENT BAR - responsive marquee
   Scrolls right to left on every screen size.
   ========================================== */
.announcement-bar {
    --ann-duration: 24s; /* one full loop; overridden per breakpoint */
    --ann-font-size: clamp(0.66rem, 0.62rem + 0.18vw, 0.82rem);
    --ann-pad-y: clamp(0.25rem, 0.2rem + 0.2vw, 0.4rem);
    --ann-item-pad: clamp(0.35rem, 0.2rem + 0.5vw, 0.75rem);

    position: relative;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
    background-color: #e11d2e;
    color: #ffffff;
    font-family: Montserrat, Roboto, system-ui, sans-serif;
    font-size: var(--ann-font-size);
    font-weight: 700;
    letter-spacing: clamp(0.05em, 0.03em + 0.06vw, 0.08em);
    text-transform: uppercase;
    line-height: 1;
    padding: var(--ann-pad-y) 0;
    padding-top: calc(var(--ann-pad-y) + env(safe-area-inset-top, 0px));
    white-space: nowrap;
    z-index: 60;
    min-height: 1.75rem;
    contain: layout paint;
}

/* Track holds TWO identical groups; moving -50% loops seamlessly */
.announcement-track {
    display: flex;
    width: max-content;
    animation: announcement-marquee var(--ann-duration) linear infinite;
    will-change: transform;
    backface-visibility: hidden;
}

/* Pause on hover, keyboard focus, or touch-hold */
.announcement-bar:hover .announcement-track,
.announcement-bar:focus-within .announcement-track,
.announcement-bar:active .announcement-track {
    animation-play-state: paused;
}

/* Items sit tightly next to their separators (no stretching).
   Repeat the messages inside each group in the HTML so a group
   is wider than the screen on large monitors. */
.announcement-group {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
}

.announcement-item {
    display: inline-flex;
    align-items: center;
    padding: 0 var(--ann-item-pad);
}

.announcement-item a {
    color: inherit;
    text-decoration: none;
}

.announcement-item a:hover,
.announcement-item a:focus-visible {
    text-decoration: underline;
}

.announcement-separator {
    opacity: 0.7;
    padding: 0 0.25rem;
}

/* Right to left: content enters from the right edge, exits on the left */
@keyframes announcement-marquee {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(-50%, 0, 0);
    }
}

/* ==========================================
   BREAKPOINTS (speed stays comfortable on each screen)
   ========================================== */

/* Small phones */
@media (max-width: 480px) {
    .announcement-bar {
        --ann-duration: 18s;
        letter-spacing: 0.05em;
    }
}

/* Mobile */
@media (min-width: 481px) and (max-width: 768px) {
    .announcement-bar {
        --ann-duration: 22s;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .announcement-bar {
        --ann-duration: 26s;
    }
}

/* Laptop */
@media (min-width: 1025px) and (max-width: 1440px) {
    .announcement-bar {
        --ann-duration: 32s;
    }
}

/* Large desktop / ultrawide */
@media (min-width: 1441px) {
    .announcement-bar {
        --ann-duration: 42s;
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    .announcement-track {
        animation: none;
        width: 100%;
    }

    /* Show a single static group, centered */
    .announcement-group {
        min-width: 0;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        white-space: normal;
    }

    /* Hide the duplicate group used only for the loop */
    .announcement-group[aria-hidden="true"] {
        display: none;
    }
}
