/* Адаптив главной страницы / страницы входа (theme/boost/templates/login.mustache).
   Подключается только на этой странице, поверх styles.css. На ширине >1340px ничего не меняет. */

html {-webkit-text-size-adjust: 100%; text-size-adjust: 100%;}
body {overflow-x: hidden;}
.home-content img, .all_content img, .footer_container img {max-width: 100%;}
.home-burger, .home-menu-extra {display: none;}
.footer_contacts a {color: inherit;}
.footer_contacts a:hover {color: #fff;}
.overlay {overflow-y: auto; -webkit-overflow-scrolling: touch; z-index: 1050;}

/* ---------- Ноутбуки и планшеты в горизонтали: убираем фиксированные ширины ---------- */
@media (max-width: 1340px) {
    .home-content, .footer_container {min-width: 0;}
    .home_container {width: auto; margin-left: 30px; margin-right: 30px; background-size: 34% auto;}
    .container_text {width: auto; max-width: 850px;}
    .container_title, .container_text {max-width: 64%;}
    .container_blocks {max-width: 64%;}
    .container_block .home_block {width: auto; flex: 1 1 0; min-width: 0;}
    .container_block .home_block:last-child {margin-right: 0;}
    .home_block {margin-right: 20px;}

    .all_content, .footer_content, .footer_content_bottom {width: auto; margin-left: 30px; margin-right: 30px;}
    .all_text {width: auto; max-width: 700px;}
    .section_img {max-width: 40%; height: auto; margin-left: 20px;}

    .service_block, .service_block_wide {width: auto !important; flex: 1 1 0; min-width: 0;}
    .service_block:last-child {margin-right: 0;}

    .program_row > a {flex: 1 1 0; min-width: 0;}
    .program_row .program_gap {margin-right: 20px !important;}
    .program_block.big, .program_block.normal {width: auto; height: 100%; min-height: 90px;}
    .program_block_text {margin-right: 10px;}

    .popup {width: 440px; max-width: calc(100% - 32px);}
}

/* ---------- Планшеты: бургер-меню ---------- */
@media (max-width: 991px) {
    .home-nav {flex-wrap: wrap; padding: 0 20px;}
    .home-logo {order: 1; flex: 1 1 auto; min-width: 0;}
    .home-logo img {max-height: 40px; width: auto;}
    /* Вход и выбор языка на мобильных живут внутри бургер-меню (.home-menu-extra) */
    .home-nav .home-lang, .home-nav .home-login {display: none;}

    .home-burger {order: 4; display: flex; flex-direction: column; justify-content: center; align-items: center; width: 36px; height: 36px; margin-left: 8px; padding: 0; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.5); background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none;}
    .home-burger:focus {outline: none;}
    .home-burger:focus-visible {box-shadow: 0 0 0 2px #35F0D6;}
    .home-burger span {display: block; width: 16px; height: 2px; margin: 2px 0; background: #fff; border-radius: 1px; transition: transform 0.2s ease, opacity 0.2s ease;}
    .home-nav.is-open .home-burger {background: rgba(255, 255, 255, 0.3);}
    .home-nav.is-open .home-burger span:nth-child(1) {transform: translateY(6px) rotate(45deg);}
    .home-nav.is-open .home-burger span:nth-child(2) {opacity: 0;}
    .home-nav.is-open .home-burger span:nth-child(3) {transform: translateY(-6px) rotate(-45deg);}

    .home-nav .home-menu {order: 5; flex: 0 0 100%; display: none; flex-direction: column; margin-top: 14px; padding: 6px 0; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px;}
    .home-nav.is-open .home-menu {display: flex;}
    .home-nav .hmenu {margin: 0; padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.1);}
    .home-nav .home-menu-extra {display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px;}
    .home-nav .home-menu-login {display: inline-flex; align-items: center; padding: 10px 20px; border-radius: 20px; background-color: #35F0D6; color: #30389A; font-weight: 700; text-transform: uppercase;}
    .home-nav .home-menu-login svg {margin-left: 10px;}
    .home-nav .home-menu-login svg path {stroke: #30389A;}
    .home-menu-langs {display: flex; margin-left: 12px;}
    .home-menu-langs a {display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-left: 8px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.5);}

    .home_container {background-image: none;}
    .container_title, .container_text, .container_blocks {max-width: none;}

    .all_content, .footer_content, .footer_content_bottom {margin-left: 20px; margin-right: 20px;}
    .about, .service {min-height: 0;}

    .footer_container {background-size: cover;}
    .footer_content {display: flex; flex-direction: column;}
    .footer_content .title {order: 1;}
    .footer_contacts {order: 2;}
    .footer_buttons {order: 3; float: none !important; margin-top: 24px !important; display: flex; flex-wrap: wrap;}
    .footer_buttons a {margin: 0 12px 12px 0;}
    .footer_content_bottom .home-menu {flex-wrap: wrap; justify-content: center;}

    .popup {width: auto; max-width: 480px; margin: 40px auto; padding: 0 16px;}
    .popup .close {right: 30px; top: 6px; z-index: 2;}
}

/* ---------- Телефоны ---------- */
@media (max-width: 767px) {
    .home-content {padding: 14px 0 0;}
    .home-nav {padding: 0 16px;}
    .container_border {margin: 14px 16px;}
    .home_container {margin-left: 16px; margin-right: 16px;}
    .home_container > div:last-child {margin-top: 32px !important;}

    .container_title {margin-top: 24px; padding-left: 14px; border-left-width: 4px; font-size: 22px; line-height: 29px; word-wrap: break-word; overflow-wrap: break-word;}
    .container_text {margin-top: 20px; padding-left: 0;}
    .container_buttons {display: flex; flex-direction: column;}
    .container_buttons a,
    .footer_buttons a {display: flex; align-items: center; justify-content: center; margin: 0; padding: 12px 20px; text-align: center; line-height: 18px;}
    .container_buttons a + a,
    .footer_buttons a + a {margin-top: 12px;}
    .container_blocks {margin-top: 28px !important;}
    .container_block {flex-direction: column; margin-top: 0;}
    .container_block .home_block {flex: none; width: 100%; margin: 0 0 12px; padding: 16px;}
    .home_block_icon {margin-right: 16px; flex-shrink: 0;}

    .all_content {margin: 16px 12px 0; padding: 20px 16px;}
    .title {font-size: 22px; line-height: 30px; margin-bottom: 14px;}
    .section_img {float: none; display: block; width: 100%; max-width: 100%; margin: 0 0 16px;}
    .all_text {max-width: none;}

    .service_container {flex-direction: column; margin-bottom: 0;}
    .service_block, .service_block_wide {flex: none; width: 100% !important; margin: 0 0 12px;}
    .service_block_icon img {width: 24px; height: auto;}

    .program_row {flex-direction: column; margin-bottom: 0 !important;}
    .program_row .program_gap {display: none;}
    .program_row > a {flex: none; margin-bottom: 12px;}
    .program_block.big, .program_block.normal {min-height: 70px; padding: 16px;}
    .program_block_text {font-size: 14px; line-height: 19px;}

    .footer_container {margin-top: 40px;}
    .footer_content {margin: 24px 12px 0; padding: 20px 16px;}
    .footer_contacts {display: flex; flex-direction: column;}
    .footer_contacts > span {margin-right: 0 !important; display: flex; align-items: center;}
    .footer_contacts > span + span {margin-top: 12px;}
    .footer_contacts svg {margin-right: 8px; flex-shrink: 0;}
    .footer_buttons {flex-direction: column;}
    .footer_content_bottom {margin: 0 12px; padding: 20px 4px;}
    .footer_content_bottom .hmenu {margin: 8px 12px;}
    .footer_copy {display: flex; flex-direction: column-reverse; align-items: center; text-align: center; margin-bottom: 24px !important;}
    .footer_social {float: none !important; margin-top: 16px;}
    .footer_social .circle:first-child {margin-left: 0;}

    .topNubex {right: 16px; bottom: 96px; width: 44px; height: 44px;}

    .popup {margin: 16px auto; padding: 0 10px;}
    .popup .close {right: 22px;}
    .popup .login-container {padding: 1.5rem 1rem; margin-bottom: 16px;}

    .fancybox__slide {padding: 8px !important;}
    .fancybox__content {max-width: 100% !important; max-height: 100% !important;}
}

/* ---------- Узкие телефоны (320–400px) ---------- */
@media (max-width: 400px) {
    .home-logo img {max-height: 32px;}
    .home-nav .home-menu-login {padding: 10px 14px; font-size: 13px;}
    .home-menu-langs a {width: 36px; height: 36px; margin-left: 6px;}
    .container_title {font-size: 20px; line-height: 26px;}
    .button_blue, .button_white {font-size: 13px;}
    .footer_content_bottom .hmenu {margin: 6px 8px;}
}
