/**
 * header.css — the sticky site header (template-parts/header-nav.php).
 *
 * Covers the header bar and logo, the header advertisement widget area, the
 * search toggle button and drop-down search bar, and layout fixes around the
 * Max Mega Menu plugin (#mega-menu-wrap-primary). The menu's own colors and
 * dropdowns are styled in the Mega Menu plugin settings, not here.
 * Behavior (search toggle, .is-scrolled shadow) is in assets/js/header.js.
 */

/* Header bar and logo */
.rn27-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--white);
    border-bottom: 1px solid var(--neutral-input);
    transition: box-shadow 0.2s var(--transition-smooth);
}

.rn27-header.is-scrolled {
    box-shadow: var(--shadow-sm);
}

.rn27-header__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 24px;
}

@media (min-width: 900px) {
    .rn27-header__bar {
            padding-left: 40px;
            padding-right: 40px;
        }
}

.rn27-header__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
}

.rn27-header__logo img {
    max-height: 68px;
    width: auto;
    display: block;
}

/* Header actions (search icon area) */
.rn27-header__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Header advertisement widget area (Appearance > Widgets > Header Advertisement) */
.rn27-header__ad {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 1 190px;
    min-width: 190px;
    max-width: 190px;

    margin: 0;
    padding: 0;

    line-height: 0;
}

.rn27-header__ad .widget,
.rn27-header-ad-widget {
    margin: 0 !important;
    padding: 0 !important;

    width: 100%;
    max-width: 100%;
}

.rn27-header__ad .widget-title,
.rn27-header-ad-widget__title {
    display: none;
}

.rn27-header__ad img {
    display: block;

    width: auto;
    height: auto;

    max-width: 100%;
    max-height: 54px;

    object-fit: contain;
}

.rn27-header__ad a {
    display: flex;
    align-items: center;
    justify-content: center;

    max-width: 100%;
}

.rn27-header__ad iframe {
    display: block;

    max-width: 100%;
    max-height: 54px;

    border: 0;
}

/* Search toggle button and drop-down search bar */
.rn27-header__icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--neutral-dark);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.rn27-header__icon-btn:hover,
.rn27-header__icon-btn[aria-expanded="true"] {
    background: var(--neutral-light);
    color: var(--brand-teal);
}

.rn27-header__search-bar {
    border-top: 1px solid var(--neutral-input);
    background: var(--neutral-light);
}

.rn27-header__search-form {
    display: flex;
    align-items: center;
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 8px;
}

.rn27-header__search-input {
    flex-grow: 1;
    border: none;
    background: var(--white);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 1rem;
    color: var(--neutral-dark);
    outline: none;
}

.rn27-header__search-submit {
    background: var(--brand-teal);
    color: var(--white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s var(--transition-smooth);
}

.rn27-header__search-submit:hover {
    background: var(--brand-black);
}

/* Desktop (900px+): header advertisement sizing */
@media (min-width: 900px) {
    .rn27-header__ad {
            flex: 0 0 360px;

            width: 360px;
            min-width: 360px;
            max-width: 360px;

            height: 76px;

            display: flex;
            align-items: center;
            justify-content: center;

            align-self: center;

            margin: 0;
            padding: 0;

            overflow: hidden;

            line-height: 1;
        }

    .rn27-header__ad .widget,
        .rn27-header-ad-widget {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;

            width: 100% !important;
            height: 100% !important;

            max-width: 100% !important;
            max-height: 100% !important;

            margin: 0 !important;
            padding: 0 !important;
        }

    .rn27-header__ad .widget > * {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;

            width: 100% !important;
            height: 100% !important;

            max-width: 100% !important;
            max-height: 100% !important;

            margin: 0 !important;
            padding: 0 !important;
        }

    .rn27-header__ad a {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;

            width: 100% !important;
            height: 100% !important;

            max-width: 100% !important;
            max-height: 100% !important;

            margin: 0 !important;
            padding: 0 !important;

            line-height: 0;
        }

    .rn27-header__ad img {
            display: block !important;

            width: 100% !important;
            height: 100% !important;

            max-width: 100% !important;
            max-height: 100% !important;

            margin: 0 !important;
            padding: 0 !important;

            object-fit: contain !important;
            object-position: center center !important;
        }
}

/* Mobile (under 900px): compact header, ad placement and Max Mega Menu toggle */
@media (max-width: 899px) {
    .rn27-header .rn27-header__bar {
            display: grid !important;

            grid-template-columns: 105px minmax(0, 1fr) 52px !important;
            grid-template-areas: "logo ad menu" !important;

            align-items: center !important;

            column-gap: 10px;

            width: 100%;

            box-sizing: border-box;

            padding: 8px 12px;
        }

    .rn27-header .rn27-header__logo {
            grid-area: logo !important;

            position: static !important;

            transform: none !important;

            width: 105px;
            min-width: 0;

            margin: 0 !important;
            padding: 0 !important;

            justify-self: start;
            align-self: center;

            z-index: auto;
        }

    .rn27-header .rn27-header__logo img {
            display: block;

            width: 100%;
            height: auto;

            max-width: 105px;
            max-height: 58px;

            object-fit: contain;
            object-position: center;
        }

    .rn27-header .rn27-header__ad {
            grid-area: ad !important;

            position: static !important;

            left: auto !important;
            right: auto !important;
            top: auto !important;

            transform: none !important;

            display: flex !important;
            align-items: center !important;
            justify-content: center !important;

            width: 100% !important;

            min-width: 0 !important;
            max-width: none !important;

            height: 64px;

            margin: 0 !important;
            padding: 0 !important;

            overflow: hidden;

            line-height: 1;

            z-index: auto;
        }

    .rn27-header .rn27-header__ad .widget,
        .rn27-header .rn27-header-ad-widget {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;

            width: 100% !important;
            height: 100% !important;

            min-width: 0 !important;

            max-width: 100% !important;
            max-height: 100% !important;

            margin: 0 !important;
            padding: 0 !important;
        }

    .rn27-header .rn27-header__ad .widget > * {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;

            width: 100% !important;
            height: 100% !important;

            min-width: 0 !important;

            max-width: 100% !important;
            max-height: 100% !important;

            margin: 0 !important;
            padding: 0 !important;
        }

    .rn27-header .rn27-header__ad a {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;

            width: 100% !important;
            height: 100% !important;

            min-width: 0 !important;

            max-width: 100% !important;
            max-height: 100% !important;

            margin: 0 !important;
            padding: 0 !important;

            line-height: 0;
        }

    .rn27-header .rn27-header__ad img {
            display: block !important;

            width: 100% !important;
            height: 100% !important;

            max-width: 100% !important;
            max-height: 100% !important;

            margin: 0 !important;
            padding: 0 !important;

            object-fit: contain !important;
            object-position: center center !important;
        }

    .rn27-header .rn27-header__nav-wrap {
            grid-area: menu !important;

            position: static !important;

            transform: none !important;

            width: 52px !important;
            min-width: 52px !important;
            max-width: 52px !important;

            margin: 0 !important;
            padding: 0 !important;

            justify-self: end !important;
            align-self: center !important;

            z-index: auto;
        }

    .rn27-header
        .rn27-header__nav-wrap
        #mega-menu-wrap-primary {
            width: 52px !important;
            min-width: 52px !important;
            max-width: 52px !important;

            margin: 0 !important;
            padding: 0 !important;
        }

    .rn27-header
        .rn27-header__nav-wrap
        #mega-menu-wrap-primary
        .mega-menu-toggle {
            width: 52px !important;
            min-width: 52px !important;
            max-width: 52px !important;

            margin: 0 !important;
            padding: 0 !important;
        }

    .rn27-header .rn27-header__actions {
            display: none !important;
        }

    body.mega-menu-primary-mobile-open .rn27-header__logo,
        body.mega-menu-primary-mobile-open .rn27-header__ad {
            visibility: hidden !important;
            pointer-events: none !important;
        }
}
