:root {
    color-scheme: light;
    --page: #f6f7f9;
    --surface: #ffffff;
    --surface-soft: #fafafa;
    --text: #1f2328;
    --muted: #6b7280;
    --muted-strong: #4b5563;
    --border: #e1e5ea;
    --border-strong: #ccd3dc;
    --accent: #334155;
    --accent-hover: #1f2937;
    --accent-soft: #f1f5f9;
    --shadow: 0 16px 42px rgba(31, 35, 40, 0.07);
    --shadow-soft: 0 8px 24px rgba(31, 35, 40, 0.05);
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--page);
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--page);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
a {
    font: inherit;
}

button {
    border: 0;
}

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

[hidden] {
    display: none !important;
}

.course-page {
    width: min(100% - 48px, 1120px);
    margin: 0 auto;
    padding: 34px 0 76px;
}

.course-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted-strong);
    font-size: 14px;
    font-weight: 650;
    transition: color 180ms ease, transform 180ms ease;
}

.course-back:hover {
    color: var(--text);
    transform: translateX(-2px);
}

.course-topbar {
    margin-bottom: 16px;
}

.course-state {
    display: grid;
    place-items: center;
    min-height: 180px;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--muted);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    font-weight: 650;
    text-align: center;
}

.course-state--error {
    gap: 12px;
}

.course-state h1 {
    margin: 0;
    color: var(--text);
    font-size: 24px;
}

.course-state p {
    margin: 0;
}

.course-state button {
    min-height: 42px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    color: #ffffff;
    background: var(--accent);
    cursor: pointer;
}

.course-hero {
    max-width: 760px;
    padding: 38px 0 42px;
}

.course-hero h1 {
    margin: 0;
    color: var(--text);
    font-size: clamp(30px, 4vw, 46px);
    font-weight: 760;
    line-height: 1.1;
}

.course-hero p {
    max-width: 680px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.7;
}

.course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
    color: var(--muted-strong);
    font-size: 13px;
    font-weight: 700;
}

.course-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}

.course-progress-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
    color: var(--muted-strong);
    font-size: 14px;
    font-weight: 700;
}

.course-progress-summary__track {
    width: min(100%, 260px);
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--border);
}

.course-progress-summary__track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #2f6f56;
    transition: width 240ms ease;
}

.course-sections {
    display: grid;
    gap: 14px;
}

.course-section-card {
    display: grid;
    gap: 10px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.course-section-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.course-section-card__meta {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 740;
}

.course-section-card h2 {
    margin: 0;
    color: var(--text);
    font-size: 22px;
    line-height: 1.25;
}

.course-section-card__description {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.55;
}

.course-section-card__progress {
    display: grid;
    gap: 7px;
    margin-top: 2px;
}

.course-section-card__progress-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.course-section-card__progress-header strong {
    color: #2f6f56;
}

.course-section-card__progress-track {
    display: block;
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--border);
}

.course-section-card__progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #2f6f56;
    transition: width 240ms ease;
}

.course-section-card__lessons {
    display: grid;
    gap: 7px;
    margin: 4px 0 0;
    padding: 0;
    color: var(--muted-strong);
    font-size: 14px;
    list-style: none;
}

.course-section-card__lessons li {
    padding-left: 14px;
    position: relative;
}

.course-section-card__lessons li::before {
    position: absolute;
    top: 0.65em;
    left: 0;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--muted);
    content: "";
}

.course-section-card__action {
    justify-self: start;
    margin-top: 4px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 780;
}

.course-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 32px;
    align-items: start;
}

.course-main {
    display: grid;
    gap: 28px;
    min-width: 0;
}

.course-card,
.course-info-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.course-card {
    padding: 26px;
}

.course-card:hover,
.course-info-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.course-card h2 {
    margin: 0 0 20px;
    color: var(--text);
    font-size: 22px;
    font-weight: 760;
    line-height: 1.25;
}

.course-outcomes__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.course-outcome {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 46px;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: var(--text);
    font-size: 15px;
    font-weight: 620;
    line-height: 1.35;
}

.course-outcome__check {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #2f6f56;
    background: #eef7f2;
    font-size: 13px;
    font-weight: 800;
}

.course-accordion {
    display: grid;
    gap: 12px;
}

.course-program__empty {
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.course-accordion__item {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.course-accordion__item:hover,
.course-accordion__item:focus-within {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}

.course-accordion__button {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    width: 100%;
    min-height: 62px;
    padding: 18px 20px;
    color: var(--text);
    background: var(--surface);
    text-align: left;
    cursor: pointer;
}

.course-accordion__icon {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: var(--muted-strong);
    background: var(--surface-soft);
    transition: transform 240ms ease, background-color 180ms ease;
}

.course-accordion__item.is-open .course-accordion__icon {
    transform: rotate(180deg);
    background: var(--accent-soft);
}

.course-accordion__title {
    min-width: 0;
    font-size: 17px;
    font-weight: 740;
    line-height: 1.35;
}

.course-accordion__body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 260ms ease;
}

.course-accordion__item.is-open .course-accordion__body {
    grid-template-rows: 1fr;
}

.course-accordion__inner {
    overflow: hidden;
}

.course-lessons {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0 20px 20px 60px;
    list-style: none;
}

.course-lessons li {
    position: relative;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--muted-strong);
    font-size: 15px;
    font-weight: 560;
    line-height: 1.4;
}

.course-lessons li::before {
    position: absolute;
    top: 17px;
    left: -12px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--muted);
    content: "";
}

.course-sidebar {
    position: sticky;
    top: 90px;
}

.course-info-card {
    padding: 24px;
}

.course-facts {
    display: grid;
    gap: 16px;
    margin: 0 0 22px;
}

.course-facts div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.course-facts div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.course-facts dt {
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
}

.course-facts dd {
    margin: 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 760;
    text-align: right;
}

.course-enroll-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    color: #ffffff;
    background: var(--accent);
    font-size: 15px;
    font-weight: 760;
    cursor: pointer;
    transition: background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.course-enroll-button:hover {
    background: var(--accent-hover);
    box-shadow: 0 12px 24px rgba(31, 41, 55, 0.16);
    transform: translateY(-1px);
}

.course-note {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.course-back:focus-visible,
.course-accordion__button:focus-visible,
.course-enroll-button:focus-visible {
    outline: 3px solid rgba(71, 85, 105, 0.18);
    outline-offset: 3px;
}

@media (max-width: 960px) {
    .course-layout {
        grid-template-columns: minmax(0, 1fr) 280px;
        gap: 24px;
    }

    .course-card,
    .course-info-card {
        padding: 22px;
    }
}

@media (max-width: 800px) {
    .course-page {
        width: min(100% - 32px, 1120px);
        padding-top: 30px;
    }

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

    .course-sidebar {
        position: static;
    }

    .course-info-card {
        max-width: none;
    }
}

@media (max-width: 560px) {
    .course-page {
        width: min(100% - 24px, 1120px);
        padding-bottom: 56px;
    }

    .course-hero {
        padding: 30px 0 34px;
    }

    .course-hero h1 {
        font-size: 30px;
    }

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

    .course-lessons {
        padding-left: 48px;
    }

    .course-facts div {
        display: grid;
        gap: 5px;
    }

    .course-facts dd {
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

.course-video {
    position: relative;
    margin-bottom: 24px;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: #17202d;
    aspect-ratio: 16 / 9;
}

.course-video .rendered-video,
.course-video-dialog .rendered-video {
    margin: 0;
}

.course-video .rendered-video__frame,
.course-video-dialog .rendered-video__frame {
    aspect-ratio: var(--video-aspect-ratio, 16 / 9);
    background: #111;
}

.course-video iframe,
.course-video-dialog iframe {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: inherit;
    border: 0;
}

.course-video__preview {
    pointer-events: none;
}

.course-video__open {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
    color: #fff;
    background: linear-gradient(transparent, rgb(0 0 0 / 65%));
    cursor: pointer;
    font-weight: 600;
}

.course-video__play {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    padding-left: 3px;
    border-radius: 50%;
    color: var(--text);
    background: #fff;
    font-size: 20px;
}

.course-video__open:hover {
    background: rgb(0 0 0 / 35%);
}

.course-video__open:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -5px;
}

.course-video-dialog {
    width: min(960px, calc(100% - 24px));
    max-width: none;
    max-height: calc(100dvh - 24px);
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.course-video-dialog::backdrop {
    background: rgb(0 0 0 / 75%);
}

.course-video-dialog__header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.course-video-dialog__header h2 {
    flex: 1;
    margin: 0;
    font-size: 18px;
}

.course-video-dialog__close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 28px;
    cursor: pointer;
}
