.content-page {
    --course-sidebar: 320px;
    background: #f7f5ef;
}

.course-app {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.course-navbar {
    position: relative;
    z-index: 30;
    display: grid;
    grid-template-columns: var(--course-sidebar) 1fr auto;
    width: 100%;
    height: 68px;
    border-bottom: 1px solid var(--ink);
    background: var(--paper);
}

.course-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 26px;
    border-right: 1px solid var(--ink);
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
}

.course-brand .brand-symbol {
    width: 34px;
    height: 34px;
}

.course-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 14px;
    padding: 0 34px;
}

.course-heading strong {
    overflow: hidden;
    font-family: "Instrument Serif", Georgia, serif;
    font-size: 1.25rem;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.course-label {
    color: var(--accent);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.mobile-menu-button {
    display: none;
}

.course-layout {
    display: grid;
    grid-template-columns: var(--course-sidebar) minmax(0, 1fr);
    height: calc(100% - 68px);
    overflow: hidden;
}

.content-menu {
    display: flex;
    min-height: 0;
    flex-direction: column;
    border-right: 1px solid var(--ink);
    background: #e8e2d6;
}

.menu-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 28px 26px 20px;
    border-bottom: 1px solid rgba(23, 23, 19, 0.18);
}

.menu-intro p {
    margin: 0;
    font-family: "Instrument Serif", Georgia, serif;
    font-size: 1.35rem;
}

.menu-intro span {
    color: var(--muted);
    font-size: 0.61rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.course-navigation {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.course-section {
    border-bottom: 1px solid rgba(23, 23, 19, 0.18);
}

.section-toggle {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 18px;
    gap: 8px;
    align-items: center;
    width: 100%;
    padding: 18px 22px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.045em;
    text-align: left;
    text-transform: uppercase;
    cursor: pointer;
}

.section-toggle:hover,
.section-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.36);
}

.section-order {
    color: var(--accent);
    font-size: 0.58rem;
}

.section-triangle {
    display: inline-block;
    transition: transform 220ms ease;
}

.course-section:not(.is-open) .section-triangle {
    transform: rotate(-90deg);
}

.section-topics {
    max-height: 1200px;
    overflow: hidden;
    transition: max-height 260ms ease;
}

.course-section:not(.is-open) .section-topics {
    max-height: 0;
}

.topic-link {
    position: relative;
    z-index: 1;
    display: grid;
    min-height: 48px;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    width: 100%;
    padding: 10px 22px;
    border: 0;
    border-left: 3px solid transparent;
    background: transparent;
    color: var(--muted);
    text-align: left;
    cursor: pointer;
}

.topic-link span {
    font-size: 0.6rem;
    font-weight: 600;
}

.topic-link strong {
    font-family: "DM Sans", sans-serif;
    font-size: 0.71rem;
    font-weight: 500;
    line-height: 1.3;
}

.topic-link:hover,
.topic-link:focus-visible,
.topic-link.is-active {
    border-left-color: var(--accent);
    background: rgba(255, 255, 255, 0.46);
    color: var(--ink);
}

.menu-footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--ink);
}

.menu-back-link {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 16px 26px 8px;
    color: var(--ink);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-decoration: none;
    text-transform: uppercase;
}

.menu-author {
    margin: 0;
    padding: 0 26px 16px;
    color: var(--muted);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.menu-overlay {
    display: none;
}

.course-content {
    min-width: 0;
    overflow-y: auto;
    padding: clamp(30px, 5vw, 76px) clamp(24px, 7vw, 110px) 34px;
    background:
        linear-gradient(rgba(23, 23, 19, 0.026) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23, 23, 19, 0.026) 1px, transparent 1px),
        #f7f5ef;
    background-size: 32px 32px;
    scroll-behavior: smooth;
}

.lesson {
    display: none;
    width: min(100%, 1120px);
    min-height: calc(100% - 74px);
    margin: 0 auto;
    animation: lessonIn 360ms ease both;
}

.lesson.is-active {
    display: block;
}

.lesson.is-active.is-leaving {
    animation: none;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 170ms ease, transform 170ms ease;
}

.lesson-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: clamp(28px, 4vw, 54px);
    padding-bottom: 24px;
    border-bottom: 1px solid var(--ink);
}

.lesson-section {
    margin: 0 0 14px;
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lesson-header h1 {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    font-size: clamp(2.6rem, 5vw, 5.4rem);
    line-height: 0.93;
}

.lesson-header h1 span {
    margin-top: 8px;
    color: var(--accent);
    font-family: "DM Sans", sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.lesson-type {
    padding: 7px 10px;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.lesson-blocks {
    display: grid;
    gap: 28px;
}

.block-video {
    width: 100%;
    margin: 0;
}

.block-video video,
.block-video iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    background: #161612;
    box-shadow: 0 20px 50px rgba(23, 23, 19, 0.12);
}

.block-video figcaption,
.block-image figcaption {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.72rem;
}

.block-title {
    margin: 18px 0 0;
    font-family: "Instrument Serif", Georgia, serif;
    font-size: clamp(2rem, 3vw, 3.2rem);
    font-weight: 400;
}

.block-subtitle {
    margin: 12px 0 0;
    font-size: 1.05rem;
}

.block-text {
    max-width: 760px;
    color: #45443e;
    font-size: 1rem;
    line-height: 1.8;
}

.block-quote {
    max-width: 820px;
    margin: 16px 0;
    padding: 10px 0 10px 28px;
    border-left: 3px solid var(--accent);
}

.block-quote p {
    margin: 0;
    font-family: "Instrument Serif", Georgia, serif;
    font-size: clamp(1.6rem, 2.5vw, 2.5rem);
    line-height: 1.15;
}

.block-quote cite {
    display: block;
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.72rem;
    font-style: normal;
}

.block-image {
    margin: 0;
}

.block-image img {
    display: block;
    width: 100%;
    height: auto;
}

.block-expandable {
    max-width: 820px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.block-expandable summary {
    padding: 18px 4px;
    font-weight: 600;
    cursor: pointer;
}

.block-presentation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    width: min(100%, 820px);
    padding: 24px 26px;
    border: 1px solid var(--ink);
    background: #e8e2d6;
}

.block-presentation span {
    color: var(--accent);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.block-presentation p {
    margin: 7px 0 0;
    color: var(--ink);
    font-family: "Instrument Serif", Georgia, serif;
    font-size: clamp(1.25rem, 2vw, 1.7rem);
    line-height: 1.15;
}

.block-file small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

.block-presentation a {
    display: flex;
    gap: 18px;
    align-items: center;
    padding: 14px 18px;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
    transition: background 180ms ease, transform 180ms ease;
}

.block-presentation a span {
    color: inherit;
    font-size: 1rem;
}

.block-presentation a:hover,
.block-presentation a:focus-visible {
    background: var(--accent);
    transform: translateY(-2px);
}

.block-presentation.is-placeholder {
    border-style: dashed;
    background: transparent;
}

.block-list {
    display: grid;
    width: min(100%, 820px);
    gap: 0;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
    list-style: none;
}

.block-list li {
    position: relative;
    padding: 14px 16px 14px 42px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    line-height: 1.45;
}

.block-list li::before {
    position: absolute;
    top: 16px;
    left: 14px;
    color: var(--accent);
    content: "—";
}

.block-presentation .placeholder-status {
    padding: 12px 16px;
    border: 1px solid var(--line);
    color: var(--muted);
}

.expandable-content {
    display: grid;
    gap: 20px;
    padding: 0 4px 22px 24px;
}

.lesson-pagination {
    display: grid;
    width: min(100%, 1120px);
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin: 48px auto 0;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.lesson-pagination button {
    width: fit-content;
    padding: 10px 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.lesson-pagination button:last-child {
    justify-self: end;
}

.lesson-pagination button:disabled {
    cursor: default;
    opacity: 0.3;
}

#lessonProgress {
    color: var(--muted);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
}

@keyframes lessonIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 801px) {
    .topic-link {
        min-height: 25px;
        padding: 3px 22px;
    }
}

@media (max-width: 800px) {
    .course-navbar {
        grid-template-columns: auto minmax(0, 1fr) auto;
        height: 64px;
    }

    .course-brand {
        flex-shrink: 0;
        padding: 0 16px;
        border-right: 0;
        font-size: 0.7rem;
    }

    .course-label {
        display: none;
    }

    .course-brand > span:last-child {
        display: inline;
        white-space: nowrap;
    }

    .course-heading {
        padding: 0 10px;
    }

    .course-heading strong {
        font-size: 1rem;
    }

    .mobile-menu-button {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 0 18px;
        border: 0;
        border-left: 1px solid var(--ink);
        background: transparent;
        color: var(--ink);
        font: inherit;
        font-size: 0.65rem;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        cursor: pointer;
    }

    .menu-lines,
    .menu-lines::before,
    .menu-lines::after {
        display: block;
        width: 17px;
        height: 1px;
        background: currentColor;
    }

    .menu-lines {
        position: relative;
    }

    .menu-lines::before,
    .menu-lines::after {
        position: absolute;
        left: 0;
        content: "";
    }

    .menu-lines::before { top: -5px; }
    .menu-lines::after { top: 5px; }

    .course-layout {
        display: block;
        height: calc(100% - 64px);
    }

    .content-menu {
        position: fixed;
        top: 64px;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 25;
        border-right: 0;
        transform: translateY(-105%);
        visibility: hidden;
        transition: transform 360ms cubic-bezier(0.76, 0, 0.24, 1), visibility 360ms;
    }

    .content-page.menu-open .content-menu {
        transform: translateY(0);
        visibility: visible;
    }

    .menu-overlay {
        display: none;
    }

    .course-content {
        width: 100%;
        height: 100%;
        padding: 26px 18px 24px;
    }

    .lesson-header {
        margin-bottom: 26px;
    }

    .lesson-header h1 {
        font-size: clamp(2.25rem, 12vw, 4rem);
    }

    .lesson-type {
        display: none;
    }

    .block-video {
        width: calc(100% + 36px);
        margin-left: -18px;
    }

    .block-video figcaption {
        padding: 0 18px;
    }

    .lesson-pagination {
        margin-top: 32px;
    }

    .block-presentation {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 20px;
    }

    .block-presentation a {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 430px) {
    .course-heading {
        display: none;
    }

    .course-navbar {
        grid-template-columns: 1fr auto;
    }

    .mobile-menu-button {
        grid-column: 2;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lesson,
    .content-menu,
    .section-topics,
    .section-triangle {
        animation: none;
        transition: none;
    }
}
