/* ============================================================
   TRISTAN HOLDINGS UK — header.css  |  Redesign v3.0
   New: Transparent-to-glass header, pill nav, sleek dropdowns
   ============================================================ */

/* ============================================================
   TOP BAR
   ============================================================ */
.th-top-bar {
    display: none;
    background: var(--th-primary-deep, #091F42);
    border-bottom: 1px solid rgba(90,174,224,0.12);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1002;
    font-size: 0.78rem;
    font-family: 'Inter', sans-serif;
    transition: transform 0.35s ease;
}

.th-top-bar.hidden {
    transform: translateY(-100%);
}

.top-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    gap: 16px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.5);
    flex-wrap: wrap;
}

.top-bar-left a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.top-bar-left a:hover { color: var(--th-gold); }
.top-bar-left .sep { opacity: 0.2; }

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.tb-badge {
    color: rgba(255, 255, 255, 0.55);
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
}

.tb-badge i { color: var(--th-gold); font-size: 0.72rem; }

.tb-cta {
    background: var(--th-accent);
    color: #ffffff !important;
    padding: 5px 14px;
    border-radius: 100px;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.25s;
    white-space: nowrap;
}

.tb-cta:hover {
    transform: translateY(-1px);
    background: var(--th-accent-light);
    box-shadow: 0 5px 14px rgba(90, 174, 224, 0.40);
}

/* ============================================================
   MAIN HEADER — Always white, shadow on scroll
   ============================================================ */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 14px 0;
    background: #ffffff;
    border-bottom: 1.5px solid #D8E6F4;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* On tablet/desktop, header sits below the fixed top bar */
@media (min-width: 768px) {
    header { top: 38px; }
    header.sticky { top: 0; }
}

/* Scrolled / sticky state — still white, stronger shadow */
header.sticky {
    padding: 10px 0;
    background: #ffffff;
    border-bottom-color: #D8E6F4;
    box-shadow: 0 4px 24px rgba(27, 80, 136, 0.10);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ============================================================
   LOGO
   ============================================================ */

/* Fixed-height container — prevents any admin-uploaded logo from ever
   pushing the header taller. overflow:hidden is the hard guard.
   Mobile-first: 64px → 80px (768px+) → 100px (992px+) */
.logo {
    height: 64px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    overflow: hidden;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    height: 100%;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--th-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 1.4rem;
    color: #ffffff;
    flex-shrink: 0;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(27, 80, 136, 0.25);
}

.logo:hover .logo-icon {
    transform: rotate(-3deg) scale(1.05);
    box-shadow: 0 6px 20px rgba(27, 80, 136, 0.40);
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-main {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: #1B5088;
    font-size: 1.15rem;
    letter-spacing: 2px;
}

.logo-sub {
    font-size: 0.55rem;
    color: #5AAEE0;
    letter-spacing: 3px;
    margin-top: 3px;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
}

/* Image / SVG logo variants */
.logo-img {
    height: 64px;           /* mobile base — scales up via media queries */
    width: auto;
    max-width: 220px;       /* guards against ultra-wide logos squeezing the nav */
    display: block;
    object-fit: contain;
}

.logo-svg-wrap {
    display: flex;
    align-items: center;
    max-height: 64px;
}
.logo-svg-wrap svg {
    max-height: 64px;
    width: auto;
    display: block;
}

/* ============================================================
   NAVIGATION — Mobile slide-out panel
   ============================================================ */
#mainNav {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(340px, 85vw);
    height: 100dvh;
    height: 100vh;
    background: #ffffff;
    border-left: 2px solid #D8E6F4;
    padding: 90px 24px 36px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: right 0.45s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 1003;
    box-shadow: -8px 0 32px rgba(27,80,136,0.08);
}

#mainNav.active { right: 0; }

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1B5088;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.3px;
    padding: 14px 16px;
    border-radius: 12px;
    transition: all 0.25s ease;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.nav-link i.fa-chevron-down {
    font-size: 0.65rem;
    transition: transform 0.3s ease;
    margin-left: auto;
    opacity: 0.6;
}

.nav-link:hover,
.nav-item.active .nav-link {
    color: #1B5088;
    background: rgba(27, 80, 136, 0.08);
}

/* ============================================================
   MOBILE DROPDOWN
   ============================================================ */
.mega-menu {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    border: none;
    background: #F4F8FD;
    border-radius: 12px;
    display: none;
    padding: 8px;
    margin-top: 4px;
    width: 100%;
}

.nav-item.has-dropdown.open > .mega-menu { display: block; }

.mega-menu-simple ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-menu-simple ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: #1B5088;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    border-left: 2px solid transparent;
}

.mega-menu-simple ul li a i {
    width: 30px;
    height: 30px;
    background: rgba(27, 80, 136, 0.07);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    color: #1B5088;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.mega-menu-simple ul li a:hover {
    background: rgba(27, 80, 136, 0.06);
    color: #1B5088;
    border-left-color: transparent;
    padding-left: 14px;
}

.mega-menu-simple ul li a:hover i {
    background: #1B5088;
    color: #ffffff;
}

.mega-menu-full { width: 100%; }
.mega-menu-header { display: none; }
.mega-footer { display: none; }

.mega-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
}

.mega-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s;
    border-left: none;
}

.mega-item i {
    width: 34px;
    height: 34px;
    background: rgba(27, 80, 136, 0.08);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #1B5088;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.mega-item div strong {
    display: block;
    color: #1B5088;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.mega-item div span {
    display: block;
    color: #64748B;
    font-size: 0.74rem;
    margin-top: 2px;
}

.mega-item:hover { background: rgba(27, 80, 136, 0.06); }
.mega-item:hover i { background: #1B5088; color: #ffffff; }
.mega-item:hover div strong { color: #1B5088; }

/* ============================================================
   HEADER CTA
   ============================================================ */
.header-cta { display: none; flex-shrink: 0; }

/* ============================================================
   MOBILE TOGGLE — Animated hamburger
   ============================================================ */
.mobile-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: 1.5px solid #D8E6F4;
    cursor: pointer;
    padding: 10px 11px;
    z-index: 1001;
    margin-left: auto;
    border-radius: 10px;
    transition: all 0.3s;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

.mobile-toggle:hover { border-color: #1B5088; background: #F4F8FD; }

.mobile-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #1B5088;
    border-radius: 2px;
    transition: all 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform-origin: center;
    margin: 0 auto;
}

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

/* ============================================================
   NAV OVERLAY
   ============================================================ */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1002;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.nav-overlay.active { display: block; }

/* ============================================================
   FLOATING ENQUIRY BUTTON
   ============================================================ */
#floatEnquiry {
    position: fixed;
    bottom: 78px;
    right: 16px;
    background: var(--th-primary);
    color: #ffffff;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    z-index: 990;
    box-shadow: 0 8px 24px rgba(27, 80, 136, 0.40);
    transition: all 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow: hidden;
    font-size: 1.1rem;
}

#floatEnquiry span {
    display: none;
    font-size: 0.68rem;
    font-weight: 700;
    margin-top: 2px;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.3px;
}

/* ============================================================
   RESPONSIVE — 768px+ (Tablet)
   ============================================================ */
@media (min-width: 768px) {
    .th-top-bar { display: block; }
    .header-inner { gap: 28px; }
    header { padding: 6px 0; }
    header.sticky { padding: 4px 0; }
    /* Logo scale-up: tablet */
    .logo { height: 80px; }
    .logo-img { height: 80px; }
    .logo-svg-wrap,
    .logo-svg-wrap svg { max-height: 80px; }
}

/* ============================================================
   RESPONSIVE — 992px+ (Desktop)
   ============================================================ */
@media (min-width: 992px) {
    .mobile-toggle { display: none; }
    .header-cta { display: flex; }

    header { padding: 4px 0; }
    header.sticky { padding: 2px 0; }

    .header-inner { gap: 36px; }

    /* Logo scale-up: desktop — full 100px */
    .logo { height: 100px; }
    .logo-img { height: 100px; }
    .logo-svg-wrap,
    .logo-svg-wrap svg { max-height: 100px; }

    /* Inline horizontal nav */
    #mainNav {
        position: static;
        right: auto;
        width: auto;
        height: auto;
        background: transparent;
        border: none;
        padding: 0;
        overflow: visible;
        transition: none;
        margin-left: auto;
    }

    .nav-list {
        flex-direction: row;
        align-items: center;
        gap: 4px;
    }

    /* Pill-style nav links */
    .nav-link {
        font-size: 0.84rem;
        padding: 10px 16px;
        border-radius: 100px;
        position: relative;
        font-weight: 600;
        letter-spacing: 0.4px;
        text-transform: uppercase;
        font-size: 0.78rem;
    }

    .nav-link i.fa-chevron-down {
        margin-left: 0;
        font-size: 0.6rem;
        opacity: 0.5;
    }

    .nav-link:hover,
    .nav-item.active .nav-link {
        color: #1B5088;
        background: rgba(27, 80, 136, 0.08);
    }

    /* Logo on desktop */
    .logo-icon { width: 44px; height: 44px; font-size: 1.5rem; border-radius: 11px; }
    .logo-main { font-size: 1.22rem; letter-spacing: 2.5px; }

    /* ---- Desktop dropdown base ---- */
    .mega-menu {
        position: absolute;
        top: calc(100% + 12px);
        left: 50%;
        transform: translateX(-50%) translateY(10px);
        background: #ffffff;
        border: 1.5px solid #D8E6F4;
        border-radius: 18px;
        overflow: hidden;
        box-shadow: 0 24px 64px rgba(27, 80, 136, 0.16), 0 4px 16px rgba(27, 80, 136, 0.07);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
        z-index: 999;
        display: block;
    }

    /* Upward arrow pointer */
    .mega-menu::before {
        content: '';
        position: absolute;
        top: -7px;
        left: 50%;
        transform: translateX(-50%) rotate(45deg);
        width: 13px;
        height: 13px;
        background: #1B5088;
        border-left: 1.5px solid #1B5088;
        border-top: 1.5px solid #1B5088;
        z-index: 1;
    }

    .nav-item.has-dropdown { position: relative; }

    .nav-item.has-dropdown:hover .nav-link i.fa-chevron-down {
        transform: rotate(180deg);
        opacity: 1;
    }

    .nav-item.has-dropdown:hover > .mega-menu {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }

    /* ---- Simple dropdown (About / Services) ---- */
    .mega-menu-simple {
        width: 290px;
        left: 0;
        transform: translateY(10px);
        padding: 8px;
    }

    .mega-menu-simple::before {
        left: 28px;
        transform: translateX(0) rotate(45deg);
        background: #1B5088;
        border-color: #1B5088;
    }

    .nav-item.has-dropdown:hover > .mega-menu-simple {
        transform: translateY(0);
    }

    .mega-menu-simple ul li a {
        font-size: 0.87rem;
        padding: 10px 12px;
        border-radius: 10px;
        border-left: none;
    }

    .mega-menu-simple ul li a i {
        width: 32px;
        height: 32px;
    }

    /* ---- Full mega menu — split dark-left / white-right ---- */
    .mega-menu-full {
        width: 740px;
        left: 50%;
        transform: translateX(-50%) translateY(10px);
        padding: 0;
        display: grid;
        grid-template-columns: 210px 1fr;
        grid-template-rows: 1fr auto;
    }

    .mega-menu-full::before {
        /* arrow sits above the right (white) panel */
        left: calc(210px + (530px / 2));
        background: #ffffff;
        border-color: #D8E6F4;
    }

    .nav-item.has-dropdown:hover > .mega-menu-full {
        transform: translateX(-50%) translateY(0);
    }

    /* Left dark panel */
    .mega-menu-header {
        display: flex;
        flex-direction: column;
        grid-column: 1;
        grid-row: 1 / 3;
        background: linear-gradient(155deg, #1B5088 0%, #0c2240 100%);
        padding: 28px 22px;
        border-radius: 0;
        border-bottom: none;
        margin: 0;
        position: relative;
        overflow: hidden;
    }

    /* Decorative orb on dark panel */
    .mega-menu-header::after {
        content: '';
        position: absolute;
        bottom: -40px;
        right: -40px;
        width: 140px;
        height: 140px;
        border-radius: 50%;
        background: rgba(90, 174, 224, 0.12);
        pointer-events: none;
    }

    .mega-menu-header h4 {
        font-family: 'Inter', sans-serif;
        font-weight: 700;
        font-size: 0.65rem;
        letter-spacing: 2.5px;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.5);
        margin-bottom: 10px;
    }

    .mega-menu-header p {
        color: #ffffff;
        font-size: 1rem;
        font-weight: 600;
        font-family: 'Playfair Display', serif;
        line-height: 1.45;
        margin: 0 0 auto;
    }

    /* Badge at bottom of dark panel */
    .mega-menu-header p::after {
        content: 'UK Registered Group';
        display: block;
        margin-top: 18px;
        font-family: 'Inter', sans-serif;
        font-size: 0.68rem;
        font-weight: 700;
        color: rgba(255, 255, 255, 0.55);
        letter-spacing: 1.5px;
        text-transform: uppercase;
        border-top: 1px solid rgba(255,255,255,0.15);
        padding-top: 14px;
    }

    /* Right panel: grid */
    .mega-grid {
        grid-column: 2;
        grid-row: 1;
        grid-template-columns: 1fr 1fr;
        gap: 2px;
        padding: 14px 12px 8px;
        align-content: start;
    }

    .mega-item {
        padding: 11px 12px;
        border-radius: 11px;
        border-left: none;
        gap: 11px;
    }

    .mega-item:hover {
        background: #F0F6FC;
        transform: none;
    }

    .mega-item i {
        width: 34px;
        height: 34px;
        border-radius: 9px;
    }

    /* Right panel: footer */
    .mega-footer {
        grid-column: 2;
        grid-row: 2;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        margin: 0;
        padding: 10px 18px 14px;
        border-top: 1px solid #EBF2FA;
    }

    .mega-footer a {
        color: #1B5088;
        text-decoration: none;
        font-size: 0.82rem;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        transition: gap 0.2s;
        font-family: 'Inter', sans-serif;
        letter-spacing: 0.2px;
    }

    .mega-footer a:hover { gap: 10px; }

    /* Floating enquiry */
    #floatEnquiry { bottom: 84px; right: 24px; width: 54px; height: 54px; }
    #floatEnquiry:hover { width: 120px; border-radius: 27px; }
    #floatEnquiry:hover span { display: block; }
}

/* ============================================================
   RESPONSIVE — 1200px+ (Wide desktop)
   ============================================================ */
@media (min-width: 1200px) {
    .header-inner { gap: 44px; }
    .nav-link { font-size: 0.8rem; padding: 10px 18px; }
    .mega-menu-full { width: 780px; }
    /* Re-calc arrow to stay centred on the wider right panel */
    .mega-menu-full::before { left: calc(210px + (570px / 2)); }
}
