/* ==========================================================================
   Направления (курсы), основатель + наставники, истории выпускников.
   ========================================================================== */

/* ---------- Выбери своё направление ---------- */
.courses {
    --courses-pad: 56px;   /* отступ сверху (над заголовком) и снизу (под карточками) */
    display: flex;
    flex-direction: column;
    padding-bottom: var(--courses-pad);
    color: var(--color-white);
}

.courses__title {
    padding: var(--courses-pad) var(--gutter) 32px;
}

.courses__grid {
    display: flex;
    flex-direction: column;
    gap: var(--page-gap);
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
}

.course-hero {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    min-height: 504px;
    padding: 24px 0 20px;
    border-radius: var(--section-radius);
    overflow: clip;
}

.course-hero > .media--fill { z-index: -2; }

.course-hero__body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding-inline: 20px;
}

.course-hero__chips { display: flex; flex-wrap: wrap; gap: 8px; }

.course-hero__copy { display: flex; flex-direction: column; gap: 8px; }

.course-hero__title {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: var(--tracking-heading);
}

.course-hero__sub { color: var(--color-on-dark-60); font-weight: 500; letter-spacing: var(--tracking-heading); }

/* Пилюли «что изменилось»: на мобильном — горизонтальная лента с выходом за края карточки */
.changes {
    --slider-gap: 8px;
    --slider-pad: 20px;
    width: 100%;
    margin-top: auto;
}

.change {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 16px 6px 6px;
    border-radius: var(--radius-pill);
    background: var(--color-white);
    color: var(--color-muted);
    font-size: 12px;
    white-space: nowrap;
}

.change__n {
    display: grid;
    place-items: center;
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text-4);
    font-size: 14px;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--page-gap);
}

.tile {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 220px;
    aspect-ratio: 800 / 1068;   /* пропорции мобильного визуала: арт нарисован под эту высоту */
    padding: 20px 16px;
    border-radius: var(--tile-radius);
    overflow: clip;
    color: var(--color-navy);
}

.tile > .media--fill { z-index: -2; background: var(--color-ph-light); }

/* Арт плитки нарисован под 1600×1100: пустое место слева-сверху отдано под заголовок, арт — справа-снизу.
   Если плитка уже кадра, обрезается левая часть, а не арт. */
.tile .media__img { object-position: 100% 100%; }

.tile__copy { display: flex; flex-direction: column; gap: 8px; }

.tile__title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: var(--tracking-heading);
}

.tile__desc { font-size: 12px; color: var(--color-muted); font-weight: 500; letter-spacing: var(--tracking-heading); }

.t-lg { display: none; }

/* ---------- Основатель + наставники ---------- */
.founder {
    display: flex;
    flex-direction: column;
    gap: var(--page-gap);
}

.founder__main,
.mentors {
    position: relative;
    background: var(--color-white);
    border-radius: var(--section-radius);
    overflow: clip;
}

.founder__frame {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 618px;
    padding: 40px 0 0;
}

.founder__quote {
    margin: 0 20px;
    font-size: 20px;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: var(--tracking);
}

.founder__path {
    margin: 22px 20px 0;
    max-width: 335px;
    font-size: 12px;
    color: rgba(14, 15, 18, 0.6);
}

.founder__stage {
    position: relative;
    flex: 1;
    min-height: 384px;
}

/* Портрет Никиты — PNG без фона со знаком «X» на фото (assets/img/founder). Мобильный макет: лицо справа, плечо уходит за край */
.founder__portrait {
    position: absolute;
    bottom: 0;
    left: 76px;
    width: 422px;
    aspect-ratio: 1168 / 1025;
}

.founder__person {
    position: absolute;
    inset: 0;
    display: block;
}

.founder__role {
    position: absolute;
    left: 20px;
    bottom: 145px;
    width: 140px;
    font-size: 12px;
    color: rgba(14, 15, 18, 0.6);
}

.founder__tags {
    position: absolute;
    left: 20px;
    bottom: 33px;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.founder__tag { height: 32px; padding: 0 12px; font-size: 12px; }
.founder__tag.pill--outline { background: var(--color-white); }

.social-dot {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-white);
    color: var(--color-navy);
    font-size: 13px;
    font-weight: 600;
}

.social-dot .icon { width: 18px; height: 18px; }

.mentors {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 48px 0 32px;
}

.mentors__title { padding-inline: var(--gutter); }

.mentors__list {
    --slider-gap: 12px;
    --slider-pad: var(--card-inset);
}

.mentor { width: 263px; }

.mentor__card {
    position: relative;
    height: 412px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    overflow: hidden;
}

.mentor__photo {
    position: relative;
    height: 260px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.mentor__badge {
    position: absolute;
    top: 20px;
    left: 18px;
    padding: 4px 10px;
    border-radius: var(--radius-lg);
    background: var(--color-white);
    font-size: 10.2px;
    line-height: 1.3;
}

.mentor__name {
    padding: 16px 20px 0;
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: var(--tracking-heading);
}

.mentor__bio {
    padding: 14px 20px 0;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.6);
}

.mentors__bar { padding-inline: var(--gutter); }

/* ---------- Истории выпускников ---------- */
.stories {
    background: var(--color-surface);
    border-top: 1px solid var(--color-line);
}

.stories__inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-block: 48px 8px;
}


.stories__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-inline: var(--card-inset);
}

.stories__title { padding-inline: var(--gutter); }

/* Пояснение под историями: серым, мелко */
.stories__note {
    padding: 0 var(--gutter) 24px;
    font-size: 12px;
    line-height: 1.35;
    letter-spacing: var(--tracking);
    color: var(--color-text-5);
    text-wrap: pretty;
}

.story-list { display: none; position: relative; }

/* Истории переключаются свайпом/перетаскиванием по фото и тексту. Вертикальный жест остаётся за страницей (pan-y). */
.story-photos,
.story-results { touch-action: pan-y pinch-zoom; -webkit-user-select: none; user-select: none; }

@media (hover: hover) and (pointer: fine) {
    .story-photos, .story-results { cursor: grab; }
}

/* Все истории лежат в одной ячейке сетки: высота блока = самая высокая история,
   поэтому при переключении страница не «прыгает». Неактивные скрыты через visibility. */
.story-photos,
.story-results { display: grid; }

.story-photo,
.story-result { grid-area: 1 / 1; visibility: hidden; }

.story-photo.is-active,
.story-result.is-active { visibility: visible; }

.story-photo {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: flex-end;
    min-height: 272px;
    padding: 20px;
    border-radius: var(--card-radius);
    overflow: clip;
    color: var(--color-white);
}

.story-photo > .media--fill { z-index: -1; }

.story-photo__copy { display: flex; flex-direction: column; gap: 8px; }

.story-photo__name {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: var(--tracking-heading);
}

.story-photo__sub { font-size: 12px; color: var(--color-on-dark-60); font-weight: 500; letter-spacing: var(--tracking-heading); }

.story-result {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 20px 20px;
    border-radius: var(--card-radius);
    background: var(--color-white);
}

.story-result__main { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }

.story-result__title {
    font-size: 22px;
    font-weight: 500;
    line-height: 1.25;
    text-wrap: balance;
    letter-spacing: var(--tracking-heading);
}

.story-result__text { font-size: 12px; color: rgba(0, 0, 0, 0.6); }

/* Панель внизу карточки: у историй без портфолио остаются только стрелки — справа */
/* Управление историями — слева: «←  01 / 05  →» */
.story-result__bar { margin-top: auto; justify-content: flex-start; }
.story-result__bar .slider-controls { align-items: center; gap: 16px; margin-left: 0; }
.story-result__count {
    min-width: 46px;
    text-align: center;
    font-size: 14px;
    letter-spacing: var(--tracking);
    font-variant-numeric: tabular-nums;
    color: var(--color-muted-2);
}

/* ==========================================================================
   Промежуточный режим 768–1199
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .founder__frame { max-width: 720px; margin-inline: auto; }

    .stories__title,
    .stories__body,
    .stories__note {
        width: min(100% - var(--gutter) * 2, 656px);   /* 720px минус поля 32px: левый край = как у основателя и футера */
        margin-inline: auto;
        padding-inline: 0;
    }

    .founder__quote, .founder__path { margin-inline: 32px; }
    .founder__portrait { left: 50%; translate: -50% 0; }
    .founder__tags, .founder__role { left: 32px; }

    .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }

    .stories__body { flex-direction: row; flex-wrap: wrap; padding-inline: 0; }
    .story-photos { flex: 1 1 280px; }
    .story-results { flex: 1 1 320px; }
}

/* ==========================================================================
   Десктоп ≥1200
   ========================================================================== */
@media (min-width: 1200px) {
    .courses { --courses-pad: 64px; gap: var(--page-gap); }

    .courses__title { padding: var(--courses-pad) 32px 48px; text-align: center; }

    .courses__grid {
        display: grid;
        grid-template-columns: minmax(0, 595fr) minmax(0, 815fr);
        gap: var(--page-gap);
    }

    .course-hero {
        gap: 24px;
        min-height: 648px;
        padding: 32px;
    }

    .course-hero__body { gap: 24px; padding-inline: 0; }

    .course-hero__title { font-size: 50px; }
    .course-hero__copy { gap: 12px; }
    .course-hero__sub { font-size: 18px; }

    .course-hero__btn {
        justify-content: flex-start;
        width: fit-content;   /* hug: подпись и кружок, без пустого места между ними */
        gap: 20px;
        height: 56px;
        padding: 6px 6px 6px 24px;
        font-size: 16px;
        letter-spacing: var(--tracking);
    }

    .course-hero__btn .btn__knob { width: 44px; height: 44px; }

    .changes {
        display: grid;
        grid-auto-flow: column;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(2, auto);
        gap: 8px;
        width: 100%;
        margin: auto 0 0;
        padding: 0;
        overflow: visible;
    }

    .change {
        min-height: 52px;
        padding: 8px 16px 8px 8px;
        white-space: normal;
    }

    .change__n { width: 36px; height: 36px; font-size: 16px; }

    .tiles { gap: var(--page-gap); }
    .tile { min-height: 320px; aspect-ratio: auto; padding: 32px; }
    .tile__title { font-size: 28px; line-height: 0.91; }
    .tile__desc { font-size: 14px; }

    .t-sm { display: none; }
    .t-lg { display: inline; }

    /* Основатель + наставники: одна карточка с абсолютной композицией */
    .founder {
        --frame-left: max(var(--gutter), calc((100% - var(--container-max)) / 2));
        position: relative;
        display: block;
        min-height: 724px;
        background: var(--color-white);
        border-radius: var(--section-radius);
        overflow: clip;
    }

    .founder__main { position: static; border-radius: 0; overflow: visible; }

    .founder__frame {
        position: absolute;
        inset: 0 0 auto;
        display: block;
        width: min(100% - var(--gutter) * 2, var(--container-max));
        height: 100%;
        min-height: 0;
        margin-inline: auto;
        padding: 0;
    }

    .founder__tags,
    .founder__quote,
    .founder__path,
    .founder__role { z-index: 2; }

    .founder__tags { top: 112px; left: 0; bottom: auto; gap: 6px; }
    .founder__tag.pill--outline { background: transparent; }

    .social-dot { background: #b7b7b7; color: var(--color-white); }

    .founder__quote {
        position: absolute;
        top: 176px;
        left: 0;
        width: 476px;
        margin: 0;
        font-family: var(--font-display);
        font-size: 28px;
        line-height: 1.2;
        letter-spacing: var(--tracking);
    }

    .founder__path {
        position: absolute;
        top: auto;
        bottom: 64px;
        left: 0;
        width: 244px;
        margin: 0;
        font-size: 11px;
    }

    .founder__stage { position: static; min-height: 0; margin: 0; }

    .founder__portrait {
        top: auto;
        bottom: 0;
        left: 21.6%;
        width: 52%;
        height: auto;
        aspect-ratio: 1170 / 1025;
        translate: none;
    }


    .founder__role { top: 423px; bottom: auto; left: 0; width: 320px; font-size: 12px; }

    /* Наставники справа от портрета, слайдер выходит за правый край карточки */
    .mentors {
        position: absolute;
        top: 112px;
        right: 0;
        left: calc(var(--frame-left) + (100% - 2 * var(--frame-left)) * 0.588);
        gap: 0;
        padding: 0;
        background: none;
        border-radius: 0;
        overflow: visible;
    }

    .mentors__title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); padding: 0; }
    .mentors__list { --slider-gap: 10px; --slider-pad: 0px; }
    .mentors .dots { --dot-w: 46.6px; gap: 8px; }
    .mentors .dots__item { background: rgba(255, 255, 255, 0.55); box-shadow: 0 1px 5px rgba(12, 10, 31, 0.35); }
    .mentors .dots__item.is-active { background: #fff; box-shadow: 0 1px 6px rgba(12, 10, 31, 0.5); }
    .mentor { width: 265px; }
    .mentor__card { border-radius: var(--radius-md); }
    .mentors__bar { position: absolute; top: 461px; left: 0; right: 0; padding-inline: 0 var(--frame-left); }

    /* Истории */
    .stories__inner { gap: 40px; padding-block: 80px 48px; width: min(100% - var(--gutter) * 2, var(--container-max)); }
    .stories__title { padding: 0; }
    .stories__note { padding: 0 0 0 20px; font-size: 13px; }

    .stories__body {
        display: grid;
        grid-template-columns: minmax(0, 393fr) 28px minmax(0, 433fr) minmax(0, 428fr);
        gap: 10px;
        padding-inline: 0;
        min-height: 498px;
    }

    .story-list { display: flex; flex-direction: column; gap: 12px; grid-column: 1; }
    .story-photos { grid-column: 3; }
    .story-results { grid-column: 4; }
    .story-photo { min-height: 0; padding: 32px; border-radius: var(--radius-xl); }
    .story-photo__name { font-size: 30px; line-height: 1.1; max-width: 242px; }
    .story-photo__sub { font-size: 14px; }
    .story-result { justify-content: space-between; gap: 0; padding: 32px; border-radius: var(--radius-xl); }
    .story-result__main { gap: 16px; }
    .story-result__title { font-size: 34px; line-height: 1.1; letter-spacing: var(--tracking-heading); }
    .story-result__text { font-size: 14px; }

    .story-item {
        position: relative;
        z-index: 1;
        display: flex;
        align-items: center;
        gap: 16px;
        width: 100%;
        padding: 16px 24px 16px 16px;
        border-radius: var(--radius-sm);
        text-align: left;
    }

    .story-item:hover { background: rgba(255, 255, 255, 0.5); }
    .story-item.is-active { background: var(--color-white); }

    /* Белая плашка активной истории — один элемент, который переезжает к выбранной (main.js задаёт --hl-y/--hl-h).
       Без JS остаётся фон у самой кнопки. */
    .story-list::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        z-index: 0;
        height: var(--hl-h, 0px);
        translate: 0 var(--hl-y, 0px);
        border-radius: var(--radius-sm);
        background: var(--color-white);
        opacity: 0;
    }

    .story-list.has-hl::before { opacity: 1; }
    .story-list.has-hl .story-item.is-active { background: transparent; }

    .story-item.is-active .story-item__chevron { translate: 4px 0; }

    .story-item__avatar {
        position: relative;
        flex: none;
        width: 58px;
        height: 58px;
        border-radius: 50%;
        overflow: hidden;
    }

    .story-item__text { display: flex; flex: 1; flex-direction: column; gap: 8px; }

    .story-item__name { font-size: 20px; font-weight: 500; line-height: 1.1; letter-spacing: var(--tracking-heading); }
    .story-item__role { font-size: 14px; color: var(--color-muted); font-weight: 500; letter-spacing: var(--tracking-heading); }

    .story-item__chevron { flex: none; width: 24px; height: 24px; }
}

/* ==========================================================================
   Широкий ≥1760 (макет 1920)
   ========================================================================== */
@media (min-width: 1760px) {
    .founder { min-height: 790px; }
    .story-result__title { font-size: 38px; }

    .founder__portrait { top: auto; bottom: 0; left: 22.8%; width: 54%; }
    .founder__quote { width: 572px; font-size: 32px; line-height: 1.19; }
    .founder__role { top: 474px; }
    .founder__path { top: auto; bottom: 72px; width: 329px; }

    .mentors { left: calc(var(--frame-left) + (100% - 2 * var(--frame-left)) * 0.671); }
    .mentor { width: 245px; }
    .mentor__card { height: 480px; }
    .mentor__photo { height: 296px; }
    .mentors__bar { top: 520px; }
    .mentor__bio { padding-top: 18px; }

    .courses__title { padding-bottom: 38px; }

    .stories__inner { gap: 48px; padding-block: 100px 56px; }
    .stories__body { grid-template-columns: minmax(0, 441fr) 53px minmax(0, 496fr) minmax(0, 500fr); min-height: 576px; }
}

/* ==========================================================================
   ≥1920: вертикальные отступы внутри блоков +20% (--pad-k, см. tokens.css)
   ========================================================================== */
@media (min-width: 1920px) {
    .courses { --courses-pad: calc(64px * var(--pad-k)); }
    .courses__title { padding-bottom: calc(38px * var(--pad-k)); }
    .stories__inner { padding-block: calc(100px * var(--pad-k)) calc(56px * var(--pad-k)); }
}

/* 1760–1920: контейнер уже (боковые поля +50%, см. tokens.css) — портрет основателя чуть правее, чтобы цитата не касалась головы */
@media (min-width: 1760px) and (max-width: 1920.98px) {
    .founder__portrait { left: 25.5%; }
}
