/* Auto Glass World - header */
/*
 * Front page (.is-overlay): transparent, over the hero. Other pages: solid dark bar.
 * Past the hero (or the header) the bar turns into the compact fixed bar and slides down (.is-stuck, header.js).
 */
.site-header {
    --agw-header-h: 90px;
    position: relative;
    z-index: 100;
    min-height: var(--agw-header-h);
    background: var(--agw-color-graphite);
    color: var(--agw-color-paper);
}

.site-header.is-overlay {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    background: transparent;
}

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

.header-bar {
    position: relative;
    z-index: 2;
}

.site-header.is-stuck .header-bar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    border-bottom: 1px solid rgba(244, 242, 236, 0.08);
    background: rgba(10, 15, 23, 0.82);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    animation: agw-bar-in 0.5s var(--agw-ease) backwards;
}

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

@keyframes agw-bar-in {
    from {
        transform: translateY(-110%);
    }

    to {
        transform: none;
    }
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 48px;
    min-height: var(--agw-header-h);
    padding-block: 16px;
}

.is-stuck .header-inner {
    gap: 40px;
    min-height: 68px;
    padding-block: 0;
}

.site-logo {
    display: block;
    flex: none;
}

.site-logo img {
    display: block;
    width: auto;
    height: 58px;
}

.is-stuck .site-logo img {
    height: 44px;
}

.header-nav {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 48px;
}

.is-stuck .header-nav {
    gap: 40px;
}

.main-navigation {
    margin-right: auto;
}

.main-menu,
.main-menu .sub-menu {
    margin: 0;
    padding: 0;
    list-style: none;
}

.main-menu {
    display: flex;
    gap: 27px;
}

.is-stuck .main-menu {
    gap: 26px;
}

.main-menu > li {
    position: relative;
}

.site-header .main-menu a {
    position: relative;
    display: block;
    padding-block: 12px;
    color: var(--agw-color-paper);
    font-size: 15px;
    font-weight: 500;
    line-height: 20px;
}

.is-stuck .main-menu > li > a {
    padding-block: 10px;
    font-size: 14.5px;
}

/* Underline grows from the left on hover; the current page keeps it. */
.main-menu > li > a::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 6px;
    left: 0;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s var(--agw-ease);
}

.main-menu > li > a:hover::after,
.main-menu > li > a:focus-visible::after,
.main-menu > .current-menu-item > a::after,
.main-menu > .current-menu-ancestor > a::after {
    transform: scaleX(1);
}

/* Desktop sub-menus open on hover and keyboard focus. */
.main-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: -16px;
    min-width: 220px;
    padding: 8px 16px;
    border: 1px solid rgba(244, 242, 236, 0.08);
    border-radius: 12px;
    background: #121925;
    box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity var(--agw-transition), transform var(--agw-transition), visibility var(--agw-transition);
}

.main-menu li:hover > .sub-menu,
.main-menu li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.site-header .main-menu .sub-menu a {
    padding-block: 8px;
}

.site-header .main-menu .sub-menu a:hover,
.site-header .main-menu .sub-menu .current-menu-item > a {
    color: var(--agw-color-sky);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 48px;
    margin-left: auto; /* stays on the right when no menu is picked */
}

.is-stuck .header-actions {
    gap: 40px;
}

.site-header .header-phone {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--agw-color-paper);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.site-header .header-phone:hover {
    color: var(--agw-color-sky);
}

.header-phone-icon {
    flex: none;
    color: var(--agw-color-sky);
    transition: color 0.2s;
}

.site-header .header-phone:hover .header-phone-icon {
    color: currentColor;
}

.header-call,
.menu-toggle,
.submenu-toggle {
    display: none;
}

/* Tablet and mobile: "Menu" pill + full-screen dark panel under the bar. */
@media (max-width: 1199px) {
    .site-header {
        --agw-header-h: 80px;
    }

    .site-logo img {
        height: 48px;
    }

    /* Logo, then call icon + Menu pill on the right (10px apart; the desktop 48px gap is too wide). */
    .header-inner,
    .is-stuck .header-inner {
        gap: 10px;
    }

    /* Call icon: outlined circle like the Menu pill, before it. */
    .site-header .header-call {
        display: inline-flex;
        flex: none;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin-left: auto;
        border: 1px solid var(--agw-film-line);
        border-radius: 50%;
        color: var(--agw-color-sky);
        transition: border-color var(--agw-transition), color var(--agw-transition);
    }

    .site-header .header-call:hover,
    .site-header .header-call:focus-visible {
        border-color: var(--agw-color-sky);
        color: var(--agw-color-paper);
    }

    .is-stuck .header-call {
        width: 40px;
        height: 40px;
    }

    .header-call + .menu-toggle {
        margin-left: 0;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        min-height: 44px;
        margin-left: auto;
        padding: 0 18px;
        border: 1px solid var(--agw-film-line);
        border-radius: 999px;
        background: none;
        color: var(--agw-color-paper);
        font: 500 15px/1 var(--agw-font-body);
        cursor: pointer;
    }

    .is-stuck .menu-toggle {
        min-height: 40px;
    }

    .menu-toggle-close,
    .menu-toggle-x,
    .menu-open .menu-toggle-open,
    .menu-open .menu-toggle-lines {
        display: none;
    }

    .menu-open .menu-toggle-close,
    .menu-open .menu-toggle-x {
        display: inline;
    }

    /* The bar is solid while the panel is open, also over the hero. No blur here:
       a filter would trap the fixed panel inside the bar. */
    .header-bar {
        transition: background-color 0.35s var(--agw-ease);
    }

    .site-header.menu-open .header-bar {
        background: var(--agw-color-graphite);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .header-nav,
    .is-stuck .header-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 32px;
        overflow-y: auto;
        padding: 24px var(--agw-gutter) 32px;
        background: var(--agw-color-graphite);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-12px);
        /* Close: fade and lift, then hide. Open: show at once, then fade and settle. */
        transition: opacity 0.3s var(--agw-ease), transform 0.3s var(--agw-ease), visibility 0s linear 0.3s;
    }

    .menu-open .header-nav {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: opacity 0.35s var(--agw-ease), transform 0.35s var(--agw-ease), visibility 0s;
    }

    /* Rows come in one after another on open (no delay on close). */
    .main-menu > li,
    .header-actions {
        opacity: 0;
        transform: translateY(8px);
        transition: opacity 0.2s var(--agw-ease), transform 0.2s var(--agw-ease);
    }

    .menu-open .main-menu > li,
    .menu-open .header-actions {
        opacity: 1;
        transform: none;
        transition: opacity 0.4s var(--agw-ease), transform 0.4s var(--agw-ease);
    }

    .menu-open .main-menu > li:nth-child(2) { transition-delay: 0.04s; }
    .menu-open .main-menu > li:nth-child(3) { transition-delay: 0.08s; }
    .menu-open .main-menu > li:nth-child(4) { transition-delay: 0.12s; }
    .menu-open .main-menu > li:nth-child(5) { transition-delay: 0.16s; }
    .menu-open .main-menu > li:nth-child(6) { transition-delay: 0.2s; }
    .menu-open .main-menu > li:nth-child(n + 7),
    .menu-open .header-actions { transition-delay: 0.24s; }

    .main-navigation {
        margin-right: 0;
    }

    .main-menu,
    .is-stuck .main-menu {
        flex-direction: column;
        gap: 0;
        border-top: 1px solid var(--agw-film-line);
    }

    .main-menu > li {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        border-bottom: 1px solid var(--agw-film-line);
    }

    .site-header .main-menu > li > a,
    .is-stuck .main-menu > li > a {
        flex: 1;
        padding-block: 16px;
        font-size: 34px;
        font-weight: 300;
        line-height: 1.1;
        letter-spacing: -0.03em;
    }

    .main-menu > li > a::after {
        display: none;
    }

    /* Arrow on the right of each link (parents keep their show/hide chevron). Moves on hover. */
    .site-header .main-menu > li:not(.menu-item-has-children) > a,
    .site-header .main-menu .sub-menu a {
        display: flex;
        gap: 16px;
        align-items: center;
        justify-content: space-between;
    }

    .main-menu > li:not(.menu-item-has-children) > a::after,
    .main-menu .sub-menu a::after {
        content: "";
        position: static;
        display: block;
        flex: none;
        width: 22px;
        height: 12px;
        background: currentColor;
        opacity: 0.5;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 12'%3E%3Cpath d='M0 6h20M15 1l5 5-5 5' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat center / contain;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 12'%3E%3Cpath d='M0 6h20M15 1l5 5-5 5' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat center / contain;
        transform: none;
        transition: transform var(--agw-transition), opacity var(--agw-transition);
    }

    .main-menu .sub-menu a::after {
        width: 18px;
        height: 10px;
    }

    .main-menu > li:not(.menu-item-has-children) > a:hover::after,
    .main-menu > li:not(.menu-item-has-children) > a:focus-visible::after,
    .main-menu .sub-menu a:hover::after,
    .main-menu .sub-menu a:focus-visible::after,
    .main-menu .current-menu-item > a::after {
        opacity: 1;
        transform: translateX(6px);
    }

    .main-menu > .current-menu-item > a,
    .main-menu > .current-menu-ancestor > a {
        color: var(--agw-color-sky);
    }

    .main-menu .sub-menu {
        position: static;
        flex-basis: 100%;
        min-width: 0;
        padding: 0 0 12px 16px;
        border: 0;
        background: none;
        box-shadow: none;
        opacity: 1;
        visibility: inherit; /* hidden with the closed panel, so it can't cover the Menu button */
        transform: none;
    }

    .site-header .main-menu .sub-menu a {
        font-size: 18px;
    }

    .main-menu .is-collapsed > .sub-menu {
        display: none;
    }

    .submenu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        background: none;
        cursor: pointer;
    }

    .submenu-toggle::before {
        content: "";
        width: 10px;
        height: 10px;
        border-right: 2px solid var(--agw-color-paper);
        border-bottom: 2px solid var(--agw-color-paper);
        transform: rotate(-135deg) translate(-2px, -2px);
        transition: transform var(--agw-transition);
    }

    .is-collapsed > .submenu-toggle::before {
        transform: rotate(45deg) translate(-2px, -2px);
    }

    /* Phone and quote button on one row at the bottom of the panel. */
    .header-actions,
    .is-stuck .header-actions {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        margin-top: auto;
        margin-left: 0;
    }

    /* In the panel the quote button is the wide paper button. */
    .header-btn {
        --agw-btn-font: 16px;
        --agw-btn-height: 56px;
        justify-content: space-between;
        background: var(--agw-color-paper);
        color: var(--agw-color-navy);
    }

    .header-btn.btn-sm:has(.btn-disc) {
        padding: 7px 7px 7px 26px;
    }

    .header-btn:hover,
    .header-btn:focus-visible {
        background: var(--agw-color-paper);
        color: var(--agw-color-navy);
    }

    .header-btn .btn-disc,
    .header-btn.btn-sm .btn-disc {
        width: 42px;
        height: 42px;
        background: var(--agw-color-primary);
        color: var(--agw-color-white);
    }

    html.agw-menu-open {
        overflow: hidden;
    }
}

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

/* WP's admin bar scrolls away below 601px. */
@media (max-width: 600px) {
    .admin-bar .site-header.is-stuck .header-bar {
        top: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header.is-stuck .header-bar {
        animation: none;
    }

    .header-nav,
    .main-menu > li,
    .header-actions {
        transform: none !important;
        transition-delay: 0s !important;
    }
}
