﻿/*
 * Navigation — Desktop + Mobile
 * Loaded after style.min.css (Tailwind output).
 * Scoped to .site-header and its children to avoid bleed.
 */

/* ═══════════════════════════════════════════════════════════════
   1. SITE HEADER
   ═══════════════════════════════════════════════════════════════ */
.site-header {
    position: fixed;
    top: var(--topbar-h, 0px);
    left: 0;
    right: 0;
    z-index: 9000;
    height: var(--header-h, 88px);
    display: flex;
    align-items: stretch;
    transition: background-color 300ms ease,
                backdrop-filter 300ms ease,
                box-shadow 300ms ease,
                border-color 300ms ease;
}

/* All pages — solid white header */
body.has-hero .site-header,
.site-header:not(.is-transparent) {
    background-color: rgba(255,255,255,0.97);
    border-bottom: 1px solid rgba(15,23,42,0.08);
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* When mobile drawer is open */
.site-header.menu-is-open {
    background-color: rgba(255,255,255,0.97) !important;
    border-bottom: 1px solid rgba(15,23,42,0.08) !important;
}

.site-header .header-inner {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem;
    gap: 1rem;
}

@media (min-width: 768px) {
    .site-header .header-inner {
        padding: 0 2.5rem;
    }
}

@media (min-width: 1280px) {
    .site-header .header-inner {
        padding: 0 4rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   2. LOGO
   ═══════════════════════════════════════════════════════════════ */
.site-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
    line-height: 1;
}

.site-logo img {
    height: 78px;
    width: auto;
    display: block;
}

.site-logo-text {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.4rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #0f172a;
    white-space: nowrap;
}

.site-logo-text span {
    color: var(--color-primary, #f97316);
}

/* ═══════════════════════════════════════════════════════════════
   3. DESKTOP PRIMARY NAV
   ═══════════════════════════════════════════════════════════════ */
.primary-nav {
    flex: 1;
    display: none; /* hidden on mobile */
}

@media (min-width: 1024px) {
    .primary-nav { display: flex; align-items: stretch; }
}

/* ── Top-level list ────────────────────────────────────────────── */
.nav-menu {
    display: flex;
    align-items: stretch;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
    height: 100%;
}

/* ── nav-item (<li>) ──────────────────────────────────────────── */
.nav-item {
    position: relative;
    display: flex;
    align-items: stretch;
}

/* ── nav-link (<a>) ──────────────────────────────────────────── */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.875rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #0f172a;
    text-decoration: none;
    white-space: nowrap;
    transition: color 200ms ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0.875rem;
    right: 0.875rem;
    height: 2px;
    background: var(--color-primary, #f97316);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 250ms ease;
}

.nav-link:hover,
.nav-link.is-active {
    color: #0f172a;
}

.nav-link.is-active::after,
.nav-item:hover > .nav-link::after {
    transform: scaleX(1);
}

/* ── Toggle button ───────────────────────────────────────────── */
.nav-toggle {
    display: flex;
    align-items: center;
    padding: 0 0.25rem 0 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #0f172a;
    transition: color 200ms ease;
}

.nav-toggle:hover,
.nav-item:hover .nav-toggle {
    color: #0f172a;
}

.nav-toggle[aria-expanded="true"] .nav-chevron {
    transform: rotate(180deg);
}

.nav-chevron {
    transition: transform 250ms ease;
    flex-shrink: 0;
}

/* ── Dropdown panel ──────────────────────────────────────────── */
.nav-dropdown-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    background: #ffffff;
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: 0 16px 48px rgba(0,0,0,0.1);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 200ms ease, transform 200ms ease;
    z-index: 9100;
}

.nav-dropdown-panel.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.nav-dropdown-list,
.nav-sub-list {
    list-style: none;
    margin: 0;
    padding: 0.375rem 0;
}

/* ── Dropdown item ───────────────────────────────────────────── */
.nav-dropdown-item {
    position: relative;
}

/* Bridge the 1px gap to the nested .nav-sub-list */
.nav-dropdown-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 100%;
    width: 4px;
    height: 100%;
}

.nav-dropdown-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5625rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #0f172a;
    text-decoration: none;
    white-space: nowrap;
    transition: color 180ms ease, background-color 180ms ease, padding-left 180ms ease;
}

.nav-dropdown-link:hover,
.nav-dropdown-link.is-active {
    color: #f97316;
    background-color: rgba(249,115,22,0.1);
    padding-left: 1.25rem;
}

.nav-dropdown-link.is-active {
    color: #f97316;
    background-color: rgba(249,115,22,0.14);
}

/* ── Second-level (nested) panel ─────────────────────────────── */
.nav-dropdown-item .nav-sub-list {
    position: absolute;
    top: -0.375rem;
    left: calc(100% + 1px);
    min-width: 200px;
    background: #ffffff;
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: 0 16px 48px rgba(0,0,0,0.1);
    padding: 0.375rem 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-8px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.nav-dropdown-item:hover > .nav-sub-list,
.nav-dropdown-item .nav-sub-list.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

/* ── Certificate badges (between nav and contact) ────────────── */
.header-certs {
    display: none;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    .header-certs { display: flex; }
}

.header-cert-img {
    height: 52px;
    width: auto;
    display: block;
    object-fit: contain;
    transition: transform 200ms ease, opacity 200ms ease;
}

.header-cert-img:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* ── Header contact block (phone + email button) ─────────────── */
.header-contact {
    display: none;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    .header-contact { display: flex; }
}

.header-phone {
    font-family: var(--font-heading);
    font-size: 1.0625rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    color: #0f172a;
    text-decoration: none;
    white-space: nowrap;
    transition: color 200ms ease;
}

.header-phone:hover {
    color: #f97316;
}

.header-email-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.125rem;
    background: #f97316;
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 200ms ease;
    white-space: nowrap;
}

.header-email-btn:hover {
    background: #ea580c;
    color: #ffffff;
}

/* ── Nav actions (search only — moved to far right) ─────────── */
.nav-actions {
    display: none;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    .nav-actions { display: flex; }
}

.nav-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid rgba(15,23,42,0.12);
    cursor: pointer;
    color: #0f172a;
    transition: color 200ms ease, background 200ms ease, border-color 200ms ease;
    border-radius: 50%;
}

.nav-search-btn:hover {
    color: #f97316;
    border-color: rgba(249,115,22,0.4);
    background: rgba(249,115,22,0.06);
}

/* ═══════════════════════════════════════════════════════════════
   4. MEGA MENU PANEL
   ═══════════════════════════════════════════════════════════════ */
.mega-panel {
    position: fixed;
    top: calc(var(--header-h, 72px) + var(--topbar-h, 0px));
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid rgba(15,23,42,0.08);
    border-bottom: 1px solid rgba(15,23,42,0.08);
    box-shadow: 0 24px 64px rgba(0,0,0,0.1);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 220ms ease, transform 220ms ease;
    z-index: 9050;
}

.mega-panel.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.mega-panel-inner {
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem 4rem;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 280px;
    gap: 2rem;
}

.mega-col-heading {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #0f172a;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(15,23,42,0.1);
}

.mega-link-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.mega-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4375rem 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
    border-radius: 2px;
    transition: color 180ms ease, background-color 180ms ease, padding-left 180ms ease;
}

.mega-link:hover {
    color: #f97316;
    background: rgba(249,115,22,0.1);
    padding-left: 0.875rem;
}

.mega-link svg { flex-shrink: 0; opacity: 0.5; color: inherit; }
.mega-link:hover svg { opacity: 1; color: #f97316; }

.mega-link-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: #0f172a;
    font-weight: 600;
}

/* ── Flyout three-column layout ──────────────────────────── */
.mega-panel-inner--flyout {
    grid-template-columns: 370px 1fr 280px; /* widened for 2-sub-col category list */
}

/* Two sub-columns inside the flyout category column */
.mega-flyout-col-inner {
    display: flex;
    gap: 0.125rem;
    align-items: flex-start;
}

.mega-flyout-col-inner .mega-link-list {
    flex: 1;
    min-width: 0;
}

/* Left flyout column — full-height category/industry list */
.mega-flyout-col {
    border-right: 1px solid rgba(15,23,42,0.08);
    padding-right: 0.75rem;
}

/* Each flyout list item */
.mega-flyout-item {
    position: relative;
}

/* Transparent bridge that covers the gap between the trigger and the inline popover,
   so moving the cursor diagonally doesn't lose the hover state. */
.mega-flyout-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 100%;
    width: 10px; /* wider than the 6px gap in .mega-inline-popover's left offset */
    height: 100%;
}

.mega-flyout-item .mega-flyout-trigger {
    justify-content: flex-start;
    padding-top: 0.3125rem;
    padding-bottom: 0.3125rem;
    gap: 0.375rem;
}

.mega-flyout-item .mega-flyout-trigger span {
    flex: 1;
    min-width: 0;
}

.mega-flyout-chevron {
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0.25;
    transition: opacity 180ms ease, transform 180ms ease;
}

/* Highlighted state when this row is being hovered */
.mega-flyout-item:hover .mega-flyout-trigger {
    background: rgba(249,115,22,0.1);
    color: #f97316;
    padding-left: 0.875rem;
}

.mega-flyout-item:hover .mega-flyout-chevron {
    opacity: 0.8;
    transform: translateX(2px);
}

/* ── Inline popover — appears beside the hovered item ───── */
.mega-inline-popover {
    position: absolute;
    left: calc(100% + 6px);
    top: -2px;
    min-width: 190px;
    max-width: 240px;
    background: #ffffff;
    border: 1px solid rgba(15,23,42,0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.09), 0 2px 8px rgba(0,0,0,0.04);
    padding: 0.75rem 0.875rem 0.875rem;
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 140ms ease, visibility 140ms ease;
}

.mega-flyout-item:hover .mega-inline-popover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mega-inline-popover .mega-col-heading {
    font-size: 0.6875rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
}

.mega-inline-popover .mega-sub-view-all {
    margin-top: 0.625rem;
}

/* "View all" link at the bottom of each sub-panel */
.mega-sub-view-all {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.875rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #0f172a;
    text-decoration: none;
    transition: color 180ms ease;
}

.mega-sub-view-all:hover {
    color: #f97316;
}

/* Mega featured column */
.mega-featured-card {
    background: rgba(249,115,22,0.07);
    border: 1px solid rgba(249,115,22,0.2);
    padding: 1.25rem;
}

.mega-featured-card-label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-primary, #f97316);
    margin-bottom: 0.5rem;
}

.mega-featured-card-title {
    font-family: var(--font-heading);
    font-size: 0.9375rem;
    font-weight: 900;
    text-transform: uppercase;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 0.625rem;
}

.mega-featured-card p {
    font-size: 0.8125rem;
    color: #0f172a;
    line-height: 1.55;
    margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════════════════════
   5. MOBILE HAMBURGER
   ═══════════════════════════════════════════════════════════════ */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    margin-left: auto;
}

@media (min-width: 1024px) { .hamburger { display: none; } }

.hamburger-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(15,23,42,0.75);
    border-radius: 1px;
    transform-origin: center;
    transition: transform 250ms ease, opacity 200ms ease, width 200ms ease;
}

.hamburger[aria-expanded="true"] .hamburger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger[aria-expanded="true"] .hamburger-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger[aria-expanded="true"] .hamburger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ═══════════════════════════════════════════════════════════════
   6. MOBILE DRAWER
   ═══════════════════════════════════════════════════════════════ */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 90vw);
    background: #ffffff;
    border-right: 1px solid rgba(15,23,42,0.08);
    z-index: 9500;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 300ms cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
}

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

.mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}

.mobile-drawer-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(15,23,42,0.08);
    flex-shrink: 0;
}

.mobile-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(15,23,42,0.05);
    border: 1px solid rgba(15,23,42,0.08);
    cursor: pointer;
    color: #0f172a;
    transition: color 200ms ease, background 200ms ease;
}

.mobile-drawer-close:hover {
    color: #0f172a;
    background: rgba(15,23,42,0.08);
}

.mobile-drawer-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.mobile-drawer-footer {
    flex-shrink: 0;
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(15,23,42,0.1);
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

/* ── Mobile nav items ────────────────────────────────────────── */
.mobile-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
}

.mobile-nav-item {
    border-bottom: 1px solid rgba(15,23,42,0.07);
}

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

.mobile-nav-row {
    display: flex;
    align-items: center;
}

.mobile-nav-link {
    flex: 1;
    display: block;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0f172a;
    text-decoration: none;
    transition: color 180ms ease;
}

.mobile-nav-link:hover,
.mobile-nav-link.is-active {
    color: #0f172a;
}

.mobile-nav-link.is-active {
    color: var(--color-primary, #f97316);
}

/* Indented deeper items */
.mobile-sub-menu .mobile-nav-link {
    padding-left: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: #0f172a;
}

.mobile-sub-menu .mobile-sub-menu .mobile-nav-link {
    padding-left: 2.75rem;
}

.mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    border-left: 1px solid rgba(15,23,42,0.08);
    cursor: pointer;
    color: #0f172a;
    flex-shrink: 0;
    transition: color 200ms ease, background-color 200ms ease;
}

.mobile-toggle:hover {
    color: #0f172a;
    background: rgba(15,23,42,0.04);
}

.mobile-toggle[aria-expanded="true"] {
    color: var(--color-primary, #f97316);
    background: rgba(249,115,22,0.08);
}

.mobile-toggle[aria-expanded="true"] .mobile-chevron {
    transform: rotate(180deg);
}

.mobile-chevron {
    transition: transform 250ms ease;
}

.mobile-sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgba(15,23,42,0.03);
    border-top: 1px solid rgba(15,23,42,0.06);
}

/* ═══════════════════════════════════════════════════════════════
   7. BODY OFFSET FOR FIXED HEADER + TOPBAR
   ═══════════════════════════════════════════════════════════════ */
:root {
    --header-h: 88px;
    --topbar-h: 0px;
    --color-sky: #0ea5e9;
    --color-sky-dark: #0284c7;
}

@media (min-width: 768px) { :root { --topbar-h: 36px; } }

/* Second phone/email — only show in topbar at xl (1280px+) to avoid overflow */
.topbar-extra-item { display: none; }
@media (min-width: 1280px) { .topbar-extra-item { display: flex; } }

body:not(.has-hero) { padding-top: calc(var(--header-h) + var(--topbar-h, 0px)); }

/* ═══════════════════════════════════════════════════════════════
   8. SEARCH PANEL
   ═══════════════════════════════════════════════════════════════ */
.header-search-panel {
    position: fixed;
    top: calc(var(--header-h) + var(--topbar-h, 0px));
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid rgba(15,23,42,0.08);
    padding: 1.25rem 1.5rem;
    z-index: 8900;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 250ms ease, opacity 250ms ease;
    pointer-events: none;
}

.header-search-panel.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.header-search-input {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    display: block;
    background: rgba(15,23,42,0.05);
    border: 1px solid rgba(15,23,42,0.12);
    color: #0f172a;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    outline: none;
    transition: border-color 200ms ease;
}

.header-search-input::placeholder { color: rgba(15,23,42,0.35); }
.header-search-input:focus { border-color: var(--color-primary, #f97316); }

/* ═══════════════════════════════════════════════════════════════
   9. TOP BAR
   ═══════════════════════════════════════════════════════════════ */
.site-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9001;
    background: #0f172a;
    border-bottom: 1px solid rgba(249,115,22,0.25);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #ffffff;
    display: none;
}

@media (min-width: 768px) { .site-topbar { display: block; } }

.site-topbar a {
    color: inherit;
    text-decoration: none;
    transition: color 180ms ease;
}

.site-topbar a:hover { color: #ffffff; }
