/* Рассказ учительницы. Основная разметка читается и без сценариев. */
.teacher-story {
    --pine: #163f38;
    --hairline: #d8d6c2;
    --stage-size: min(40vw, 55vh, 510px);
    --stage-top: max(100px, calc((100vh - var(--stage-size)) / 2 - 7px));
    color: var(--pine);
    background: radial-gradient(ellipse 78% 820px at 86% 1%, #f6dfaa91, transparent 80%), #faf8ef;
    border-bottom: 1px solid var(--hairline);
}
.teacher-story__layout { max-width: 1220px; }
.teacher-chapter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .94fr);
    grid-template-areas: "lead art" "body art";
    align-content: center;
    align-items: center;
    gap: 0 clamp(38px, 6vw, 94px);
    min-height: min(82vh, 740px);
    padding: clamp(48px, 6vw, 86px) 12px;
}
.teacher-chapter + .teacher-chapter { border-top: 1px solid var(--hairline); }
.teacher-chapter__lead {
    grid-area: lead;
    align-self: end;
    margin: 0 0 20px;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(29px, 2.6vw, 42px);
    font-weight: 500;
    line-height: 1.14;
    letter-spacing: -.043em;
    text-wrap: pretty;
}
h1.teacher-chapter__lead {
    font-size: clamp(52px, 5.4vw, 84px);
    line-height: 1.02;
    letter-spacing: -.062em;
}
.teacher-chapter__lead em { display: block; color: #46725b; }
.teacher-chapter__body { grid-area: body; align-self: start; }
.teacher-chapter__body p {
    max-width: 52ch;
    margin: 0;
    color: #394d42;
    font-size: clamp(17px, 1.25vw, 20px);
    line-height: 1.65;
}
.teacher-chapter__art, .teacher-stage__canvas {
    position: relative;
    background: #e5d9b7;
    border-radius: 44% 44% 24px 24px / 19% 19% 24px 24px;
    box-shadow: 0 18px 38px -25px #303d2c80;
}
.teacher-chapter__art { grid-area: art; width: min(100%, 510px); justify-self: center; }
.teacher-chapter__art img, .teacher-stage__canvas img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    height: auto;
    border-radius: inherit;
    object-fit: cover;
}
.teacher-chapter__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 24px; }
.teacher-chapter__actions .button--dark {
    background: var(--pine);
    color: #fffdf2;
    border-radius: 100px;
    padding-inline: 22px;
    box-shadow: none;
}
.teacher-chapter__actions .button--dark:hover { background: #225949; }
.teacher-chapter:first-child .button svg { rotate: 90deg; }
.teacher-story .text-link { --section-deep: var(--pine); border-color: #c2aa69; }
.teacher-resources { margin-top: 16px; font-size: 15px; }
.teacher-resources summary { padding-block: 6px; width: fit-content; color: #4c6655; cursor: pointer; }
.teacher-resources ul { margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px 16px; list-style: none; }
.teacher-resources a { display: inline-block; padding-block: 3px; text-decoration: underline; text-underline-offset: .2em; }
.teacher-story :is(a, summary):focus-visible, .teacher-catalog > summary:focus-visible {
    outline: 3px solid #997125; outline-offset: 4px;
}
.teacher-stage { display: none; }
.teacher-catalog { padding-bottom: 36px; }
.teacher-catalog > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-block: 20px 10px; padding: 18px 22px;
    border-block: 1px solid #dcdacb; color: #284d40; font-weight: 650; cursor: pointer;
}
.teacher-catalog > summary::-webkit-details-marker { display: none; }
.teacher-catalog[open] > summary svg { rotate: 180deg; }
.teacher-story + .home-launch { padding-top: 40px; }

/* Закреплённая иллюстрация справа переключается в такт текущему абзацу. */
@media screen and (min-width: 880px) and (min-height: 560px) and (prefers-reduced-motion: no-preference) {
    .teacher-story.is-pinned .teacher-story__layout {
        display: grid;
        grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr);
        align-items: start;
        gap: clamp(34px, 5.6vw, 90px);
        padding-inline: 12px;
    }
    .teacher-story.is-pinned .teacher-chapter {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        min-height: max(74vh, calc(var(--stage-size) + 110px));
        padding-inline: 0;
    }
    .teacher-story.is-pinned .teacher-chapter__lead,
    .teacher-story.is-pinned .teacher-chapter__body { align-self: auto; }
    /* Описание рисунка остаётся рядом с текстом для экранного диктора. */
    .teacher-story.is-pinned .teacher-chapter__art {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
    .teacher-story.is-pinned .teacher-stage {
        position: sticky;
        top: var(--stage-top);
        display: block;
        width: var(--stage-size);
        max-width: 100%;
        justify-self: center;
        margin-block: clamp(36px, 4vw, 58px);
    }
    .teacher-stage::before {
        content: "";
        position: absolute;
        inset: 0 0 auto;
        aspect-ratio: 1;
        border: 1px solid #ad985f;
        border-radius: 44% 44% 24px 24px / 19% 19% 24px 24px;
        transform: translate(10px, -7px) rotate(2deg);
        pointer-events: none;
    }
    .teacher-stage__canvas { isolation: isolate; overflow: hidden; aspect-ratio: 1; }
    .teacher-stage__canvas img { position: absolute; inset: 0; visibility: hidden; border-radius: 0; }
    .teacher-stage__canvas img.is-previous { visibility: visible; z-index: 1; }
    .teacher-stage__canvas img.is-current { visibility: visible; z-index: 2; }
    .teacher-stage__canvas.has-transition img.is-current { animation: story-wipe .78s cubic-bezier(.22,.72,.15,1) both; }
    .teacher-stage__canvas.is-backward { --wipe-origin: -3%; }
    .teacher-stage__canvas.has-transition img.is-previous { animation: story-recede .78s ease-out both; }
    .teacher-stage__caption {
        display: flex; align-items: center; justify-content: space-between;
        gap: 16px; margin-top: 20px; color: #355447; font-size: 15px; font-weight: 650;
    }
    .teacher-stage__position { font-variant-numeric: tabular-nums; color: #626d60; font-size: 13px; }
    .teacher-stage__nav { display: flex; gap: 5px; }
    .teacher-stage__nav a { display: grid; align-items: center; flex: 1; height: 28px; }
    .teacher-stage__nav a::before {
        content: ""; display: block; height: 3px; border-radius: 3px; background: #d8d6c8;
        transition: background-color .35s;
    }
    .teacher-stage__nav a:is(:hover, [aria-current])::before { background: #2d6353; }
    @keyframes story-wipe {
        from { clip-path: ellipse(80% 0% at 50% var(--wipe-origin, 103%)); transform: scale(1.065); }
        to { clip-path: ellipse(130% 150% at 50% var(--wipe-origin, 103%)); transform: scale(1); }
    }
    @keyframes story-recede { from { transform: scale(1); } to { transform: scale(.98); } }
}
@media screen and (prefers-reduced-motion: no-preference) {
    .teacher-chapter.is-entering .teacher-chapter__lead,
    .teacher-chapter.is-entering .teacher-chapter__body { animation: story-arrive .65s cubic-bezier(.18,.72,.2,1) both; }
    .teacher-chapter.is-entering .teacher-chapter__body { animation-delay: .07s; }
    .teacher-story:not(.is-pinned) .teacher-chapter.is-entering .teacher-chapter__art {
        animation: story-image-arrive .75s cubic-bezier(.18,.72,.2,1) both;
    }
    .teacher-chapter.is-entering:focus-within > * { animation: none; }
    @keyframes story-arrive { from { opacity: .4; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
    @keyframes story-image-arrive { from { opacity: .4; transform: translateY(15px) scale(.97); } to { opacity: 1; transform: none; } }
    @supports (animation-timeline: view()) {
        .teacher-story:not(.is-pinned) .teacher-chapter:not(:first-child) .teacher-chapter__art {
            animation: story-develop 1s linear both;
            animation-timeline: view();
            animation-range: entry 0% entry 80%;
        }
        @keyframes story-develop {
            from { clip-path: inset(9% 5% 10% round 36px); scale: .96; }
            to { clip-path: inset(0 round 0); scale: 1; }
        }
    }
}
@media (max-width: 760px) {
    .teacher-story__layout { max-width: 570px; }
    .teacher-chapter {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "lead" "art" "body";
        gap: 20px; min-height: 0; padding: 34px 0;
    }
    .teacher-chapter__lead { font-size: clamp(26px, 5vw, 32px); margin-bottom: 0; }
    h1.teacher-chapter__lead { font-size: clamp(45px, 8.5vw, 64px); }
    .teacher-chapter__art { width: min(100%, 370px); }
    .teacher-chapter__actions { margin-top: 18px; }
}
@media print {
    .teacher-chapter { min-height: 0; padding: 1em 0; break-inside: avoid; }
    .teacher-chapter__actions, .teacher-stage, .teacher-resources { display: none; }
}
