/* ==========================================================================
   CUSTOM FIXED HEADER STYLES
   ========================================================================== */

:root {
    --header-height: 80px;
    --header-bg: #e0deed;
    --header-padding-top: 10px;
    --header-padding-side: 50px;
    --brand-blue: #003366;
    --brand-orange: #ff6b00;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #eee;
    --header-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --header-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Prevent body scroll when mobile menu is open */
body.no-scroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    overscroll-behavior: none;
}

.df-skip-link {
    position: fixed;
    top: 0.75rem;
    left: 1rem;
    z-index: 2000;
    padding: 0.65rem 1rem;
    transform: translateY(-200%);
    background: var(--df-blue, #303090);
    color: #fff;
    font-family: var(--df-sans, 'Source Sans 3', sans-serif);
    font-size: 0.875rem;
    font-weight: 650;
    text-decoration: none;
    transition: transform 160ms ease;
}

.df-skip-link:focus-visible {
    transform: translateY(0);
    outline: 3px solid var(--df-focus, #2f5fd0);
    outline-offset: 4px;
}

/* ----------------------------------------
   1. SITE HEADER CONTAINER
   ---------------------------------------- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--header-bg);
    padding: var(--header-padding-top) var(--header-padding-side) var(--header-padding-top);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
    transition:
        padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        background-color 0.4s ease,
        box-shadow 0.4s ease;
    /* Smooth complex transition */
}

/* Scrolled State (Scroll-Driven Animation) */
.site-header.header-scrolled {
    padding-top: 5px;
    padding-bottom: 5px;
    background: rgba(224, 222, 237, 0.85);
    backdrop-filter: blur(12px);
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.1);
}

/* Scrolled: Shrink logo */
.site-header.header-scrolled .site-logo img {
    height: 45px !important;
}

/* Scrolled: Shrink nav links */
.site-header.header-scrolled .nav-link {
    font-size: 1rem;
}

/* Body padding to prevent content overlap */
body {
    padding-top: var(--header-height);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

/* ----------------------------------------
   2. HEADER LEFT: BRANDING
   ---------------------------------------- */
.header-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.site-logo {
    display: flex;
    align-items: center;
    max-width: 300px;
}

.site-logo img {
    height: 60px !important;
    /* Default: larger */
    width: auto !important;
    max-width: 100%;
    object-fit: contain;
    display: block;
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ----------------------------------------
   3. HEADER RIGHT: NAVIGATION
   ---------------------------------------- */
.header-right {
    display: flex;
    align-items: center;
    gap: 30px;
}

.main-nav {
    display: block;
}

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

.nav-item {
    position: relative;
}

.nav-link {
    font-family: var(--header-sans);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    padding: 10px 0;
    display: block;
    text-transform: none;
    letter-spacing: 0.5px;
    transition: color 0.2s;
    position: relative;
    /* For pseudo-element */
}

/* Marker Hover Effect (Desktop Main Nav) */
.main-nav .nav-item .nav-link {
    z-index: 1;
}

/* Disable black underline and use marker stroke instead */
.main-nav .nav-item .nav-link::after {
    display: none !important;
}

/* Shared marker base for Download / Products / Contact / News */
.main-nav .nav-item .nav-link::before {
    content: '';
    position: absolute;
    inset: auto -14px 4px -16px; /* Wider lateral bleed */
    height: 22px; /* Extra thick marker, increased height */
    z-index: -1;
    transform-origin: left center;
    transform: rotate(-2deg) scaleX(0.15); /* Hidden start state */

    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100' preserveAspectRatio='none'%3e%3cpath d='M2.3,64.6c43.1-9.2,126-24.6,263.6-26c36.1-0.4,17.2-24.9-19-25C193.7,13.2,85.6,25.4,10,38.2C-8,41.4-6.4,66.5,2.3,64.6z M272,32.4c-97-9-216.4-1.2-262.6,3.6c-49.8,5.2-12,23.3,37.8,18.1c118.9-12.4,204-12.2,243.6-7.8C314.5,51.2,322.2,37.1,272,32.4z' fill='%23F1B92E'/%3e%3c/svg%3e");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    mix-blend-mode: multiply;
    opacity: 0;

    /* Sliding Door Mask: Hidden by default (clips 100% from the right) */
    -webkit-clip-path: inset(0 100% 0 0);
    clip-path: inset(0 100% 0 0);

    /* Handwriting velocity: fast strike, slightly slow tail */
    transition:
        transform 0.4s cubic-bezier(0.21, 0.85, 0.35, 1),
        opacity 0.15s ease,
        clip-path 0.4s cubic-bezier(0.21, 0.85, 0.35, 1),
        -webkit-clip-path 0.4s cubic-bezier(0.21, 0.85, 0.35, 1);
}

/* Marker color overrides by item */
.main-nav .nav-item--products .nav-link::before {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100' preserveAspectRatio='none'%3e%3cpath d='M2.3,64.6c43.1-9.2,126-24.6,263.6-26c36.1-0.4,17.2-24.9-19-25C193.7,13.2,85.6,25.4,10,38.2C-8,41.4-6.4,66.5,2.3,64.6z M272,32.4c-97-9-216.4-1.2-262.6,3.6c-49.8,5.2-12,23.3,37.8,18.1c118.9-12.4,204-12.2,243.6-7.8C314.5,51.2,322.2,37.1,272,32.4z' fill='%23A7D8FF'/%3e%3c/svg%3e");
}

.main-nav .nav-item--download .nav-link::before {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100' preserveAspectRatio='none'%3e%3cpath d='M2.3,64.6c43.1-9.2,126-24.6,263.6-26c36.1-0.4,17.2-24.9-19-25C193.7,13.2,85.6,25.4,10,38.2C-8,41.4-6.4,66.5,2.3,64.6z M272,32.4c-97-9-216.4-1.2-262.6,3.6c-49.8,5.2-12,23.3,37.8,18.1c118.9-12.4,204-12.2,243.6-7.8C314.5,51.2,322.2,37.1,272,32.4z' fill='%23F1B92E'/%3e%3c/svg%3e");
}

.main-nav .nav-item--faq .nav-link::before {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100' preserveAspectRatio='none'%3e%3cpath d='M2.3,64.6c43.1-9.2,126-24.6,263.6-26c36.1-0.4,17.2-24.9-19-25C193.7,13.2,85.6,25.4,10,38.2C-8,41.4-6.4,66.5,2.3,64.6z M272,32.4c-97-9-216.4-1.2-262.6,3.6c-49.8,5.2-12,23.3,37.8,18.1c118.9-12.4,204-12.2,243.6-7.8C314.5,51.2,322.2,37.1,272,32.4z' fill='%23FF6B00'/%3e%3c/svg%3e");
}

.main-nav .nav-item--contact .nav-link::before {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100' preserveAspectRatio='none'%3e%3cpath d='M2.3,64.6c43.1-9.2,126-24.6,263.6-26c36.1-0.4,17.2-24.9-19-25C193.7,13.2,85.6,25.4,10,38.2C-8,41.4-6.4,66.5,2.3,64.6z M272,32.4c-97-9-216.4-1.2-262.6,3.6c-49.8,5.2-12,23.3,37.8,18.1c118.9-12.4,204-12.2,243.6-7.8C314.5,51.2,322.2,37.1,272,32.4z' fill='%23A7D8FF'/%3e%3c/svg%3e");
}

.main-nav .nav-item--blog .nav-link::before {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100' preserveAspectRatio='none'%3e%3cpath d='M2.3,64.6c43.1-9.2,126-24.6,263.6-26c36.1-0.4,17.2-24.9-19-25C193.7,13.2,85.6,25.4,10,38.2C-8,41.4-6.4,66.5,2.3,64.6z M272,32.4c-97-9-216.4-1.2-262.6,3.6c-49.8,5.2-12,23.3,37.8,18.1c118.9-12.4,204-12.2,243.6-7.8C314.5,51.2,322.2,37.1,272,32.4z' fill='%232B2A27'/%3e%3c/svg%3e");
}

.main-nav .nav-item--news .nav-link::before {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100' preserveAspectRatio='none'%3e%3cpath d='M2.3,64.6c43.1-9.2,126-24.6,263.6-26c36.1-0.4,17.2-24.9-19-25C193.7,13.2,85.6,25.4,10,38.2C-8,41.4-6.4,66.5,2.3,64.6z M272,32.4c-97-9-216.4-1.2-262.6,3.6c-49.8,5.2-12,23.3,37.8,18.1c118.9-12.4,204-12.2,243.6-7.8C314.5,51.2,322.2,37.1,272,32.4z' fill='%23F04B3E'/%3e%3c/svg%3e");
}

.main-nav .nav-item:hover .nav-link::before,
.main-nav .nav-item:focus-within .nav-link::before,
.main-nav .nav-item.active .nav-link::before {
    /* Fully reveal the marker stroke */
    opacity: 0.9;
    transform: rotate(-2deg) scaleX(1);
    -webkit-clip-path: inset(0 0 0 0);
    clip-path: inset(0 0 0 0);
}

.nav-link:hover,
.nav-item.active .nav-link {
    color: var(--text-primary);
}

/* ----------------------------------------
   5. MEGA MENU
   ---------------------------------------- */
.nav-item.has-mega-menu {
    position: relative;
}

.mega-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    padding-top: 15px;
    transform: translateX(-50%);
    min-width: 600px;
    background: transparent;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.nav-item.has-mega-menu:hover .mega-menu,
.nav-item.has-mega-menu:focus-within .mega-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mega-menu-inner {
    display: flex;
    min-height: 320px;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transform: translateY(10px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item.has-mega-menu:hover .mega-menu-inner,
.nav-item.has-mega-menu:focus-within .mega-menu-inner {
    transform: translateY(0);
}

/* Left: Parent Categories */
.mega-menu-parents {
    width: 200px;
    background: rgba(245, 245, 250, 0.9);
    padding: 20px 0;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.mega-parent-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--header-sans);
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.mega-parent-link:hover,
.mega-parent-link.active {
    background: #fff;
    color: var(--brand-blue);
    border-left-color: var(--brand-blue);
}

.mega-arrow {
    font-size: 1.2rem;
    opacity: 0.4;
    transition: transform 0.2s;
}

.mega-parent-link:hover .mega-arrow,
.mega-parent-link.active .mega-arrow {
    opacity: 1;
    transform: translateX(3px);
}

/* Right: Child Categories */
.mega-menu-children {
    flex: 1;
    position: relative;
    background: #fff;
}

.mega-child-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 25px 30px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition:
        opacity 0.25s ease,
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow-y: auto;
    /* Enable vertical scrolling */
}

.mega-child-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.mega-child-link {
    display: block;
    font-family: var(--header-sans);
    padding: 10px 0;
    color: #555;
    text-decoration: none;
    font-size: 0.95rem;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s;
}

.mega-child-link:hover {
    color: var(--brand-blue);
    padding-left: 8px;
    border-bottom-color: var(--brand-blue);
}

.mega-no-children {
    font-family: var(--header-sans);
    color: #999;
    font-size: 0.9rem;
    font-style: italic;
}

/* ----------------------------------------
   5. MOBILE HEADER
   ---------------------------------------- */
.header-mobile-toggle,
.mobile-nav-panel {
    display: none;
}

.header-mobile-toggle {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent !important;
    border: 0;
    border-radius: 0;
    box-shadow: none !important;
    cursor: pointer;
    color: var(--text-primary);
}

.header-mobile-toggle:hover,
.header-mobile-toggle:focus,
.header-mobile-toggle:active {
    background: transparent !important;
    color: var(--text-primary);
}

.header-mobile-toggle:focus-visible,
.close-mobile-menu:focus-visible,
.mobile-expand-btn:focus-visible,
.mobile-nav-link:focus-visible,
.mobile-cat-link:focus-visible,
.mobile-nav-logo:focus-visible {
    outline: 3px solid var(--brand-blue);
    outline-offset: -3px;
}

/* ----------------------------------------
   6. RESPONSIVE
   ---------------------------------------- */
@media (max-width: 992px) {
    .site-header {
        padding: 10px 20px;
    }

    .main-nav {
        display: none;
    }

    .header-left {
        gap: 20px;
    }

    .header-mobile-toggle {
        display: inline-flex;
    }

    .mobile-nav-panel {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%;
        width: min(88vw, 360px);
        height: 100vh;
        height: 100dvh;
        box-sizing: border-box;
        background: var(--header-bg);
        z-index: 1001;
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        overflow: hidden;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-nav-panel.open {
        right: 0;
    }

    .mobile-nav-topbar {
        min-height: 80px;
        padding: 10px 16px 10px 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid rgba(51, 51, 51, 0.12);
        flex: 0 0 auto;
    }

    .mobile-nav-logo {
        min-width: 48px;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
    }

    .mobile-nav-logo img {
        display: block;
        width: auto;
        height: 44px;
        max-width: 150px;
        object-fit: contain;
    }

    .close-mobile-menu {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--text-primary);
        background: transparent !important;
        border: 0;
        border-radius: 0;
        box-shadow: none !important;
        cursor: pointer;
    }

    .close-mobile-menu:hover,
    .close-mobile-menu:focus,
    .close-mobile-menu:active {
        color: var(--text-primary);
        background: transparent !important;
    }

    .mobile-nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition:
            opacity 0.3s ease,
            visibility 0s linear 0.3s;
    }

    .mobile-nav-overlay.open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition-delay: 0s;
    }

    .mobile-nav-list {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        list-style: none;
        padding: 0;
        margin: 0;
        overscroll-behavior: contain;
    }

    .mobile-nav-item {
        margin: 0;
        border-bottom: 1px solid rgba(51, 51, 51, 0.12);
    }

    .mobile-nav-link {
        width: 100%;
        min-height: 64px;
        box-sizing: border-box;
        padding: 0 24px;
        display: flex;
        align-items: center;
        font-family: var(--header-sans);
        font-size: 1.12rem;
        font-weight: 600;
        line-height: 1.2;
        letter-spacing: 0.5px;
        text-transform: none;
        color: var(--text-primary);
        text-decoration: none;
        background: transparent !important;
        box-shadow: none !important;
    }

    .mobile-nav-link:hover,
    .mobile-nav-link:focus,
    .mobile-nav-link:active {
        color: var(--text-primary);
        background: transparent !important;
    }

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

    .mobile-nav-header .mobile-nav-link {
        flex: 1 1 auto;
        min-width: 0;
    }

    .mobile-expand-btn {
        width: 64px;
        height: 64px;
        min-width: 64px;
        min-height: 64px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-primary);
        background: transparent !important;
        border: 0;
        border-left: 1px solid rgba(51, 51, 51, 0.12);
        border-radius: 0;
        box-shadow: none !important;
        cursor: pointer;
    }

    .mobile-expand-btn:hover,
    .mobile-expand-btn:focus,
    .mobile-expand-btn:active {
        color: var(--text-primary);
        background: transparent !important;
    }

    .expand-icon {
        font-size: 1.5rem;
        font-weight: 300;
        line-height: 1;
        transition: transform 0.3s;
    }

    .mobile-nav-item.has-children.open .expand-icon {
        transform: rotate(45deg);
    }

    .mobile-sub-menu {
        max-height: 0;
        overflow: hidden;
        margin: 0;
        padding: 0;
        background: rgba(255, 255, 255, 0.28);
        transition: max-height 0.3s ease;
    }

    .mobile-nav-item.has-children.open .mobile-sub-menu {
        max-height: 70vh;
    }

    .mobile-cat-link {
        min-height: 52px;
        padding: 8px 28px 8px 40px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        font-family: var(--header-sans);
        font-size: 1rem;
        line-height: 1.3;
        color: #555;
        text-decoration: none;
        border-top: 1px solid rgba(51, 51, 51, 0.09);
        background: transparent !important;
        box-shadow: none !important;
    }

    .mobile-cat-link:hover,
    .mobile-cat-link:focus,
    .mobile-cat-link:active {
        color: #555;
        background: transparent !important;
    }
}

@media (max-width: 420px) {
    .site-header {
        padding-right: 14px;
        padding-left: 14px;
    }

    .mobile-nav-panel {
        width: min(92vw, 360px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header,
    .site-logo img,
    .main-nav .nav-item .nav-link::before,
    .mega-menu,
    .mobile-nav-panel,
    .mobile-nav-overlay,
    .mobile-sub-menu,
    .expand-icon {
        transition-duration: 0.01ms !important;
    }
}
