/*
 * _header.css
 * Navigation bar — rewritten to match OneSix mega-menu structure.
 * CSS-driven dropdowns on desktop, checkbox-hack hamburger on mobile.
 * No JS required for the toggle; JS adds .submenu-open for mobile sub-menus.
 *
 * Sections:
 *   1. Nav Bar
 *   2. Logo
 *   3. Nav Menu (desktop)
 *   4. Top-level Links + Animated Underline
 *   5. Dropdown / Mega-menu
 *   6. Mega-menu Columns + Icons
 *   7. Company Mega-menu (3-column cards)
 *   8. CTA Button
 *   9. Hamburger Toggle (mobile)
 *  10. Mobile Menu
 */

/* ==========================================================
   1. NAV BAR
   ========================================================== */
#site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: var(--color-navy);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
}

/* Mobile: nav is NOT sticky/fixed — scrolls with page */
@media (max-width: 1023px) {
    #site-nav {
        position: relative;
    }
}

/* WordPress admin bar offset — desktop only (nav is fixed) */
@media (min-width: 1024px) {
    .admin-bar #site-nav {
        top: 32px;
    }
    .admin-bar .nav__mega {
        top: calc(5rem + 32px);
    }
}
/* Mobile: nav is position: relative, no top offset needed.
   Admin bar naturally pushes it down in document flow. */

.nav__inner {
    display: flex;
    align-items: center;
    height: 5rem;
    gap: 2rem;
    position: relative;
}

/* Push body content below fixed nav */
body { padding-top: 5rem; }

/* ==========================================================
   2. LOGO
   ========================================================== */
.nav__logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
    margin-right: auto;
}

.nav__logo img {
    height: 36px;
    width: auto;
    display: block;
}

/* ==========================================================
   3. NAV MENU (desktop layout)
   ========================================================== */
.nav__menu {
    display: none;   /* hidden on mobile */
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    gap: 0;
    height: 100%;
}

/* ==========================================================
   4. TOP-LEVEL LINKS + Animated Underline
   ========================================================== */
.nav__item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: 0.3125rem;
    height: 100%;
    padding: 0 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    transition: color 0.3s ease;
}

/* Animated underline — starts at 0% width */
.nav__link::after {
    content: '';
    position: absolute;
    bottom: 1.25rem;
    left: 1.25rem;
    right: 1.25rem;
    height: 2px;
    background-color: var(--color-brand-red);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
    border-radius: 1px;
}

.nav__link:hover::after,
.nav__item--active > .nav__link::after {
    transform: scaleX(1);
}

.nav__link:hover {
    color: var(--color-white);
}

/* Chevron indicator for items with dropdowns */
.nav__link .nav__chevron {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}
.nav__item:hover > .nav__link .nav__chevron {
    transform: rotate(180deg);
}

/* ==========================================================
   5. DROPDOWN — standard 1-column (not used anymore but kept)
   ========================================================== */
.nav__dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background-color: var(--color-white);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.2);
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    animation: dropFadeIn 0.2s ease;
}

.nav__item:hover > .nav__dropdown {
    display: block;
}

.nav__dropdown li a {
    display: block;
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-navy);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.nav__dropdown li a:hover {
    background-color: var(--color-gray-50);
    color: var(--color-brand-red);
    padding-left: 1.5rem;
}

/* ==========================================================
   6. MEGA-MENU — 4-column expertise dropdown
   ========================================================== */
.nav__mega {
    display: none;
    position: fixed;
    top: 5rem;
    left: 0;
    right: 0;
    background-color: var(--color-white);
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.18);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 2.5rem 0;
    z-index: 999;
    animation: dropFadeIn 0.2s ease;
}

.nav__item:hover > .nav__mega {
    display: block;
}

/* Inner grid: 4 equal columns */
.nav__mega-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    max-width: var(--max-width-xl, 1280px);
    margin: 0 auto;
    padding: 0 2rem;
}

/* 3-column layout for Company */
.nav__mega-inner--3col {
    grid-template-columns: repeat(3, 1fr);
}

/* Mega column icon */
.nav__mega-icon {
    width: 28px;
    height: 28px;
    color: var(--color-brand-red);
    flex-shrink: 0;
}

/* Mega column heading (e.g. "By Service") */
.nav__mega-col-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-navy);
    text-decoration: none;
    padding-bottom: 0.875rem;
    margin-bottom: 0.625rem;
    border-bottom: 1px solid var(--color-gray-200);
    transition: color var(--transition-fast);
}
.nav__mega-col-title:hover {
    color: var(--color-brand-red);
}

/* Mega column sub-links */
.nav__mega-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.nav__mega-col ul a {
    display: block;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-gray-600);
    text-decoration: none;
    transition: color 0.2s ease, padding 0.2s ease;
}
.nav__mega-col ul a:hover {
    color: var(--color-brand-red);
    padding-left: 0.375rem;
}

/* ==========================================================
   7. COMPANY MEGA-MENU — 3-column image cards
   ========================================================== */
.company-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-decoration: none;
    padding: 1rem;
    border-radius: var(--radius-lg);
    transition: background 0.2s ease;
}

.company-card:hover {
    background-color: var(--color-gray-50);
}

.company-card__img {
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16 / 10;
}

.company-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.company-card:hover .company-card__img img {
    transform: scale(1.03);
}

.company-card__title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--color-navy);
    margin: 0;
}

.company-card__text {
    font-size: 0.875rem;
    color: var(--color-gray-500);
    line-height: 1.55;
    margin: 0;
}

.company-card__link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-brand-red);
    transition: gap 0.2s ease;
}

.company-card:hover .company-card__link {
    gap: 0.625rem;
}

/* ==========================================================
   8. CTA BUTTON
   ========================================================== */
.nav__cta {
    flex-shrink: 0;
    display: none;  /* hidden on mobile, shown desktop */
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.5rem;
    background-color: var(--color-brand-red);
    color: var(--color-white);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--color-brand-red);
    border-radius: var(--radius-md);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}
.btn-nav:hover {
    background-color: var(--color-brand-red);
    color: var(--color-white);
    transform: translateY(-1px);
}



/* ==========================================================
   9. HAMBURGER TOGGLE (mobile only)
   ========================================================== */
.nav__check {
    display: none;
}

.nav__toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.nav__toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--color-white);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: center;
}



/* Checked state — animate to X */
.nav__check:checked ~ .nav__toggle .nav__toggle-bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.nav__check:checked ~ .nav__toggle .nav__toggle-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.nav__check:checked ~ .nav__toggle .nav__toggle-bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ==========================================================
   10. MOBILE MENU
   ========================================================== */
.nav__mobile {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color-white);
    border-top: 1px solid var(--color-gray-200);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.1);
    padding: 0;
    z-index: 998;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.nav__check:checked ~ .nav__mobile {
    max-height: 100vh;
    overflow-y: auto;
    padding: 1rem 0;
}

/* Mobile nav links */
.nav__mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav__mobile-menu li a,
.nav__mobile-menu li span {
    display: block;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-navy);
    text-decoration: none;
    border-bottom: 1px solid var(--color-gray-100);
    cursor: pointer;
}
.nav__mobile-menu li a:hover { color: var(--color-brand-red); }

.nav__mobile-menu .nav__mobile-sub {
    background-color: var(--color-gray-50);
    display: none;
}
.nav__mobile-menu .nav__mobile-sub.open { display: block; }
.nav__mobile-menu .nav__mobile-sub a {
    padding-left: 2.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-600);
}
.nav__mobile-menu .nav__mobile-sub a:hover { color: var(--color-brand-red); }

/* Mobile CTA */
.nav__mobile-cta {
    padding: 1rem 1.5rem;
}
.nav__mobile-cta .btn-nav {
    display: block;
    text-align: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--color-brand-red);
    color: var(--color-white);
    border-color: var(--color-brand-red);
}

/* ==========================================================
   DESKTOP BREAKPOINT — show menu, hide toggle
   ========================================================== */
/* Mobile: smaller nav height, NOT fixed */
@media (max-width: 1023px) {
    .nav__inner {
        height: 4rem;
        gap: 1rem;
    }
    body { padding-top: 0; }  /* No offset needed — nav is in normal flow on mobile */

    .nav__logo img { height: 30px; }
}

/* Hide menu + toggle on desktop, show them on mobile */
@media (min-width: 1024px) {
    .nav__menu  { display: flex; }
    .nav__cta   { display: block; }
    .nav__toggle,
    .nav__mobile { display: none !important; }
}

/* ==========================================================
   ANIMATION
   ========================================================== */
@keyframes dropFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
