/* ============================================================
   Heron Lakes — Header
   ============================================================ */

/* -------------------------------------------------------
   Sticky footer foundation
   ------------------------------------------------------- */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main {
    flex: 1;
}

/* Inner pages only — compensates for the now-fixed .site-header so
   content starts right below the nav instead of hidden behind it.
   Homepage is excluded on purpose: the hero is designed to sit
   full-bleed behind the transparent fixed header. */
body:not(.home) .site-main {
    padding-block-start: var(--header-height);
}

/* -------------------------------------------------------
   Skip to content (accessibility)
   ------------------------------------------------------- */
.skip-to-content {
    position: absolute;
    inset-block-start: -100%;
    inset-inline-start: 0;
    z-index: 9999;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-primary);
    color: var(--color-white);
    font-weight: 600;
}

.skip-to-content:focus {
    inset-block-start: 0;
}

/* -------------------------------------------------------
   Site Header
   ------------------------------------------------------- */

/* Sticky on every page — on the homepage it overlays the hero;
   on inner pages the content below gets padding-top to compensate
   (see .site-main rule further down). Solid navy by default (inner
   pages don't need transparency — nothing behind the header to see
   through to, unlike the homepage hero). */
.site-header {
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    z-index: 100;
    background-color: var(--color-navy);
    box-shadow: 0 0 12px var(--overlay-black-07);
    transition: background-color var(--transition-base), box-shadow var(--transition-base);
}

/* Homepage only — starts semi-transparent to overlay the hero */
.home .site-header {
    background-color: var(--overlay-navy-94);
}

/* Scrolled — solid navy, no transparency */
.site-header.is-scrolled {
    background-color: var(--color-navy);
}

/* Logged-in admin viewing the front end — WP's own #wpadminbar is fixed
   at the very top (z-index 99999), so the fixed .site-header needs to
   start below it instead of at 0, or the admin bar renders on top of/
   hides the header's own top edge. Matches WP core's admin-bar height
   and its 782px breakpoint (unrelated to this theme's own breakpoints). */
body.admin-bar .site-header {
    top: 32px;
}

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

/* -------------------------------------------------------
   Header Inner — flex row: logo | nav | cta
   Height driven by clamp() for fluid scaling 70px → 90px
   ------------------------------------------------------- */
.header-inner {
    display: flex;
    align-items: center;
    gap: clamp(16px, 3vw, 40px);
    min-height: var(--header-height);
}

/* When no CTA: push nav to the right */
.header-inner.no-cta .header-nav {
    margin-inline-start: auto;
}

/* When CTA exists: nav centered between logo and CTA */
.header-inner.has-cta .header-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* -------------------------------------------------------
   Logo
   ------------------------------------------------------- */
.header-logo {
    flex-shrink: 0;
    line-height: 1;
}

.header-logo a {
    display: block;
}

.header-logo-img {
    width: 100%;
    max-width: clamp(150px, 18vw, 230px);
    height: auto;
    object-fit: contain;
}

.header-logo-text {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    color: var(--color-white);
}

/* -------------------------------------------------------
   Main Navigation — Desktop
   ------------------------------------------------------- */
.header-nav {
    display: flex;
    align-items: center;
}

.main-menu {
    display: flex;
    align-items: center;
    list-style: none;
    gap: clamp(20px, 2.5vw, 40px);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(0.8rem, 1vw, 0.9rem);
}

/* Top-level items */
.main-menu > .top-level-item {
    position: relative;
}

.main-menu > .top-level-item > a {
    position: relative;
    display: block;
    color: var(--color-white);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    padding-block-end: 4px;
    transition: color var(--transition-base);
}

.main-menu > .top-level-item > a:hover,
.main-menu > .top-level-item.current-menu-item > a,
.main-menu > .top-level-item.current-menu-ancestor > a,
.main-menu > .top-level-item.current-menu-parent > a {
    color: var(--color-blue-bright);
}

/* Chevron for items with sub-menus */
.main-menu > .top-level-item.has-children > a {
    padding-inline-end: 14px;
}

.main-menu > .top-level-item.has-children > a::before {
    content: '';
    position: absolute;
    inset-inline-end: 0;
    top: 50%;
    translate: 0 -60%;
    width: 0;
    height: 0;
    border-inline: 4px solid transparent;
    border-block-start: 4px solid currentColor;
}

/* Sub-menu toggle button: hidden on desktop, mobile-menu.css shows it on mobile */
.sub-menu-toggle {
    display: none;
}

/* CSS chevron arrow: hide on mobile (mobile uses the toggle button instead) */
@media (max-width: 1024px) {
    .main-menu > .top-level-item.has-children > a::before {
        display: none;
    }
}

/* Mobile — hide CTA, push nav all the way right */
@media (max-width: 1024px) {
    .header-cta-wrap {
        display: none;
    }

    .header-inner.has-cta .header-nav {
        flex: unset;
        justify-content: unset;
        margin-inline-start: auto;
    }
}

/* -------------------------------------------------------
   Sub-menu — Desktop dropdown
   ------------------------------------------------------- */
@media (min-width: 1025px) {
    .sub-menu,
    .sub-sub-menu {
        display: none;
        position: absolute;
        inset-block-start: 100%;
        inset-inline-start: 0;
        z-index: 200;
        min-width: 200px;
        list-style: none;
        background-color: var(--color-navy);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-lg);
        padding-block-start: calc(var(--space-sm) + 8px); /* 8px visual gap above first item */
        padding-block-end: var(--space-sm);
    }

    .sub-sub-menu {
        inset-block-start: 0;
        inset-inline-start: 100%;
    }

    /* Show on hover and keyboard focus */
    .has-children:hover > .sub-menu,
    .has-children:focus-within > .sub-menu,
    .has-children:hover > .sub-sub-menu,
    .has-children:focus-within > .sub-sub-menu {
        display: block;
    }

    .sub-menu a,
    .sub-sub-menu a {
        display: block;
        white-space: nowrap;
        color: var(--color-white);
        padding: 10px var(--space-lg);
        text-transform: uppercase;
        letter-spacing: 0.06em;
        font-family: var(--font-heading);
        font-weight: 600;
        font-size: 0.8rem;
        transition: color var(--transition-fast);
    }

    .sub-menu a:hover,
    .sub-sub-menu a:hover,
    .sub-menu .current-menu-item > a,
    .sub-sub-menu .current-menu-item > a {
        color: var(--color-blue-bright);
    }

    /* Hide mobile-only elements on desktop */
    .sub-menu-toggle,
    .mobile-menu-toggle {
        display: none;
    }
}

/* -------------------------------------------------------
   Header CTA wrapper — the button itself is .cta-button (main.css),
   shared sitewide, not header-specific.
   ------------------------------------------------------- */
.header-cta-wrap {
    flex-shrink: 0;
}
