/* =========================================================================
   K24 Sticky Header — Phase 2
   Compressed-state styling that activates when the legacy scroll handler
   in `assets/js/main.js` adds `.sticky-bar` to `.header-bottom.header-sticky`.
   No new JS required; this only refines the visuals of the existing system.
   ========================================================================= */

/* ----- Active sticky bar: tighter, premium presence -------------------- */
.main-header .header-bottom.header-sticky.sticky-bar {
    background: var(--k24h-surface, #FFFFFF);
    border-bottom: 1px solid var(--k24h-border, #E5E7EB);
    box-shadow: 0 6px 20px rgba(17, 24, 39, .08);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
}

/* Compressed nav: 64px height, tighter link rhythm */
.main-header .header-bottom.header-sticky.sticky-bar .k24-header-navigation {
    min-height: 64px;
    padding-inline: 56px 56px;
    transition: min-height .2s ease, padding .2s ease;
}

.main-header .header-bottom.header-sticky.sticky-bar
    .k24-menu--desktop-root > .k24-menu__item > .k24-menu__item-row > .k24-menu__link {
    padding: 18px 12px;
    font-size: 14px;
}

.main-header .header-bottom.header-sticky.sticky-bar
    .k24-menu--desktop-root > .k24-menu__item > .k24-menu__item-row > .k24-menu__link::after {
    bottom: 10px;
}

/* Compressed All-Sections trigger: keep pill shape, slightly smaller */
.main-header .header-bottom.header-sticky.sticky-bar .k24-nav-trigger {
    height: 40px;
    min-height: 40px;
    padding-inline: 14px;
    font-size: 13px;
}

.main-header .header-bottom.header-sticky.sticky-bar .search-button .search-icon {
    width: 40px;
    height: 40px;
}

/* ----- Compact brand mark (visible only in sticky mode) ---------------- */
.k24-sticky-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--k24h-red, #DC2626);
    font-family: 'ItfHuwiyaArabic', var(--font-header, inherit), sans-serif;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.01em;
    text-decoration: none;
    line-height: 1;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-2px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
    pointer-events: none;
    flex-shrink: 0;
    /* Hidden in flow until sticky activates so it doesn't push other items */
    margin-inline-end: 0;
    width: 0;
    overflow: hidden;
}

.k24-sticky-brand__img {
    height: 28px;
    width: auto;
    display: block;
}

.k24-sticky-brand__text {
    font-weight: 800;
    color: var(--k24h-red, #DC2626);
    white-space: nowrap;
}

.main-header .header-bottom.header-sticky.sticky-bar .k24-sticky-brand {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    width: auto;
    margin-inline-end: 16px;
    overflow: visible;
}

.main-header .header-bottom.header-sticky.sticky-bar .k24-sticky-brand:hover {
    color: #B91C1C;
}

/* ----- Sticky toolbar coexistence -------------------------------------- */
/* Push the rest of the page down by ONE nav row when sticky-bar is fixed. */
body.has-sticky-header { /* reserved for JS toggle if/when needed */ }

/* ----- Mobile sticky behaviour ----------------------------------------- */
@media (max-width: 991.98px) {
    .main-header .header-bottom.header-sticky.sticky-bar .k24-header-navigation {
        min-height: 56px;
        padding-inline: 48px 48px;
    }

    .k24-sticky-brand {
        height: 32px;
        font-size: 16px;
    }

    .k24-sticky-brand__img { height: 24px; }
}

/* ----- Sticky-bar hides ad slots & utility bar implicitly -------------- */
/* They scroll out of view; nothing to override. The fade-in animation on
   .sticky-bar (defined in style.css :: .sticky-bar) gives a smooth entry. */
