/* Лендинг «Школы МФТИ» — по макету Figma (страница 1600px).
   Своя система, не админская: Montserrat, палитра и шкала из UI-кита. */

:root {
    --blue: #0069b4;
    --blue-60: rgba(0, 105, 180, 0.6);
    --blue-10: rgba(0, 105, 180, 0.1);
    --orange: #ee6e5b;
    --light-blue: #e3f3ff;
    --light-blue-2: #f0f4ff;
    --lavender: #4d6eaa;
    --lavender-2: #729ceb;
    --light-lavender: #a4c3fb;
    --light-orange: #ffece9;
    --light-orange-2: #ffb3a0;
    --white-60: rgba(255, 255, 255, 0.6);
    --white-70: rgba(255, 255, 255, 0.7);
    --page: #f4f6f9;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--page);
    color: var(--blue);
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-size: 18px;
    line-height: 1.3;
    letter-spacing: -0.03em;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1520px; margin: 0 auto; padding: 0 40px; }

/* Три яруса на всю страницу: десктоп, планшет (721–1100) и мобильный (≤720).
   Пороги совпадают с фреймами макета 1600 / 768 / 360. */
@media (max-width: 1100px) {
    .wrap { padding: 0 24px; }
}

@media (max-width: 720px) {
    .wrap { padding: 0 10px; }
}

/* ---------- типографика из кита ---------- */

.h1 {
    font-size: clamp(48px, 7.5vw, 120px);
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    margin: 0;
}

.h2 { font-size: clamp(32px, 3vw, 45px); font-weight: 500; line-height: 1; margin: 0; }
.h3 { font-size: clamp(28px, 2.6vw, 40px); font-weight: 500; line-height: 1; margin: 0; }
.h4 { font-size: clamp(24px, 2.3vw, 35px); font-weight: 500; line-height: 1; margin: 0; }
.text-1 { font-size: clamp(20px, 1.7vw, 25px); font-weight: 500; line-height: 1; }
.text-2 { font-size: 18px; font-weight: 400; line-height: 1.3; }
.descriptor { font-size: 20px; font-weight: 500; line-height: 1.2; }

/* Шкалы из UI Kit 360 и 768. Десктопная сидит в верхних границах clamp()
   и совпадает с китом 1600, поэтому переопределяется только два нижних яруса:
   clamp() по vw давал промежуточные размеры, которых в ките нет. */
@media (min-width: 721px) and (max-width: 1100px) {
    .h1 { font-size: 65px; }
    .h2 { font-size: 30px; }
    .h3 { font-size: 25px; }
    .h4 { font-size: 20px; line-height: 1.2; }
    .text-1 { font-size: 18px; }
    .text-2 { font-size: 14px; line-height: 1.2; }
    .descriptor { font-size: 14px; }
}

@media (max-width: 720px) {
    .h1 { font-size: 45px; }
    .h2 { font-size: 30px; }
    .h3 { font-size: 25px; }
    .h4 { font-size: 20px; line-height: 1.2; }
    .text-1 { font-size: 18px; }
    .text-2 { font-size: 14px; line-height: 1.2; }
    .descriptor { font-size: 14px; }
}

.section { padding-top: 90px; }

@media (max-width: 1100px) { .section { padding-top: 64px; } }
@media (max-width: 720px) { .section { padding-top: 48px; } }

.section-head { display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; }

/* ---------- кнопки ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 0;
    border-radius: 12px;
    background: var(--orange);
    color: #fff;
    font: 600 18px/1.2 'Montserrat', sans-serif;
    letter-spacing: -0.03em;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, summary:focus-visible {
    outline: 3px solid var(--lavender-2);
    outline-offset: 2px;
}

.btn--white { background: #fff; color: var(--blue); }

/* Button из кита — 16/120 на 1600 и 14/120 ниже. Объявлено после .btn:
   её font-shorthand иначе перебивает размер из блока типографики. */
@media (max-width: 1100px) { .btn { font-size: 14px; } }

/* ---------- хедер ---------- */

/* Шапка едет со страницей. Ниже 1100 она в потоке — хватает sticky; на
   десктопе в макете она лежит поверх первого экрана и потому вне потока,
   там fixed сохраняет и прокрутку, и наложение. */
.header { padding: 20px 0; position: sticky; top: 0; z-index: 40; }

/* Подложка включается, только когда шапка отъехала от верха: на первом экране
   в макете она лежит прямо на фотографии, без фона. */
.header[data-stuck="true"] {
    background: var(--page);
    box-shadow: 0 6px 24px rgba(0, 105, 180, 0.08);
}

/* Якорные переходы не должны прятать заголовок секции под шапку. */
section[id], div[id="consult"] { scroll-margin-top: 100px; }

/* Только прямой потомок: у выпадающего меню внутри тоже есть .wrap, и общий
   селектор превращал его в флекс-строку. */
.header > .wrap { display: flex; align-items: center; gap: 24px; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 25px; font-weight: 600; }
.brand img { width: 49px; height: 54px; }

.nav { display: flex; gap: 20px; margin: 0 auto; }

.nav a { font: 500 20px/1.2 'Montserrat', sans-serif; letter-spacing: -0.03em; padding-bottom: 6px; }
.nav a:hover { color: var(--orange); }

.nav-schools { position: relative; }
.nav-schools > a::after { content: ' ⌄'; font-size: 16px; }
.nav-schools-menu {
    position: absolute; top: 100%; left: 50%; translate: -50% 0;
    display: none; flex-direction: column; gap: 2px; min-width: 190px;
    background: #fff; border: 1px solid var(--blue-10); border-radius: 12px;
    padding: 10px; z-index: 30;
}
.nav-schools:hover .nav-schools-menu,
.nav-schools:focus-within .nav-schools-menu { display: flex; }
.nav-schools-menu a { font-size: 17px; padding: 8px 10px; border-radius: 8px; }
.nav-schools-menu a:hover { background: var(--light-blue-2); color: var(--blue); }

.header > .wrap > .btn { padding: 20px; width: 210px; }

.burger {
    display: none;
    margin-left: auto; flex: none;
    width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px;
    background: transparent; cursor: pointer;
    grid-auto-flow: row; place-content: center; place-items: center; gap: 5px;
}
.burger span { width: 24px; height: 2px; border-radius: 2px; background: var(--blue); transition: transform 0.2s ease, opacity 0.2s ease; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Панель под шапкой, а не полноэкранный оверлей: семь ссылок помещаются
   без перекрытия страницы, и на 768 это не выглядит мобильной заглушкой. */
.mobile-menu {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    background: #fff; border-top: 1px solid var(--blue-10);
    box-shadow: 0 18px 40px rgba(0, 105, 180, 0.12);
    padding: 8px 0 24px;
}
.mobile-menu ul { margin: 0; padding: 0; list-style: none; }
.mobile-menu ul a {
    display: block; padding: 14px 0;
    font: 500 20px/1.2 'Montserrat', sans-serif; letter-spacing: -0.03em;
    border-bottom: 1px solid var(--blue-10);
}
.mobile-menu ul a:hover { color: var(--orange); }
.mobile-menu .btn { width: 100%; margin-top: 20px; }

@media (max-width: 1100px) {
    .nav, .header > .wrap > .btn { display: none; }
    .burger { display: grid; }
    .mobile-menu[data-open="true"] { display: block; }
}

/* ---------- герой ---------- */

.hero { position: relative; overflow: hidden; }

.hero .wrap {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 860px;
}

.hero-copy { position: relative; z-index: 2; padding-top: 90px; }

.hero-copy .h1 { max-width: 653px; }

.hero-sub { margin: 60px 0 18px; max-width: 342px; }

.hero-points { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }

.hero-points li { display: flex; gap: 10px; align-items: flex-start; max-width: 350px; }

.check {
    flex: none; width: 31px; height: 32px; border-radius: 5px;
    background: var(--light-blue);
    display: grid; place-items: center;
}
.check img { width: 24px; height: 24px; }
.check--soft { background: var(--light-blue-2); }

.hero-copy .btn { margin-top: 26px; width: min(531px, 100%); }

.hero-art { position: relative; min-height: 640px; }

.hero-ellipse {
    position: absolute; left: 50%; top: 99px; translate: -50% 0;
    width: 803px; max-width: none; height: 821px;
}

.hero-photo {
    position: absolute; left: 50%; bottom: -40px; translate: -54% 0;
    /* height: auto обязателен: атрибут height у <img> — презентационная
       подсказка, и без сброса картинка растягивается на все 1086px. */
    width: 725px; max-width: none; height: auto;
}

.hero-clip { position: absolute; width: 0; height: 0; }

.dot { position: absolute; border-radius: 50%; }
.hero-art .dot--sky   { width: 50px; height: 50px; background: var(--light-lavender); left: 8%; top: 250px; }
.hero-art .dot--navy  { width: 60px; height: 60px; background: var(--lavender); left: 41%; top: 67px; }
.hero-art .dot--big   { width: 100px; height: 100px; background: var(--lavender); left: 5%; bottom: 40px; }
.hero-art .dot--light { width: 80px; height: 80px; background: var(--light-lavender); right: 6%; top: 552px; }
.hero .dot--orange    { width: 50px; height: 50px; background: var(--orange); left: 45%; top: 120px; z-index: 1; }

.intake-card {
    position: absolute; right: 0; bottom: 24px; z-index: 3;
    width: 342px; min-height: 202px;
    background: var(--blue); color: #fff;
    border-radius: 20px; padding: 15px;
    display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.intake-card::before {
    content: ''; width: 20px; height: 20px; border-radius: 50%;
    background: var(--light-lavender);
}
.intake-card .label { color: var(--white-60); font-size: 16px; line-height: 1; }
.intake-card .name { font-size: 35px; font-weight: 600; line-height: 1; margin: 10px 0 5px; }
.intake-card .dates { font-size: 18px; }

@media (min-width: 721px) and (max-width: 1100px) {
    .hero .wrap { min-height: 0; column-gap: 24px; }
    .hero-copy { padding-top: 24px; padding-bottom: 40px; }
    .hero-sub { margin: 28px 0 14px; }
    .hero-copy .btn { margin-top: 20px; }
    /* Колонка узкая: без сброса max-width подпись и пункты подлезали под фото. */
    .hero-sub, .hero-points li { max-width: 100%; }
    .hero-art { min-height: 560px; }
    .hero-ellipse { width: 340px; height: 348px; top: 40px; right: 8px; left: auto; translate: none; }
    /* Круг макета — это сама фотография: кадр 472x354 относится к эллипсу
       340x348 так же, как на десктопе. Правый край считаем от колонки, чтобы
       во всём ярусе 721–1100 волосы срезались одинаково, а круг не наезжал
       на текстовую колонку даже на 721. */
    .hero-photo {
        width: 472px; top: 34px; right: -37px; left: auto; bottom: auto; translate: none;
        clip-path: url(#hero-photo-clip-sm);
    }
    .intake-card {
        width: 264px; right: 0; bottom: 60px;
        min-height: 0; gap: 14px; padding: 12px 14px;
    }
    .intake-card .name { font-size: 26px; margin: 6px 0 4px; }
    .intake-card .dates { font-size: 16px; }
    /* Кружки привязаны к правому краю — как круг и фотография. От процентов
       колонки они уезжали: на 768 лежали на фотографии, а на 1023 колонка шире
       на 130px, и они оказывались в пустой полосе между текстом и кругом.
       Отступы подобраны так, чтобы на 768 всё осталось на прежних местах. */
    .hero .dot--orange { left: auto; right: 310px; top: 150px; }
    .hero-art .dot--navy { left: auto; right: 170px; top: 20px; }
    .hero-art .dot--big { width: 70px; height: 70px; left: auto; right: 261px; bottom: 150px; }
    .hero-art .dot--light { width: 60px; height: 60px; right: 21px; top: 420px; }
    .hero-art .dot--sky { left: auto; right: 270px; top: 180px; }
}

@media (max-width: 720px) {
    /* В мобильном фрейме фотография стоит между заголовком и подписью, а не
       под всей колонкой текста, поэтому .hero-copy отдаёт детей сетке .wrap
       и порядок задаётся через order. */
    .hero .wrap { grid-template-columns: 1fr; min-height: 0; padding-top: 24px; }
    .hero-copy { display: contents; }
    .hero-copy .h1 { order: 1; }
    .hero-art { order: 2; }
    .hero-sub { order: 3; }
    .hero-points { order: 4; }
    .hero-copy .btn { order: 5; }
    .intake-card { order: 6; }

    .hero-sub { margin: 20px 0 5px; }
    .hero-points { gap: 5px; }
    .hero-copy .btn { margin-top: 19px; }

    /* Кадр «Фотография» из фрейма 360 — 339x386: круг 328x336 стоит в нём на
       10.6/50.3, фотография 485px — на -95/70. Расстояние по горизонтали между
       ними постоянное (105.6px), поэтому у обоих один и тот же клэмп: на 360
       они встают ровно по макету, на широких мобильных — по центру колонки.
       Голова уходит за правый край экрана, её режет overflow у .hero. */
    .hero-art { min-height: 386px; margin-top: 9px; }
    .hero-ellipse {
        width: 328px; height: 336px; top: 50px;
        left: max(10.6px, calc(50% - 164px)); translate: none;
    }
    .hero-photo {
        width: 485px; top: 70px; bottom: auto;
        left: max(-95px, calc(50% - 269.6px)); translate: none;
        clip-path: url(#hero-photo-clip-xs);
    }

    /* Кружки — по координатам того же кадра; в нём они лежат поверх фото,
       иначе тот, что на 122/278, целиком скрывался бы кругом. */
    .hero-art .dot { z-index: 1; }
    .hero-art .dot--sky   { width: 20px; height: 20px; left: 39px; top: 95px; }
    .hero-art .dot--navy  { width: 58px; height: 58px; left: 258px; top: 63px; }
    .hero-art .dot--big   { width: 32px; height: 32px; left: 122px; top: 278px; bottom: auto; }
    .hero-art .dot--light { width: 40px; height: 40px; left: 296px; right: auto; top: 290px; }

    .intake-card { position: static; margin-top: 16px; width: 100%; }
    /* В одну колонку свободного поля рядом с заголовком нет — точка садилась
       прямо на слово «ШАГ». */
    .hero .dot--orange { display: none; }
}

/* Десктоп — по фрейму «Первый экран» 1600x920 из Figma. Шапка там лежит
   поверх экрана, поэтому она уходит из потока, а всё внутри героя
   отсчитывается от верха страницы, а не от низа шапки. */
@media (min-width: 1101px) {
    .header { position: fixed; left: 0; right: 0; top: 0; }

    /* Между 1101 и 1600 своего макета нет: композицию берём от 1600-го фрейма
       и ужимаем пропорционально колонке, иначе фото 1115px лезет на заголовок.
       От 1520 и шире коэффициент равен единице — это и есть макет. */
    .hero { --hero-k: calc((min(1520px, 100vw) - 80px) / 1440px); }

    .hero .wrap { min-height: calc(920px * var(--hero-k)); }

    .hero-art { transform: scale(var(--hero-k)); transform-origin: 100% 0; }

    .hero-copy { padding-top: 133px; }
    .hero-sub { margin: 20px 0 15px; }

    .hero-ellipse { left: auto; right: 77px; top: 99px; translate: none; }

    /* Фото не лежит поверх круга прямоугольником: оно вписано в круг, а голова
       и плечо выходят за него вправо-вверх. Обе области — один clipPath из
       макета, координаты в системе самой картинки (1115x836). */
    .hero-photo {
        left: auto; right: -29px; top: 84px; bottom: auto; translate: none;
        width: 1115px;
        clip-path: url(#hero-photo-clip);
    }

    /* right: 0 отсчитывается от padding-box .wrap, то есть на 40px правее
       колонки контента, — в макете карточка стоит по её краю. */
    .intake-card { right: 40px; bottom: 48px; }

    /* Браузерные отступы <p> раздували карточку до 232px вместо 202px:
       space-between тогда разносил точку и текст не по макету. */
    .intake-card p { margin: 0; }

    .hero-copy .btn { margin-top: 23px; }

    .hero-art .dot--orange { left: -91px; top: 208px; }
    .hero-art .dot--navy { left: 110px; top: 91px; }
    .hero-art .dot--big { left: -116px; top: 777px; bottom: auto; }
    .hero-art .dot--light { right: 46px; top: 552px; }
}

/* ---------- о проекте ---------- */

.about-card {
    position: relative;
    background: #fff;
    border-radius: 30px;
    padding: 30px 40px 70px;
    overflow: hidden;
}

.about-label { position: absolute; left: 40px; top: 30px; }

.about-title { display: grid; grid-template-columns: 346px 1fr; gap: 24px; margin-bottom: 60px; }
.about-title .h2 { grid-column: 2; max-width: 720px; }
.about-title .h2 .lead { display: block; }

.about-grid { display: grid; grid-template-columns: minmax(300px, 1fr) 342px 342px; gap: 24px; justify-content: end; }

.about-cloud { position: relative; }
.about-cloud img { width: 100%; max-width: 539px; height: auto; }

/* Пунктирные связи с цифрами: рисует landing.js по реальным координатам. */
.about-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

@media (max-width: 1250px) { .about-lines { display: none; } }

.about-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 40px;
    margin-top: 150px;
    padding-left: 70px;
    position: relative;
}

.fact:nth-child(1) { justify-self: start; }
.fact:nth-child(2) { justify-self: center; }
.fact:nth-child(3) { justify-self: end; }

.fact .num {
    margin: 0;
    display: flex; align-items: flex-start; gap: 16px;
    font-size: clamp(64px, 7vw, 120px); font-weight: 400; line-height: 1;
}
.fact .num img { height: 0.5em; width: auto; margin-top: 0.14em; }
.fact .text-2 { margin: 6px 0 0; max-width: 300px; }

.plus-sign { position: relative; width: 0.6em; height: 0.6em; margin-top: 0.2em; flex: none; }
.plus-sign i { position: absolute; background: var(--orange); border-radius: 10px; }
.plus-sign i:nth-child(1) { width: 3px; height: 46%; left: calc(50% - 1.5px); top: 0; }
.plus-sign i:nth-child(2) { width: 3px; height: 46%; left: calc(50% - 1.5px); bottom: 0; }
.plus-sign i:nth-child(3) { width: 46%; height: 3px; top: calc(50% - 1.5px); right: 0; }
.plus-sign i:nth-child(4) { width: 46%; height: 3px; top: calc(50% - 1.5px); left: 0; }

@media (min-width: 1101px) and (max-width: 1250px) {
    .about-title { grid-template-columns: 1fr; }
    .about-facts { margin-top: 50px; padding-left: 0; }
    .about-title .h2 { grid-column: 1; }
    .about-grid { grid-template-columns: 1fr 1fr; }
    .about-cloud { grid-column: 1 / -1; max-width: 560px; }
}

@media (min-width: 721px) and (max-width: 1100px) {
    .about-card { padding: 24px 24px 40px; }
    .about-label { left: 24px; top: 24px; }
    .about-title { grid-template-columns: 128px 1fr; gap: 16px; margin-bottom: 32px; }
    /* Облако слева на всю высоту текста, оба текстовых блока — справа. */
    .about-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
    .about-cloud { grid-column: 1; grid-row: 1 / span 2; }
    .about-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 48px; padding-left: 0; }
    .fact .num { font-size: 44px; }
}

@media (max-width: 720px) {
    .about-title { grid-template-columns: 1fr; margin-bottom: 32px; }
    .about-title .h2 { grid-column: 1; }
    .about-grid { grid-template-columns: 1fr; }
    .about-card { padding: 20px 10px 40px; }
    .about-label { position: static; margin-bottom: 16px; }

    /* Цифры отбиты от текста и подписаны вертикальной линией с точками —
       это мобильная замена пунктирным связям, которые ниже 1250px скрыты. */
    .about-facts {
        grid-template-columns: 1fr; gap: 15px;
        margin-top: 40px; padding-left: 29px;
    }
    .about-facts::before {
        content: ''; position: absolute; left: 0; top: -14px; bottom: -14px; width: 7px;
        background:
            radial-gradient(circle at 50% 50%, var(--blue) 49%, transparent 50%) top center / 7px 7px no-repeat,
            radial-gradient(circle at 50% 50%, var(--blue) 49%, transparent 50%) bottom center / 7px 7px no-repeat,
            linear-gradient(var(--blue), var(--blue)) center top 4px / 1px calc(100% - 8px) no-repeat;
    }
    .fact .num { font-size: 80px; gap: 10px; }
    .fact .text-2 { max-width: 275px; margin-top: 0; }
}

/* Лесенка из justify-self нужна только широкой сетке под пунктирные связи;
   ниже 1100 она превращается в три цифры с разъезжающимся отступом. */
@media (max-width: 1100px) {
    .fact:nth-child(1), .fact:nth-child(2), .fact:nth-child(3) { justify-self: start; }
}

/* ---------- кто за этим стоит ---------- */

.orgs { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 58px; }

.org {
    background: #fff; border: 1px solid var(--blue-10); border-radius: 30px;
    padding: 30px; display: flex; flex-direction: column; gap: 20px;
}

.org-logo {
    height: 309px; border-radius: 16px;
    background: var(--light-blue-2); border: 1px solid var(--blue-10);
    display: grid; place-items: center;
}
.org-logo img { max-height: 55%; max-width: 65%; }
.org-logo-fc { height: 200px; width: auto; }

.org .h3 { margin-bottom: 10px; }

.org-stats { display: flex; flex-direction: column; gap: 16px; margin: 20px 0; }
.org-stat { margin: 0; display: flex; align-items: center; gap: 10px; }
/* flex: none обязателен — без него nowrap-число ужимается по ширине бокса,
   но не по содержимому, и «№ 1» уезжает под свою же подпись. */
.org-stat b { flex: none; font-size: clamp(32px, 3vw, 45px); font-weight: 500; line-height: 1; min-width: 80px; white-space: nowrap; }
.org-stat .text-2 { min-width: 0; overflow-wrap: break-word; }
.org-stat--wide b { min-width: 0; }

/* Узко — числа и подписи встают в две колонки на всю группу: колонка чисел
   равна самому широкому из них, подпись переносится, а не распирает карточку
   (иначе nowrap задирает min-content и страница едет по горизонтали). */
@media (max-width: 1100px) {
    .org-stats { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px 10px; align-items: baseline; }
    .org-stat { display: contents; }
    /* Колонка чисел равна самому широкому из них, поэтому её кегль напрямую
       решает, сколько места останется подписи. */
    .org-stat b, .org-stat--wide b { min-width: 0; font-size: 28px; }
}

@media (max-width: 720px) {
    .orgs { grid-template-columns: 1fr; }
    .org-logo { height: 220px; }
    .org-stat b, .org-stat--wide b { font-size: 26px; }
}

/* ---------- карусели (школы, отзывы) ---------- */

.rail-head { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 20px; }
.rail-head .h2 { grid-column: 1 / -1; text-align: center; }
.rail-head--inline { display: flex; justify-content: center; position: relative; }
.rail-head--inline .arrows { position: absolute; right: 0; top: 0; }

.arrows { display: flex; gap: 6px; }
.arrows--rail-only { display: none; }
.arrow {
    width: 50px; height: 50px; border: 0; padding: 0; border-radius: 50%;
    background: transparent; cursor: pointer;
}
.arrow img { width: 50px; height: 50px; transform: rotate(-90deg); }
.arrow--next img { transform: rotate(90deg); }
.arrow:disabled { opacity: 0.35; cursor: default; }

.rail {
    display: grid; grid-auto-flow: column; grid-auto-columns: 464px;
    gap: 24px; margin-top: 34px;
    overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    padding: 16px 4px 4px;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }

/* Заголовок по центру, стрелки — по краям строки под ним: справа-вдвоём они
   на узкой строке налезали на заголовок. */
@media (max-width: 1100px) {
    .rail-head--inline { flex-direction: column; align-items: center; gap: 20px; }
    .rail-head--inline .arrows { position: static; width: 100%; justify-content: space-between; }
    .rail { grid-auto-columns: 344px; margin-top: 24px; }
}

/* На 360 карточка занимает всю колонку (340px в макете), поэтому боковой
   padding у ленты убираем — иначе карточка недобирает 8px. */
@media (max-width: 720px) {
    .rail { grid-auto-columns: 100%; gap: 25px; padding: 16px 0 4px; }
}

.dots { display: flex; gap: 10px; justify-content: center; padding: 16px 0 0; }
.dots button {
    width: 8px; height: 8px; border-radius: 50%; border: 0; padding: 0;
    background: var(--blue); cursor: pointer;
}
.dots button[aria-current="true"] { background: var(--orange); }

/* ---------- карточка школы ---------- */

.school {
    position: relative;
    background: #fff; border: 1px solid var(--blue-10); border-radius: 24px;
    padding: 20px; display: flex; flex-direction: column; gap: 20px;
}

.school-badge {
    position: absolute; left: 23px; top: -16px; z-index: 2;
    min-width: 217px; height: 56px; border-radius: 12px;
    display: grid; place-items: center; padding: 0 16px;
    font: 500 16px/1.2 'Montserrat', sans-serif; letter-spacing: -0.03em;
    background: var(--light-blue); color: var(--blue);
}
.school-badge--open { background: var(--light-orange); color: var(--orange); }

.school-photo { height: 453px; }
.school-photo img { width: 100%; height: 100%; object-fit: cover; }
.school-photo--round img {
    border: 1px solid var(--blue-10);
    border-radius: 10px 10px 100px 100px;
}

.school-body { display: flex; flex-direction: column; gap: 15px; flex: 1; }

.school-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.school-tag {
    background: var(--light-blue-2); border-radius: 8px; padding: 10px;
    font: 500 14px/1.2 'Montserrat', sans-serif; letter-spacing: -0.03em;
}

.school-list { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 0; list-style: none; }
.school-list li { display: flex; gap: 5px; }
.school-list img { flex: none; width: 24px; height: 24px; }

.school .btn { width: 100%; margin-top: auto; }

@media (max-width: 1100px) {
    .school-photo { height: 280px; }
}

@media (max-width: 720px) {
    .school-photo { height: 240px; }
    .school-badge { min-width: 0; height: 48px; font-size: 15px; }
}

/* ---------- преимущества ---------- */

.why-head { position: relative; margin-bottom: 44px; }
.why-head .descriptor { position: absolute; left: 0; top: 4px; }
.why-head .h2 { text-align: center; }
.why-head .h2 span { display: block; text-align: right; max-width: 1072px; margin-left: auto; }
.why-head .h2 span:first-child { text-align: left; margin-left: 366px; }

.why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

.adv {
    background: #fff; border: 1px solid var(--blue-10); border-radius: 20px;
    min-height: 374px; padding: 20px;
    display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
}
.adv > img { width: 95px; height: 95px; align-self: flex-end; }
.adv .h4 { margin-bottom: 10px; }

@media (max-width: 1150px) {
    .why-grid { grid-template-columns: 1fr 1fr; }
    .why-head .descriptor { position: static; display: block; margin-bottom: 10px; }
    .why-head .h2 span, .why-head .h2 span:first-child { text-align: center; margin: 0; max-width: none; }
}

/* Ниже 1100 заголовок перестаёт быть двумя отдельными строками: span-ы
   склеиваются в один абзац и прижимаются к краю по макету. */
@media (max-width: 1100px) {
    .why-head .h2 span, .why-head .h2 span:first-child { display: inline; }
    .why-head .h2 span:first-child::after { content: ' '; }
}

@media (min-width: 721px) and (max-width: 1100px) {
    .why-head .h2 { text-align: right; }
}

@media (max-width: 720px) {
    .why-head .h2 { text-align: left; }
    .why-grid { grid-template-columns: 1fr; }
    .adv { min-height: 0; }
}

/* ---------- атмосфера ---------- */

.mosaic {
    position: relative; margin-top: 44px;
    aspect-ratio: 1440 / 666;
}
.mosaic img {
    position: absolute; border-radius: 14px; object-fit: cover;
    width: var(--w); height: var(--h); left: var(--x); top: var(--y);
}

/* Раскладка от 1440 держится только на широком экране: ниже она сжимается
   в россыпь миниатюр, поэтому мозаика становится обычной сеткой. */
@media (min-width: 721px) and (max-width: 1100px) {
    .mosaic { aspect-ratio: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .mosaic img { position: static; width: 100%; height: 200px; }
}

/* Мозаика на 360 — лента из девяти кадров 340x300 со стрелками, как в макете:
   в две колонки миниатюры получались 140px и ничего не читалось. */
@media (max-width: 720px) {
    .arrows--rail-only {
        display: flex; justify-content: space-between;
        width: 100%; margin-top: 20px;
    }
    .mosaic {
        aspect-ratio: auto; margin-top: 20px;
        display: grid; grid-auto-flow: column; grid-auto-columns: 100%; gap: 10px;
        overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    }
    .mosaic::-webkit-scrollbar { display: none; }
    .mosaic img { position: static; width: 100%; height: 300px; scroll-snap-align: start; }
}

/* ---------- отзывы ---------- */

.review {
    background: var(--blue); color: #fff; border-radius: 20px;
    padding: 20px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
}
.review-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.review-head img { width: 88px; height: 88px; flex: none; }
.review-tag {
    display: inline-block; background: var(--light-blue-2); color: var(--blue);
    border-radius: 8px; padding: 10px;
    font: 500 14px/1.2 'Montserrat', sans-serif; letter-spacing: -0.03em;
}
.review-name { font: 500 20px/1.2 'Montserrat', sans-serif; margin-top: 8px; }
.review-role { color: var(--white-60); font-size: 16px; line-height: 1.2; }
.review-date { color: var(--white-60); }

/* ---------- FAQ ---------- */

.faq { max-width: 851px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

.faq details {
    background: #fff; border: 1px solid var(--blue-10); border-radius: 18px;
}
.faq summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 20px;
    font-size: clamp(19px, 1.7vw, 25px); font-weight: 500; line-height: 1;
}
.faq summary::-webkit-details-marker { display: none; }

.faq .toggle { position: relative; flex: none; width: 50px; height: 50px; }
.faq .toggle::before, .faq .toggle::after {
    content: ''; position: absolute; left: 50%; top: 50%;
    translate: -50% -50%; background: currentColor; border-radius: 4px;
}
.faq .toggle::before { width: 24px; height: 3px; }
.faq .toggle::after { width: 3px; height: 24px; transition: transform 0.15s ease; }

.faq details[open] { background: var(--orange); border-color: var(--orange); color: #fff; }
.faq details[open] .toggle::after { transform: translate(0, 0) scaleY(0); }
.faq .answer { padding: 0 20px 30px; max-width: 706px; }

/* ---------- контакты ---------- */

.contacts-grid {
    position: relative; z-index: 2;
    display: grid; grid-template-columns: 1fr 688px; gap: 40px;
    align-items: start; margin-top: 65px;
}

.contact-list { display: flex; flex-direction: column; gap: 10px; max-width: 342px; }
.contact-list .label { font-size: 18px; }
.contact-list .value { font-size: 25px; font-weight: 500; line-height: 1; margin-top: 5px; }
.contact-list .value a:hover { color: var(--orange); }

.socials { display: flex; gap: 10px; margin-top: 5px; }
.socials a {
    width: 50px; height: 50px; border-radius: 50%; background: #fff;
    display: grid; place-items: center;
}
.socials img { width: 24px; height: 24px; }

.consult {
    background: var(--blue); color: #fff; border-radius: 30px; padding: 40px;
}
.consult .h4 { max-width: 516px; }
.consult .text-2 { margin: 10px 0 20px; }

.consult-fields { display: flex; flex-direction: column; gap: 10px; }
.consult-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.consult input[type="text"], .consult input[type="tel"], .consult input[type="email"], .consult select {
    width: 100%; padding: 15px 10px;
    background: transparent; color: #fff;
    border: 1px solid var(--white-70); border-radius: 8px;
    font: 400 16px/1.2 'Montserrat', sans-serif; letter-spacing: -0.03em;
    appearance: none;
}
.consult input::placeholder { color: var(--white-70); }
.consult select { color: var(--white-70); }
.consult select:valid { color: #fff; }
.consult select option { color: var(--blue); }

.consult .select-wrap { position: relative; }
.consult .select-wrap::after {
    content: ''; position: absolute; right: 14px; top: 50%; translate: 0 -50%;
    width: 10px; height: 10px;
    border-right: 2px solid var(--white-70); border-bottom: 2px solid var(--white-70);
    transform: rotate(45deg); pointer-events: none;
}

.consult-consent { display: flex; gap: 6px; align-items: flex-start; margin: 20px 0; font-size: 14px; line-height: 1.4; letter-spacing: 0; }
.consult-consent input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: #fff; }
.consult-consent u { text-underline-offset: 3px; }

.consult .btn { width: 100%; }

.consult-done { display: none; padding: 40px 0; text-align: center; }
.consult.is-done form { display: none; }
.consult.is-done .consult-done { display: block; }

.consult-error { display: none; margin-top: 12px; font-size: 14px; letter-spacing: 0; color: var(--light-orange-2); }

.contacts-map { margin-top: -148px; position: relative; z-index: 1; }
.contacts-map img { width: 100%; height: 645px; object-fit: cover; }

/* Полоса 721–1150 целиком: иначе на 1101–1150 контакты вставали в одну
   колонку, а на 1100 снова в две — сужение экрана добавляло колонку. */
@media (min-width: 721px) and (max-width: 1150px) {
    .contacts-grid { grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; margin-top: 40px; }
    .consult { padding: 24px; }
    .consult-row { grid-template-columns: 1fr; }
    /* Десктопный подъём карты под форму здесь не работает: колонка контактов
       почти догоняет форму по высоте, и карта накрывала соцсети. */
    .contacts-map { margin-top: 0; }
    .contacts-map img { height: 460px; }
}

@media (max-width: 720px) {
    .contacts-grid { grid-template-columns: 1fr; margin-top: 32px; }
    .consult { padding: 24px; }
    .consult-row { grid-template-columns: 1fr; }
    .contacts-map { margin-top: 24px; }
    .contacts-map img { height: 320px; }
}

/* ---------- футер ---------- */

.footer { margin-top: -80px; position: relative; z-index: 2; }
.footer-inner {
    background: #fff; border-radius: 30px 30px 0 0;
    padding: 30px 0 25px;
}
.footer-grid { display: grid; grid-template-columns: 50.8% 25.4% 23.8%; gap: 24px 0; }

.footer-logos { display: flex; align-items: center; gap: 66px; flex-wrap: wrap; }
.footer-logos img { height: 90px; width: auto; }
.footer-logos img:last-child { height: 154px; }

.footer-legal { color: var(--blue-60); margin: 26px 0 0; max-width: 636px; }

.footer-nav p { font: 500 20px/1.2 'Montserrat', sans-serif; margin: 0 0 12px; }
.footer-nav ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.footer-nav a:hover { color: var(--orange); }

.footer-req { color: var(--blue-60); margin: 0; }

/* Строка внутри сетки: на десктопе и на 360 она растянута на все колонки,
   на 768 — уезжает во вторую. Отступ сверху даёт row-gap сетки. */
.footer-bottom {
    grid-column: 1 / -1;
    display: grid; grid-template-columns: 50.8% 25.4% 23.8%;
}
/* Копирайт занимает две последние колонки: в одной третьей он на 1600
   переносился на вторую строку и растил подвал на 24px. */
.footer-bottom span { grid-column: 2 / -1; justify-self: end; }
.footer-bottom a { text-decoration: underline; text-underline-offset: 4px; }
.footer-bottom span { color: var(--blue-60); }

/* Логотипы и реквизиты слева, навигация справа — колонка ссылок узкая
   и на планшете не оправдывает отдельную строку во всю ширину. */
@media (min-width: 721px) and (max-width: 1100px) {
    .footer-inner { padding: 30px 0 19px; }

    /* Колонки макета: 353 под тексты и 230 под навигацию, расстояние между
       ними растёт вместе с экраном, а сами колонки держат свою меру. */
    .footer-grid {
        grid-template-columns: 353px 230px; justify-content: space-between;
        gap: 20px;
    }
    .footer-req { grid-column: 1; }
    .footer-bottom { grid-column: 2; display: flex; flex-direction: column; gap: 33px; }

    /* Логотипы в ряд по центрам; 11px — на столько ряд опущен относительно
       «Навигации» в соседней колонке. */
    .footer-logos { gap: 11px; margin-top: 11px; flex-wrap: nowrap; }
    .footer-logos img { height: 67.5px; }
    .footer-logos img:last-child { height: 121px; }

    .footer-legal { margin: 49px 0 0; }
    .footer-nav p { margin-bottom: 10px; }
    .footer-nav ul { gap: 5px; }
}

/* Мобильный подвал собран иначе, чем на десктопе: логотипы столбиком по
   центру, а навигация и реквизиты — в две колонки под ними. Раньше здесь
   переопределялись только высоты логотипов, всё остальное оставалось
   десктопным, и подвал вырастал до 1146px вместо макетных 748px. */
@media (max-width: 720px) {
    .footer-inner { padding: 49px 0 15px; }

    /* Колонки ровно по 165px с зазором 10 — это и есть 340 контентной полосы. */
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 20px 10px; }
    .footer-grid > :first-child { grid-column: 1 / -1; }

    .footer-logos { flex-direction: column; align-items: center; gap: 34px; }
    .footer-logos img { height: 80px; }
    .footer-logos img:last-child { height: 154px; }

    /* margin: 0 у реквизитов не косметика — без него браузерный отступ <p>
       сдвигает правую колонку на строку вниз относительно «Навигации». */
    .footer-legal { margin: 22px 0 0; }
    .footer-req { margin: 0; }
    .footer-nav p { margin-bottom: 10px; }
    .footer-nav ul { gap: 5px; }

    /* 20px даёт row-gap сетки, 14px добираем здесь — в макете от списка
       ссылок до «Политики» ровно 34px. */
    .footer-bottom {
        display: flex; flex-direction: column; align-items: flex-start;
        margin-top: 14px; gap: 20px;
    }
}

/* Отдельная страница формы. Открывается с тех же доменов, что и лендинг,
   поэтому и выглядит его частью, а не чужим сайтом. */
.form-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: var(--blue); }
.form-page-card { width: 100%; max-width: 520px; padding: 40px; border-radius: 20px; background: rgba(255,255,255,0.08); color: #fff; }
.form-page-card h1 { margin-bottom: 24px; }
.form-page-card .consult-fields { margin-bottom: 20px; }
.form-page-card .btn { width: 100%; }
.form-page-card fieldset { border: 0; padding: 0; margin: 0; }
.form-page-card fieldset legend { margin-bottom: 8px; font-size: 14px; color: var(--white-70); }
.form-page-card fieldset label { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 15px; }
.form-page-card.is-done form { display: none; }
.form-page-card.is-done .consult-done { display: block; }
