/* Sprint 15 header and navigation management. */
.hbat-screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    white-space: nowrap;
}

.hbat-site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(0.75rem);
}

.admin-bar .hbat-site-header {
    top: 32px;
}

.hbat-site-header__inner {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--hbat-space-5, 1.25rem);
    min-height: 5rem;
    padding-block: var(--hbat-space-4, 1rem);
}

.hbat-site-branding {
    min-width: 0;
}

.hbat-site-branding__logo img,
.hbat-custom-logo-link img {
    display: block;
    width: auto;
    max-width: 10rem;
    max-height: 3rem;
}

.hbat-primary-navigation {
    justify-self: center;
    min-width: 0;
}

.hbat-menu--primary {
    justify-content: center;
    gap: var(--hbat-space-2, 0.5rem) var(--hbat-space-5, 1.25rem);
}

.hbat-menu--primary a {
    position: relative;
    min-height: 2.75rem;
    color: var(--hbat-color-text, #182114);
    font-weight: 750;
}

.hbat-menu--primary a::after {
    position: absolute;
    right: 0;
    bottom: 0.35rem;
    left: 0;
    height: 0.125rem;
    content: "";
    background: var(--hbat-color-primary, #2f6b3f);
    opacity: 0;
    transform: scaleX(0.7);
    transition: opacity 160ms ease, transform 160ms ease;
}

.hbat-menu--primary a:hover::after,
.hbat-menu--primary a:focus-visible::after,
.hbat-menu--primary .current-menu-item > a::after,
.hbat-menu--primary .current_page_item > a::after,
.hbat-menu--primary .current-menu-ancestor > a::after {
    opacity: 1;
    transform: scaleX(1);
}

.hbat-header-actions {
    display: flex;
    align-items: center;
    justify-content: end;
    gap: var(--hbat-space-3, 0.75rem);
}

.hbat-header-icon-button,
.hbat-menu-toggle,
.hbat-header-search__close {
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--hbat-color-border, #d7dfd1);
    border-radius: var(--hbat-radius-md, 0.5rem);
    background: var(--hbat-color-surface, #ffffff);
    color: var(--hbat-color-text, #182114);
    cursor: pointer;
}

.hbat-header-icon-button:hover,
.hbat-header-icon-button:focus-visible,
.hbat-menu-toggle:hover,
.hbat-menu-toggle:focus-visible,
.hbat-header-search__close:hover,
.hbat-header-search__close:focus-visible {
    border-color: var(--hbat-color-primary, #2f6b3f);
    color: var(--hbat-color-primary, #2f6b3f);
}

.hbat-header-icon {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.hbat-menu-toggle,
.hbat-mobile-actions {
    display: none;
}

.hbat-header-cta {
    white-space: nowrap;
}

.hbat-header-search {
    position: absolute;
    top: calc(100% + var(--hbat-space-2, 0.5rem));
    right: var(--hbat-size-container-padding, 1rem);
    z-index: 1001;
    width: min(100% - (2 * var(--hbat-size-container-padding, 1rem)), 34rem);
    padding: var(--hbat-space-3, 0.75rem);
    border: 1px solid var(--hbat-color-border, #d7dfd1);
    border-radius: var(--hbat-radius-md, 0.5rem);
    background: var(--hbat-color-surface, #ffffff);
    box-shadow: 0 1.25rem 3rem rgba(24, 33, 20, 0.16);
}

.hbat-header-search[hidden] {
    display: none;
}

.hbat-header-search__form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: var(--hbat-space-2, 0.5rem);
    align-items: center;
}

.hbat-header-search__input {
    min-width: 0;
    min-height: 2.75rem;
    padding-inline: var(--hbat-space-3, 0.75rem);
    border: 1px solid var(--hbat-color-border, #d7dfd1);
    border-radius: var(--hbat-radius-md, 0.5rem);
    color: var(--hbat-color-text, #182114);
    font: inherit;
}

.hbat-header-search__submit {
    min-height: 2.75rem;
    padding-inline: var(--hbat-space-5, 1.25rem);
    border: 1px solid var(--hbat-color-primary, #2f6b3f);
    border-radius: var(--hbat-radius-md, 0.5rem);
    background: var(--hbat-color-primary, #2f6b3f);
    color: var(--hbat-color-primary-contrast, #ffffff);
    font-weight: 800;
    cursor: pointer;
}

@media (max-width: 782px) {
    .admin-bar .hbat-site-header {
        top: 46px;
    }
}

@media (max-width: 63.999rem) {
    .hbat-site-header__inner {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: var(--hbat-space-3, 0.75rem);
        min-height: 4.5rem;
    }

    .hbat-menu-toggle {
        display: inline-flex;
        justify-self: end;
    }

    .hbat-primary-navigation {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        display: none;
        justify-self: stretch;
        width: 100%;
        max-width: 100%;
        padding: var(--hbat-space-4, 1rem);
        border-top: 1px solid var(--hbat-color-border, #d7dfd1);
        background: var(--hbat-color-surface, #ffffff);
        box-shadow: 0 1.25rem 2rem rgba(24, 33, 20, 0.1);
    }

    .hbat-site-header.is-menu-open .hbat-primary-navigation {
        display: block;
    }

    .hbat-menu--primary {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: var(--hbat-space-1, 0.25rem);
    }

    .hbat-menu--primary a {
        width: 100%;
        min-height: 2.75rem;
        padding-inline: var(--hbat-space-2, 0.5rem);
    }

    .hbat-header-actions {
        display: none;
    }

    .hbat-mobile-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: var(--hbat-space-3, 0.75rem);
        margin-top: var(--hbat-space-4, 1rem);
    }

    .hbat-mobile-actions .hbat-header-icon-button {
        width: 100%;
        justify-content: space-between;
        padding-inline: var(--hbat-space-4, 1rem);
        font-weight: 800;
    }

    .hbat-header-cta--mobile {
        width: 100%;
    }

    .hbat-header-search {
        right: 0;
        left: 0;
        width: 100%;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }
}

@media (max-width: 30rem) {
    .hbat-site-branding__logo img,
    .hbat-custom-logo-link img {
        max-width: 8rem;
    }

    .hbat-header-search__form {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .hbat-header-search__submit {
        grid-column: 1 / -1;
    }
}
