/* =========================================================
   MAHIDHARA RESPONSIVE HEADER
========================================================= */

:root {
    --mh-green: #075f59;
    --mh-green-dark: #034943;
    --mh-red: #e50922;
    --mh-header-height: 92px;
    --mh-mobile-header-height: 74px;
}

body.mh-menu-open {
    overflow: hidden !important;
}

.mh-header,
.mh-header *,
.mh-mobile-menu,
.mh-mobile-menu * {
    box-sizing: border-box;
}

.mh-header {
    position: sticky;
    top: 0;
    z-index: 50000;
    width: 100%;
    min-height: var(--mh-header-height);
    border-bottom: 1px solid rgba(7, 95, 89, 0.08);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 34px rgba(7, 95, 89, 0.08);
    backdrop-filter: blur(18px) saturate(155%);
    -webkit-backdrop-filter: blur(18px) saturate(155%);
    transition:
        min-height 320ms cubic-bezier(0.22, 1, 0.36, 1),
        background 280ms ease,
        box-shadow 320ms ease,
        border-color 280ms ease;
}

.mh-header.is-scrolled {
    min-height: 78px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 14px 36px rgba(7, 95, 89, 0.14);
}

.mh-header-shell {
    position: relative;
    width: min(1160px, calc(100% - 44px));
    min-height: inherit;
    margin-inline: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 32px;
}

.mh-brand {
    display: block;
    line-height: 0;
}

.mh-brand img {
    display: block;
    width: 190px;
    height: auto;
    max-height: 54px;
    object-fit: contain;
    transition: filter 280ms ease, transform 320ms ease;
}

.mh-desktop-brand {
    justify-self: center;
}

.mh-mobile-brand {
    display: none;
}

.mh-desktop-left,
.mh-desktop-right nav {
    display: flex;
    align-items: center;
}

.mh-desktop-left {
    justify-content: flex-start;
    gap: clamp(24px, 3vw, 48px);
}

.mh-desktop-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(18px, 2.4vw, 34px);
}

.mh-desktop-right nav {
    gap: clamp(20px, 2.4vw, 34px);
}

.mh-desktop-left a,
.mh-desktop-right nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--mh-green-dark);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 220ms ease, transform 220ms ease;
}

.mh-project-link svg {
    width: 9px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.mh-desktop-left a::after,
.mh-desktop-right nav a::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: -8px;
    left: 0;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 240ms ease;
}

.mh-desktop-left a:hover,
.mh-desktop-left a:focus-visible,
.mh-desktop-left a[aria-current='page'],
.mh-desktop-right nav a:hover,
.mh-desktop-right nav a:focus-visible,
.mh-desktop-right nav a[aria-current='page'] {
    color: var(--mh-red);
    outline: none;
}

.mh-desktop-left a:hover::after,
.mh-desktop-left a:focus-visible::after,
.mh-desktop-left a[aria-current='page']::after,
.mh-desktop-right nav a:hover::after,
.mh-desktop-right nav a:focus-visible::after,
.mh-desktop-right nav a[aria-current='page']::after {
    transform: scaleX(1);
}

.mh-search {
    width: 192px;
    height: 36px;
    display: flex;
    align-items: center;
    padding: 0 9px 0 16px;
    border: 1px solid var(--mh-red);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.42);
    transition: border-color 260ms ease, background 260ms ease;
}

.mh-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--mh-green-dark);
    font: inherit;
    font-size: 11px;
}

.mh-search input::placeholder {
    color: rgba(3, 73, 67, 0.72);
    opacity: 1;
}

.mh-search button {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 4px;
    border: 0;
    background: transparent;
    color: var(--mh-red);
    cursor: pointer;
}

.mh-search svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mh-menu-toggle {
    display: none;
}

/* Transparent overlay version used by project hero pages. */
.mh-header-overlay {
    position: fixed;
    top: 0;
    left: 0;
    background:
        linear-gradient(
            180deg,
            rgba(9, 44, 69, 0.34) 0%,
            rgba(9, 44, 69, 0.10) 68%,
            transparent 100%
        );
    border-bottom-color: transparent;
    box-shadow: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.mh-header-overlay:not(.is-scrolled) .mh-desktop-left a,
.mh-header-overlay:not(.is-scrolled) .mh-desktop-right nav a {
    color: rgba(255, 255, 255, 0.96);
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.18);
}

.mh-header-overlay:not(.is-scrolled) .mh-brand img {
    filter: brightness(0) invert(1);
}

.mh-header-overlay:not(.is-scrolled) .mh-search {
    border-color: rgba(255, 255, 255, 0.64);
    background: rgba(255, 255, 255, 0.06);
}

.mh-header-overlay:not(.is-scrolled) .mh-search input {
    color: #ffffff;
}

.mh-header-overlay:not(.is-scrolled) .mh-search input::placeholder {
    color: rgba(255, 255, 255, 0.72);
}

.mh-header-overlay:not(.is-scrolled) .mh-search button {
    color: rgba(255, 255, 255, 0.90);
}

.mh-header-overlay.is-scrolled {
    background: rgba(255, 255, 255, 0.96);
    border-bottom-color: rgba(7, 95, 89, 0.08);
    box-shadow: 0 14px 38px rgba(7, 95, 89, 0.15);
    backdrop-filter: blur(18px) saturate(155%);
    -webkit-backdrop-filter: blur(18px) saturate(155%);
}

/* Mobile menu */
.mh-mobile-menu {
    position: fixed;
    inset: var(--mh-mobile-header-height) 0 0;
    z-index: 49999;
    display: none;
    width: 100%;
    height: calc(100dvh - var(--mh-mobile-header-height));
    padding: 22px 22px 34px;
    overflow-x: hidden;
    overflow-y: auto;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(7, 61, 58, 0.12);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(100%, 0, 0);
    transition:
        opacity 250ms ease,
        visibility 250ms ease,
        transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.mh-mobile-menu.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
}

.mh-mobile-nav {
    display: flex;
    width: 100%;
    flex-direction: column;
}

.mh-mobile-nav a {
    width: 100%;
    min-height: 58px;
    display: flex;
    align-items: center;
    padding: 12px 4px;
    border-bottom: 1px solid rgba(7, 95, 89, 0.10);
    color: var(--mh-green-dark);
    font-size: 15px;
    font-weight: 500;
}

.mh-mobile-nav a:hover,
.mh-mobile-nav a:focus-visible,
.mh-mobile-nav a[aria-current='page'] {
    color: var(--mh-red);
    outline: none;
}

.mh-mobile-search {
    width: 100%;
    height: 44px;
    margin-top: 20px;
}

@media (max-width: 1180px) {
    .mh-header-shell {
        width: min(1080px, calc(100% - 34px));
        gap: 22px;
    }

    .mh-desktop-left {
        gap: 24px;
    }

    .mh-desktop-right,
    .mh-desktop-right nav {
        gap: 22px;
    }

    .mh-search {
        width: 160px;
    }

    .mh-brand img {
        width: 176px;
    }
}

@media (max-width: 920px) {
    .mh-header,
    .mh-header.is-scrolled {
        min-height: var(--mh-mobile-header-height);
    }

    .mh-header-shell {
        width: calc(100% - 26px);
        min-height: var(--mh-mobile-header-height);
        display: flex;
        justify-content: center;
    }

    .mh-desktop-left,
    .mh-desktop-brand,
    .mh-desktop-right {
        display: none;
    }

    .mh-mobile-brand {
        position: relative;
        z-index: 50002;
        display: block;
    }

    .mh-mobile-brand img {
        width: 160px;
        max-height: 46px;
    }

    .mh-menu-toggle {
        position: absolute;
        top: 50%;
        right: 0;
        z-index: 50003;
        display: grid;
        place-content: center;
        width: 44px;
        height: 44px;
        padding: 10px;
        border: 0;
        border-radius: 50%;
        background: rgba(7, 95, 89, 0.08);
        transform: translateY(-50%);
        cursor: pointer;
        transition: background 220ms ease;
    }

    .mh-menu-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        margin: 3px auto;
        border-radius: 999px;
        background: var(--mh-green);
        transition: transform 250ms ease, opacity 200ms ease, background 250ms ease;
    }

    .mh-header-overlay:not(.is-scrolled) .mh-menu-toggle {
        background: rgba(255, 255, 255, 0.12);
    }

    .mh-header-overlay:not(.is-scrolled) .mh-menu-toggle span {
        background: #ffffff;
    }

    body.mh-menu-open .mh-header-overlay {
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 10px 30px rgba(7, 95, 89, 0.10);
    }

    body.mh-menu-open .mh-header-overlay .mh-brand img {
        filter: none;
    }

    body.mh-menu-open .mh-header-overlay .mh-menu-toggle span {
        background: var(--mh-green);
    }

    .mh-menu-toggle[aria-expanded='true'] span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .mh-menu-toggle[aria-expanded='true'] span:nth-child(2) {
        opacity: 0;
    }

    .mh-menu-toggle[aria-expanded='true'] span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

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

@media (max-width: 480px) {
    .mh-header-shell {
        width: calc(100% - 20px);
    }

    .mh-mobile-brand img {
        width: 148px;
    }

    .mh-mobile-menu {
        padding: 18px 18px 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mh-header,
    .mh-brand img,
    .mh-mobile-menu,
    .mh-menu-toggle span,
    .mh-desktop-left a,
    .mh-desktop-right nav a {
        transition-duration: 0.01ms !important;
    }
}
