/* ===== Header ===== */
.hm-header {
    --_fg: #fff;
    --_bar-bg: transparent;
    --_bar-bg-scrolled: rgba(40, 39, 37, .86);
    --_drop-bg: rgba(52, 51, 49, .78);
    --_drop-fg: #fff;
    --_drawer-bg: rgba(28, 27, 26, .88);
    --_drawer-fg: #fff;
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    color: var(--_fg);
    font-family: var(--hm-font-body);
}
.hm-header[data-sticky="false"] { position: absolute; }
.hm-header--solid { position: sticky; top: 0; --_fg: var(--hm-c-text); --_bar-bg: var(--hm-c-bg); --_bar-bg-scrolled: var(--hm-c-bg); }
.hm-header--solid[data-sticky="false"] { position: relative; }

.hm-header__bar { position: relative; transition: color var(--hm-dur) var(--hm-ease); }
.hm-header__bar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--_bar-bg);
    transition: background-color var(--hm-dur) var(--hm-ease), box-shadow var(--hm-dur);
}
.hm-header--overlay .hm-header__bar::after {
    content: "";
    position: absolute;
    inset: 0 0 -40px;
    z-index: -2;
    background: linear-gradient(rgba(0, 0, 0, .38), transparent);
    pointer-events: none;
    transition: opacity var(--hm-dur);
}
.hm-header.is-scrolled .hm-header__bar::before { background: var(--_bar-bg-scrolled); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.hm-header.is-scrolled .hm-header__bar::after { opacity: 0; }

.hm-header__inner {
    display: flex;
    align-items: center;
    gap: clamp(16px, 2vw, 32px);
    max-width: calc(1400px + var(--hm-gutter) * 2);
    height: var(--hm-header-h);
    margin-inline: auto;
    padding-inline: var(--hm-gutter);
}

/* Logo */
.hm-header__logo { flex: none; display: block; line-height: 0; }
.hm-header__logo-img { height: 48px; width: auto; }
.hm-header__logo-img--dark { display: none; }
.hm-header--solid .hm-header__logo-img--light { display: none; }
.hm-header--solid .hm-header__logo-img--dark { display: block; }

/* Geo · phone · messengers */
.hm-header__meta { display: grid; gap: 2px; font-size: 13px; line-height: 1.3; min-width: 0; }
.hm-header__geo { opacity: .85; white-space: nowrap; }
.hm-header__contacts { display: flex; align-items: center; gap: 10px; }
.hm-header__phone { font-weight: 600; text-decoration: none; white-space: nowrap; }
.hm-header__social { display: flex; gap: 8px; }
.hm-header__social a { display: block; width: 18px; height: 18px; opacity: .9; transition: opacity .2s; }
.hm-header__social a:hover { opacity: 1; }
.hm-header__social svg { width: 100%; height: 100%; }

/* Desktop navigation */
.hm-header__nav { margin-left: auto; }
.hm-header__drawer-top, .hm-header__drawer-bottom { display: none; }
.hm-header__menu, .hm-header__sub { list-style: none; margin: 0; padding: 0; }
.hm-header__menu { display: flex; align-items: center; gap: clamp(14px, 1.6vw, 28px); }
.hm-header__item { position: relative; }
.hm-header__item > a {
    display: flex;
    align-items: center;
    gap: 6px;
    height: var(--hm-header-h);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
.hm-header__item.has-children > a::after {
    content: "";
    width: 5px; height: 5px;
    margin-top: -3px;
    border: solid currentColor;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
    opacity: .8;
}
.hm-header__expand { display: none; }

.hm-header__item > .hm-header__sub {
    position: absolute;
    top: calc(100% - 14px);
    left: -22px;
    min-width: 260px;
    padding: 14px 0;
    border-radius: 18px;
    background: var(--_drop-bg);
    color: var(--_drop-fg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--hm-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .25s var(--hm-ease), transform .25s var(--hm-ease), visibility .25s;
}
.hm-header__item:hover > .hm-header__sub,
.hm-header__item:focus-within > .hm-header__sub { opacity: 1; visibility: visible; transform: none; }
.hm-header__sub li { position: relative; }
.hm-header__sub a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 9px 22px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color .2s, color .2s;
}
.hm-header__sub a:hover { background: rgba(255, 255, 255, .1); }
.hm-header__sub .has-children > a::after {
    content: "";
    width: 6px; height: 6px;
    border: solid currentColor;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(-45deg);
}
/* Level 3 continues the same panel to the right */
.hm-header__sub .hm-header__sub {
    position: absolute;
    top: -14px;
    left: 100%;
    min-width: 380px;
    min-height: calc(100% + 28px);
    padding: 14px 0;
    border-left: 1px solid rgba(255, 255, 255, .14);
    border-radius: 0 18px 18px 0;
    background: var(--_drop-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
}
.hm-header__sub li:hover > .hm-header__sub,
.hm-header__sub li:focus-within > .hm-header__sub { opacity: 1; visibility: visible; }
.hm-header__sub .hm-header__sub a { font-weight: 400; }

.hm-header__cta { flex: none; }

/* Burger */
.hm-header__burger {
    display: none;
    position: relative;
    z-index: 3;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}
.hm-header__burger span {
    position: absolute;
    left: 6px;
    right: 6px;
    height: 2px;
    background: currentColor;
    transition: transform .3s var(--hm-ease), opacity .2s;
}
.hm-header__burger span:nth-child(1) { top: 13px; }
.hm-header__burger span:nth-child(2) { top: 21px; }
.hm-header__burger span:nth-child(3) { top: 29px; }
.hm-header.is-open .hm-header__burger span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hm-header.is-open .hm-header__burger span:nth-child(2) { opacity: 0; }
.hm-header.is-open .hm-header__burger span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---------- Tablet & mobile: burger drawer ---------- */
@media (max-width: 1199px) {
    .hm-header { --hm-header-h: 72px; }
    .hm-header__contacts { display: none; }
    .hm-header__burger { display: block; }
    .hm-header__cta { margin-left: auto; }
    .hm-header__cta + .hm-header__burger { margin-left: 0; }

    .hm-header__nav {
        position: fixed;
        inset: 0;
        z-index: 2;
        display: flex;
        flex-direction: column;
        margin: 0;
        padding: 0 0 calc(24px + env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
        background: var(--_drawer-bg);
        color: var(--_drawer-fg);
        backdrop-filter: blur(22px);
        -webkit-backdrop-filter: blur(22px);
        opacity: 0;
        visibility: hidden;
        transition: opacity .3s var(--hm-ease), visibility .3s;
    }
    .hm-header.is-open .hm-header__nav { opacity: 1; visibility: visible; }
    .hm-header__drawer-top {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 120px;
        padding: 20px var(--hm-gutter);
        border-bottom: 1px solid rgba(255, 255, 255, .35);
    }
    .hm-header__drawer-logo { height: 56px; width: auto; }
    .hm-header__menu {
        display: block;
        width: 100%;
        max-width: 560px;
        margin: 0 auto;
        padding: 28px var(--hm-gutter);
    }
    .hm-header__item { border: 0; }
    .hm-header__item > a, .hm-header__sub a {
        height: auto;
        padding: 14px 52px 14px 0;
        font-size: 19px;
        font-weight: 400;
        letter-spacing: .02em;
        text-transform: uppercase;
        white-space: normal;
    }
    .hm-header__item.has-children > a::after, .hm-header__sub .has-children > a::after { display: none; }
    .hm-header__item, .hm-header__sub li { position: relative; }
    .hm-header__expand {
        display: grid;
        place-items: center;
        position: absolute;
        top: 6px;
        right: -10px;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        background: none;
        color: inherit;
        cursor: pointer;
    }
    .hm-header__expand::before { content: "→"; font-size: 22px; line-height: 1; transition: transform .3s var(--hm-ease); }
    .is-open > .hm-header__expand::before { transform: rotate(90deg); }

    .hm-header__item > .hm-header__sub, .hm-header__sub .hm-header__sub {
        position: static;
        display: none;
        min-width: 0;
        min-height: 0;
        padding: 0 0 8px 18px;
        border: 0;
        border-left: 1px solid rgba(255, 255, 255, .2);
        border-radius: 0;
        background: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    .is-open > .hm-header__sub { display: block; }
    .hm-header__sub a { padding-block: 9px; font-size: 15px; text-transform: none; letter-spacing: 0; }
    .hm-header__sub .hm-header__expand { top: 0; }
    .hm-header__sub a:hover { background: none; opacity: .75; }

    .hm-header__drawer-bottom {
        display: grid;
        justify-items: center;
        gap: 18px;
        margin-top: auto;
        padding: 24px var(--hm-gutter) 0;
    }
    .hm-header__drawer-bottom .hm-btn { min-width: 240px; }
    .hm-header__drawer-phone { font-size: 15px; font-weight: 600; text-decoration: none; }
}
@media (max-width: 767px) {
    .hm-header__cta { display: none; }
    .hm-header__burger { margin-left: auto; }
    .hm-header__logo-img { height: 38px; }
    .hm-header__meta { font-size: 12px; }
}
@media (max-width: 359px) {
    .hm-header__geo { display: none; }
}
@media (max-width: 767px) {
    .hm-header__drawer-top { justify-content: flex-start; min-height: var(--hm-header-h); padding-block: 0; }
    .hm-header__drawer-logo { height: 38px; }
}
