/*
 * Header Style 4 — Full-Screen Overlay Navigation
 *
 * @package WP Pro Real Estate 7
 * @subpackage CSS
 */

/** ============================================================
 *  Header Bar
 * ============================================================ */

.header-style-four header#masthead {
    display: flex;
    align-items: stretch;
    min-height: 89px;
}

/* Override the float-based grid — use flexbox for style 4 header bar */
.header-style-four header#masthead .col.span_12.first {
    display: flex;
    align-items: center;
    width: 100%;
}

.header-style-four header#masthead .col.span_12.first > div,
.header-style-four header#masthead .col.span_12.first > button {
    float: none;
}

/* Logo: shrink to content, override fixed grid % width */
.header-style-four header#masthead .logo-wrap.col.span_3 {
    flex: 0 0 auto;
    width: auto;
}

/* Nav: grow to fill remaining space, override fixed grid % width */
.header-style-four header#masthead .col.span_7 {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.header-style-four header#masthead .col.span_7 nav {
    display: flex;
    align-items: stretch;
    width: 100%;
    justify-content: flex-end;
}

.header-style-four header#masthead .col.span_7 nav ul.ct-menu {
    display: flex;
    align-items: stretch;
    height: 100%;
    justify-content: flex-end;
}

.header-style-four header#masthead .col.span_7 nav ul.ct-menu > li {
    display: flex;
    align-items: stretch;
}

/* Login / register: shrink to content, override fixed grid % width, flush to end */
.header-style-four header#masthead .col.span_1 {
    flex: 0 0 auto;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Hamburger: last item, sits flush at the container end */
.header-style-four header#masthead .ct-overlay-hamburger {
    flex: 0 0 auto;
    margin-left: 0;
}

/* Hide user-name text — show avatar/icon only for a cleaner minimal bar */
.header-style-four .user-frontend li.user-logged-in span.user-name {
    display: none;
}

/* Remove green background from login/register button in style 4 bar */
.header-style-four .user-frontend li.login-register a {
    background: none;
}

/* Remove top-border indicator on hover/active nav items in the style 4 bar */
.header-style-four nav > ul.ct-menu > li:hover > a,
.header-style-four .ct-menu li.current-menu-item > a,
.header-style-four .ct-menu li.current-menu-ancestor > a {
    border-color: transparent !important;
}

/* Uppercase bar nav items */
.header-style-four .ct-menu > li > a {
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Hide bar nav on mobile — login + hamburger remain visible at the far right */
@media only screen and (max-width: 1024px) {
    .header-style-four header#masthead .col.span_7 {
        display: none;
    }

    /* Logo: grow to fill the gap left by the hidden nav, pushing login + hamburger far right.
       Override inherited mobile rules that clip (overflow:hidden) and shrink (padding-right:10%)
       the logo-wrap, causing the logo image to disappear. */
    .header-style-four header#masthead .logo-wrap.col.span_3 {
        flex: 1 1 auto;
        width: auto !important;
        padding-right: 0 !important;
        overflow: visible;
        min-width: 0;
    }

    /* Login: prevent the responsive grid from overriding width:auto with a % value,
       which would cause the flex row to overflow the container. */
    .header-style-four header#masthead .col.span_1 {
        width: auto !important;
    }
}

/** ============================================================
 *  Transparent Header overrides (Header Style 4)
 * ============================================================ */

/* Logged-in avatar link: no background on trans header */
.header-style-four.trans-header .user-frontend li.user-logged-in > a {
    background: none;
}

/* Hamburger lines: white on transparent header so they read over imagery */
.header-style-four.trans-header .ct-overlay-hamburger .hamburger-line {
    background-color: #ffffff;
}

/** ============================================================
 *  Hamburger Button
 * ============================================================ */

.ct-overlay-hamburger {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-align-items: center;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    border: none;
    padding: 28px 13px;
    background-color: transparent;
    color: inherit;
    vertical-align: middle;
    cursor: pointer;
    outline: none;
    z-index: 915;
    opacity: 1;
    flex-shrink: 0;
    margin-left: 4px;
}

.ct-overlay-hamburger:hover,
.ct-overlay-hamburger:focus {
    background-color: transparent;
    outline: none;
}

/* Inner wrapper — the gap compression happens here, not on the button */
.ct-overlay-hamburger .hamburger-box {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 22px;
    transition: gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover: bars compress toward each other with easing */
.ct-overlay-hamburger:hover .hamburger-box {
    gap: 5px;
}

/* Three lines */
.ct-overlay-hamburger .hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #121212;
    border-radius: 1px;
    transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover: line color driven by dynamic CSS (ct_header_four_overlay_link_hover_color)
   — this default matches the overlay gold default */
.ct-overlay-hamburger:hover .hamburger-line {
    background-color: rgba(180, 160, 120, 1);
}

/** ============================================================
 *  Full-Screen Overlay
 * ============================================================ */

#ct-nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999999999;
    background-color: rgba(18, 18, 18, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 80px 60px 60px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    overflow-y: auto;
}

#ct-nav-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Prevent body scroll when overlay is open */
body.ct-overlay-open {
    overflow: hidden;
}

/* Admin bar offset */
body.admin-bar #ct-nav-overlay {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar #ct-nav-overlay {
        top: 46px;
    }
}

/** ============================================================
 *  Close Button
 * ============================================================ */

#ct-overlay-close {
    position: absolute;
    top: 28px;
    right: 32px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#ct-overlay-close:hover {
    opacity: 0.7;
    transform: scale(0.88);
}

#ct-overlay-close span {
    position: absolute;
    width: 24px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
}

#ct-overlay-close span:first-child {
    transform: rotate(45deg);
}

#ct-overlay-close span:last-child {
    transform: rotate(-45deg);
}

/** ============================================================
 *  Primary Menu in Overlay (mobile merge)
 * ============================================================ */

/* Desktop: primary is already in the bar — suppress it in the overlay */
@media only screen and (min-width: 1025px) {
    .ct-overlay-primary-items {
        display: none;
    }
}

/* Mobile: show primary items above overlay items as one cohesive menu */
@media only screen and (max-width: 1024px) {
    .ct-overlay-primary-items {
        display: block;
        padding-bottom: 0.4em;
        margin-bottom: 0.4em;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/** ============================================================
 *  Overlay Navigation
 * ============================================================ */

.ct-overlay-nav-wrap {
    position: relative;
    z-index: 1;
    text-align: right;
}

.ct-overlay-nav ul.ct-overlay-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ct-overlay-nav ul.ct-overlay-menu > li {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.ct-overlay-nav ul.ct-overlay-menu > li > a {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    font-size: clamp(1.5rem, 4vw, 4rem);
    font-family: inherit; /* picks up the theme heading font */
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.2;
    color: rgba(255, 255, 255, 1);
    text-decoration: none;
    padding: 0.18em 0;
    transition: color 0.2s ease;
    text-transform: uppercase;
}

.ct-overlay-nav ul.ct-overlay-menu > li > a:hover {
    color: rgba(180, 160, 120, 1);
    opacity: 1;
}

.ct-overlay-nav ul.ct-overlay-menu > li.current-menu-item > a,
.ct-overlay-nav ul.ct-overlay-menu > li.current-menu-ancestor > a {
    color: rgba(180, 160, 120, 1);
}

/* Full link area opens submenu on first click, navigates on second */
.ct-overlay-nav ul.ct-overlay-menu li.menu-item-has-children > a {
    cursor: pointer;
}

.ct-overlay-nav .ct-overlay-submenu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    cursor: pointer;
    flex-shrink: 0;
}

.ct-overlay-nav .ct-overlay-submenu-toggle i {
    font-size: 0.5em;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.25s ease, color 0.25s ease;
}

.ct-overlay-nav ul.ct-overlay-menu > li > a:hover .ct-overlay-submenu-toggle i {
    color: rgba(180, 160, 120, 1);
}

.ct-overlay-nav li.open > a .ct-overlay-submenu-toggle i {
    transform: rotate(180deg);
    color: rgba(180, 160, 120, 1);
}

/* Sub-menus */
.ct-overlay-nav .sub-menu {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0.2em 0 0.4em;
    position: relative;
    visibility: visible;
}

.ct-overlay-nav .sub-menu a {
    display: block;
    font-size: clamp(0.85rem, 1.8vw, 1.4rem);
    font-family: inherit;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    padding: 0.2em 0;
    text-align: right;
    text-transform: uppercase;
    transition: color 0.2s ease;
}

.ct-overlay-nav .sub-menu a:hover {
    color: rgba(180, 160, 120, 1);
    opacity: 1;
}

.ct-overlay-nav .sub-menu .sub-menu a {
    font-size: clamp(0.75rem, 1.4vw, 1.1rem);
    padding-left: 1.5em;
}

/** ============================================================
 *  Overlay Logo
 * ============================================================ */

.ct-overlay-logo {
    line-height: 0;
}

.ct-overlay-logo a {
    display: inline-block;
}

.ct-overlay-logo img {
    display: block;
    width: auto;
    height: auto;
}

/* Desktop / tablet: bottom-left, absolute */
.ct-overlay-logo-desktop {
    position: absolute;
    bottom: 40px;
    left: 48px;
    max-width: 200px;
}

/* Mobile: shown above first nav item, inline with flow */
.ct-overlay-logo-mobile {
    display: none;
    max-width: 240px;
    margin-bottom: 2rem;
    margin-left: auto;
}

@media only screen and (max-width: 768px) {
    .ct-overlay-logo-desktop {
        display: none;
    }

    .ct-overlay-logo-mobile {
        display: block;
    }

    #ct-nav-overlay {
        padding: 80px 32px 48px;
    }

    .ct-overlay-nav ul.ct-overlay-menu > li > a {
        font-size: clamp(1.5rem, 8vw, 2.8rem);
    }

    .ct-overlay-nav .sub-menu a {
        font-size: clamp(0.85rem, 4vw, 1.1rem);
    }

    #ct-overlay-close {
        top: 24px;
        right: 24px;
    }
}
