/* Bandeau d'annonce (sticky, au-dessus du header sticky) */
html.has-announcement {
    --announce-h: 36px;
    --nav-bar-total-height: calc(var(--nav-height) + 40px + var(--announce-h));
}

.announce-bar {
    --announce-h: 36px;
    position: sticky;
    top: 0;
    z-index: 1001;
    height: var(--announce-h);
    background: linear-gradient(90deg, #01081c 0%, #01113b 50%, #01081c 100%);
    color: #e8efff;
    border-bottom: 1px solid rgba(217, 231, 255, 0.12);
    font-size: 0.8125rem;
    line-height: 1;
    overflow: hidden;
}

html:not(.has-announcement) .announce-bar {
    display: none;
}

.announce-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(217, 231, 255, 0.08) 50%, transparent 70%);
    transform: translateX(-100%);
    animation: announce-shine 6s ease-in-out infinite;
    pointer-events: none;
}

.announce-bar-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    height: 100%;
    padding: 0 44px 0 16px;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

.announce-bar-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(217, 231, 255, 0.12);
    border: 1px solid rgba(217, 231, 255, 0.25);
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.announce-bar-badge i {
    color: #ffd76a;
}

.announce-bar-viewport {
    position: relative;
    height: var(--announce-h);
    overflow: hidden;
    min-width: 0;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 25%, #000 75%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 25%, #000 75%, transparent 100%);
}

.announce-bar-track {
    list-style: none;
    margin: 0;
    padding: 0;
    animation: announce-scroll-up 9s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.announce-bar:hover .announce-bar-track,
.announce-bar:focus-within .announce-bar-track {
    animation-play-state: paused;
}

.announce-bar-item {
    height: var(--announce-h);
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #d9e7ff;
}

.announce-bar-item strong {
    color: #ffffff;
    font-weight: 600;
    margin: 0 0.25em;
}

.announce-bar-item strong:first-child {
    margin-left: 0;
}

.announce-bar-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    padding-bottom: 1px;
    transition: border-color 0.2s ease, gap 0.2s ease;
}

.announce-bar-cta:hover,
.announce-bar-cta:focus-visible {
    color: #ffffff;
    border-color: #ffffff;
    gap: 9px;
}

.announce-bar-cta i {
    font-size: 0.7rem;
}

.announce-bar-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(217, 231, 255, 0.7);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.announce-bar-close:hover,
.announce-bar-close:focus-visible {
    background: rgba(217, 231, 255, 0.12);
    color: #ffffff;
}

/* Header et éléments collants décalés sous le bandeau (menu mobile plein écran exclu) */
html.has-announcement .site-header:not(.is-nav-open) {
    top: var(--announce-h);
}

html.has-announcement .site-main .research-post-page__toc {
    top: calc(clamp(88px, 12vh, 120px) + var(--announce-h));
    max-height: calc(100vh - clamp(100px, 14vh, 140px) - var(--announce-h));
}

html.has-announcement .site-main .research-post-page__content h1,
html.has-announcement .site-main .research-post-page__content h2,
html.has-announcement .site-main .research-post-page__content h3,
html.has-announcement .site-main .legal-page .legal-page__content section[id] {
    scroll-margin-top: calc(clamp(88px, 12vh, 120px) + var(--announce-h));
}

@keyframes announce-scroll-up {
    0%, 40% { transform: translateY(0); }
    50%, 90% { transform: translateY(calc(-1 * var(--announce-h))); }
    100% { transform: translateY(calc(-2 * var(--announce-h))); }
}

@keyframes announce-shine {
    0%, 60% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@media (max-width: 900px) {
    .announce-bar { font-size: 0.75rem; }
    .announce-bar-inner { gap: 10px; padding: 0 40px 0 12px; justify-content: flex-start; }
    .announce-bar-cta { display: none; }
}

@media (max-width: 480px) {
    .announce-bar-badge { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .announce-bar-track,
    .announce-bar::after {
        animation: none;
    }
}
