/* ═══════════════════════════════════════════════════════════════════════════════
   NATIONAL MOURNING THEME
   Colorless only (grayscale) — same brightness, no dark theme.

   Strategy:
   - Universal: grayscale every direct child of body → works on ALL public layouts
     (_Layout, _FacultyLayout, cathedra, AI-Sana, etc.), not only home selectors.
   - Exception: shells that CONTAIN <video> — some browsers drop the whole filter;
     strip filter from that shell and grayscale video + siblings separately.
   - Admin panel never gets html.mourning / this file.
   - Chat root stays unfiltered (fixed + open on mobile); desaturate inner bits.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Universal site-wide (Faculty, Cathedra, Home shells, …) ── */
html.mourning body > *:not(#a11y-overlay):not(#au-chatbot) {
    -webkit-filter: grayscale(1) !important;
    filter: grayscale(1) !important;
}

/*
 * Home (and any page): ancestor of <video> must NOT carry filter, or grayscale
 * is discarded for the entire subtree. Re-apply on pieces instead.
 */
@supports selector(:has(*)) {
    html.mourning body > *:has(video) {
        -webkit-filter: none !important;
        filter: none !important;
    }

    html.mourning body > *:has(video) video,
    html.mourning body > *:has(video) .au-hero__overlay,
    html.mourning body > *:has(video) .au-hero__content,
    html.mourning body > *:has(video) .au-hero__nav,
    html.mourning body > *:has(video) .au-hero__slider-dots,
    html.mourning body > *:has(video) .au-hero__scroll,
    html.mourning body > *:has(video) main > *:not(.au-hero),
    html.mourning body > *:has(video) .au-floating-btn,
    html.mourning body > *:has(video) footer,
    html.mourning body > *:has(video) .premium-footer {
        -webkit-filter: grayscale(1) !important;
        filter: grayscale(1) !important;
    }
}

/* Fallback when :has() is unavailable — home-oriented shells */
@supports not selector(:has(*)) {
    html.mourning #header-container,
    html.mourning footer.premium-footer,
    html.mourning .m-bottom-nav,
    html.mourning #snow-container,
    html.mourning #shopwindow,
    html.mourning .sw-overlay,
    html.mourning #mnOverlay,
    html.mourning .mn-overlay,
    html.mourning .mn-backdrop,
    html.mourning main > *:not(.au-hero),
    html.mourning .au-hero__video,
    html.mourning .au-hero__overlay,
    html.mourning .au-hero__content,
    html.mourning .au-hero__nav,
    html.mourning .au-hero__slider-dots,
    html.mourning .au-hero__scroll,
    html.mourning .au-floating-btn,
    html.mourning .metro-hero,
    html.mourning .faculty-header,
    html.mourning .footer-zero-kz {
        -webkit-filter: grayscale(1) !important;
        filter: grayscale(1) !important;
    }
}

/* Fixed FABs — kill tinted pulse shadows */
html.mourning .au-floating-btn {
    border-color: #6a6a6a !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28) !important;
    animation: none !important;
}

html.mourning .au-floating-btn:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35) !important;
}

/* A11y dialog stays usable */
html.mourning #a11y-overlay,
html.mourning #a11y-overlay .a11y-modal {
    -webkit-filter: none !important;
    filter: none !important;
}

/* ── Chat: root unfiltered; content desaturated ── */
html.mourning #au-chatbot {
    -webkit-filter: none !important;
    filter: none !important;
    --chatbot-primary: #5a5a5a;
    --chatbot-primary-dark: #3f3f3f;
    --chatbot-gold: #9a9a9a;
}

html.mourning #au-chatbot .au-chatbot-header__avatar,
html.mourning #au-chatbot .au-chatbot-message__avatar,
html.mourning #au-chatbot .au-chatbot-avatar-svg,
html.mourning #au-chatbot .au-chatbot-message__text,
html.mourning #au-chatbot .au-chatbot-hint__badge {
    -webkit-filter: grayscale(1) !important;
    filter: grayscale(1) !important;
}

html.mourning #au-chatbot .au-chatbot-avatar-svg [fill="#ecfdf5"],
html.mourning #au-chatbot .au-chatbot-avatar-svg [fill="#22c55e"],
html.mourning #au-chatbot .au-chatbot-avatar-svg [fill="#187D35"] {
    fill: #b0b0b0 !important;
}

html.mourning #au-chatbot .au-chatbot-avatar-svg [stroke="#86efac"],
html.mourning #au-chatbot .au-chatbot-avatar-svg [stroke="#0f766e"],
html.mourning #au-chatbot .au-chatbot-avatar-svg [stroke="#187D35"] {
    stroke: #6a6a6a !important;
}

html.mourning #au-chatbot .au-chatbot-toggle,
html.mourning #au-chatbot #au-chatbot-toggle,
html.mourning #au-chatbot button.au-chatbot-toggle,
html.mourning button#au-chatbot-toggle {
    background: linear-gradient(135deg, #5a5a5a 0%, #3f3f3f 100%) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35) !important;
}

html.mourning #au-chatbot .au-chatbot-toggle:hover,
html.mourning #au-chatbot .au-chatbot-toggle:focus-visible,
html.mourning #au-chatbot .au-chatbot-toggle:active,
html.mourning button#au-chatbot-toggle:hover,
html.mourning button#au-chatbot-toggle:active {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4) !important;
}

html.mourning #au-chatbot .au-chatbot-window {
    box-shadow:
        0 30px 60px -12px rgba(15, 23, 42, 0.28),
        0 10px 25px -8px rgba(0, 0, 0, 0.16) !important;
}

html.mourning #au-chatbot .au-chatbot-window::after {
    background-image:
        linear-gradient(
            135deg,
            transparent 0 40%,
            rgba(90, 90, 90, 0.55) 40% 52%,
            transparent 52% 66%,
            rgba(90, 90, 90, 0.45) 66% 78%,
            transparent 78% 92%,
            rgba(90, 90, 90, 0.35) 92% 100%
        ) !important;
}

html.mourning #au-chatbot .au-chatbot-header__status {
    background: #6b6b6b !important;
}

html.mourning #au-chatbot .au-chatbot-quick__btn:hover,
html.mourning #au-chatbot .au-chatbot-quick__btn:focus-visible {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
}

html.mourning #au-chatbot .au-chatbot-input textarea:focus,
html.mourning #au-chatbot #au-chatbot-input-field:focus {
    border-color: #5a5a5a !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12) !important;
}

html.mourning #au-chatbot .au-chatbot-send:hover,
html.mourning #au-chatbot .au-chatbot-send:focus-visible {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
}

html.mourning #au-chatbot .au-chatbot-hint__badge {
    background: rgba(90, 90, 90, 0.9) !important;
}

html.mourning #au-chatbot .au-chatbot-message--user .au-chatbot-message__text a {
    color: #e5e5e5 !important;
}

/* Hard exclude admin even if class leaked */
html.mourning body.admin-body > *,
body.admin-body.mourning > * {
    -webkit-filter: none !important;
    filter: none !important;
}
