/* Keep the original header layout fixed and reserve its actual height in the document. */
html {
    --site-header-height: 100px;
    scroll-padding-top: calc(var(--site-header-height) + 32px);
    scroll-behavior: smooth;
}
.section-header.wrap { min-height: var(--site-header-height); }
.header-wrap.fixed-site-header {
    min-height: 100px;
    position: fixed;
    z-index: 1000;
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background: var(--color-body);
}
.fixed-site-header::before {
    content: '';
    position: fixed;
    z-index: -1;
    top: 0;
    right: 0;
    left: 0;
    height: var(--site-header-height);
    background: var(--color-body);
    pointer-events: none;
}
@media (min-width: 480px) and (max-width: 1399px) {
    .header-wrap.fixed-site-header { width: calc(100% - 170px); }
}
@media (max-width: 479px) {
    html { --site-header-height: 100px; }
    .header-wrap.fixed-site-header { width: calc(100% - 60px); }
}
/* Menus remain reachable when the viewport is shorter than their expanded contents. */
@media (min-width: 1024px) {
    .fixed-site-header .nav-dots-wrap {
        max-height: calc(100vh - var(--site-header-height) - 24px);
        max-height: calc(100dvh - var(--site-header-height) - 24px);
        overflow-y: auto;
    }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* Header navigation typography at every viewport width. */
.fixed-site-header .nav-wrap,
.fixed-site-header .nav-dots,
.fixed-site-header .nav-dots-wrap,
.fixed-site-header .nav-dots-wrap .nav-link { font-size: 16px; }
.fixed-site-header .nav-project-link { font-size: 14px; }

/* Align industry links with the current reading direction. */
.fixed-site-header #industries-menu { text-align: start; }
.fixed-site-header #industries-menu .nav-link { padding-inline-start: 18px; }
.fixed-site-header #industries-menu .nav-dot {
    left: auto;
    right: auto;
    inset-inline-start: 8px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Services navigation: one link per service, with a short description. */
.fixed-site-header .nav-chevron {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin: 0 0 3px 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
}
.fixed-site-header .nav-menu-toggle[aria-expanded="true"] .nav-chevron {
    margin-bottom: 0;
    transform: rotate(225deg);
}
/* Service descriptions and cards are desktop-only. */
@media (min-width: 1024px) {
    .fixed-site-header .nav-services > .services-menu {
        box-sizing: border-box;
        display: none;
        gap: 6px;
        padding: 16px;
        list-style: none;
        text-align: left;
        border: 1px solid #e8e9ee;
        background: #fff;
        box-shadow: 0 18px 50px rgba(22, 27, 61, .12);
    }
    .fixed-site-header .nav-services.is-active > .services-menu { display: grid; }
    .fixed-site-header .services-menu .service-menu-item {
        display: block;
        min-width: 0;
        margin: 0;
        padding: 0;
    }
    .fixed-site-header .services-menu .service-menu-link {
        box-sizing: border-box;
        display: block;
        height: 100%;
        margin: 0;
        padding: 18px;
        border: 1px solid transparent;
        border-radius: 10px;
        color: #161b3d;
        line-height: 1.5;
        letter-spacing: 0;
        text-align: left;
        white-space: normal;
        overflow-wrap: break-word;
    }
    .fixed-site-header .service-menu-title {
        display: block;
        margin-bottom: 6px;
        font-size: 16px;
        font-weight: 700;
    }
    .fixed-site-header .service-menu-description {
        display: block;
        color: #596174;
        font-size: 14px;
        font-weight: 400;
        line-height: 1.6;
    }
    .fixed-site-header .services-menu .service-menu-link:hover,
    .fixed-site-header .services-menu .service-menu-link:focus-visible {
        background: #f6f7fa;
        border-color: #e8e9ee;
    }
    .fixed-site-header .services-menu .service-menu-link:focus-visible {
        outline: 2px solid var(--color-details);
        outline-offset: -2px;
    }
    .fixed-site-header .services-menu .service-menu-link[aria-current="page"] {
        background: #fff;
        border-color: #f3d4d8;
    }
    .fixed-site-header .service-menu-link[aria-current="page"] .service-menu-title {
        color: #bd1627;
    }
    .fixed-site-header .services-menu .nav-dot { display: none; }
}
@media (min-width: 1024px) {
    .fixed-site-header { --header-control-height: 32px; }
    .fixed-site-header #primary-navigation > :is(.nav-project-item, .nav-language-item) {
        display: inline-flex;
        align-items: center;
        vertical-align: middle;
    }
    .fixed-site-header .nav-project-link {
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        height: var(--header-control-height);
        top: 0;
        padding-block: 0;
    }
    .fixed-site-header .nav-services { position: static; }
    .fixed-site-header .nav-services > .services-menu {
        top: calc(100% + 16px);
        right: 0;
        left: auto;
        width: 760px;
        max-width: calc(100vw - 60px);
        grid-template-columns: repeat(2, minmax(0, 1fr));
        transform: none;
        background: var(--color-bg-elements);
    }
    .fixed-site-header #industries-menu {
        border: 1px solid #e8e9ee;
        box-shadow: 0 18px 50px rgba(22, 27, 61, .12);
    }
    /* Center each marker on its link, excluding the row's bottom spacing. */
    .fixed-site-header #industries-menu .nav-dot { top: calc(50% - 5.5px); }
    .fixed-site-header #industries-menu .nav-list-item:last-child .nav-dot { top: calc(50% - 2.5px); }
}
@media (max-width: 1023px) {
    html.mobile-menu-open { overflow: hidden; overscroll-behavior: none; }
    html.mobile-menu-open body {
        position: fixed;
        top: var(--mobile-menu-scroll-y, 0px);
        left: 0;
        width: 100%;
        overflow: hidden;
    }
    html.mobile-menu-open .fixed-site-header .blog-description { visibility: hidden; }
    /* The existing header stays visible above an edge-to-edge, scrollable menu. */
    .fixed-site-header .nav-wrap > #primary-navigation {
        box-sizing: border-box;
        position: fixed;
        inset: var(--site-header-height) 0 0;
        width: 100%;
        min-width: 0;
        height: calc(100vh - var(--site-header-height));
        height: calc(100dvh - var(--site-header-height));
        margin: 0;
        padding: 16px max(30px, env(safe-area-inset-right)) max(30px, env(safe-area-inset-bottom)) max(30px, env(safe-area-inset-left));
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        border: 0;
        border-top: 1px solid #e8e9ee;
        border-radius: 0;
        background: var(--color-body);
        text-align: start;
    }
    .fixed-site-header #primary-navigation > :is(.nav-list-item, .nav-dots) {
        margin: 0;
        padding: 0;
        border-radius: 0;
        border-bottom: 1px solid #e8e9ee;
    }
    .fixed-site-header #primary-navigation :is(.nav-link, .nav-menu-toggle, .nav-search-button, .nav-project-link, .nav-dots-wrap) {
        text-align: start;
    }
    .fixed-site-header #primary-navigation > .nav-list-item > .nav-link,
    .fixed-site-header #primary-navigation .nav-menu-toggle {
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        width: 100%;
        min-height: 60px;
        padding: 16px 0;
        font-size: 16px;
        line-height: 1.4;
        letter-spacing: 0;
    }
    .fixed-site-header #primary-navigation > .nav-list-item > .nav-dot { display: none; }
    .fixed-site-header #primary-navigation .nav-link[aria-current="page"] { color: #bd1627; }
    .fixed-site-header #primary-navigation .nav-chevron { flex-shrink: 0; margin-inline: 0 4px; }
    .fixed-site-header #primary-navigation > .nav-project-item {
        display: block;
        margin: 24px 0 12px;
        padding: 0;
    }
    .fixed-site-header #primary-navigation .nav-project-link {
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 52px;
        margin: 0;
        padding: 14px 20px;
        border-radius: 12px;
        font-size: 14px;
        line-height: 1.5;
        text-align: center;
    }
    .fixed-site-header #primary-navigation .nav-project-link::after { border-radius: inherit; }
    .fixed-site-header #primary-navigation > .nav-list-item:last-child { border-bottom: 0; }
    .fixed-site-header #primary-navigation .nav-search-button {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        min-height: 52px;
        padding: 12px;
        border: 1px solid #e8e9ee;
        border-radius: 12px;
        color: var(--color-font);
    }
    .fixed-site-header #primary-navigation .nav-search-button span {
        padding: 0;
        font-size: 16px;
        letter-spacing: 0;
        text-transform: none;
        color: inherit;
    }
    .fixed-site-header #primary-navigation .nav-search-button svg { width: 16px; height: 16px; fill: currentColor; }
    /* Both mobile submenus use the same title-only rows and active markers. */
    .fixed-site-header #services-menu { text-align: start; }
    .fixed-site-header :is(#services-menu, #industries-menu) > .nav-list-item { margin-bottom: 10px; }
    .fixed-site-header :is(#industries-menu, #services-menu) .nav-link {
        padding: 14px 12px;
        padding-inline-start: 24px;
        line-height: 1.5;
    }
    .fixed-site-header :is(#industries-menu, #services-menu) .nav-dot {
        left: auto;
        right: auto;
        inset-inline-start: 4px;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: none;
    }
    .fixed-site-header #services-menu .service-menu-title { display: inline; }
    .fixed-site-header #services-menu .service-menu-description { display: none; }
    .fixed-site-header .nav-label.is-active .hamburger-inner { height: 2px; transform: rotate(45deg); }
    .fixed-site-header .nav-label.is-active .hamburger-inner::after {
        bottom: 0;
        height: 2px;
        opacity: 1;
        transform: rotate(90deg);
    }
}
@media (min-width: 480px) and (max-width: 1023px) {
    .fixed-site-header .nav-wrap > #primary-navigation {
        padding-left: max(85px, env(safe-area-inset-left));
        padding-right: max(85px, env(safe-area-inset-right));
    }
}
