/* ==========================================================================
   Episode Breakdown Page — «конспект после сеанса»
   Двуязычная типографика: английский контент — Fraunces, русский — Golos.
   Power Phrases набраны словарными статьями, сцены — сценарным форматом.
   ========================================================================== */

html {
    scroll-behavior: smooth;
}

.hidden {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

.page {
    max-width: 968px;
    margin: 0 auto;
    padding: 0 32px 96px;
}

/* ==========================================================================
   Шапка разбора: заголовок и метаданные в одну строку
   ========================================================================== */

.note-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 18px;
    padding: 14px 0;
}

/* На широких экранах шапка закреплена под topbar; её фактическую высоту
   публикует JS (--note-header-h) для отступов sticky-панели и якорей.
   На узких экранах шапка не закрепляется: вместе с topbar она съедала бы
   слишком много высоты экрана. */
@media (min-width: 1021px) {
    .note-header {
        position: sticky;
        top: var(--topbar-h);
        z-index: 40;
        background-color: var(--void);
    }
}

.note-title {
    font-family: var(--font-display);
    font-size: 38px;
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.01em;
}

.note-title-en {
    font-size: 16px;
    color: var(--text-3);
}

.note-episode-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Каркас: панель действий с оглавлением + текст
   ========================================================================== */

.note-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 720px);
    column-gap: 48px;
}

.note-aside {
    position: sticky;
    top: calc(var(--topbar-h) + var(--note-header-h, 71px) + 24px);
    align-self: start;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    margin-bottom: 12px;
}

.back-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.back-link:hover {
    color: var(--gold);
}

.note-actions {
    margin-bottom: 16px;
}

.note-actions .btn-watch {
    width: 100%;
    justify-content: center;
    padding-left: 16px;
    padding-right: 16px;
}

.toc {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 16px;
}

.toc-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 12px;
    border-left: 2px solid transparent;
    text-decoration: none;
    color: var(--text-2);
    transition: border-color 0.15s, color 0.15s;
}

.toc-num {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
    transition: color 0.15s;
}

.toc-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.toc-en {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.toc-ru {
    font-size: 11px;
    color: var(--text-3);
    line-height: 1.3;
}

.toc-item:hover .toc-en {
    color: var(--text);
}

.toc-item.active {
    border-left-color: var(--gold);
}

.toc-item.active .toc-en,
.toc-item.active .toc-num {
    color: var(--gold);
}

/* ==========================================================================
   Секции
   ========================================================================== */

.section {
    scroll-margin-top: calc(var(--topbar-h) + 28px);
}

@media (min-width: 1021px) {
    .section {
        scroll-margin-top: calc(var(--topbar-h) + var(--note-header-h, 71px) + 28px);
    }
}

.section + .section {
    margin-top: 72px;
}

.section-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-bottom: 24px;
}

.section-en {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.section-ru {
    font-size: 13px;
    color: var(--text-3);
}

/* ==========================================================================
   01 · The Gist
   ========================================================================== */

.gist-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
}

.gist-tab {
    padding: 7px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: none;
    color: var(--text-2);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.gist-tab:hover {
    color: var(--text);
}

.gist-tab.active {
    border-color: var(--gold);
    background-color: var(--gold-subtle);
    color: var(--gold);
}

.gist-text p {
    max-width: 68ch;
}

.gist-en p {
    font-family: var(--font-display);
    font-size: 19px;
    line-height: 1.68;
    color: var(--text);
    white-space: pre-line;
}

.gist-ru p {
    font-size: 17px;
    line-height: 1.65;
    color: var(--text-2);
    white-space: pre-line;
}

/* ==========================================================================
   02 · Power Phrases — словарные статьи
   ========================================================================== */

.phrase-list {
    list-style: none;
}

.phrase-entry {
    padding: 30px 0;
    border-top: 1px solid var(--line);
}

.phrase-entry:last-child {
    padding-bottom: 4px;
}

.phrase-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}

.phrase-word {
    font-family: var(--font-ui);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.phrase-level {
    flex-shrink: 0;
    padding: 2px 9px;
    border-radius: 999px;
    background-color: var(--violet-subtle);
    color: var(--violet);
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.phrase-ipa {
    font-size: 13px;
    color: var(--gold);
    letter-spacing: 0.02em;
    margin-bottom: 14px;
}

.phrase-intext {
    font-size: 13px;
    color: var(--text-3);
    margin-bottom: 16px;
}

.phrase-breakdown {
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-2);
    max-width: 64ch;
    margin-bottom: 20px;
    white-space: pre-line;
}

.phrase-contexts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px 28px;
    margin-bottom: 20px;
}

.context {
    padding-left: 14px;
}

.context-ok {
    border-left: 2px solid var(--gold);
}

.context-avoid {
    border-left: 2px solid var(--danger);
}

.context-title {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

.context-ok .context-title {
    color: var(--gold);
}

.context-avoid .context-title {
    color: var(--danger);
}

.context ul,
.phrase-alts ul {
    list-style: none;
}

.context li {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-2);
    padding: 3px 0 3px 14px;
    position: relative;
}

.context li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.72em;
    width: 8px;
    height: 1px;
    background-color: var(--line-strong);
}

.context p {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-2);
    max-width: 60ch;
}

.phrase-alts {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 10px;
}

.alts-title {
    font-size: 12px;
    color: var(--text-3);
}

.phrase-alts li {
    list-style: none;
}

.phrase-alts li {
    padding: 4px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    transition: border-color 0.15s, background-color 0.15s;
}

.phrase-alts li:hover {
    border-color: var(--line-strong);
    background-color: var(--raise);
}

.phrase-alts li.alts-title {
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-3);
}

/* ==========================================================================
   03 · Scene Breakdown — сценарный формат
   ========================================================================== */

.scene + .scene {
    margin-top: 44px;
    padding-top: 36px;
    border-top: 1px solid var(--line);
}

.scene-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 20px;
}

.scene-line {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    margin-bottom: 18px;
}

.scene-line:last-child {
    margin-bottom: 0;
}

/* Имя героя — фиолетовым, как в панели субтитров плеера */
.line-speaker {
    font-size: 11px;
    font-weight: 600;
    color: var(--violet);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-top: 5px;
}

.line-en {
    font-family: var(--font-display);
    font-size: 18px;
    line-height: 1.5;
    color: var(--text);
    white-space: pre-line;
}

.line-ru {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-3);
    margin-top: 3px;
    white-space: pre-line;
}

/* ==========================================================================
   04 · Culture & Context
   ========================================================================== */

.culture-text p {
    font-size: 15.5px;
    line-height: 1.72;
    color: var(--text-2);
    max-width: 62ch;
    margin-bottom: 18px;
    white-space: pre-line;
}

.culture-text p:last-child {
    margin-bottom: 0;
}

.en-inline {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--text);
    font-size: 1.03em;
}

/* ==========================================================================
   Переход к следующему разбору
   ========================================================================== */

.next-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 72px;
    padding: 20px 24px;
    border-radius: var(--radius-card);
    background-color: var(--surface);
    text-decoration: none;
    transition: background-color 0.15s;
}

.next-note:hover {
    background-color: var(--raise);
}

.next-note > svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--gold);
}

.next-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.next-label {
    font-size: 12px;
    color: var(--text-3);
}

.next-title {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   Адаптив
   ========================================================================== */

@media (max-width: 1020px) {
    .note-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .note-aside {
        position: static;
    }

    .toc {
        flex-direction: row;
        gap: 6px;
        overflow-x: auto;
        margin: 0 -32px 24px;
        padding: 12px 32px;
        border-top: none;
        border-bottom: 1px solid var(--line);
    }

    .toc-item {
        flex-shrink: 0;
        border-left: none;
        border: 1px solid var(--line);
        border-radius: 999px;
        padding: 6px 14px;
    }

    .toc-item.active {
        border-color: var(--gold);
        background-color: var(--gold-subtle);
    }

    .toc-num {
        display: none;
    }

    .toc-ru {
        display: none;
    }
}

@media (max-width: 640px) {
    .page {
        padding: 0 16px 72px;
    }

    .note-title {
        font-size: 30px;
    }

    .toc {
        margin: 0 -16px 20px;
        padding: 10px 16px;
    }

    .phrase-head {
        flex-wrap: wrap;
        gap: 8px;
    }

    .scene-line {
        grid-template-columns: 1fr;
    }

    .line-speaker {
        padding: 0 0 4px;
    }
}
