/* ============================================
   HEADER.CSS - Navigation & Header Styles
   ============================================ */

/* ============================================
   HEADER WRAPPER
   ============================================ */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.header-logo a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.header-logo img {
    width: 140px;
    height: auto;
    display: block;
}

/* ============================================
   DESKTOP NAVIGATION
   ============================================ */

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

.header-nav-list {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-nav-list li {
    list-style: none;
}

.header-nav-list a {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.header-nav-list a:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--color-indigo);
}

/* When header is scrolled — always dark text */
.site-header.scrolled .header-nav-list a {
    color: var(--color-text-primary);
}

.site-header.scrolled .header-nav-list a:hover {
    background-color: var(--color-slate);
    color: var(--color-indigo);
}

/* Dark hero pages — white text before scroll */
.site-header.header-dark-hero .header-nav-list a {
    color: var(--color-white);
}

.site-header.header-dark-hero .header-nav-list a:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.site-header.header-dark-hero.scrolled .header-nav-list a {
    color: var(--color-text-primary);
}

.site-header.header-dark-hero.scrolled .header-nav-list a:hover {
    background-color: var(--color-slate);
    color: var(--color-indigo);
}

/* CTA button in nav */
.header-nav-cta a {
    background-color: var(--color-indigo);
    color: var(--color-white) !important;
    font-weight: 600;
    padding: 10px 20px;
}

.header-nav-cta a:hover {
    background-color: var(--color-indigo-dark) !important;
    color: var(--color-white) !important;
}

.site-header.scrolled .header-nav-cta a {
    color: var(--color-white) !important;
}

/* ============================================
   HAMBURGER BUTTON
   ============================================ */

.header-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.header-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-text-primary);
    margin-bottom: 6px;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.3s ease;
}

.header-hamburger span:last-child {
    margin-bottom: 0;
}

.site-header.scrolled .header-hamburger span {
    background-color: var(--color-text-primary);
}

/* Dark hero pages — white hamburger before scroll */
.site-header.header-dark-hero .header-hamburger span {
    background-color: var(--color-white);
}

.site-header.header-dark-hero.scrolled .header-hamburger span {
    background-color: var(--color-text-primary);
}

/* Hamburger open state */
.header-hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.header-hamburger.active span:nth-child(2) {
    opacity: 0;
}

.header-hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* X must always be white when menu is open — overrides all other states */
.header-hamburger.active span {
    background-color: var(--color-white) !important;
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

.header-mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background-color: rgba(31, 41, 55, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 999;
    padding: 100px 24px 48px 24px;
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.header-mobile-nav.open {
    opacity: 1;
    visibility: visible;
}

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

.header-mobile-nav-list li {
    list-style: none;
}

.header-mobile-nav-list a {
    display: block;
    padding: 14px 20px;
    font-size: 18px;
    font-weight: 500;
    color: var(--color-white);
    text-decoration: none;
    border-radius: 10px;
    transition: background-color 0.3s ease;
}

.header-mobile-nav-list a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Mobile CTA */
.header-mobile-nav-cta {
    margin-top: 24px;
}

.header-mobile-nav-cta a {
    display: block;
    text-align: center;
    padding: 16px 24px;
    background-color: var(--color-indigo);
    color: var(--color-white);
    font-size: 16px;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.header-mobile-nav-cta a:hover {
    background-color: var(--color-indigo-dark);
}

/* ============================================
   MEGAMENU - DESKTOP
   ============================================ */

.header-nav-list > li {
    position: relative;
}

/* Parent item with children — add dropdown arrow */
.header-nav-list > li.menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    margin-left: 6px;
    margin-bottom: 2px;
    transition: transform 0.3s ease;
}

.header-nav-list > li.menu-item-has-children:hover > a::after {
    transform: rotate(-135deg);
}

/* Dropdown panel */
.header-nav-list .sub-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 8px;
    margin-top: 8px;
    list-style: none;
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.12),
                0 4px 8px -4px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(8px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    z-index: 1001;
}

.header-nav-list > li.menu-item-has-children:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Dropdown links */
.header-nav-list .sub-menu li {
    list-style: none;
}

.header-nav-list .sub-menu a {
    display: block;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary) !important;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.header-nav-list .sub-menu a:hover {
    background-color: var(--color-indigo-light-bg) !important;
    color: var(--color-indigo) !important;
}

/* ============================================
   MEGAMENU - MOBILE
   ============================================ */

/* Hide sub-menu by default on mobile */
.header-mobile-nav-list .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0 0 0 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.header-mobile-nav-list .sub-menu.open {
    max-height: 500px;
}

.header-mobile-nav-list .sub-menu a {
    display: block;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.header-mobile-nav-list .sub-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--color-white);
}

/* Parent item toggle arrow on mobile */
.header-mobile-nav-list > li.menu-item-has-children > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-mobile-nav-list > li.menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.header-mobile-nav-list > li.menu-item-has-children.open > a::after {
    transform: rotate(-135deg);
}

/* ============================================
   HEADER SPACING
   All hero wrappers: 192px top (120px standard + 72px for fixed header)
   Bottom padding: 96px standard
   ============================================ */

.hero-wrapper,
.hero-wrapper-about,
.contact-hero-wrapper,
.hero-wrapper-zoho,
.bks-hero-wrapper,
.zo-hero-wrapper,
.pd-hero-wrapper,
.pd-ads-hero-wrapper,
.blog-hero-wrapper,
.cs-hero-wrapper,
.csd-hero-wrapper {
    padding-top: 192px !important;
    padding-bottom: 96px !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .header-nav {
        display: none;
    }

    .header-hamburger {
        display: block;
    }

    .header-mobile-nav {
        display: block;
    }

    .header-logo img {
        width: 110px;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 12px 16px;
    }

    .header-logo img {
        width: 100px;
    }
}

@media (max-width: 768px) {
    .hero-wrapper,
    .hero-wrapper-about,
    .contact-hero-wrapper,
    .hero-wrapper-zoho,
    .bks-hero-wrapper,
    .zo-hero-wrapper,
    .pd-hero-wrapper,
    .pd-ads-hero-wrapper,
    .blog-hero-wrapper,
    .cs-hero-wrapper,
    .csd-hero-wrapper {
        padding-top: 140px !important;
        padding-bottom: 64px !important;
    }
}
