/* MaruVista Site Header */
:root {
    --header-gold: #c9922e;
    --header-gold-light: #e8b84a;
    --header-gold-dark: #9a6b1a;
    --header-green: #1a3d32;
    --header-green-dark: #0f2920;
    --header-white: #ffffff;
    --header-text: #2a2118;
    --header-muted: #6b5d4a;
    --header-height: 118px;
}

.site-header {
    position: relative;
    z-index: 1000;
    font-family: "Outfit", sans-serif;
    transform: translateY(0);
    transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* After scroll: stick to top without covering hero */
.site-header.is-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

.site-header.header-hidden {
    transform: translateY(-100%);
}

.header-spacer {
    display: none;
    width: 100%;
    flex-shrink: 0;
}

/* ── Top utility bar — modern dark strip ── */
.header-top {
    background: linear-gradient(90deg, #0f2920 0%, #1a3d32 55%, #163429 100%);
    color: #fff;
    font-size: 0.78rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-top-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.5rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.header-contact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.header-top-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.7rem 0.35rem 0.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 0.74rem;
    font-weight: 500;
    transition: background 0.25s, border-color 0.25s, transform 0.2s;
}

.header-top-pill:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(232, 201, 106, 0.35);
    transform: translateY(-1px);
}

.header-top-pill__icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(201, 146, 46, 0.25), rgba(232, 201, 106, 0.15));
    border: 1px solid rgba(232, 201, 106, 0.2);
    flex-shrink: 0;
}

.header-top-pill__icon svg {
    width: 13px;
    height: 13px;
    fill: #e8c96a;
}

.header-top-pill__label {
    line-height: 1.2;
    white-space: nowrap;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.header-top-pill__label.is-phone-fading {
    opacity: 0;
    transform: translateY(3px);
}

.header-top-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.header-socials {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.header-socials a {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s, border-color 0.2s;
}

.header-socials a:hover {
    transform: translateY(-2px);
    background: rgba(201, 146, 46, 0.22);
    border-color: rgba(232, 201, 106, 0.35);
}

.header-socials svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}

.header-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem 0.45rem 0.85rem;
    background: linear-gradient(135deg, #c9922e 0%, #e8c96a 100%);
    color: #1a1510;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(201, 146, 46, 0.35);
    transition: transform 0.25s, box-shadow 0.25s, filter 0.25s;
    white-space: nowrap;
}

.header-cta svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

.header-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(201, 146, 46, 0.45);
    filter: brightness(1.05);
}

/* Admin button (top bar) */
.header-admin-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    color: var(--header-text);
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.header-admin-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--header-gold);
}

.header-admin-btn:hover {
    background: #fffdf8;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    transform: translateY(-1px);
}

.header-admin-btn:focus-visible {
    outline: 2px solid var(--header-gold);
    outline-offset: 1px;
}

/* ── Main navigation ── */
.header-main {
    position: relative;
    background: var(--header-white);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.header-main-inner {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.5rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 64px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    flex-shrink: 0;
    z-index: 2;
}

.header-brand img {
    height: 52px;
    width: auto;
    object-fit: contain;
}

.header-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.header-brand-text .name {
    font-family: "Cinzel", serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--header-gold);
    letter-spacing: 0.06em;
}

.header-brand-text .sub {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--header-green);
    font-weight: 500;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.05rem;
    flex-wrap: nowrap;
    justify-content: center;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    max-width: calc(100% - 280px);
}

/* Nav link animations */
.header-nav--animated > .header-nav-link,
.header-nav--animated > .header-nav-item {
    animation: headerNavFadeIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.header-nav--animated > *:nth-child(1) { animation-delay: 0.06s; }
.header-nav--animated > *:nth-child(2) { animation-delay: 0.11s; }
.header-nav--animated > *:nth-child(3) { animation-delay: 0.16s; }
.header-nav--animated > *:nth-child(4) { animation-delay: 0.21s; }
.header-nav--animated > *:nth-child(5) { animation-delay: 0.26s; }
.header-nav--animated > *:nth-child(6) { animation-delay: 0.31s; }
.header-nav--animated > *:nth-child(7) { animation-delay: 0.36s; }

@keyframes headerNavFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-nav-link,
.header-nav-dropdown-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.5rem 0.55rem;
    color: var(--header-text);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: color 0.25s, transform 0.25s;
    flex-shrink: 0;
}

button.header-nav-dropdown-trigger {
    appearance: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: inherit;
    margin: 0;
}

.header-nav-link::after,
.header-nav-dropdown-trigger::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0.3rem;
    width: 0;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--header-gold-dark), var(--header-gold-light));
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.header-nav-link:hover,
.header-nav-dropdown-trigger:hover,
.header-nav-link.active,
.header-nav-dropdown-trigger.active {
    color: var(--header-gold);
    transform: translateY(-1px);
}

.header-nav-link:hover::after,
.header-nav-dropdown-trigger:hover::after,
.header-nav-link.active::after,
.header-nav-dropdown-trigger.active::after {
    width: calc(100% - 1.4rem);
}

.header-nav-link.active,
.header-nav-dropdown-trigger.active {
    font-weight: 600;
}

.header-nav-link.active::after,
.header-nav-dropdown-trigger.active::after {
    animation: headerNavUnderlineGlow 2.4s ease-in-out infinite;
}

@keyframes headerNavUnderlineGlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.header-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.5rem 0.55rem;
    color: var(--header-text);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-nav a:hover,
.header-nav a.active {
    color: var(--header-gold);
}

.header-nav a.active {
    font-weight: 600;
}

.header-nav .chev {
    font-size: 0.55rem;
    opacity: 0.6;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.header-nav-item--dropdown:hover .chev,
.header-nav-item--dropdown.open .chev {
    transform: rotate(180deg);
    opacity: 1;
}

.header-nav-item {
    position: relative;
}

.header-nav-item--dropdown .header-nav-dropdown {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    min-width: 220px;
    padding: 0.5rem 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 200;
}

.header-nav-item--dropdown:hover .header-nav-dropdown,
.header-nav-item--dropdown.open .header-nav-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.header-nav-dropdown a {
    display: block;
    padding: 0.55rem 1.1rem;
    font-size: 0.82rem;
    color: var(--header-text, #333);
    white-space: nowrap;
    border-bottom: none;
}

.header-nav-dropdown a:hover {
    background: rgba(198, 156, 76, 0.08);
    color: var(--header-gold);
}

.header-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    margin-left: auto;
    z-index: 2;
}

.header-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--header-text);
    border-radius: 1px;
    transition: transform 0.25s, opacity 0.25s;
}

.header-menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.header-menu-btn.open span:nth-child(2) { opacity: 0; }
.header-menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu backdrop */
.header-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 990;
    background: rgba(15, 41, 32, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s;
    -webkit-tap-highlight-color: transparent;
}

.header-menu-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.nav-menu-open {
    overflow: hidden;
    touch-action: none;
}

/* Keep header visible while mobile menu is open */
body.nav-menu-open .site-header.header-hidden {
    transform: none;
}

/* Mobile */
@media (max-width: 960px) {
    :root { --header-height: 108px; }

    .header-contact { gap: 0.35rem; }

    .header-top-pill__label--email {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-top-pill {
        font-size: 0.68rem;
        padding: 0.3rem 0.55rem 0.3rem 0.3rem;
    }

    .header-top-pill__icon {
        width: 24px;
        height: 24px;
    }
    .header-socials { display: none; }
    .header-menu-btn {
        display: flex;
        flex-shrink: 0;
        position: relative;
        z-index: 20;
    }

    .header-brand .brand-text-animated__tagline {
        display: none;
    }

    .header-main {
        position: relative;
        z-index: 1001;
    }

    .header-main-inner {
        flex-wrap: nowrap;
        overflow: visible;
    }

    .header-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        margin: 0;
        transform: none;
        background: var(--header-white);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        padding: 0.35rem 0 0.75rem;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition:
            max-height 0.35s ease,
            opacity 0.25s ease,
            visibility 0.25s;
        z-index: 1002;
    }

    .header-nav.open {
        max-height: min(78vh, 640px);
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .header-nav a,
    .header-nav-link,
    .header-nav-dropdown-trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0.9rem 1.25rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        transform: none;
        white-space: normal;
        line-height: 1.3;
        box-sizing: border-box;
    }

    .header-nav-link::after,
    .header-nav-dropdown-trigger::after {
        display: none;
    }

    .header-nav--animated > .header-nav-link,
    .header-nav--animated > .header-nav-item {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .header-nav-item {
        width: 100%;
    }

    /* Mobile accordion: only .open (no :hover — sticky hover kept it open) */
    .header-nav-item--dropdown .header-nav-dropdown {
        position: static;
        left: auto;
        top: auto;
        transform: none !important;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        margin: 0;
        min-width: 0;
        width: 100%;
        background: #eef3f1;
        border-top: 0 solid rgba(26, 61, 50, 0.1);
        border-bottom: 0 solid rgba(26, 61, 50, 0.1);
        opacity: 1;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        pointer-events: none;
        transition:
            max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
            padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
            border-width 0.35s ease,
            visibility 0.35s;
    }

    .header-nav-item--dropdown.open .header-nav-dropdown {
        visibility: visible;
        max-height: 480px;
        pointer-events: auto;
        transform: none !important;
        opacity: 1;
        padding: 0.35rem 0;
        border-top-width: 1px;
        border-bottom-width: 1px;
    }

    .header-nav-item--dropdown:hover .chev {
        transform: none;
    }

    .header-nav-item--dropdown.open .chev {
        transform: rotate(180deg);
        opacity: 1;
    }

    /* Submenu links — dark text on light green (fix white-on-white) */
    .header-nav .header-nav-dropdown a,
    .header-nav-dropdown a {
        display: block;
        padding: 0.75rem 1.25rem 0.75rem 2rem;
        font-size: 0.9rem;
        font-weight: 500;
        color: #1a3d32 !important;
        background: transparent;
        white-space: normal;
        border-bottom: 1px solid rgba(26, 61, 50, 0.06);
        line-height: 1.35;
    }

    .header-nav .header-nav-dropdown a:last-child {
        border-bottom: none;
    }

    .header-nav .header-nav-dropdown a:hover,
    .header-nav .header-nav-dropdown a:active,
    .header-nav .header-nav-dropdown a:focus {
        color: #9a6b1a !important;
        background: rgba(201, 146, 46, 0.14);
    }

    .header-nav > a.header-nav-link,
    .header-nav .header-nav-dropdown-trigger {
        color: #1a3d32;
    }

    .header-nav .header-nav-dropdown-trigger .chev {
        color: #1a3d32;
        opacity: 0.75;
    }

    .header-brand img { height: 44px; }
    .header-brand-text .name { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .header-nav--animated > .header-nav-link,
    .header-nav--animated > .header-nav-item {
        animation: none;
    }

    .header-nav-link:hover,
    .header-nav-dropdown-trigger:hover {
        transform: none;
    }

    .header-nav-link.active::after,
    .header-nav-dropdown-trigger.active::after {
        animation: none;
    }
}

@media (max-width: 520px) {
    :root { --header-height: 148px; }

    .header-top-inner { justify-content: center; }
    .header-contact { justify-content: center; width: 100%; }
    .header-top-right { width: 100%; justify-content: center; flex-wrap: wrap; margin-top: 0.15rem; }
    .header-cta { flex: 1; text-align: center; max-width: 220px; justify-content: center; }
}
