:root {
    --color-primary: #004EA6;
    --color-primary-dark: #003d82;
    --color-secondary: #050625;
    --color-text-link: #ED254E;
    --color-bg-light: #F5F5FA;
    --color-bg-hover: #EBEBF4;
    --color-border: rgba(235, 235, 244, 0.47);
    --color-text-dark: #050625;
    --color-text-light: #666666;
    --color-white: #FFFFFF;
    --color-footer-bg: #001F41;

    --font-main: 'Gramatika', Arial, sans-serif;
    --font-size-xs: clamp(12px, 0.75rem, 13px);
    --font-size-sm: clamp(13px, 0.875rem, 15px);
    --font-size-base: clamp(14px, 1rem, 16px);
    --font-size-md: clamp(16px, 1.125rem, 19px);
    --font-size-lg: clamp(20px, 1.375rem, 25px);
    --font-size-xl: clamp(25px, 1.75rem, 32px);
    --font-size-xxl: clamp(32px, 2.5rem, 40px);

    --space-xs: clamp(4px, 0.25rem, 7px);
    --space-sm: clamp(8px, 0.5rem, 11px);
    --space-md: clamp(12px, 0.75rem, 16px);
    --space-lg: clamp(20px, 1.25rem, 26px);
    --space-xl: clamp(28px, 1.75rem, 32px);
    --space-xxl: clamp(32px, 2rem, 43px);

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-xxl: 24px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    --container-width: 1160px;
    --container-padding: clamp(10px, 2vw, 20px);

    --header-height: 42px;
    --main-header-height: clamp(150px, 15vw, 211px);
    --menu-item-height: clamp(50px, 5vw, 63px);
}

* {
    font-family: var(--font-main) !important;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: var(--font-main);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--color-text-dark);
    background-color: var(--color-white);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main {
    flex: 1;
}

/* Верхняя панель */
.header-up {
    background: var(--color-primary);
    height: var(--header-height);
    width: 100%;
}


.header-up-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
    display: flex;
    align-items: center;
    height: var(--header-height);
    justify-content: space-between;
}

.top-panel_group {
    display: flex;
    align-items: center;
}

.top-panel_group-social {
    gap: clamp(20px, 2vw, 26px);
}

.top-panel_group-feedback {
    gap: clamp(16px, 1.8vw, 22px);
}

/* Шапка */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
}

.main-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    height: var(--main-header-height);
}

.main-header_logo {
    display: flex;
    align-items: center;
    gap: clamp(7px, 3vw, 43px);
}

.main-header_logo_img {
    max-width: clamp(50px, 8vw, 107px);
    height: auto;
}

.main-header_title {
    width: min(425px, 100%);
    color: var(--color-secondary);
    font-size: clamp(13px, 1.5vw, 22px);
}

.main-header_controls {
    display: flex;
    gap: clamp(16px, 2vw, 28px);
    flex-wrap: wrap;
    align-items: center;
}

.main-header_button,
.main-header_search-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(8px, 0.8vw, 11px);
    height: clamp(44px, 4vw, 48px);
    border-radius: var(--radius-lg);
    color: var(--color-bg-light);
    font-weight: 500;
    border: 0;
    cursor: pointer;
    background: var(--color-bg-light);
    transition: background-color var(--transition-fast);
}

.main-header_button:hover,
.main-header_search-button:hover {
    background-color: var(--color-bg-hover);
}

/* Меню */
.container__header-menu {
    width: 100%;
    max-width: 1152px;
    margin: 0 auto;
    position: relative;
    z-index: 1000;
}

.nav {
    display: block;
    width: 100%;
}

.top-menu__root-items {
    display: flex;
    flex-direction: row;
    list-style: none;
    margin: 0;
    padding: 0;
    justify-content: space-between;
    border-top: 1px solid var(--color-border);
    background: white;
    position: relative;
}

.top-menu__root-item {
    position: static;
    padding: 0;
}

.top-menu__root-item__content {
    display: flex;
    align-items: center;
    min-height: var(--menu-item-height);
    padding: var(--space-xs);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.top-menu__root-item__content:hover {
    background-color: var(--color-bg-hover);
    border-radius: 8px;
}

.top-menu__root-item-link,
.top-menu__root-item-link:hover,
.top-menu__root-item-link:focus,
.top-menu__root-item-link:active,
.top-menu__root-item-link:visited {
    display: flex;
    align-items: center;
    min-height: var(--menu-item-height);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-secondary);
    padding: 0 var(--space-sm);
    white-space: nowrap;
    background: transparent;
    /* pointer-events: none; */
    text-decoration: none;
    border-bottom: none;
    outline: none;
}

.top-menu__root-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    outline: none;
    pointer-events: auto;
    transition: background-color var(--transition-fast);
}

.top-menu__root-item-icon:hover {
    background-color: var(--color-bg-hover);
    border-radius: 4px;
}

.top-menu__root-item-icon img {
    width: 13px;
    height: 13px;
    transition: transform 0.3s;
}

.top-menu__root-item-icon[aria-expanded="true"] img {
    transform: rotate(180deg);
}

/* Подменю */
/* Основной контейнер выпадающего меню */
#main-dropdown-container {
    position: absolute;
    background-color: var(--color-white);
    width: 100%;
    max-width: 1140px;
    padding: var(--space-lg) var(--space-xl);
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-lg);
    display: none;
}

#main-dropdown-container:not([hidden]) {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* 
   ВАЖНО: Контейнер для списка (2-й уровень). 
   Добавь этот класс или ID, если он есть в HTML (в твоем JS это dropdownListEl)
*/
#dropdown-list {
    display: flex;           /* Выстраивает пункты 2-го уровня в строку */
    flex-wrap: wrap;         /* Перенос на новую строку, если не влезают */
    gap: 30px;               /* Расстояние между колонками */
    align-items: flex-start;
}

/* Пункт 2-го уровня (теперь это колонка) */
.menu-item-wrapper {
    position: relative;
    width: auto;             /* Убираем 100%, чтобы элементы встали в ряд */
    min-width: 180px;        /* Минимальная ширина колонки */
    cursor: pointer;
}

.menu-item-link {
    display: block;
    padding: 10px 0;         /* Убираем лишние боковые отступы */
    text-decoration: none;
    color: var(--color-secondary, #333);
    font-weight: 700;        /* Делаем заголовки 2-го уровня жирнее */
    font-size: 15px;
}

/* Контейнер 3-го уровня — СКРЫТ по умолчанию */
.sub-menu-level-3 {
    border-radius: var(--radius-md);
    background-color: var(--color-bg-light);
    display: none; 
    position: absolute;      /* Вылетает из потока, чтобы не раздвигать соседние колонки */
    top: 100%;               /* Появляется строго под ссылкой */
    left: 0;
    width: max-content;            /* Ширина выпадающего списка */
    background: #fff;
    padding: 5px 15px 5px 15px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #eee;
    z-index: 10;
}

/* ЭФФЕКТ: Показываем 3-й уровень ПРИ НАВЕДЕНИИ на колонку 2-го уровня */
.menu-item-wrapper:hover > .sub-menu-level-3 {
    display: block;
}

/* Ссылки 3-го уровня */
.sub-menu-level-3 a {
    display: block;
    padding: 8px 15px;
    font-size: 14px;
    color: #666;
    text-decoration: none;
    font-weight: 400;
}

.sub-menu-level-3 a:hover {
    color: var(--color-primary, #000);
    background-color: #f8f9fa;
    text-decoration: none;
}



@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

#dropdown-title-link {
    display: inline-block;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-primary);
    margin: 0 0 var(--space-md) 0;
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--color-primary);
    text-decoration: none;
}

#dropdown-title-link:hover {
    text-decoration: none;
}

#dropdown-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-md) clamp(30px, 5vw, 60px);
    width: 100%;
    list-style: none;
    padding: 0;
    margin: 0;
}

#dropdown-list > div {
    flex: 0 0 auto;
    min-width: 180px;
}

#dropdown-list a {
    display: inline-block;
    font-size: var(--font-size-md);
    color: var(--color-text-link);
    text-decoration: none;
    line-height: 1.4;
    padding: var(--space-xs) 0;
    white-space: nowrap;
    transition: color var(--transition-fast);
    border-bottom: 1px solid transparent;
}

#dropdown-list a:hover {
    color: var(--color-secondary);
}

/* Футер */
.main-footer {
    position: relative;
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
    color: var(--color-white);
}

.main-footer__background {
    background: var(--color-footer-bg);
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: -1;
}

.main-footer-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.main-footer__logo {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
    font-size: var(--font-size-sm);
    text-decoration: none;
    color: var(--color-white);
}

.main-footer__logo-img {
    width: clamp(40px, 5vw, 71px);
    height: clamp(51px, 6vw, 91px);
}

.main-footer__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.main-footer__sitename {
    color: var(--color-white);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.main-footer__social {
    display: flex;
    gap: var(--space-lg);
    color: var(--color-white);
}

.main-footer-grid {
    display: grid;
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    align-items: baseline;
    grid-template-columns: repeat(3, auto);
    justify-content: space-between;
}

.main-footer-lower__label {
    color: rgba(235, 235, 244, 0.75);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-xs);
}

.main-footer-lower__value,
.main-footer-lower__value a {
    color: var(--color-white);
    font-size: var(--font-size-md);
    text-decoration: none;
}

.main-footer__small-text,
.main-footer__small-text a {
    color: rgba(235, 235, 244, 0.75);
    font-size: var(--font-size-xs);
    line-height: 1.6;
    text-decoration: none;
}

.footer__link {
    color: var(--color-white);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Адаптив */

@media (max-width: 1159px) {
    #main-dropdown-container {
        width: 90vw;
        left: 5%;
        transform: none;
        padding: var(--space-md);
    }

    #dropdown-list > div {
        min-width: 150px;
    }

    #dropdown-list {
        gap: var(--space-sm) 20px;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

@media (max-width: 767px) {
    .top-menu {
        display: none;
    }

    .main-footer-grid {
        grid-template-columns: 1fr;
    }

    .main-footer-grid > div {
        grid-column: 1 !important;
        grid-row: auto !important;
    }

    .main-footer-grid__extension {
        display: none;
    }

    .main-footer-grid > div:nth-child(2) .main-footer-lower__value::after {
        content: " (доб. 732, 734)";
        font-size: var(--font-size-base);
        color: var(--color-white);
    }
}

@media (max-width: 480px) {
    .main-footer__logo-img {
        width: 40px;
        height: 51px;
    }

    .main-footer__sitename {
        font-size: var(--font-size-xs);
    }
}

/* Утилиты */
.link {
    transition: all var(--transition-slow);
}

.link:hover {
    transform: scale(1.1);
}

.no-link {
    cursor: default;
}

/* Шрифты */
@font-face {
    font-family: 'Gramatika';
    src: url('./fonts/1095-font.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Gramatika';
    src: url('./fonts/1096-font.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}