/* ===================================
   Rahaya Realty — Header
   Theme: White / Black / Gold
=================================== */

:root {
    --color-black: #111111;
    --color-white: #ffffff;
    --color-gold: #b8933e;
    --color-gold-dark: #9c7a2f;
    --color-gray: #555555;
    --header-height: 92px;
    --topbar-height: 40px;
}

* {
    box-sizing: border-box;
}

.site-header {
    /* display:contents removes this wrapper's own box so .main-header's
       sticky containing block is <body> (full page height) instead of
       this element (topbar + header height only) — otherwise the sticky
       header would detach right after the gold bar scrolls past. */
    display: contents;
}

/* ---------- Gold top utility bar ---------- */
.topbar {
    background-color: var(--color-gold);
    height: var(--topbar-height);
}

.topbar-inner {
    max-width: 1280px;
    height: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-social {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-social a {
    color: var(--color-black);
    font-size: 13px;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.topbar-social a:hover {
    opacity: 1;
}

.topbar-email a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-black);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.topbar-email i {
    font-size: 12px;
}

/* ---------- Main header ---------- */
.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--color-white);
    border-bottom: 1px solid #ececec;
}

.main-header-inner {
    max-width: 1280px;
    height: var(--header-height);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* Logo slot */
.site-logo {
    flex-shrink: 0;
    min-width: 180px;
    height: 68px;
    display: flex;
    align-items: center;
}

.site-logo a {
    display: block;
    height: 100%;
}

.site-logo img {
    height: 100%;
    width: auto;
    display: block;
}

/* Desktop nav */
.main-nav ul {
    display: flex;
    align-items: center;
    gap: 36px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-nav a {
    color: var(--color-black);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    position: relative;
    padding: 6px 0;
    transition: color 0.2s ease;
}

.main-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-gold);
    transition: width 0.25s ease;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--color-gold-dark);
}

.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}

/* Right actions: button + hamburger */
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.btn-contact {
    display: inline-block;
    background-color: var(--color-black);
    color: var(--color-white);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 15px 32px;
    border: 1px solid var(--color-black);
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.btn-contact:hover {
    background-color: var(--color-gold-dark);
    border-color: var(--color-gold-dark);
    color: var(--color-white);
}

/* Hamburger (hidden on desktop) */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-toggle span {
    display: block;
    width: 26px;
    height: 2px;
    background-color: var(--color-black);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease, background-color 0.25s ease;
}

.nav-toggle.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ===================================
   Tablet
=================================== */
@media (max-width: 991px) {
    .main-nav ul {
        gap: 22px;
    }

    .btn-contact {
        padding: 10px 18px;
    }
}

/* ===================================
   Mobile
=================================== */
@media (max-width: 768px) {
    :root {
        --header-height: 80px;
        --topbar-height: 36px;
    }

    /* On phones the gold bar only appears while the burger menu is open:
       pinned to the top of the screen, with the header pushed below it.
       It is a plain gold strip; the social icons and email are in the menu. */
    .topbar {
        display: none;
    }

    body.menu-open .topbar {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1001;
    }

    body.menu-open .main-header {
        top: var(--topbar-height);
    }

    .topbar-email,
    .topbar-social {
        display: none;
    }

    .main-header-inner {
        padding: 0 16px;
    }

    .site-logo {
        min-width: 140px;
        height: 64px;
    }

    /* Hide desktop nav, becomes slide-down mobile menu */
    .main-nav {
        /* anchored to the sticky header so it sits right under it whether or
           not the gold bar has scrolled away */
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        background-color: var(--color-white);
        border-bottom: 1px solid #ececec;
        transition: max-height 0.3s ease;
    }

    .main-nav.is-open {
        max-height: calc(100vh - var(--header-height) - var(--topbar-height));
        overflow-y: auto;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 8px 20px 16px;
    }

    .main-nav li {
        width: 100%;
    }

    .main-nav a {
        display: block;
        width: 100%;
        padding: 12px 0;
        border-bottom: 1px solid #f2f2f2;
    }

    .main-nav a::after {
        display: none;
    }

    /* Hide desktop contact button, show hamburger */
    .header-actions .btn-contact {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }
}


/* ===================================
   Off-Plan emirates dropdown
=================================== */
.main-nav .has-submenu {
    position: relative;
}

.main-nav .has-submenu > a::before {
    content: "";
    position: absolute;
    right: -14px;
    top: 50%;
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-70%) rotate(45deg);
}

.main-nav .has-submenu > a {
    margin-right: 14px;
}

.main-nav .submenu {
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 1100;
    min-width: 230px;
    margin: 0;
    padding: 14px 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background-color: var(--color-white);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(17, 17, 17, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

/* invisible bridge so the menu doesn't close while the pointer crosses the gap */
.main-nav .submenu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -22px;
    height: 22px;
}

.main-nav .has-submenu:hover > .submenu,
.main-nav .has-submenu:focus-within > .submenu {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.main-nav .submenu li {
    width: 100%;
}

.main-nav .submenu a {
    display: block;
    padding: 11px 32px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
    white-space: nowrap;
}

.main-nav .submenu a::after {
    display: none;
}

.main-nav .submenu a:hover {
    background-color: #faf6ec;
    color: var(--color-gold-dark);
}

@media (max-width: 768px) {
    .main-nav .has-submenu > a {
        margin-right: 0;
        position: relative;
        padding-right: 28px;
    }

    /* chevron on the right edge of the row; flips when expanded */
    .main-nav .has-submenu > a::before {
        right: 6px;
        width: 8px;
        height: 8px;
        transition: transform 0.2s ease;
    }

    .main-nav .has-submenu.is-expanded > a::before {
        transform: translateY(-30%) rotate(-135deg);
    }

    .main-nav .submenu {
        display: none;
        position: static;
        min-width: 0;
        padding: 0 0 6px 16px;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .main-nav .submenu::before {
        display: none;
    }

    .main-nav .submenu a {
        padding: 10px 0;
        font-size: 14px;
        font-weight: 500;
        border-bottom: 1px solid #f2f2f2;
    }
}

.main-nav .submenu .submenu-all a {
    color: var(--color-gold-dark);
    border-bottom: 1px solid #f0ece0;
    margin-bottom: 6px;
    padding-bottom: 13px;
}

@media (max-width: 768px) {
    .main-nav .has-submenu.is-expanded > .submenu {
        display: flex;
    }
}

/* Mobile: after a tap the link is :hover/:focus-within, which would re-apply the
   desktop dropdown's translate(-50%) and push the list off-screen. Neutralise it. */
@media (max-width: 768px) {
    .main-nav .has-submenu .submenu,
    .main-nav .has-submenu:hover > .submenu,
    .main-nav .has-submenu:focus-within > .submenu {
        left: auto;
        transform: none;
        opacity: 1;
        visibility: visible;
    }
}


/* ===================================
   Mobile menu: contact details + map
=================================== */
.main-nav .mobile-contact {
    display: none;
}

@media (max-width: 768px) {
    .main-nav .mobile-contact {
        display: block;
        padding: 4px 20px 24px;
    }

    .mobile-contact-title {
        margin: 12px 0 10px;
        color: var(--color-gold-dark);
        font-family: var(--font-body);
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.12em;
        text-transform: uppercase;
    }

    .main-nav .mobile-contact-list {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 0 0 18px;
        margin: 0;
        list-style: none;
    }

    .mobile-contact-list li {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        color: var(--color-gray);
        font-family: var(--font-body);
        font-size: 14px;
        line-height: 1.5;
    }

    .mobile-contact-list i {
        flex: 0 0 18px;
        margin-top: 3px;
        color: var(--color-gold);
        text-align: center;
    }

    .main-nav .mobile-contact-list a {
        display: inline;
        width: auto;
        padding: 0;
        border: 0;
        color: var(--color-black);
        font-weight: 500;
    }

    .mobile-contact-map {
        height: 190px;
        overflow: hidden;
        border-radius: 10px;
        border: 1px solid #ece6d6;
    }

    .mobile-contact-map iframe {
        display: block;
    }
}

@media (max-width: 768px) {
    .mobile-contact-social {
        display: flex;
        gap: 10px;
        margin: 0 0 18px;
    }

    .main-nav .mobile-contact-social a {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        padding: 0;
        border: 1px solid var(--color-gold);
        border-radius: 50%;
        color: var(--color-gold-dark);
        font-size: 15px;
        transition: background-color 0.2s ease, color 0.2s ease;
    }

    .main-nav .mobile-contact-social a:hover {
        background: var(--color-gold);
        color: var(--color-black);
    }
}
