/* ==========================================================================
   Cardinal Roofing - Header Styles
   Replicates Oxygen Builder header for GeneratePress child theme
   ========================================================================== */

/* --- Top Bar --- */
.cr-top-bar {
    background-color: var(--cr-black);
    padding: 8px 0;
    font-size: 13px;
    color: var(--cr-white);
    line-height: 1.4;
}

.cr-top-bar__inner {
    max-width: var(--cr-max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cr-top-bar__left {
    display: flex;
    gap: 20px;
    align-items: center;
}

.cr-top-bar__left a {
    color: var(--cr-white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.3s ease;
}

.cr-top-bar__left a:hover {
    opacity: 0.8;
}

.cr-top-bar__right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.cr-top-bar__right a {
    color: var(--cr-white);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: opacity 0.3s ease;
}

.cr-top-bar__right a:hover {
    opacity: 0.8;
}

.cr-top-bar svg {
    width: 16px;
    height: 16px;
    fill: var(--cr-white);
}

/* --- Main Header --- */
.cr-main-header {
    background-color: var(--cr-dark-gray);
    padding: 0;
    position: relative;
    z-index: 100;
}

.cr-main-header--sticky {
    position: sticky;
    top: 0;
}

.cr-main-header__inner {
    max-width: var(--cr-max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

/* --- Logo --- */
.cr-logo-wrap {
    width: 120px;
    background: var(--cr-white);
    padding: 10px;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.cr-logo-wrap::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 20px;
    background: var(--cr-white);
}

.cr-logo-wrap img,
.cr-logo-wrap .cr-logo-img {
    display: block;
    width: 100%;
    height: auto;
}

.cr-logo-wrap a,
.cr-logo-link {
    display: block;
}

/* --- Navigation --- */
.cr-nav-desktop {
    display: flex;
    align-items: center;
}

.cr-nav-desktop ul,
.cr-nav-list {
    display: flex;
    gap: 5px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.cr-nav-desktop li {
    position: relative;
}

.cr-nav-desktop a {
    color: var(--cr-white);
    padding: 10px 15px;
    font-size: 15px;
    font-family: var(--cr-font);
    font-weight: 500;
    text-decoration: none;
    display: block;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.cr-nav-desktop a:hover {
    color: var(--cr-red);
}

.cr-nav-desktop .current-menu-item > a,
.cr-nav-desktop .current-menu-ancestor > a {
    color: var(--cr-red);
}

/* --- Submenus --- */
.cr-nav-desktop .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--cr-dark-gray);
    min-width: 250px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 99;
    padding: 0;
    margin: 0;
    list-style: none;
    flex-direction: column;
}

.cr-nav-desktop .sub-menu li {
    width: 100%;
}

.cr-nav-desktop .sub-menu a {
    padding: 10px 20px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cr-nav-desktop .sub-menu a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.cr-nav-desktop li:hover > .sub-menu {
    display: flex;
}

/* Nested submenus */
.cr-nav-desktop .sub-menu .sub-menu {
    top: 0;
    left: 100%;
}

/* --- Header CTA --- */
.cr-header-cta .cr-btn {
    font-size: 13px;
    padding: 12px 25px;
}

/* --- Mobile Toggle --- */
.cr-mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    flex-direction: column;
    gap: 5px;
}

.cr-mobile-toggle .cr-hamburger,
.cr-mobile-toggle .cr-hamburger::before,
.cr-mobile-toggle .cr-hamburger::after {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--cr-white);
    transition: all 0.3s ease;
}

.cr-mobile-toggle .cr-hamburger {
    position: relative;
}

.cr-mobile-toggle .cr-hamburger::before,
.cr-mobile-toggle .cr-hamburger::after {
    content: '';
    position: absolute;
    left: 0;
}

.cr-mobile-toggle .cr-hamburger::before {
    top: -7px;
}

.cr-mobile-toggle .cr-hamburger::after {
    top: 7px;
}

.cr-mobile-toggle.is-active .cr-hamburger {
    background-color: transparent;
}

.cr-mobile-toggle.is-active .cr-hamburger::before {
    top: 0;
    transform: rotate(45deg);
}

.cr-mobile-toggle.is-active .cr-hamburger::after {
    top: 0;
    transform: rotate(-45deg);
}

/* --- Mobile Nav Drawer --- */
.cr-mobile-nav {
    display: none;
    background-color: var(--cr-dark-gray);
    padding: 20px;
}

.cr-mobile-nav.is-open {
    display: block;
}

.cr-mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cr-mobile-nav-list li a {
    display: block;
    color: var(--cr-white);
    padding: 12px 0;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cr-mobile-nav-list .sub-menu {
    list-style: none;
    padding: 0 0 0 20px;
    margin: 0;
}

.cr-mobile-nav-list .sub-menu a {
    font-size: 14px;
    padding: 10px 0;
}

/* --- Responsive: Tablet --- */
@media (max-width: 991px) {
    .cr-mobile-toggle {
        display: flex;
    }

    .cr-nav-desktop {
        display: none;
    }

    .cr-header-cta {
        display: none;
    }

    .cr-logo-wrap {
        width: 100px;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 767px) {
    .cr-top-bar {
        display: none;
    }

    .cr-logo-wrap {
        width: 90px;
        padding: 8px;
    }
}
