.top-bar {
    background: var(--color-navy-900);
    color: var(--color-gray-300);
    font-size: var(--fs-sm);
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(6, 182, 212, 0.15);
}

.top-bar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: var(--space-4);
}

.top-bar__info {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    flex-wrap: wrap;
}

.top-bar__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-gray-300);
    transition: color var(--t-base);
}

.top-bar__link:hover {
    color: var(--color-blue-500);
}

.top-bar__link i {
    color: var(--color-blue-500);
    font-size: 0.85em;
}

.top-bar__social {
    display: flex;
    gap: var(--space-3);
}

.top-bar__social a {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-full);
    color: var(--color-gray-300);
    transition: all var(--t-base);
}

.top-bar__social a:hover {
    background: var(--color-blue-500);
    color: var(--color-navy-900);
}

@media (max-width: 768px) {.top-bar__hours { display: none; }
.top-bar__info { gap: var(--space-4); }}

.header {
    background: var(--color-white);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--t-base), top var(--t-base);
}

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

.logged-in:not(.elementor-editor-active) .header.is-scrolled {
    top: 30px;
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    padding-block: var(--space-4);
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

.nav__list {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.nav__item {
    position: relative;
}

.nav__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.6rem 0.9rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: var(--fs-sm);
    color: var(--color-gray-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 0;
    position: relative;
    transition: color var(--t-base), background-color var(--t-base), box-shadow var(--t-base);
}

.nav__link:hover,
.nav__link--active {
    color: var(--color-blue-600);
}

.nav__link--active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.12) 0%, rgba(59, 130, 246, 0.12) 100%);
    box-shadow: none;
}

li.nav__link--active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0.15rem;
    width: 18px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--color-blue-500), var(--color-blue-600));
    transform: translateX(-50%);
    transition: width var(--t-base);
}

li.nav__link--active:hover::after {
    width: 26px;
}

.nav__caret {
    font-size: 0.7em;
    transition: transform var(--t-base);
}

.nav__item--dropdown:hover > .nav__caret {
    transform: rotate(180deg);
}

/* Nested parents fly out sideways, so their chevron starts pointing
   right and rotates down when the sub-menu opens. */
.nav__caret--side {
    font-size: 0.65em;
}

.nav__item--dropdown:hover > .nav__caret--side,
.nav__item--dropdown:focus-within > .nav__caret--side {
    transform: rotate(90deg);
}

/* Second-level parents (Heating, Cooling) are a flex row: the label
   takes the free space and the caret is pushed to the trailing edge
   of the panel, vertically centered. */
.nav__dropdown > .nav__item--dropdown > .nav__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: var(--space-3);
}

.nav__dropdown li {
    margin: 5px auto;
}

/* Keep the label from being squeezed by a long caret-free sibling. */
.nav__dropdown > .nav__item--dropdown > .nav__link .nav__caret--side {
    flex: 0 0 auto;
    margin-left: auto;
}

.nav__item--has-active .nav__link {
    color: var(--color-blue-600);
}

.nav__item--has-active .nav__link::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0.15rem;
    width: 18px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--color-blue-500), var(--color-blue-600));
    transform: translateX(-50%);
}

@media (max-width: 960px) {
    .nav__item--has-active .nav__link::after {
        display: none;
    }
}

.nav__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    /* No `overflow` here: a clipping ancestor would cut off the
       third-level flyout that renders outside this panel. */
    background: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--t-base);
    border-top: 3px solid var(--color-blue-500);
}

/* Reveal only the dropdown belonging to the item actually hovered.
   This must stay a child combinator: a descendant selector would
   open the Heating *and* Cooling flyouts simultaneously the moment
   Services is hovered, since both sit inside it. */
.nav__item--dropdown:hover > .nav__dropdown,
.nav__item--dropdown:focus-within > .nav__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ---------- Third-level flyout ----------
   Menus nested deeper than two levels (Services → Heating → Gas
   Furnaces) fly out to the side instead of stacking downward, so the
   third level stays visible instead of overflowing off-screen. */
.nav__dropdown .nav__dropdown {
    /* Align the flyout's top edge with the parent row ("Heating")
       rather than hanging below it, so the first child reads as a
       continuation of the row it belongs to. */
    top: 0;
    left: 100%;
    border-top: 0;
    border-left: 3px solid var(--color-blue-500);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    transform: translateX(10px);
    /* Long lists (e.g. 7 heating services) scroll within the flyout
       instead of running past the viewport. Clipping is safe here
       because this panel's own children are what scroll. */
    max-height: min(70vh, 420px);
    overflow-y: auto;
}

/* Hover bridge: the flyout is offset sideways by its transform while
   entering, and the parent row's padding leaves a small gap before it.
   This invisible strip spans that gap so the pointer can cross without
   momentarily leaving every ancestor and snapping the menu shut. */
.nav__dropdown .nav__dropdown::before {
    content: "";
    position: absolute;
    top: 0;
    right: 100%;
    width: 12px;
    height: 100%;
}

/* The desktop safety net in responsive.css targets every .nav__dropdown
   descendant, so re-open the third level when any ancestor is hovered. */
.nav__item--dropdown:hover > .nav__dropdown .nav__dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nav__dropdown li a {
    display: block;
    padding: 0.7rem 1rem;
    font-size: var(--fs-sm);
    color: var(--color-gray-700);
    border-radius: var(--radius-sm);
    position: relative;
    transition: all var(--t-fast);
}

.nav__dropdown li a:hover {
    background: var(--color-gray-50);
    color: var(--color-blue-600);
}

.nav__dropdown li a.current-menu-item,
.nav__dropdown li a.is-active,
.nav__dropdown li a.active {
    color: var(--color-blue-600);
    font-weight: 600;
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.10) 0%, rgba(6, 182, 212, 0) 100%);
}

.nav__dropdown li a.current-menu-item::before,
.nav__dropdown li a.is-active::before,
.nav__dropdown li a.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--color-blue-500), var(--color-blue-600));
}

ul ul > li.nav__link--active::after {
    left: 15%;
}

/* ---------- Third-level links ----------
   Declared after the base `.nav__dropdown li a` rules above so these
   values aren't overridden by them. */
.nav__dropdown .nav__dropdown {
    /* Room for service names like "Hot Water / Warm Air Heaters"
       without wrapping, since this panel holds the longest labels. */
    min-width: 280px;
    /* No bullets at this level — the flyout is already visually
       nested, and a marker here reads as an odd floating dot. */
    list-style: none;
}

.nav__dropdown .nav__dropdown li {
    list-style: none;
}

/* Match the second level's inset exactly (see `.nav__dropdown li a`)
   so both panels line up on their left edge. */
.nav__dropdown .nav__dropdown li a {
    padding-left: 1rem;
}

.nav__cta {
    padding: 0.7rem 1.4rem;
    font-size: var(--fs-sm);
}

.hamburger {
    display: none;
    width: 36px;
    height: 36px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    z-index: 110;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--color-navy-900);
    border-radius: 2px;
    transition: all var(--t-base);
}

.hamburger.is-active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger.is-active span:nth-child(2) {
    opacity: 0;
}

.hamburger.is-active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

@media (min-width: 961px) {
    .mobile-only {
        display: none;
    }
}

@media (max-width: 960px) {
    .hamburger { display: flex; }

    .nav {
        position: fixed;
        top: 0;
        right: 0;
        width: 320px;
        max-width: 85vw;
        height: 100vh;
        background: var(--color-white);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 5rem 1.5rem 1.5rem;
        gap: var(--space-4);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
        transform: translateX(100%);
        transition: transform var(--t-base);
        overflow-y: auto;
    }

    .nav.is-open {
        transform: translateX(0);
    }

    .nav__list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .nav__link {
        padding: 0.9rem 1rem;
        border-bottom: 1px solid var(--color-gray-100);
        border-radius: var(--radius-md);
    }

    .nav__link--active {
        background: linear-gradient(90deg, rgba(6, 182, 212, 0.14) 0%, rgba(6, 182, 212, 0) 100%);
        box-shadow: inset 3px 0 0 0 var(--color-blue-100);
        border-radius: 0 var(--radius-md) var(--radius-md) 0;
    }

    .nav__link--active::after {
        display: none;
    }

    li.nav__link--active li.nav__link--active li.nav__link--active {
        padding-left: 0;
    }

    li.nav__link--active li.nav__link--active::after {
        display: none;
    }

    .nav__link--active li:last-of-type {
        margin-bottom: 15px;
    }

    .nav__dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        padding: 0;
        border: none;
        margin-left: var(--space-4);
    }

    .nav__dropdown li a {
        padding: 0.6rem 0.75rem;
    }

    .nav__dropdown li a.current-menu-item,
    .nav__dropdown li a.is-active,
    .nav__dropdown li a.active {
        background: linear-gradient(90deg, rgba(6, 182, 212, 0.12) 0%, rgba(6, 182, 212, 0) 100%);
    }

    .nav__cta {
        margin-top: var(--space-4);
    }

    .nav__caret { display: none; }
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--color-blue-500);
    color: var(--color-navy-900);
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--t-base);
    z-index: 99;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--color-blue-600);
    transform: translateY(-4px);
}

.container.header__inner .custom-logo {
    display: block;
    margin-left: 0;
    max-width: 200px;
}
