/* =============================================================
   Courses — learner player
   Namespaced cp-* so nothing here can leak into other features.
   All colour derives from var(--ButtonBackgroundColor) or neutral
   greys; nothing hardcodes a brand hue.
   ============================================================= */

/* .warning-message is new — we shipped .success-message and .error-message
   but had no "in progress / waiting on someone" treatment. Kept alongside
   them so the three read as one family. */
.warning-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 13px;
    border-radius: 3px;
    font-size: 13px;
    border: 1px solid #eddfae;
    background: #fdf6e3;
    color: #8a6100;
}

.warning-message b { font-weight: 700; }

/* ---------- layout ---------- */
/* Mobile-first: stacked is the default, the two-column rules are additive.
   If a query is ever mis-scoped the narrow layout is what ships, which is the
   safer failure. */
.cp-layout { display: block; }
.cp-rail-desktop { display: none; }
.cp-rail-mobile { display: block; position: sticky; top: 0; z-index: 6; margin-bottom: 10px; }

/* The nav is inside the viewport (224px, per layout.css), so the player only
   gets viewport minus nav minus gutters. Two columns need ~840px of player:
   280 rail + 20 gap + 540 main. 840 + 224 + gutters ≈ 1100. */
@media (min-width: 1100px) {
    .cp-layout { display: flex; gap: 20px; align-items: flex-start; }
    .cp-col-rail { flex: 0 0 clamp(280px, 27%, 330px); position: sticky; top: 14px; max-height: calc(100vh - 28px); display: flex; flex-direction: column; min-height: 0; }
    .cp-col-main { flex: 1 1 auto; min-width: 0; }
    .cp-rail-desktop { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
    .cp-rail-mobile { display: none; }
    .cp-notes.is-docked { position: sticky; bottom: 0; z-index: 4; box-shadow: 0 -4px 12px rgba(24,34,45,.09); }
}

/* When the side nav is collapsed to an icon rail the player gains room, so two
   columns fit sooner. Keyed off the shell's own class because a viewport media
   query cannot see a runtime toggle. */
@media (min-width: 960px) {
    .wrapper.collapseSideBar .cp-layout { display: flex; gap: 20px; align-items: flex-start; }
    .wrapper.collapseSideBar .cp-col-rail { flex: 0 0 clamp(280px, 27%, 330px); position: sticky; top: 14px; max-height: calc(100vh - 28px); display: flex; flex-direction: column; min-height: 0; }
    .wrapper.collapseSideBar .cp-col-main { flex: 1 1 auto; min-width: 0; }
    .wrapper.collapseSideBar .cp-rail-desktop { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
    .wrapper.collapseSideBar .cp-rail-mobile { display: none; }
}

/* ---------- rail ---------- */
.cp-progress { padding: 12px 14px; border-bottom: 1px solid #e2e7ec; }
.cp-progress-top { display: flex; justify-content: space-between; font-size: 12px; color: #5a6572; margin-bottom: 6px; }
.cp-progress-top b { color: #22282f; font-weight: 600; }

.cp-rail-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.cp-sections { list-style: none; margin: 0; padding: 0; }
.cp-items { list-style: none; margin: 0; padding: 0; }

.cp-section-hd {
    display: flex; align-items: center; gap: 8px; padding: 9px 14px;
    background: #f6f8fa; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: #5a6572;
    border-top: 1px solid #e2e7ec; border-bottom: 1px solid #e2e7ec;
}
.cp-sec-count { margin-left: auto; font-weight: 600; letter-spacing: 0; text-transform: none; color: #8a949e; }

.cp-lesson {
    display: flex; gap: 11px; width: 100%; text-align: left; padding: 11px 14px;
    border: 0; border-bottom: 1px solid #eef1f4; border-left: 3px solid transparent;
    background: #fff; color: inherit; font: inherit; cursor: pointer;
}
button.cp-lesson:hover { background: #f6f8fa; }
.cp-items li:last-child .cp-lesson { border-bottom: 0; }

.cp-lesson-ic { margin-top: 1px; font-size: 15px; line-height: 1; color: #b6bfc9; flex: 0 0 auto; }
.cp-lesson-b { min-width: 0; flex: 1; }
.cp-lesson-t { font-size: 13.5px; font-weight: 600; display: block; }
.cp-lesson-d { font-size: 12px; color: #5a6572; display: block; margin-top: 1px; }
.cp-lesson-m { font-size: 11.5px; color: #8a949e; margin-top: 5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cp-sep { color: #ccd3da; }

.cp-lesson.is-done .cp-lesson-ic { color: var(--ButtonBackgroundColor); }
.cp-lesson.is-done .cp-lesson-t { font-weight: 500; color: #5a6572; }

.cp-lesson.is-current {
    border-left-color: var(--ButtonBackgroundColor);
    background: #f4f6f8; /* neutral fallback — never a hue */
    background: color-mix(in srgb, var(--ButtonBackgroundColor) 7%, #fff);
}
button.cp-lesson.is-current:hover { background: color-mix(in srgb, var(--ButtonBackgroundColor) 12%, #fff); }
.cp-lesson.is-current .cp-lesson-ic { color: var(--ButtonBackgroundColor); }
.cp-lesson.is-current .cp-lesson-t { font-weight: 700; }

.cp-heretag {
    font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: #fff; background: var(--ButtonBackgroundColor); padding: 1px 6px; border-radius: 2px;
}

.cp-lesson.is-locked { background: #f6f8fa; cursor: default; }
.cp-lesson.is-locked .cp-lesson-t { color: #5a6572; font-weight: 500; }
.cp-lesson.is-locked .cp-lesson-d { color: #8a949e; }

.cp-lock-why { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; font-size: 11.5px; padding: 4px 7px; border-radius: 2px; }

/* Sequence lock: something you can act on now, so it reads neutral and offers a way forward. */
.cp-lesson.is-seqlock .cp-lock-why { background: #eaeef2; color: #5a6572; }

/* Drip lock: only time opens it, so it reads as a wait and leads with the date. */
.cp-lesson.is-driplock { border-left: 3px dashed #d8dde3; }
.cp-lesson.is-driplock .cp-lock-why { background: #fdf6e3; color: #8a6100; }

.cp-lock-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; cursor: pointer; color: var(--ButtonBackgroundColor); text-decoration: underline; }

/* ---------- mobile disclosure ---------- */
.cp-disc > summary { list-style: none; cursor: pointer; padding: 8px 12px; display: flex; align-items: center; gap: 10px; min-height: 44px; }
.cp-disc > summary::-webkit-details-marker { display: none; }
.cp-sum-b { min-width: 0; flex: 1; }
.cp-sum-t { font-size: 12.5px; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-sum-s { font-size: 11px; color: #5a6572; }
.cp-disc .progress { height: 3px; margin-top: 4px; }
.cp-chev { margin-left: auto; color: #5a6572; transition: transform .15s; }
.cp-disc[open] > summary .cp-chev { transform: rotate(180deg); }
.cp-disc[open] > summary { border-bottom: 1px solid #e2e7ec; }
.cp-disc .cp-rail-scroll { max-height: 58vh; }

/* ---------- lesson body ---------- */
.cp-lesson-hd { padding: 13px 16px; border-bottom: 1px solid #e2e7ec; }
.cp-eyebrow { font-size: 11.5px; color: #8a949e; }
.cp-lesson-h1 { font-size: 19px; font-weight: 600; margin: 2px 0 0; }
.cp-lesson-sum { font-size: 13.5px; color: #5a6572; margin: 7px 0 0; max-width: 70ch; }
.cp-body { padding: 14px; }

.cp-video { background: #11161c; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; color: #66727f; font-size: 12px; }
.cp-video iframe, .cp-video video, .cp-video > div { width: 100%; height: 100%; border: 0; }
.cp-videobar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: #f6f8fa; border-top: 1px solid #e2e7ec; font-size: 12.5px; }
.cp-vb-act { margin-left: auto; display: flex; gap: 8px; }

.cp-prose { padding: 14px; max-width: 72ch; font-size: 14.5px; line-height: 1.65; }
.cp-prose h1, .cp-prose h2, .cp-prose h3 { font-size: 16px; margin: 16px 0 6px; }
.cp-prose h3:first-child { margin-top: 0; }
.cp-prose ul, .cp-prose ol { padding-left: 20px; margin: 8px 0; }
.cp-prose img { max-width: 100%; height: auto; }
.cp-prose blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid #e2e7ec; color: #5a6572; }

.cp-doc { padding: 14px; display: flex; gap: 14px; align-items: center; background: #f6f8fa; border: 1px solid #e2e7ec; border-radius: 3px; flex-wrap: wrap; }
.cp-embed { height: 420px; background: #f0f2f5; border: 1px solid #e2e7ec; border-radius: 3px; width: 100%; }
.cp-drop { border: 1px dashed #c3ccd6; border-radius: 3px; background: #f6f8fa; padding: 18px; text-align: center; }

.cp-cert { text-align: center; padding: 24px 18px; border: 1px solid #e2e7ec; border-radius: 3px; background: #f6f8fa; }
.cp-cert.is-ready { background: #fff; border-color: var(--ButtonBackgroundColor); }
.cp-req { max-width: 400px; margin: 14px auto 0; text-align: left; font-size: 13px; padding: 0; list-style: none; }
.cp-req li { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid #eef1f4; }

.cp-empty { text-align: center; padding: 46px 20px; color: #5a6572; }
.cp-empty b { display: block; color: #22282f; font-size: 15px; margin: 10px 0 4px; }

/* ---------- notes ---------- */
.cp-notes { border-top: 1px solid #e2e7ec; background: #fff; }
.cp-notes-body { padding: 9px 14px; }
/* Collapses only when empty — a saved note stays readable without clicking in. */
.cp-notes textarea { min-height: 70px; resize: none; font-size: 13.5px; overflow: auto; line-height: 1.45; }
.cp-notes textarea:placeholder-shown { min-height: 36px; overflow: hidden; }
.cp-notes:focus-within textarea { min-height: 140px; resize: vertical; overflow: auto; }
.cp-notes-foot { display: none; align-items: center; gap: 10px; margin-top: 7px; font-size: 11.5px; color: #8a949e; flex-wrap: wrap; }
.cp-notes:focus-within .cp-notes-foot { display: flex; }
.cp-privacy { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- action bar ---------- */
.cp-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 11px 14px; border-top: 1px solid #e2e7ec; background: #fff; position: relative; z-index: 5; }
.cp-act-right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cp-nexthint { font-size: 11.5px; color: #8a949e; }
.cp-donetag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ButtonBackgroundColor); }

/* On a short screen only the action bar pins — a third sticky layer would leave
   too little room for the lesson itself. */
@media (max-width: 1099px) {
    .cp-actions { position: sticky; bottom: 0; padding: 8px 10px; box-shadow: 0 -3px 10px rgba(20,30,40,.08); }
    .cp-actions .button { flex: 1 1 auto; min-height: 40px; }
    .cp-act-right { width: 100%; margin-left: 0; gap: 8px; }
    .cp-notes.is-docked { position: static; box-shadow: none; }
    .cp-lesson-h1 { font-size: 17px; }
    .cp-body, .cp-prose { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) { .cp-chev { transition: none; } }
