/* ============================================================
   1. ОБЩИЕ НАСТРОЙКИ
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Clarendon', sans-serif;
    background: #f5f7fb;
    color: #1e293b;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   2. ШАПКА
   ============================================================ */
header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo img {
    max-height: 50px;
    width: auto;
}

nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

nav button {
    background: transparent;
    border: none;
    padding: 8px 18px;
    font-size: 1rem;
    font-family: 'Clarendon', sans-serif;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    border-radius: 30px;
    transition: all 0.3s ease;
}

nav button:hover {
    background: #eef2ff;
    transform: translateY(-2px);
}

nav button.active {
    background: #1f90bc;
    color: #fff;
    box-shadow: 0 4px 10px rgba(31,144,188,0.3);
}

.header-phone a {
    color: #1f90bc;
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
}

/* ============================================================
   3. ОСНОВНОЙ КОНТЕНТ / СТРАНИЦЫ
   ============================================================ */
main {
    flex: 1;
    padding: 30px 0;
}

.page {
    display: none;
    animation: fadeSlide 0.6s ease forwards;
}

.page.active {
    display: block;
}

@keyframes fadeSlide {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   4. КНОПКИ
   ============================================================ */
.btn-primary {
    display: inline-block;
    background: #1f90bc;
    color: #fff;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.btn-primary:hover {
    background: #0088cf;
    transform: scale(1.03);
}

/* ============================================================
   5. ГЛАВНАЯ / HERO
   ============================================================ */
.hero {
    display: flex;
    align-items: center;
    gap: 40px;
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.06);
    margin-bottom: 50px;
    flex-wrap: wrap;
}

/* Видео на десктопе – фиксированный размер, как была картинка */
.hero-video {
    flex: 0 0 300px;
    width: 300px;
    height: 170px;        /* 16:9 от 300px */
    position: relative;
    background: #e9edf2;
    border-radius: 12px;
    overflow: hidden;
}

.hero-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.hero-video .video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9edf2;
    color: #94a3b8;
    font-size: 0.9rem;
    z-index: 1;
    border-radius: 12px;
}

/* Адаптив: на мобильных ширина не больше 250px, высота пропорциональна */
@media (max-width: 768px) {
    .hero-video {
        flex: 0 0 auto;
        width: 100%;
        max-width: 250px;
        position: relative;
        padding-bottom: 56.25%; /* 16:9 */
        height: 0;
    }
    .hero-video iframe,
    .hero-video .video-placeholder {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/* ============================================================
   6. ПРЕИМУЩЕСТВА
   ============================================================ */
.advantages {
    margin-bottom: 50px;
}

.advantages h2 {
    text-align: center;
    font-size: 2rem;
    color: #1e3c72;
    margin-bottom: 40px;
}

.adv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
}

.adv-item {
    background: #fff;
    padding: 25px 20px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
}

.adv-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

.adv-item img {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
}

.adv-item h3 {
    font-size: 1.1rem;
    color: #1e3c72;
    margin-bottom: 8px;
}

.adv-item p {
    font-size: 0.95rem;
    color: #64748b;
}

/* ============================================================
   7. ПРОГРАММЫ
   ============================================================ */
.programs {
    background: #fff;
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.06);
    margin-bottom: 30px;
}

.programs h2 {
    text-align: center;
    font-size: 2rem;
    color: #1e3c72;
}

.subtitle {
    text-align: center;
    color: #475569;
    margin-bottom: 30px;
}

.program-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    justify-items: center;
}

.program-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: 700;
    color: #1e3c72;
    transition: transform 0.3s ease;
}

.program-item:hover {
    transform: scale(1.05);
}

.program-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 8px;
}

.programs-btn {
    text-align: center;
    margin-top: 30px;
}

/* ============================================================
   8. О НАС
   ============================================================ */
.about-content {
    display: flex;
    gap: 40px;
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.06);
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.about-text {
    flex: 2;
}

.about-text p {
    margin-bottom: 15px;
}

.about-photo {
    flex: 1;
    text-align: center;
    min-width: 200px;
}

.about-photo img {
    width: 100%;
    max-width: 220px;
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.about-photo p {
    margin-top: 15px;
    font-size: 0.95rem;
}

.about-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.feature {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.feature h3 {
    color: #1e3c72;
    margin-bottom: 8px;
}

/* ============================================================
   9. ПРЕПОДАВАТЕЛИ
   ============================================================ */
.teachers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 30px;
}

.teacher-card {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    text-align: center;
    transition: all 0.3s ease;
}

.teacher-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

.teacher-card img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 3px solid #eef2ff;
}

.teacher-card h3 {
    font-size: 1.1rem;
    color: #1e3c72;
    margin-bottom: 4px;
}

.teacher-card .position {
    font-size: 0.85rem;
    color: #1f90bc;
    font-weight: 700;
    margin-bottom: 10px;
}

.teacher-card p {
    font-size: 0.9rem;
    color: #475569;
}

/* ============================================================
   10. ОТЗЫВЫ (карточка, текст, автор, аватар, карусель)
   ============================================================ */

/* --- Аватарки --- */
.review-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 15px;
    flex-shrink: 0;
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: #1f90bc;
}

.review-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.review-avatar.no-photo {
    background: #eef2ff;
    color: #1f90bc;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* --- Карточка отзыва (используется внутри карусели) --- */
.review-card {
    flex: 0 0 100%;
    box-sizing: border-box;
    min-width: 0;        /* ← добавь эту строку */
    display: flex;
    flex-direction: column;
    padding: 25px 30px;
    background: #fff;
    border-radius: 16px;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    transition: all 0.3s ease;
}

.review-card p {
    font-size: 0.95rem;
    color: #334155;
    margin-bottom: 15px;
    max-width: 100%;
    overflow-wrap: anywhere;   /* ← замени word-break: break-word на это */
}

.review-card .author {
    font-weight: 700;
    color: #1f90bc;
    text-align: right;
    font-size: 0.9rem;
}

/* --- Обрезка длинного текста отзыва --- */
.review-card .review-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 8;
    overflow: hidden;
}

.review-card .review-text.expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.expand-btn {
    display: inline-block;
    align-self: flex-start;
    margin-top: -5px;
    margin-bottom: 10px;
    background: none;
    border: none;
    color: #1f90bc;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
}

.expand-btn:hover {
    text-decoration: underline;
}

/* --- Карусель: обёртка, трек, кнопки, индикатор --- */
.reviews-carousel {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px 0;
}

.carousel-wrapper {
    position: relative;
    overflow: hidden;
    max-width: 100%;
    border-radius: 16px;
    transition: height 0.4s ease;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    min-height: 180px;
}

.carousel-track {
    display: flex;
    max-width: 100%;
    transition: transform 0.5s ease-in-out;
    will-change: transform;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(31, 144, 188, 0.85);
    color: #fff;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.carousel-btn:hover {
    background: #1f90bc;
    transform: translateY(-50%) scale(1.05);
}

.carousel-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }

.carousel-indicator {
    text-align: center;
    margin-top: 20px;
    font-size: 1rem;
    font-weight: 700;
    color: #1e3c72;
}

/* --- Планшеты --- */
@media (max-width: 768px) {
    .review-card {
        padding: 18px 22px;
    }
    .review-card p {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    .review-card .author {
        font-size: 0.85rem;
    }
    .review-card .review-text {
        -webkit-line-clamp: 6;
    }
    .review-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 12px;
    }
    .carousel-wrapper {
        min-height: 150px;
    }
    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 1.6rem;
    }
    .carousel-btn.prev { left: 5px; }
    .carousel-btn.next { right: 5px; }
    .carousel-indicator {
        font-size: 0.9rem;
        margin-top: 15px;
    }
}

/* --- Телефоны --- */
@media (max-width: 480px) {
    .reviews-carousel {
        padding: 10px 0;
        overflow: hidden;
        max-width: 370px;
    }
    .carousel-wrapper {
        min-height: 120px;
        border-radius: 12px;
        margin: 0 5px;
    }
@media (max-width: 480px) {
    .review-card {
        padding: 12px 14px 15px;
    }
}
    .review-card p {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    .review-card .author {
        font-size: 0.75rem;
        margin-top: 8px;
    }
    .review-card .review-text {
        -webkit-line-clamp: 5;
    }
    .review-avatar {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    .expand-btn {
        font-size: 0.75rem;
    }
    .carousel-btn {
        width: 34px;
        height: 34px;
        font-size: 1.3rem;
    }
    .carousel-btn.prev { left: 2px; }
    .carousel-btn.next { right: 2px; }
    .carousel-indicator {
        font-size: 0.8rem;
        margin-top: 12px;
    }
}

/* ============================================================
   11. СТРАНИЦА "ФОРМАТЫ"
   ============================================================ */
.formats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
    margin: 30px 0 50px;
}

.format-card {
    background: #fff;
    padding: 25px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    text-align: center;
    transition: all 0.3s ease;
}

.format-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.format-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 15px;
}

.format-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.format-card h3 {
    color: #1e3c72;
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.format-card p {
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.5;
}

.price-card {
    background: #f8faff;
    border: 2px solid #e0e7ff;
}

.price-card p {
    margin-bottom: 10px;
}

.price-card .btn-primary {
    margin-top: 10px;
}

/* --- Блок "География" --- */
.geography-block {
    display: flex;
    align-items: center;
    gap: 40px;
    background: #f9ef26;
    padding: 40px;
    border-radius: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.geo-content {
    flex: 2;
}

.geo-content h3 {
    font-size: 2rem;
    color: #1e3c72;
    margin-bottom: 15px;
}

.geo-content p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #1e293b;
}

.geo-footnote {
    margin: 20px 0;
    font-size: 0.95rem;
    color: #334155;
}

.geo-footnote p {
    margin-bottom: 8px;
}

.geo-image {
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.geo-image img {
    max-width: 100%;
    max-height: 300px;
    width: auto;
}

@media (max-width: 768px) {
    .geography-block {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
    }
    .geo-image {
        order: -1;
    }
    .geo-image img {
        max-height: 200px;
    }
}

/* ============================================================
   12. СТРАНИЦА "КОНТАКТЫ"
   ============================================================ */
.contacts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin: 30px 0 40px;
}

.contact-card {
    background: #fff;
    padding: 30px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    text-align: center;
    transition: all 0.3s ease;
}

.contact-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.contact-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.contact-card h3 {
    color: #1e3c72;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.contact-card p {
    color: #475569;
    font-size: 1rem;
    line-height: 1.6;
}

.contact-phone {
    display: inline-block;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f90bc;
    text-decoration: none;
    transition: color 0.3s;
}

.contact-phone:hover {
    color: #0088cf;
}

.contact-map-btn {
    display: inline-block;
    background: #1f90bc;
    color: #fff;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 700;
    transition: background 0.3s, transform 0.2s;
}

.contact-map-btn:hover {
    background: #0088cf;
    transform: scale(1.03);
}

/* На планшетах – две колонки */
@media (max-width: 768px) {
    .contacts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* На телефонах – одна колонка */
@media (max-width: 480px) {
    .contacts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .contact-phone {
        font-size: 1.2rem;
    }
}

/* ============================================================
   13. КАРТА 2ГИС
   ============================================================ */
.map-container {
    margin-top: 30px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.map-container iframe {
    display: block;
    width: 100%;
    height: 600px;
    border: none;
}

@media (max-width: 600px) {
    .map-container iframe {
        height: 250px;
    }
}

/* ============================================================
   14. ФУТЕР
   ============================================================ */
footer {
    background: #fff;
    padding: 30px 0;
    margin-top: 40px;
    border-top: 1px solid #e9edf2;
}

.footer-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-logo img {
    max-height: 40px;
}

.footer-info {
    text-align: center;
    font-size: 0.9rem;
    color: #64748b;
}

.footer-info p {
    margin-bottom: 5px;
}

.footer-info strong {
    color: #1f90bc;
}

.footer-social {
    display: flex;
    gap: 15px;
}

.footer-social a {
    display: inline-block;
    transition: transform 0.3s ease;
}

.footer-social a:hover {
    transform: scale(1.1);
}

/* ============================================================
   15. ПОПАП
   ============================================================ */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.popup.open {
    display: flex;
}

.popup-content {
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: fadeSlide 0.3s ease;
}

.close-popup {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.3s;
}

.close-popup:hover {
    color: #1e293b;
}

.popup-content h2 {
    color: #1e3c72;
    margin-bottom: 10px;
}

.popup-content form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.popup-content input,
.popup-content select {
    padding: 12px 15px;
    border: 1px solid #d1d9e6;
    border-radius: 8px;
    font-size: 1rem;
}

.popup-content button {
    align-self: flex-start;
}

@media (max-width: 600px) {
    .popup-content iframe {
        height: 700px; /* чуть меньше на телефонах */
    }
}

/* ============================================================
   16. ОБЩИЙ АДАПТИВ (шапка, hero, "о нас", футер)
   ============================================================ */
@media (max-width: 768px) {
    .header-flex {
        flex-direction: column;
        gap: 10px;
    }
    nav {
        justify-content: center;
    }
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
    }
    .hero-text h1 {
        font-size: 2rem;
    }
    .about-content {
        flex-direction: column;
        align-items: center;
    }
    .about-photo img {
        max-width: 150px;
    }
    .footer-flex {
        flex-direction: column;
        text-align: center;
    }
}

html, body {
    overflow-x: hidden;
    max-width: 100%;
}