/* =========================
   HEADER / MENU — extracted
   ========================= */

/* Header wrapper */
.header {
    position: relative;
    z-index: 1000;
}

.header__content {
    display: flex;
    align-items: center;
    padding-top: 10px;
}

/* Nav alignment */
.nav { margin-left: auto; }

/* Base list reset */
.menu,
.menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    padding: 10px;
}

/* hidden toggles */
.menu-toggle,
.submenu-toggle { display: none; }

/* =========================
   BURGER
   ========================= */

.burger {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--stroke);
    background: #fff;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    cursor: pointer;

    position: relative;
    z-index: 1200;
}

.burger span {
    width: 18px;
    height: 2px;
    background: #000;
    margin: 2px 0;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

/* burger -> X */
.menu-toggle:checked + .burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle:checked + .burger span:nth-child(2) { opacity: 0; }
.menu-toggle:checked + .burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* =========================
   DESKTOP MENU
   ========================= */

.menu {
    display: flex;
    gap: 8px;
    font-size: 16px;
}

.menu__item { position: relative; }

.menu__link {
    display: flex;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.menu__link:hover {
    color: var(--green);

}

/*.menu__link.selected {*/
/*    color: var(--green);*/
/*    font-weight: 600;*/
/*}*/

.menu__link-icon {
    margin-left: 4px;
    transition: transform 0.2s ease;
}

/* =========================
   DROPDOWN — DESKTOP
   ========================= */

.menu__dropdown {
    position: absolute;
    top: calc(100% + 16px);
    left: 0;
    min-width: 220px;

    background: #fff;
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 16px;

    display: none;
    z-index: 1100;
}

.menu__dropdown li { margin-bottom: 8px; }
.menu__dropdown li:last-child { margin-bottom: 0; }


/* =========================
   LOGO (fixed height)
   ========================= */

/* link wrapper */
.header__logo{
    display:flex;
    align-items:center;
    gap: 14px;
    text-decoration:none;
    color: inherit;
}

/* fixed logo height */
.header__logo img{
    height: 44px;          /* фикс по высоте */
    width: auto;           /* ширина по пропорциям */
    display:block;
    flex: 0 0 auto;
    object-fit: contain;
}

/* text near logo */
.header__logo p{
    margin: 0;
    line-height: 1.15;
    font-size: 12px;
    font-weight: 700;
    color: #0b0b0b;
}

/* optional: tighten on small screens */
@media (max-width: 520px){
    .header__logo img{ height: 40px; }
    .header__logo p{ font-size: 11px; }
}


@media (min-width: 1281px) {
    .menu__item--dropdown:hover .menu__dropdown { display: block; }
    .menu__item--dropdown:hover .menu__link-icon { transform: rotate(180deg); }
}

/* =========================
   MOBILE MENU
   ========================= */

@media (max-width: 1280px) {
    .burger {
        display: flex;
        margin-left: auto;
    }

    .nav {
        position: fixed;
        inset: 0;
        background: var(--gradient);

        padding: 96px 32px 32px;
        transform: translateY(-100%);
        transition: transform 0.25s ease;

        z-index: 1100;
    }

    .menu-toggle:checked ~ .nav { transform: translateY(0); }

    .menu {
        flex-direction: column;
        gap: 16px;
        color: #fff;
    }

    .menu__link {
        color: #fff;
        line-height: 32px;
    }

    .menu__link.selected { color: #fff; }

    .menu__dropdown {
        position: static;
        border: none;
        background: transparent;
        padding: 8px 0 0 16px;
        display: none;
    }

    .submenu-toggle:checked ~ .menu__dropdown { display: block; padding: 10px 30px;}
    .submenu-toggle:checked + .menu__link .menu__link-icon { transform: rotate(180deg); }
}

/* overlay dim */
@media (max-width: 1280px) {
    .nav::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: -1;
    }
}


/* MOBILE: dropdown links must be white (otherwise they stay default/visited purple) */
@media (max-width: 1280px) {
    .menu__dropdown a{
        color:#fff;
        text-decoration:none;
    }
    .menu__dropdown a:visited{
        color:#fff;
    }
    .menu__dropdown a:hover{
        text-decoration: underline;
    }
}

/* =========================
   MOBILE DROPDOWN ANIMATION
   ========================= */

@media (max-width: 1280px){

    /* базово: скрыто, но НЕ через display */
    .menu__dropdown{
        display: block;              /* важно: оставляем block */
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        transform: translateY(-6px);
        transition: max-height .28s ease, opacity .22s ease, transform .22s ease;
        will-change: max-height, opacity, transform;
    }

    /* открыто: даём запас по высоте */
    .submenu-toggle:checked ~ .menu__dropdown{
        max-height: 520px;           /* если пунктов станет больше — увеличь */
        opacity: 1;
        transform: translateY(0);
    }
}
@media (max-width: 1280px){
    .menu__dropdown{ padding-top: 0; }
    .submenu-toggle:checked ~ .menu__dropdown{ padding-top: 8px; }
}


/* =========================
   DROPDOWN — DESKTOP (fixed hover gap)
   ========================= */

.menu__dropdown {
    position: absolute;
    top: 100%;                 /* было: calc(100% + 16px) */
    left: 0;
    min-width: 220px;

    background: #fff;
    border: 1px solid var(--stroke);
    border-radius: 12px;

    padding: 24px 16px 16px;   /* сверху “воздух”, но без разрыва hover */
    display: none;
    z-index: 1100;
}

@media (min-width: 1281px) {
    .menu__item--dropdown:hover .menu__dropdown { display: block; }
    .menu__item--dropdown:hover .menu__link-icon { transform: rotate(180deg); }
}

/* чтобы ссылки не становились фиолетовыми (visited) */
.menu__dropdown a{
    color: #0f172a;
    text-decoration: none;
}
.menu__dropdown a:visited{
    color: #0f172a;
}
.menu__dropdown a:hover{
    text-decoration: underline;
}
