/* Course library — the deep-purple learning area. Loaded only on /courses and
   /course/... so it never touches storefront styling. */
.courses-page {
    --course-surface: #3a1a6b;
    --course-surface-2: #452080;
    --course-border: rgba(255, 255, 255, 0.08);
    --course-text: #ffffff;
    --course-muted: #c3b3dd;
    --course-accent: #f0c987;
    --course-link: #6db4e8;

    /* No background of its own. This used to paint a second purple radial on
       top of the branded gradient the body already carries, so the courses
       were the one area that didn't match the site — and the one place the
       Branding background had no effect. */
    background: transparent;
    color: var(--course-text);
    min-height: 80vh;
    padding: 40px 24px 80px;
}

.courses-layout,
.course-layout {
    max-width: 1800px;
    margin: 0 auto;
    display: grid;
    gap: 28px;
    align-items: start;
}
/* The collection itself is capped at 1000px — full-bleed cards on a wide
   monitor stretched to the point where a row read as unrelated tiles. The
   promo column keeps its width, and the pair centres on the page. */
.courses-layout {
    grid-template-columns: minmax(0, 1000px) 400px;
    justify-content: center;
}
.course-layout  { grid-template-columns: 340px minmax(0, 1fr) 360px; }

/* --- Index --- */
.course-group { margin-bottom: 48px; }
.course-group-title {
    font-size: 22px;
    margin: 0 0 18px;
    color: var(--course-text);
}
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}
.course-card {
    display: block;
    background: var(--course-surface);
    border: 1px solid var(--course-border);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform .15s ease, background .15s ease;
}
.course-card:hover { transform: translateY(-3px); background: var(--course-surface-2); }
.course-card-image { aspect-ratio: 16 / 9; background: #1b0a37; }
.course-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.course-card-body { padding: 20px 22px 26px; }
.course-card-body h3 { margin: 0 0 10px; font-size: 21px; line-height: 1.25; }
.course-card-body p {
    margin: 0;
    color: var(--course-muted);
    font-size: 15px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.course-empty { color: var(--course-muted); }

/* --- Promo banner --- */
.course-promo {
    background: var(--course-surface);
    border: 1px solid var(--course-border);
    border-radius: 12px;
    overflow: hidden;
    position: sticky;
    top: 24px;
}
/* No padding: the image is the header, and it runs to the card's edge — the
   card already clips it to the rounded corners. */
.course-promo-header {
    background: #331460;
    text-align: center;
    line-height: 0;
}
.course-promo-header img { display: block; width: 100%; height: auto; }
.course-promo-body { padding: 24px 26px 28px; }
.course-promo-body h3 { margin: 0 0 14px; font-size: 22px; line-height: 1.3; }
.course-promo-body p { margin: 0 0 22px; color: var(--course-muted); line-height: 1.55; }
.course-promo-btn {
    display: block;
    text-align: center;
    background: #fff;
    color: #1b0a37;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 16px;
    border-radius: 6px;
    text-decoration: none;
}
.course-promo-btn:hover { background: #efe8fb; }

/* --- Player --- */
.course-back { color: var(--course-muted); text-decoration: none; font-size: 14px; }
.course-back:hover { color: #fff; }
.course-sidebar-title { font-size: 22px; margin: 14px 0 16px; }

.course-progress {
    position: relative;
    height: 26px;
    border-radius: 13px;
    background: var(--course-surface);
    overflow: hidden;
    margin-bottom: 22px;
}
.course-progress-fill {
    height: 100%;
    width: 0;
    background: var(--course-accent);
    transition: width .25s ease;
}
.course-progress-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.course-chapter { margin-bottom: 6px; }
.course-chapter-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: 0;
    color: var(--course-text);
    font: inherit;
    font-weight: 700;
    text-align: left;
    padding: 12px 8px;
    cursor: pointer;
}
.course-chapter-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--course-surface);
    transition: transform .15s ease;
}
.course-chapter.open .course-chapter-caret { transform: rotate(180deg); }
.course-chapter-lessons { display: none; }
.course-chapter.open .course-chapter-lessons { display: block; }
.course-lesson-link {
    display: block;
    padding: 12px 18px;
    margin: 2px 0 2px 12px;
    border-radius: 8px;
    color: var(--course-muted);
    text-decoration: none;
    font-size: 15px;
}
.course-lesson-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.course-lesson-link.active { background: var(--course-surface); color: #fff; }
.course-lesson-link.done::after { content: " ✓"; color: var(--course-accent); }

.course-lesson-card {
    background: var(--course-surface);
    border: 1px solid var(--course-border);
    border-radius: 12px;
    padding: 26px 28px 32px;
}
.course-lesson-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}
.course-lesson-header h2 { margin: 0; line-height: 1.25; }
.course-done-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--course-surface-2);
    border: 0;
    border-radius: 20px;
    color: var(--course-muted);
    font: inherit;
    padding: 10px 18px;
    cursor: pointer;
}
.course-done-btn.is-done { background: var(--course-accent); color: #1b0a37; font-weight: 700; }
.course-video { overflow: hidden; background: #000; }
.course-video iframe { border: 0; max-width: 100%; }

/* Bunny, Vidalytics and Cloudflare all hand you a padded wrapper with the
   player absolutely positioned inside it. That shape now survives sanitising,
   so leave it alone — these rules only supply the geometry an embed does not
   bring with it. */
.course-video > iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
}
.course-video > div:not([style]) { position: relative; padding-top: 56.25%; }
.course-video > div:not([style]) > iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.course-lesson-body { margin-top: 22px; line-height: 1.6; color: #ece5f8; }
.course-section-title { margin: 28px 0 12px; font-size: 22px; }
.course-lesson-links a { color: var(--course-link); }

.course-account {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 13px;
    color: var(--course-muted);
    margin: 12px 0 20px;
}
.course-account a,
.course-account-link {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--course-link);
    text-decoration: underline;
    cursor: pointer;
}

/* --- Sign-up modal --- */
.course-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 4, 22, .8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.course-modal-overlay[hidden] { display: none; }
.course-modal {
    background: #241338;
    color: #fff;
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 540px;
}
.course-modal h2 { margin: 0 0 18px; line-height: 1.2; }
.course-modal p { margin: 0 0 26px; color: #d6cbe8; font-size: 18px; }
.course-modal-form input[type="email"] {
    width: 100%;
    padding: 14px 16px;
    border-radius: 6px;
    border: 1px solid #4a3768;
    background: #1b0f2c;
    color: #fff;
    margin-bottom: 14px;
    font-size: 16px;
}
.course-modal-primary,
.course-modal-secondary {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 6px;
    padding: 16px;
    font: inherit;
    font-size: 17px;
    cursor: pointer;
}
.course-modal-primary { background: #3fa2dd; color: #fff; font-weight: 600; }
.course-modal-secondary { background: #4a4159; color: #fff; margin-top: 12px; }

@media (max-width: 1200px) {
    .courses-layout { grid-template-columns: minmax(0, 1fr); }
    .course-layout { grid-template-columns: 300px minmax(0, 1fr); }
    .course-layout .course-promo { grid-column: 1 / -1; position: static; }
}
@media (max-width: 800px) {
    .courses-page { padding: 24px 14px 60px; }
    .course-layout { grid-template-columns: minmax(0, 1fr); }
    /* On a phone the video is the point — the chapter list follows it. */
    .course-content { order: -1; }
    .course-promo { position: static; }
    .course-lesson-header { flex-direction: column; }
}
