/* ==========================================================================
   Mobile Header  — fedhen-header-mobile styles
   Component: <fedhen-header-mobile>
   The desktop <fedhen-header> is hidden below 992px;
   this component takes over and renders a compact top-bar +
   a full-height drawer that slides in from the RIGHT.
   ========================================================================== */

/* ── Show/hide rules ─────────────────────────────────────────────────── */

/* Hide the mobile drawer elements on desktop */
@media (min-width: 769px) {
    fedhen-header-mobile,
    .mh-toggle,
    .mh-backdrop,
    .mh-drawer {
        display: none !important;
    }
}

/* On mobile, adjust the main header to act like the mobile bar */
@media (max-width: 768px) {
    .header {
        display: grid;
        grid-template-columns: 1fr auto auto;
        grid-template-rows: auto auto;
        align-items: center;
        gap: 24px;
        padding: 16px 24px;
        z-index: 1300; /* Keep header above the mobile drawer (1200) */
    }
    
    .top-bar, 
    .nav-container, 
    .nav-container-right {
        display: contents;
    }
    
    .nav-links,
    .top-bar-link {
        display: none !important;
    }

    /* Row 2: Logo, Lang-Switch, Hamburger */
    .logo {
        grid-column: 1 / 2;
        grid-row: 1 / 3;
        width: max-content;
    }
    
    .lang-switch {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
        margin: 0;
    }
    
    .mh-toggle {
        grid-column: 3 / 4;
        grid-row: 2 / 3;
    }

    /* Row 1: CTA Button (Full width) */
    .btn-nav {
        grid-column: 1 / -1;
        grid-row: 1 / 2;
        justify-self: end;
        font-size: 0.65rem;
        line-height: 3;
    }
    
    /* Show full text on the CTA button since it has full width */
    .btn-text-short {
        display: none !important;
    }
    
    .btn-text-full {
        display: inline !important;
    }
}

/* ── Top bar overrides for desktop header acting as mobile header ── */

.header.scrolled .mh-toggle-bar {
    background: var(--primary-color, #0d1b2a);
}

.header.scrolled .lang-switch-btn {
    color: rgba(0, 0, 0, 0.65);
}

.header.scrolled .lang-switch-btn.active {
    color: var(--primary-color, #0d1b2a);
}

.header.scrolled .lang-switch {
    background: rgba(0, 0, 0, 0.05);
}



/* ── Hamburger button ────────────────────────────────────────────────── */

.mh-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mh-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mh-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
    transform-origin: center;
}

/* Animate bars → X when open (add class .mh-toggle--open via JS) */
.mh-toggle--open .mh-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mh-toggle--open .mh-toggle-bar:nth-child(2) { opacity: 0; width: 0; }
.mh-toggle--open .mh-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Backdrop ────────────────────────────────────────────────────────── */

.mh-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1150;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.mh-backdrop--visible {
    opacity: 1;
    visibility: visible;
}

/* ── Drawer ──────────────────────────────────────────────────────────── */

.mh-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    width: min(340px, 90vw);
    background: var(--primary-color, #0d1b2a);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
}

.mh-drawer--open {
    transform: translateX(0);
}

/* ── Drawer header ───────────────────────────────────────────────────── */

.mh-drawer-header {
    display: none; /* Hidden on mobile because the main .header stays on top */
}

.mh-drawer-logo {
    height: 32px;
    width: auto;
    pointer-events: none;
}

.mh-close {
    display: none;
}

/* ── Drawer body (scrollable) ────────────────────────────────────────── */

.mh-drawer-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 120px 0 16px; /* Extra top padding to account for the main header */
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 172, 75, 0.3) transparent;
}

/* ── Mobile menu open header styling ──────────────────────────────────── */

/* When menu is open, make the header look like a dark hero section */
body:has(.mh-drawer--open) .header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #152A43 100%) !important;
    color: var(--bg-white);
    box-shadow: none !important;
}

/* Add the subtle grid pattern from .hero-section */
body:has(.mh-drawer--open) .header::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(197, 168, 128, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(197, 168, 128, .04) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: -1;
}

/* Ensure text and icons are white when menu is open */
body:has(.mh-drawer--open) .header .logo,
body:has(.mh-drawer--open) .header .lang-switch-btn {
    color: var(--bg-white) !important;
}

body:has(.mh-drawer--open) .header .mh-toggle-bar {
    background: var(--bg-white) !important;
}

body:has(.mh-drawer--open) .header .lang-switch {
    background-color: #ffffff26 !important;
    border-color: #ffffff33 !important;
}

/* ── Utility quick links ─────────────────────────────────────────────── */

.mh-utility-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 16px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    margin-bottom: 8px;
}

.mh-util-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    text-transform: uppercase;
    transition: background 0.2s ease, color 0.2s ease;
}

.mh-util-link i {
    font-size: 1rem;
    flex-shrink: 0;
}

.mh-util-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.85);
}

/* ── Primary nav list ────────────────────────────────────────────────── */

.mh-nav {
    list-style: none;
    margin: 0;
    padding: 0 16px;
}

.mh-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mh-item:last-child {
    border-bottom: none;
}

/* Plain (no sub) link */
.mh-item-link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: color 0.2s ease;
}

.mh-item-link:hover {
    color: var(--accent-gold, #d4ac4b);
}

/* Expandable button */
.mh-item-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 12px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.01em;
    transition: color 0.2s ease;
}

.mh-item-btn:hover {
    color: var(--accent-gold, #d4ac4b);
}

.mh-item-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Chevron */
.mh-chevron {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.3s ease, color 0.2s ease;
    flex-shrink: 0;
}

.mh-item--expanded .mh-chevron {
    transform: rotate(180deg);
    color: var(--accent-gold, #d4ac4b);
}

.mh-item--expanded .mh-item-btn {
    color: var(--accent-gold, #d4ac4b);
}

/* ── Submenu (accordion) ─────────────────────────────────────────────── */

.mh-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s ease;
    padding: 0 4px;
}

.mh-item--expanded .mh-sub {
    max-height: 600px;
    padding: 0 4px 12px;
}

.mh-sub-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.mh-sub-link i {
    font-size: 1rem;
    flex-shrink: 0;
    color: var(--accent-gold, #d4ac4b);
    opacity: 0.75;
}

.mh-sub-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    padding-left: 20px;
}

.mh-sub-link:hover i {
    opacity: 1;
}

/* ── Portfolio promo card inside sub ─────────────────────────────────── */

.mh-sub-promo {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px;
    margin: 4px 0 8px;
}

.mh-sub-promo-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

.mh-pulse {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #27ae60;
    border-radius: 50%;
    animation: mhPulse 1.8s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes mhPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.5); }
    50%       { box-shadow: 0 0 0 5px rgba(39, 174, 96, 0); }
}

.mh-sub-promo-logo {
    max-width: 110px;
    height: auto;
    display: block;
    margin-bottom: 8px;
    filter: brightness(0) invert(1);
    opacity: 0.85;
}

.mh-sub-promo-desc {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    line-height: 1.4;
}

/* ── Nav badge ───────────────────────────────────────────────────────── */

.mh-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-gold, #d4ac4b);
    color: var(--primary-color, #0d1b2a);
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
}

/* ── Drawer footer ───────────────────────────────────────────────────── */

.mh-drawer-footer {
    flex-shrink: 0;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* CTA button */
.mh-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    background: var(--accent-gold, #d4ac4b);
    color: var(--primary-color, #0d1b2a) !important;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 10px;
    transition: filter 0.2s ease, transform 0.15s ease;
}

.mh-cta-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.mh-cta-btn i {
    font-size: 1.05rem;
}

/* Contact links */
.mh-contact-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mh-contact-link {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    padding: 12px 0; /* Increase touch target area vertically */
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    transition: color 0.2s ease;
}

.mh-contact-link i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.mh-contact-link:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Social icons */
.mh-social-links {
    display: flex;
    gap: 10px;
}

.mh-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1rem;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.mh-social-btn:hover {
    background: rgba(212, 172, 75, 0.15);
    color: var(--accent-gold, #d4ac4b);
}

/* License line */
.mh-license {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.25);
    margin: 0;
    text-decoration: none;
}

.mh-license a {
    display: inline-block;
    padding: 12px 0;
    transition: color 0.2s ease;
}

.mh-license a:hover {
    color: rgba(255, 255, 255, 0.5);
}
