/* ==========================================================================
   1. ГЛОБАЛЬНЫЕ НАСТРОЙКИ (СБРОС И БАЗА)
   ========================================================================== */
body, html {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    background-color: #F9FED8;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden; /* Защита от горизонтального скролла */
}

.wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    z-index: 1;
}

/* ==========================================================================
   2. ОБЩИЕ СТИЛИ ФОНОВЫХ БЛОКОВ (АДАПТИВНАЯ ВЫСОТА)
   ========================================================================== */
.background-1, .background-1-events, .background-1-history, .background-1-article,
.background-2, .background-2-events, .background-3, .background-4, .background-4-about {
    position: relative;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    height: auto !important; /* Высота подстраивается под контент */
    box-sizing: border-box;
    z-index: 1;
}

/* Специфические паддинги для блоков */
.background-1 {
    background-color: #5A062A;
    padding: 0 !important; /* Убираем отступы, чтобы баннер и край были единым целым */
}

.background-2 {
    background-color: #F9FED8;
    padding: 60px 0;
}

.background-3 {
    background-color: #5A062A;
    padding-top: 80px;     /* Место под torn-edge2 */
    padding-bottom: 130px; /* Запас для кнопки "Подробнее" и torn-edge3 */
    z-index: 2;
}

.background-4, .background-4-about {
    background-color: #F9FED8;
    margin-top: -80px !important; /* Нахлест на десктопе */
    padding-top: 100px !important;
    position: relative;
    z-index: 1; /* Уходит ПОД рваный край третьего блока */
}

/* Цвета для спец-страниц */
.background-1-events { background-color: #F9FED8; }

/* ==========================================================================
   3. РВАНЫЕ КРАЯ (TORN EDGES) — ПЛОТНАЯ СКЛЕЙКА
   ========================================================================== */
.torn-edge1, .torn-edge2, .torn-edge3 {
    width: 100%;
    height: 76px;
    background-repeat: no-repeat;
    background-size: cover;
    position: absolute;
    left: 0;
    pointer-events: none;
}

/* Край 1: Приклеен к НИЗУ картинки баннера (важно для отсутствия щелей) */
.banner-img .torn-edge1 {
    bottom: -1px; /* Микро-нахлест убирает белую линию */
    background-image: url(/dist/ba077a449d6cfc0c63c2.png);
    z-index: 10;
}
.background-1 .torn-edge1 {
    position: absolute !important;
    bottom: 0 !important;
    left: 0;
    width: 100%;
    height: 76px;
    background-image: url(/dist/ba077a449d6cfc0c63c2.png);
    background-repeat: no-repeat;
    background-size: cover;
    z-index: 10;
}

/* Край 2: Верх третьего блока */
.background-3 .torn-edge2 {
    top: 0;
    background-image: url(/dist/8e3f0a8b7f6aaeec8f0d.png);
    z-index: 10;
}

/* Край 3: Низ третьего блока (Всегда ПОВЕРХ анонсов) */
.background-3 .torn-edge3 {
    bottom: 0;
    background-image: url(/dist/ba077a449d6cfc0c63c2.png);
    z-index: 100 !important;
}

/* ==========================================================================
   4. ВСПОМОГАТЕЛЬНЫЕ ЭЛЕМЕНТЫ
   ========================================================================== */
.upbtn {
    z-index: 9999;
    width: 58px;
    height: 58px;
    position: fixed;
    bottom: 20px;
    right: 20px;
    cursor: pointer;
    background: url(/dist/9f5ff1cfd79f8b54f4ab.svg) no-repeat center / contain;
    transition: transform 0.3s ease;
}

/* ==========================================================================
   5. ЕДИНАЯ АДАПТАЦИЯ (MOBILE @MEDIA 991PX)
   ========================================================================== */
@media (max-width: 991px) {
    /* Сбрасываем нахлесты четвертого блока */
    .background-4, .background-4-about {
        margin-top: 0 !important;
        padding-top: 40px !important;
    }

    /* Уменьшаем высоту краев для мобильных */
    .torn-edge1, .torn-edge2, .torn-edge3 {
        height: 50px;
    }

    /* Мобильные паддинги для background-3 */
    .background-3 {
        padding-top: 60px !important;
        padding-bottom: 90px !important;
    }
}

/* ГЛОБАЛЬНЫЕ ССЫЛКИ */
a { text-decoration: none !important; }

@font-face {
    font-family: "Andantino script";
    src: url(/dist/f9058f1b71d38b6eaa39.ttf) format('truetype'),
         url(/dist/a88e245a1fd42f853ae3.woff2) format('woff2'),
         url(/dist/4b7179bc8284790c873e.woff) format('woff');
    font-style: normal;
    font-weight: normal;
}
@font-face {
    font-family: "Novelist";
    src: url(/dist/1d511c4989f47cf2b8fe.otf) format("opentype"),
         url(/dist/f9d03dc96786ddbaf24e.woff2) format('woff2'),
         url(/dist/5610dd157ae1aeafb667.woff) format('woff');
    font-style: normal;
    font-weight: normal;
}
@font-face {
    font-family: "Gabriola";
    src: url(/dist/88ea98efc0d476a13db1.ttf) format("truetype"),
         url(/dist/7f67351ace9f7b2defc3.woff2) format('woff2'),
         url(/dist/bc1aa45f0eaa6e33a561.woff) format('woff');
    font-style: normal;
    font-weight: normal;
}
@font-face {
    font-family: "Noah";
    src: url(/dist/37236cf279ec4db4ef89.ttf) format('truetype'),
         url(/dist/c7824c744b57e1c0cd68.woff2) format('woff2'),
         url(/dist/2f9c6e6534829c62d03a.woff) format('woff');
    font-style: normal;
    font-weight: normal;
}
@font-face {
    font-family: "Noah";
    src: url(/dist/d362ffa0591a5734a715.ttf) format('truetype'),
         url(/dist/57c2ab09a9ac2356b415.woff2) format('woff2'),
         url(/dist/53397dbd968548d19f30.woff) format('woff');
    font-style: normal;
    font-weight: bold;
}
@font-face {
    font-family: "Noah";
    src: url(/dist/f442dc89a6bc99bcb848.ttf) format("truetype"),
         url(/dist/fad82669606f4453a33c.woff2) format('woff2'),
         url(/dist/9b6059f1ead0aafa63e7.woff) format('woff');
    font-style: italic;
    font-weight: normal;
}

@font-face {
    font-family: "Noah";
    src: url(/dist/c2168a669bf11bc73eda.ttf) format("truetype"),
         url(/dist/d727ad3fd032440043c4.woff2) format('woff2'),
         url(/dist/72477596499b4ef3a50e.woff) format('woff');
    font-style: italic;
    font-weight: bold;
}
.footer {
    position: relative;
    width: 100%;
    min-height: 342px; /* Изменил на min-height */
    background-color: #0F0F0C;
    z-index: 0;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    padding: 40px 50px;
    box-sizing: border-box;
}

/* Верхний ряд: Логотипы и Кнопки */
.footer-main-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    width: 100%;
}
.nav-and-social {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-top: 50px;
    box-sizing: border-box;
}

/* Блок логотипов */
.logos-group {
    display: flex;
    gap: 10px;
}

.footer-logo, .footer-logo-nko {
    width: 192px;
    height: 192px;
    flex-shrink: 0;
    background-size: cover;
    background-repeat: no-repeat;
}

.footer-logo { background-image: url(/dist/add3ddc5518ecbfe99ec.png); }
.footer-logo-nko { background-image: url(/dist/5fdfbaafa6a86f0d9ef3.png); }

/* Группа кнопок навигации */
.footer-buttons-group {
    display: flex;
    flex-flow: row wrap;
    justify-content: flex-end;
    gap: 5px 20px;
    max-width: 650px;
    height: auto !important;
}

.footer-button-main-page, .footer-button-about, .footer-button-history,
.footer-button-biography, .footer-button-events, .footer-button-confidential {
    display: flex;
    height: 30px;
    color: #FFF;
    font-family: 'Noah', sans-serif !important;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none !important;
}

.footer-button-confidential {
    width: 100%; /* Занимает всю строку в своей группе */
    justify-content: flex-end;
    margin-top: 2px;
}

/* Соцсети (выносим в отдельный ряд) */
.social-group {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
}

.footer-button-rutube, .footer-button-vk, .footer-button-phone, .footer-button-tg {
    width: 39px;
    height: 39px;
    background-size: contain;
    background-repeat: no-repeat;
    transition: 0.2s;
    justify-content: center;
}

.footer-button-rutube { background-image: url(/dist/6c67e012caeb993599ec.svg); }
.footer-button-vk { background-image: url(/dist/5a2a5beabaf3b1ced1b0.svg); }
.footer-button-phone { background-image: url(/dist/84ab3413a4caaf070f76.svg); }
.footer-button-tg { background-image: url(/dist/027ffea5daa141ba195e.svg); }

/* Техническая маркировка (НКО и прочее) */
.marking-row {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 30px;
    width: 100%;
}

.marking-nko, .marking {
    color: #FFF;
    font-family: 'Noah', sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    max-width: 45%;
}

.marking { text-align: right; }

/* --- МОБИЛЬНАЯ АДАПТАЦИЯ --- */
@media (max-width: 991px) {
    .footer {
        height: auto !important; /* Убираем фиксированную высоту 342px */
        padding: 30px 15px !important;
        display: flex;
        flex-direction: column;
        align-items: center; /* Центрируем всё по середине */
    }

    .footer-main-content {
        flex-direction: column;
        align-items: center;
        gap: 25px;
    }

    .logos-group {
        flex-direction: row; /* Логотипы в ряд на мобильном */
        gap: 15px;
    }

    .footer-logo, .footer-logo-nko {
        width: 120px; /* Уменьшаем логотипы для мобильных */
        height: 120px;
    }

    .nav-and-social {
        padding-top: 0 !important; /* Убираем десктопный отступ в 21px */
        align-items: center;
        width: 100%;
    }

    .footer-buttons-group {
        flex-direction: column; /* Кнопки в столбик */
        align-items: center;
        gap: 12px;
        width: 100%;
        max-width: 100%;
    }

    /* Делаем все кнопки в футере одинаковыми и удобными на мобилках */
    .footer-buttons-group a {
        width: 90% !important; /* Почти на всю ширину экрана */
        height: 45px !important; /* Увеличиваем высоту для нажатия */
        justify-content: center !important;
        margin: 0 auto !important;
    }

    .social-group {
        justify-content: center;
        margin-top: 20px;
        gap: 20px;
    }

    .marking-row {
        flex-direction: column; /* Маркировки друг под другом */
        align-items: center;
        gap: 10px;
        margin-top: 30px;
        width: 100%;
    }

    .marking-nko, .marking {
        text-align: center !important;
        max-width: 100%;
        font-size: 11px; /* Чуть крупнее для читаемости */
    }
}

.footer-button-main-page,
.footer-button-about,
.footer-button-history,
.footer-button-biography,
.footer-button-events,
.footer-button-confidential {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
}

.footer-button-main-page:hover,
.footer-button-about:hover,
.footer-button-history:hover,
.footer-button-biography:hover,
.footer-button-events:hover,
.footer-button-confidential:hover {
    border: 1px solid #FFFFFF;
    text-decoration: none !important;
    color: #FFF !important;
}

.footer-button-confidential {
    width: auto !important;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: end;
    height: 30px;
    margin-left: auto;
}

/* Эффект имитации нажатия */
.footer-button-main-page:active,
.footer-button-about:active,
.footer-button-history:active,
.footer-button-biography:active,
.footer-button-events:active,
.footer-button-confidential:active {
    border: 1px solid #FFFFFF;
    transform: translateY(2px);
}

.footer-buttons-group a {
    border: 1px solid transparent;
    box-sizing: border-box;
}

/* ==========================================================
   МЕНЮ (HEADER) — ОСНОВНЫЕ СТИЛИ
   ========================================================== */
.menu {
    background: #0F0F0C;
    width: 100% !important;
    max-width: 100vw;
    height: 109px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    margin: 0 !important;
    position: relative;
    box-sizing: border-box;
    z-index: 1000;
}

/* ОБЕРТКА ЛОГОТИПА (КНОПКА-ССЫЛКА) */
.logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
    height: 109px; /* Высота вровень с меню */
    width: 109px;  /* Квадратная область */
    flex-shrink: 0;
    margin-right: 40px;
    /* Вместо border используем внутреннюю тень, чтобы размер не менялся ни на пиксель */
    box-shadow: inset 0 0 0 1px transparent;
}

/* ЭФФЕКТЫ ЛОГОТИПА */
.logo-link:hover {
    /* Внутренняя белая рамка - она никогда не выйдет за границы */
    box-shadow: inset 0 0 0 1px #FFFFFF;
}

.logo-link:active {
    box-shadow: inset 0 0 0 1px #FFFFFF;
    transform: translateY(2px); /* Анимация нажатия */
}

.menu_logo {
    width: 109px; /* Возвращаем твой оригинальный размер */
    height: 109px;
    background: url(/dist/add3ddc5518ecbfe99ec.png) #0f0f0c 50% / cover no-repeat;
    z-index: 1;
    /* Убираем все старые позиционирования, теперь всё центрирует .logo-link */
    position: relative;
    left: 0 !important;
    bottom: 0 !important;
}

/* НАВИГАЦИЯ */
.nav-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: flex-start;
}

.group2 {
    display: flex;
    gap: 30px;
    justify-content: space-between;
    align-items: center;
    width: auto;
    max-width: 100%;
    min-width: 300px;
    height: 40px;
    position: relative;
    margin-left: auto;
    flex-shrink: 0;
}

/* КНОПКИ МЕНЮ */
.menu-button-about, .menu-button-history, .menu-button-biography, .menu-button-events {
    display: flex;
    height: 30px;
    flex-shrink: 0;
    color: #FFF;
    font-family: 'Noah', sans-serif;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 3;
    background: transparent;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.menu-button-about { width: 60px; }
.menu-button-history { width: 84px; }
.menu-button-biography { width: 110px; }
.menu-button-events { width: 126px; }

.menu-button-about:hover, .menu-button-history:hover, .menu-button-biography:hover, .menu-button-events:hover {
    border: 1px solid #FFFFFF;
}

.menu-button-about:active, .menu-button-history:active, .menu-button-biography:active, .menu-button-events:active {
    border: 1px solid #FFFFFF;
    transform: translateY(2px);
}

/* ==========================================================
   МОБИЛЬНАЯ ВЕРСИЯ (BURGER)
   ========================================================== */
.burger-menu { display: none; }

@media (max-width: 991px) {
    .burger-menu {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 24px;
        background: transparent;
        border: none;
        cursor: pointer;
        z-index: 1002;
        margin-right: 20px;
    }
    .burger-menu span { width: 100%; height: 3px; background: #FFF; transition: 0.3s; }

    .nav-wrapper {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 109px;
        left: 0;
        width: 100%;
        height: calc(100vh - 109px);
        background: #0F0F0C;
        z-index: 1001;
        padding-top: 20px;
    }

    .nav-wrapper.active { display: flex; }

    .group2 {
        flex-direction: column;
        position: static !important;
        width: 100% !important;
        height: auto !important;
        gap: 20px;
        margin-left: 0;
    }

    .menu-button-about, .menu-button-history,
    .menu-button-biography, .menu-button-events {
        width: 80% !important;
        margin: 0 auto;
        height: 50px;
    }

    /* Анимация крестика */
    .burger-menu.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .burger-menu.open span:nth-child(2) { opacity: 0; }
    .burger-menu.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}

/* ССЫЛКИ И ЦВЕТА */
.group2 a, .to-main-btn {
    color: #FFFFFF;
    text-decoration: none !important;
}

.a1:hover { text-decoration: none; color: #5A062A; }
a { position: relative; z-index: 10; text-decoration: none; }
a:hover { color: #FFF; }
.to-main, .back {
    display: flex;
    justify-content: center;
    align-items: center;
    width: auto;
    height: 40px;
    flex-shrink: 0;
    z-index: 2;
}

.to-main-btn, .back-btn {
    display: flex;
    width: 130px;
    height: 30px;
    flex-shrink: 0;
    color: #FFF !important;
    font-family: 'Noah', sans-serif !important;
    text-decoration: none !important;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    background: transparent;
    transition: 0.2s;
    border: 1px solid transparent;
}

.to-main-btn:hover, .back-btn:hover {
    border: 1px solid #FFFFFF;
    text-decoration: none !important;
    color: #FFF !important;
}

.to-main-btn:active, .back-btn:active {
    border: 1px solid #FFFFFF;
    transform: translateY(2px);
}


@media (max-width: 991px) {
    .to-main, .back {
        margin-left: 0;
        margin-bottom: 20px;
        width: 100%;
    }

    .to-main-btn, .back-btn {
        width: 80%;
        height: 45px;
    }
}
