/* Header Styles */
/* Reserve space while header is loading (avoids layout shift / flicker on inner pages) */
#header-placeholder.header-placeholder-loading {
    min-height: 95px;
    display: block;
}

/* Hide until layout has settled (Bootstrap/font reflow) on cloud inner pages; removed from JS after 2 rAFs */
#header-placeholder.header-placeholder-hidden {
    opacity: 0;
    pointer-events: none;
    transition: none;
}

#site-header *,
#header-placeholder .site-header * {
    font-family: inherit !important;
}

#site-header,
#header-placeholder .site-header {
    background-color: #000000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    height: 95px !important;
    min-height: 95px !important;
    max-height: 95px !important;
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid #1e2939;
    box-sizing: border-box;
    contain: layout style;
    /* Reduce scroll jitter: promote to own compositor layer so fixed header doesn’t repaint with content */
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.site-header .header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-height: 0;
}

.logo {
    flex-shrink: 0;
}

.logo img {
    height: 30px;
    width: auto;
}

.main-nav {
    display: flex;
    align-items: center;
    flex-grow: 1;
    justify-content: space-between; /* Space between nav list and button */
    margin-left: 40px; /* Space from logo */
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0 auto; /* Center in the available space */
    padding: 0;
    gap: 32px;
    align-items: flex-end; /* Align by bottom so underline stays at same height */
}

.nav-link {
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: border-color 0.2s ease, color 0.2s ease;
    border-bottom: 2px solid transparent;
    padding-bottom: 8px;
    margin-bottom: -10px; /* offset so layout doesn't shift */
    line-height: 1.25;
    display: inline-block;
    box-sizing: border-box;
}

.nav-link:hover,
.nav-item.dropdown:hover .nav-link {
    color: #ffffff;
    border-bottom-color: #e85d2a;
}

/* Active (current page) always stays highlighted, even when another item is hovered */
.nav-link.active {
    color: #ffffff;
    border-bottom-color: #e85d2a;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #e85d2a;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.btn-primary:hover {
    background-color: #d64d1f;
}

button.btn-primary {
    border: none;
    font-family: inherit;
    cursor: pointer;
}

/* Dropdown Styles */
.nav-item.dropdown {
    position: relative; /* Dropdown positions relative to this item */
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%; /* Below the nav item */
    left: 0; /* Aligns left edge with Services link */
    width: 700px; /* Reduced width */
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 24px;
    z-index: 1001;
    margin-top: 18px; /* Gap between underline and popup */
}

/* Specific styling for Products dropdown */
.nav-item.dropdown-products .dropdown-menu {
    width: 410px; /* Narrower width for single column */
}

/* Specific styling for Industries dropdown */
.nav-item.dropdown-industries .dropdown-menu {
    width: 600px;
}

/* Invisible bridge to maintain hover state across the gap */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -18px; /* Extends up to cover the margin gap */
    left: 0;
    width: 100%;
    height: 18px; /* Matches margin-top */
    background: transparent;
}

.nav-item.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dropdown-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dropdown-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent; /* Prepare for border on hover */
}

.dropdown-item:hover {
    background-color: #fff7ed;
    border-color: rgba(232, 93, 42, 0.2);
}

.dropdown-item.bg-highlight {
    background-color: #fff7ed;
    border-color: rgba(232, 93, 42, 0.25);
}

.item-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bg-orange-light {
    background-color: #fff7ed; /* Light orange background for icons */
}

/* Specific icon background adjustments on hover only; current-page item matches default */
.dropdown-item:hover .item-icon-box {
    background-color: #fff5f0;
}

.dropdown-item.bg-highlight .item-icon-box {
    background-color: #fff7ed; /* same as .bg-orange-light – no distinct highlight */
}

.dropdown-item.bg-highlight:hover {
    background-color: #fff7ed;
    border-color: rgba(232, 93, 42, 0.2);
}

.dropdown-item.bg-highlight:hover .item-icon-box {
    background-color: #fff5f0;
}

.item-icon-box img {
    width: 20px;
    height: 20px;
}

/* Products menu: grey SVGs → brand orange on all screen sizes */
.nav-item.dropdown-products .item-icon-box img {
    filter: brightness(0) saturate(100%) invert(42%) sepia(93%) saturate(1352%) hue-rotate(350deg) brightness(98%) contrast(91%);
}

.item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-title {
    font-size: 14px;
    font-weight: 600;
    color: #101828;
    line-height: 1.3;
}

.item-desc {
    font-size: 12px;
    color: #667085;
    line-height: 1.4;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #ffffff;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

/* Responsive */
@media (max-width: 1024px) {
    .header-container {
        display: flex;
        justify-content: space-between;
    }

    .main-nav {
        display: none; /* Hide main nav on mobile/tablet */
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        max-height: calc(100vh - 95px); /* 95px = header height; allow scroll inside menu */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain; /* prevent touch scroll from chaining to body */
        background-color: #000000;
        flex-direction: column;
        padding: 20px;
        align-items: flex-start;
        margin: 0;
    }

    .main-nav.active {
        display: flex;
    }

    .nav-list {
        flex-direction: column;
        width: 100%;
        gap: 0;
        margin: 0;
        align-items: stretch;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
        margin-top: 20px;
    }


    .nav-link {
        display: block;
        padding: 15px 0;
        border-bottom: 1px solid #1e2939;
        width: 100%;
        margin-bottom: 0;
        text-align: left;
    }

    .nav-link:hover {
        border-bottom-color: #e85d2a;
    }

    /* Current page stays highlighted when menu is open */
    .nav-link.active,
    .nav-item.dropdown.open > .nav-link.active {
        border-bottom-color: #e85d2a;
    }

    .mobile-menu-toggle {
        display: block;
    }

    /* Mobile Dropdown - click only, no hover */
    .dropdown-menu {
        position: static;
        transform: none;
        width: 100%;
        box-shadow: none;
        background-color: #111;
        padding: 0;
        display: none;
    }

    .nav-item.dropdown:hover .dropdown-menu {
        display: none;
    }

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

    .dropdown-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .dropdown-item {
        padding: 15px;
        border-radius: 0;
    }

    .item-title {
        color: #fff;
    }

    .item-desc {
        color: #999;
    }

    .bg-orange-light {
        background-color: #222;
    }

    .dropdown-item:hover {
        background-color: #222;
    }

    .dropdown-item.bg-highlight {
        background-color: rgba(232, 93, 42, 0.15);
    }

    .dropdown-item.bg-highlight .item-icon-box {
        background-color: #222;
    }

    .dropdown-item.bg-highlight:hover,
    .dropdown-item.bg-highlight:focus {
        background-color: rgba(232, 93, 42, 0.2);
    }

    .dropdown-item.bg-highlight:hover .item-icon-box,
    .dropdown-item.bg-highlight:focus .item-icon-box {
        background-color: #fff5f0;
    }

    .nav-item.dropdown-products .dropdown-menu {
        width: 100%;
    }

    .nav-item.dropdown-products .item-icon-box img {
        filter: brightness(0) saturate(100%) invert(42%) sepia(93%) saturate(1352%) hue-rotate(350deg) brightness(98%) contrast(91%);
    }

    .nav-item.dropdown-industries .dropdown-menu {
        width: 100%;
    }
}
