/* ==========================================================================
   News Banner — top-bar carousel
   Used by: HomeTemplate.html (markup lives directly above [[$header]])
   Note: .site-header is position:sticky/top:0/z-index:1000, so this bar stays
   in normal flow and scrolls away — otherwise the two would overlap at top:0.
   ========================================================================== */

/* home.css:892 forces .site-header to position:fixed/top:0/z-index:9999, so the
   banner must also be fixed and sit ABOVE it. --news-banner-h is written by
   news-banner.js from the real rendered height (0 when dismissed) and is what
   pushes the header down — see the .site-header override at the end of this file. */
.news-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 10000;
    background:
        linear-gradient(90deg, rgba(0, 217, 126, 0.10) 0%, rgba(59, 130, 246, 0.10) 100%),
        var(--bg-secondary, #1A1F2E);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-family: var(--font-base, 'Inter', -apple-system, sans-serif);
    overflow: hidden;
}

/* Accent hairline along the top edge */
.news-banner::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg,
        var(--primary, #00D97E) 0%,
        var(--primary-light, #00FF94) 35%,
        var(--secondary, #3B82F6) 100%);
    opacity: 0.85;
}

.news-banner.is-dismissed {
    display: none;
}

.news-banner__inner {
    max-width: var(--container-width, 1200px);
    margin: 0 auto;
    padding: 0.5rem var(--spacing-sm, 1rem);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-height: 64px;
}

/* --- Slide track: all slides stacked in one grid cell for crossfade ------- */

.news-banner__track {
    order: 1;
    flex: 1 1 auto;
    min-width: 0; /* enables ellipsis inside flex child */
    display: grid;
}

.news-banner__slide {
    grid-area: 1 / 1;
    min-width: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s;
    pointer-events: none;
}

.news-banner__slide.is-active {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.45s ease, transform 0.45s ease, visibility 0s;
    pointer-events: auto;
}

.news-banner__link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    border-radius: 10px;
    padding: 0.25rem;
    transition: background 0.2s ease;
}

.news-banner__link:hover,
.news-banner__link:focus-visible {
    background: rgba(255, 255, 255, 0.04);
}

.news-banner__link:focus-visible {
    outline: 2px solid var(--primary, #00D97E);
    outline-offset: 2px;
}

.news-banner__img {
    flex: 0 0 auto;
    width: 120px;
    height: 46px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: var(--bg-tertiary, #252B3B);
}

.news-banner__content {
    display: flex;
    align-items: baseline;
    gap: 0.625rem;
    min-width: 0;
}

.news-banner__tag {
    flex: 0 0 auto;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--primary, #00D97E);
    background: rgba(0, 217, 126, 0.12);
    border: 1px solid rgba(0, 217, 126, 0.28);
    border-radius: 999px;
    padding: 0.1875rem 0.5rem;
    white-space: nowrap;
}

.news-banner__title {
    min-width: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-primary, #E5E7EB);
    /* clamp to a single line so bar height never jumps */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-banner__link:hover .news-banner__title {
    color: #fff;
}

/* --- Lead slide: ~1.5x visual weight ------------------------------------- */

.news-banner__slide.is-lead .news-banner__img {
    width: 120px;
    height: 46px;
}

.news-banner__slide.is-lead .news-banner__title {
    font-size: 0.9375rem;
    font-weight: 600;
}

.news-banner__slide.is-lead .news-banner__tag {
    font-size: 0.75rem;
    color: #04150d;
    background: linear-gradient(90deg, var(--primary-light, #00FF94), var(--primary, #00D97E));
    border-color: transparent;
    box-shadow: 0 0 12px rgba(0, 217, 126, 0.35);
}

/* --- Dots ---------------------------------------------------------------- */

.news-banner__dots {
    order: 2;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.news-banner__dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: background 0.2s ease, width 0.2s ease;
}

.news-banner__dot:hover {
    background: rgba(255, 255, 255, 0.45);
}

.news-banner__dot.is-active {
    width: 18px;
    border-radius: 999px;
    background: var(--primary, #00D97E);
}

.news-banner__dot:focus-visible {
    outline: 2px solid var(--primary, #00D97E);
    outline-offset: 2px;
}

/* --- CTA ----------------------------------------------------------------- */

.news-banner__cta-btn {
    order: 3;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    color: #04150d;
    background: linear-gradient(90deg, var(--primary, #00D97E), var(--primary-dark, #00B368));
    border-radius: 999px;
    padding: 0.4375rem 0.9375rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news-banner__cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow, 0 0 20px rgba(0, 217, 126, 0.3));
}

.news-banner__cta-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* --- Close --------------------------------------------------------------- */

/* Order 5 keeps the close X the rightmost item; the language switcher
   (lang-switcher.css) takes order 4 and sits directly to its left. */
.news-banner__close {
    order: 5;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    line-height: 1;
    color: var(--text-secondary, #9CA3AF);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.news-banner__close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.28);
}

.news-banner__close:focus-visible {
    outline: 2px solid var(--primary, #00D97E);
    outline-offset: 2px;
}

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 900px) {
    .news-banner__cta-btn {
        display: none;
    }
}

@media (max-width: 640px) {
    .news-banner__inner {
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
        min-height: 56px;
    }

    .news-banner__img,
    .news-banner__slide.is-lead .news-banner__img {
        display: none;
    }

    .news-banner__content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.1875rem;
    }

    .news-banner__title,
    .news-banner__slide.is-lead .news-banner__title {
        font-size: 0.8125rem;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .news-banner__dots {
        display: none;
    }
}

/* --- Layout integration ------------------------------------------------- */

/* Header sits directly under the banner. home.css:892 sets top:0 !important,
   so this override needs !important too. */
.site-header {
    top: var(--news-banner-h, 0px) !important;
}

/* body.home-page has padding-top:70px (home.css:904) / 120px (@768px) for the
   fixed header alone; add the banner height on top of it. */
body.home-page {
    padding-top: calc(70px + var(--news-banner-h, 0px)) !important;
}

@media (max-width: 768px) {
    body.home-page {
        padding-top: calc(120px + var(--news-banner-h, 0px)) !important;
    }
}

/* --- Motion preferences -------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .news-banner__slide,
    .news-banner__cta-btn,
    .news-banner__dot {
        transition: none;
    }

    .news-banner__slide {
        transform: none;
    }
}
