/* Paid video courses — layered on top of css/variables.css design tokens.
   Mobile-first: everything is single-column by default and the player layout
   only splits into sidebar + stage on wider screens. */

/* variables.css locks html/body to overflow:hidden for the app-shell pages.
   Course pages are documents, so let them scroll. */
html, body {
  overflow: auto;
  height: auto;
  min-height: 100%;
  background: var(--bg);
}

.c-wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--sp-4); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.c-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--font); font-size: var(--text-md); font-weight: 600;
  padding: 11px 18px; border-radius: var(--radius-md); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background var(--transition-fast), border-color var(--transition-fast);
}
.c-btn--primary { background: var(--primary); color: #fff; }
.c-btn--primary:hover { background: var(--primary-hover); }
.c-btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.c-btn--ghost:hover { border-color: var(--text-muted); }
.c-btn--success { background: var(--success); color: #fff; }
.c-btn:disabled { opacity: .55; cursor: not-allowed; }
.c-btn--full { width: 100%; }

/* ── Hero / page heading ──────────────────────────────────────────────── */
.c-hero { padding: var(--sp-8) 0 var(--sp-6); }
.c-hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -.01em; margin-bottom: var(--sp-2); }
.c-hero p { color: var(--text-secondary); font-size: var(--text-lg); max-width: 60ch; }
/* Stat chips under the locked-landing hero (lessons, runtime, certificate…) */
.c-hero-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.c-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); box-shadow: var(--shadow-sm); }
.c-chip i { color: var(--primary); }

/* ── Catalog grid ─────────────────────────────────────────────────────── */
.c-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-5); padding-bottom: var(--sp-10); }
.c-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; text-decoration: none; color: inherit; transition: box-shadow var(--transition), transform var(--transition); }
.c-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.c-card-cover { aspect-ratio: 16 / 9; background: var(--primary-light) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--primary-dark); font-size: 32px; }
/* Auto-generated branded cover (when no cover_image is set) */
.c-card-cover--gen { display: block; position: relative; overflow: hidden; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.c-card-cover--gen .c-cover-mark { position: absolute; top: -14px; right: -6px; font-size: 96px; color: rgba(255, 255, 255, 0.10); }
.c-card-cover--gen .c-cover-title { position: absolute; left: 16px; right: 16px; bottom: 14px; color: #fff; font-size: 18px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.c-card-cover--gen::after { content: ""; position: absolute; left: 0; top: 0; width: 46px; height: 6px; background: #ffdc03; }
.c-card-body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.c-card-title { font-size: var(--text-lg); font-weight: 700; }
.c-card-sub { color: var(--text-secondary); font-size: var(--text-md); line-height: 1.5; flex: 1; }
.c-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-2); }
.c-badge { font-size: var(--text-xs); font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.c-badge--locked { background: var(--border-light); color: var(--text-muted); }

/* ── Loading skeletons (storefront + My Learning card grids) ──────────── */
.c-skel-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.c-skel-cover { aspect-ratio: 16 / 9; }
.c-skel-body { padding: var(--sp-4); display: flex; flex-direction: column; gap: 10px; }
.c-skel-line { height: 14px; border-radius: 6px; }
.c-skel-shimmer { background: linear-gradient(90deg, var(--border-light) 25%, #edf2f7 37%, var(--border-light) 63%); background-size: 400% 100%; animation: cskel 1.3s ease infinite; }
@keyframes cskel { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .c-skel-shimmer { animation: none; } }

/* ── Progress bar ─────────────────────────────────────────────────────── */
.c-progress { height: 7px; background: var(--border-light); border-radius: 999px; overflow: hidden; }
.c-progress > span { display: block; height: 100%; background: var(--success); border-radius: 999px; transition: width var(--transition); }
.c-progress-label { font-size: var(--text-sm); color: var(--text-secondary); }

/* ── Player layout ────────────────────────────────────────────────────── */
.c-player { display: grid; grid-template-columns: 1fr; gap: var(--sp-5); padding: var(--sp-5) 0 var(--sp-10); }
@media (min-width: 920px) {
  .c-player { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .c-sidebar { position: sticky; top: 76px; }
}

.c-stage { min-width: 0; }
.c-video { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-lg); overflow: hidden; }
.c-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.c-video-locked { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-3); color: #fff; text-align: center; padding: var(--sp-5); background: #0f172a; }
.c-video-locked i { font-size: 30px; opacity: .8; }

.c-lesson-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin: 0 0 var(--sp-3); }
.c-lesson-head-text { flex: 1; min-width: 0; }
.c-lesson-kicker { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 3px; }
.c-lesson-head h2 { font-size: var(--text-2xl); font-weight: 700; }
.c-lesson-desc { color: var(--text-secondary); line-height: 1.7; font-size: 15px; }
/* Rich-text (Markdown-rendered) notes & descriptions */
.c-lesson-desc > * + * { margin-top: var(--sp-3); }
.c-lesson-desc h2, .c-lesson-desc h3, .c-lesson-desc h4 { color: var(--text); font-weight: 700; line-height: 1.3; margin-top: var(--sp-5); }
.c-lesson-desc h2 { font-size: var(--text-xl); }
.c-lesson-desc h3 { font-size: var(--text-lg); }
.c-lesson-desc h4 { font-size: var(--text-md); }
.c-lesson-desc a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.c-lesson-desc a:hover { color: var(--primary-hover); }
.c-lesson-desc strong { color: var(--text); font-weight: 700; }
.c-lesson-desc ul, .c-lesson-desc ol { padding-left: 1.4em; }
.c-lesson-desc li { margin: 4px 0; }
.c-lesson-desc li::marker { color: var(--text-muted); }
.c-lesson-desc code { font-family: var(--font-mono); font-size: .92em; background: var(--border-light); padding: 2px 6px; border-radius: var(--radius-sm); color: var(--primary-dark); }
.c-lesson-desc blockquote { border-left: 3px solid var(--primary-light); padding-left: var(--sp-4); color: var(--text-secondary); }

/* ── Prev / next lesson nav ───────────────────────────────────────────── */
.c-lesson-nav { display: flex; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-4); }
.c-lesson-nav .c-btn:disabled { visibility: hidden; }   /* keep the other button aligned at its edge */

/* ── Video wrap + "Up next" overlay ───────────────────────────────────── */
.c-video-wrap { position: relative; }
.c-upnext { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, .80); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); border-radius: var(--radius-lg); z-index: 5; }
.c-upnext-card { text-align: center; color: #fff; padding: var(--sp-5); max-width: 440px; }
.c-upnext-kicker { font-size: var(--text-sm); font-weight: 600; color: #6ee7b7; display: inline-flex; align-items: center; gap: 6px; }
.c-upnext-title { font-size: var(--text-xl); font-weight: 700; margin: var(--sp-2) 0 var(--sp-4); line-height: 1.3; }
.c-upnext-actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }
.c-upnext-actions .c-btn--ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.c-upnext-actions .c-btn--ghost:hover { border-color: #fff; }
.c-upnext-auto { display: inline-flex; align-items: center; gap: 8px; margin-top: var(--sp-4); font-size: var(--text-sm); color: rgba(255, 255, 255, .75); cursor: pointer; }
.c-upnext-auto:hover { color: #fff; }
.c-upnext-auto input { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }

/* ── Course meta / stats ──────────────────────────────────────────────── */
.c-side-meta { font-size: var(--text-sm); color: var(--text-muted); margin-top: 4px; }

/* ── Sidebar lesson list ──────────────────────────────────────────────── */
.c-sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.c-sidebar-head { padding: var(--sp-4); border-bottom: 1px solid var(--border); }
.c-sidebar-head h3 { font-size: var(--text-md); font-weight: 700; margin-bottom: var(--sp-3); }
/* Fold-all control. It shares the meta line rather than owning a row: a
   full-width band here reads as a section header and shouts louder than the
   lessons it sits above. [hidden] last, so it beats the display:inline-flex. */
.c-side-metarow { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.c-side-fold { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin: 0 -4px 0 auto; padding: 0; background: none; border: 0; border-radius: var(--radius-sm); font-size: 11px; line-height: 1; color: var(--text-muted); cursor: pointer; transition: color var(--transition-fast), background var(--transition-fast); }
.c-side-fold:hover { color: var(--primary); background: var(--border-light); }
.c-side-fold:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.c-side-fold[hidden] { display: none; }
.c-lessons { list-style: none; max-height: 60vh; overflow-y: auto; scrollbar-width: thin; }
.c-lesson-item { position: relative; display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border-light); padding: var(--sp-3) var(--sp-4); cursor: pointer; font-family: var(--font); color: var(--text); transition: background var(--transition-fast); }
.c-lesson-item:hover { background: var(--border-light); }
.c-lesson-item.is-active { background: var(--primary-light); }
/* Accent bar + emphasized title mark the lesson that's playing. */
.c-lesson-item.is-active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.c-lesson-item.is-active .c-lesson-meta .t { color: var(--primary-dark); font-weight: 600; }
.c-lesson-item.is-active .c-lesson-num { background: var(--primary); color: #fff; border-color: var(--primary); }
.c-lesson-num { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); }
.c-lesson-num i { font-size: 10px; }
.c-lesson-num.is-done { background: var(--success); border-color: var(--success); color: #fff; }
.c-lesson-meta { flex: 1; min-width: 0; }
.c-lesson-meta .t { font-size: var(--text-md); font-weight: 500; line-height: 1.35; }
.c-lesson-meta .d { font-size: var(--text-xs); color: var(--text-muted); }
.c-lesson-item .lock { color: var(--text-muted); font-size: var(--text-sm); }
/* Section header rows inside the lesson list (not sticky: the positioned
   lesson rows would paint over a stuck header and the text collides) */
.c-lesson-sec { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4) var(--sp-2); background: var(--border-light); border-bottom: 1px solid var(--border-light); }
.c-lesson-sec-t { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); }
.c-lesson-sec-meta { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
/* Collapsible variant (enrolled player only — the header carries data-sec-toggle) */
.c-lesson-sec[data-sec-toggle] { cursor: pointer; user-select: none; align-items: center; }
.c-lesson-sec[data-sec-toggle]:hover { background: var(--border); }
.c-lesson-sec[data-sec-toggle]:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.c-lesson-sec-left { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.c-sec-chev { font-size: 10px; color: var(--text-muted); transition: transform 150ms ease; flex-shrink: 0; }
.c-lesson-sec.is-collapsed .c-sec-chev { transform: rotate(-90deg); }
.c-lesson-subsec { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4) var(--sp-2) calc(var(--sp-4) + 14px); background: rgba(55, 114, 163, .09); border-left: 3px solid var(--primary); }
.c-lesson-subsec-t { font-size: var(--text-xs); font-weight: 700; letter-spacing: .02em; color: var(--primary); }
.c-lesson-subsec-meta { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }

/* ── Lesson panel: Overview / Q&A tabs on their own card surface, so the
   notes read as a distinct sheet instead of blending into the page bg. ── */
.c-panelcard { margin-top: var(--sp-6); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.c-tabs { display: flex; gap: var(--sp-2); border-bottom: 1px solid var(--border); padding: 0 var(--sp-5); }
.c-tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 13px 6px; font-family: var(--font); font-size: var(--text-md); font-weight: 600; color: var(--text-secondary); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: color var(--transition-fast), border-color var(--transition-fast); }
.c-tab i { font-size: .9em; color: var(--text-muted); }
.c-tab:hover { color: var(--text); }
.c-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.c-tab.is-active i { color: var(--primary); }
.c-tabpanel { display: none; }
.c-tabpanel.is-active { display: block; padding: var(--sp-5) var(--sp-6) var(--sp-6); }
@media (max-width: 560px) {
  .c-tabs { padding: 0 var(--sp-3); }
  .c-tabpanel.is-active { padding: var(--sp-4); }
}

/* ── Q&A ──────────────────────────────────────────────────────────────── */
.c-qa-form { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.c-qa-form textarea { width: 100%; min-height: 90px; resize: vertical; font-family: var(--font); font-size: var(--text-md); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text); }
.c-qa-form textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(55,114,163,.15); }

/* Sort control */
.c-qa-sortbar { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.c-qa-sort { background: none; border: none; font-family: var(--font); font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); cursor: pointer; padding: 4px 10px; border-radius: 999px; }
.c-qa-sort:hover { color: var(--text); }
.c-qa-sort.is-active { background: var(--primary-light); color: var(--primary); }

/* Comment thread (YouTube / LinkedIn style) */
.c-comment { display: flex; gap: var(--sp-3); padding: var(--sp-4) 0; }
/* Each question is a clear card so the Q&A reads as distinct threads. */
.c-comment--q { padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: var(--sp-3); }
.c-comment-main { flex: 1; min-width: 0; }
.c-comment-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: 3px; }
.c-comment-who { font-weight: 700; font-size: var(--text-sm); color: var(--text); }
.c-comment-time { font-size: var(--text-xs); color: var(--text-muted); }
.c-comment-body { line-height: 1.6; font-size: var(--text-md); color: var(--text); word-wrap: break-word; }
.c-comment-body > * + * { margin-top: var(--sp-2); }
.c-comment-body p { margin: 0; }
.c-comment-actions { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); flex-wrap: wrap; }
/* Nested replies sit behind a thread rail and collapse by default. */
.c-replies { margin-top: var(--sp-3); padding-left: var(--sp-4); border-left: 2px solid var(--border-light); }
.c-comment--reply { padding: var(--sp-3) 0 0; }
.c-replies-toggle { background: none; border: none; color: var(--primary); font-family: var(--font); font-size: var(--text-sm); font-weight: 600; cursor: pointer; padding: 3px 8px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; gap: 6px; }
.c-replies-toggle:hover { background: var(--primary-light); }
.c-replies-toggle i { font-size: .8em; }

/* Avatars */
.c-av { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: var(--text-md); overflow: hidden; }
img.c-av { object-fit: cover; }
.c-comment--reply .c-av { width: 30px; height: 30px; font-size: var(--text-sm); }
.c-av--instr { box-shadow: 0 0 0 2px var(--primary-light); }

/* Badges */
.c-badge-instr { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #fff; background: var(--primary); padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.c-badge-answered { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #047857; background: var(--success-light); padding: 2px 8px; border-radius: 999px; }

/* Upvote + reply actions */
.c-vote { display: inline-flex; align-items: center; gap: 5px; background: none; border: 1px solid var(--border); color: var(--text-secondary); border-radius: 999px; padding: 3px 11px; font-size: var(--text-sm); font-weight: 600; cursor: pointer; font-family: var(--font); transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast); }
.c-vote:hover { border-color: var(--primary); color: var(--primary); }
.c-vote.is-on { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.c-vote i { font-size: .85em; }
.c-reply-btn { background: none; border: none; color: var(--text-secondary); font-family: var(--font); font-size: var(--text-sm); font-weight: 600; cursor: pointer; padding: 3px 8px; border-radius: var(--radius-sm); }
.c-reply-btn:hover { color: var(--primary); background: var(--primary-light); }
/* Delete (own posts): reads like the other actions, warns on hover */
.c-reply-btn--danger:hover { color: #dc2626; background: #fef2f2; }

/* Inline reply form */
.c-reply-form { margin-top: var(--sp-3); }
.c-reply-input { width: 100%; resize: vertical; font-family: var(--font); font-size: var(--text-md); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text); }
.c-reply-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(55,114,163,.15); }
.c-reply-form-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-2); }
.c-btn--sm { padding: 6px 13px; font-size: var(--text-sm); }

/* ── Misc ─────────────────────────────────────────────────────────────── */
.c-muted { color: var(--text-secondary); }
.c-spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: cspin 700ms linear infinite; margin: var(--sp-8) auto; }
@keyframes cspin { to { transform: rotate(360deg); } }
.c-empty { padding: var(--sp-8); text-align: center; color: var(--text-muted); }

/* ── Dashboard sections ───────────────────────────────────────────────── */
.c-section-title { font-size: var(--text-xl); font-weight: 700; letter-spacing: -.01em; margin: var(--sp-6) 0 var(--sp-4); }
.c-empty-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-8); text-align: center; }
.c-empty-card i { font-size: 28px; color: var(--text-muted); }
.c-empty-card h3 { font-size: var(--text-lg); font-weight: 700; margin: var(--sp-3) 0 var(--sp-2); }

/* ── Player: lesson navigation on the LEFT (desktop). Video stays first on
   mobile via the source order; on desktop the sidebar is pulled to column 1.
   The sidebar fills the viewport height like a real course player: the head
   and certificate row stay pinned while the lesson list scrolls between them. */
@media (min-width: 920px) {
  .c-player--learn { grid-template-columns: 360px minmax(0, 1fr); }
  .c-player--learn .c-sidebar { order: -1; display: flex; flex-direction: column; max-height: calc(100vh - 96px); }
  .c-player--learn .c-lessons { flex: 1 1 auto; min-height: 0; max-height: none; }
}

/* ── Locked landing: buy card, includes list + sticky mobile buy bar ──── */
.c-price { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-bottom: var(--sp-3); }
.c-includes-label { font-size: var(--text-md); font-weight: 700; margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--border-light); }
.c-sidebar--buy .c-sidebar-head { border-bottom: 0; }
.c-includes { margin-top: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); }
.c-includes div { font-size: var(--text-md); color: var(--text-secondary); display: flex; align-items: center; gap: var(--sp-2); }
.c-includes i { color: var(--success); }

/* ── Locked landing: free-preview chips under the video ───────────────── */
.c-prev-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: var(--sp-3); }
.c-prev-label { font-size: var(--text-sm); font-weight: 700; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; }
.c-prev-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; font-family: var(--font); font-size: var(--text-sm); font-weight: 600; color: var(--primary); cursor: pointer; transition: border-color var(--transition-fast), background var(--transition-fast); }
.c-prev-chip:hover { border-color: var(--primary); background: var(--primary-light); }
.c-prev-chip.is-playing { background: var(--primary-light); border-color: var(--primary); }
.c-prev-chip i { font-size: .9em; }

/* ── Locked landing: "About this course" card ─────────────────────────── */
.c-about { margin-top: var(--sp-6); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-6); box-shadow: var(--shadow-sm); }
.c-about > h2 { font-size: var(--text-xl); font-weight: 700; letter-spacing: -.01em; margin-bottom: var(--sp-4); }

/* ── Locked landing: course content (curriculum accordion) ────────────── */
.c-curriculum { margin-top: var(--sp-6); }
.c-cur-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.c-cur-head h2 { font-size: var(--text-xl); font-weight: 700; letter-spacing: -.01em; }
.c-cur-expand { background: none; border: none; color: var(--primary); font-family: var(--font); font-size: var(--text-sm); font-weight: 600; cursor: pointer; padding: 6px 10px; border-radius: var(--radius-sm); }
.c-cur-expand:hover { background: var(--primary-light); }
.c-cur-summary { color: var(--text-muted); font-size: var(--text-sm); margin: var(--sp-1) 0 var(--sp-4); }
.c-cur-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.c-cur-sec + .c-cur-sec { border-top: 1px solid var(--border); }
.c-cur-sec-head { display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left; background: var(--border-light); border: none; padding: 14px var(--sp-4); cursor: pointer; font-family: var(--font); transition: background var(--transition-fast); }
.c-cur-sec-head:hover { background: var(--border); }
.c-cur-chev { font-size: 11px; color: var(--text-muted); transition: transform 150ms ease; flex-shrink: 0; }
.c-cur-sec:not(.is-open) .c-cur-chev { transform: rotate(-90deg); }
.c-cur-sec-title { flex: 1; min-width: 0; font-size: var(--text-md); font-weight: 700; color: var(--text); line-height: 1.35; }
.c-cur-sec-meta { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.c-cur-rows { list-style: none; }
.c-cur-sec:not(.is-open) .c-cur-rows { display: none; }
.c-cur-row { display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left; background: none; border: none; border-top: 1px solid var(--border-light); padding: 11px var(--sp-4); font-family: var(--font); cursor: pointer; transition: background var(--transition-fast); }
.c-cur-row:hover { background: var(--border-light); }
.c-cur-ico { flex-shrink: 0; width: 18px; text-align: center; color: var(--text-muted); font-size: var(--text-sm); }
.c-cur-row.is-preview .c-cur-ico { color: var(--primary); }
.c-cur-title { flex: 1; min-width: 0; font-size: var(--text-md); color: var(--text-secondary); line-height: 1.4; }
.c-cur-row.is-preview .c-cur-title { color: var(--primary); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(55, 114, 163, .35); }
.c-cur-badge { flex-shrink: 0; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); background: var(--primary-light); padding: 2px 8px; border-radius: 999px; }
.c-cur-dur { flex-shrink: 0; font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.c-cur-sub { display: flex; align-items: baseline; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4); background: rgba(55, 114, 163, .06); border-top: 1px solid var(--border-light); font-size: var(--text-xs); font-weight: 700; letter-spacing: .02em; color: var(--primary); }
.c-cur-sub .n { color: var(--text-muted); font-weight: 600; }
.c-buybar { display: none; }
@media (max-width: 919px) {
  .c-buybar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--surface); border-top: 1px solid var(--border); padding: 10px 16px; box-shadow: 0 -2px 12px rgba(0, 0, 0, .08); }
  #c-locked { padding-bottom: 76px; }
}

/* ── Mobile lesson drawer (off-canvas playlist on the enrolled player) ─── */
.c-side-toggle, .c-side-close, .c-side-overlay { display: none; }
@media (max-width: 919px) {
  .c-side-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: var(--sp-4); padding: 9px 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    font-family: var(--font); font-size: var(--text-md); font-weight: 600; color: var(--text); cursor: pointer;
  }
  .c-side-toggle:hover { border-color: var(--text-muted); }

  .c-player--learn .c-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(330px, 86vw); max-height: 100vh; overflow-y: auto;
    transform: translateX(-100%); transition: transform var(--transition);
    z-index: 90; border-radius: 0; box-shadow: var(--shadow-lg);
  }
  .c-player--learn .c-sidebar.is-open { transform: translateX(0); }
  .c-player--learn .c-lessons { max-height: none; }

  .c-sidebar-head { position: relative; }
  .c-side-close {
    display: inline-flex; align-items: center; justify-content: center;
    position: absolute; top: 8px; right: 8px; width: 32px; height: 32px;
    border: none; background: var(--border-light); color: var(--text-secondary);
    border-radius: 50%; cursor: pointer; font-size: var(--text-md);
  }
  .c-side-overlay { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 85; }
}

/* ── Lessons / Materials toggle (segmented control) ───────────────────── */
.c-modes { display: inline-flex; background: var(--border-light); border: 1px solid var(--border); border-radius: 999px; padding: 4px; gap: 4px; }
.c-mode { border: none; background: none; font-family: var(--font); font-size: var(--text-md); font-weight: 600; color: var(--text-secondary); padding: 8px 18px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: background var(--transition-fast), color var(--transition-fast); }
.c-mode:hover { color: var(--text); }
.c-mode.is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.c-modebar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin: var(--sp-5) 0 var(--sp-4); }
.c-modebar h1 { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.01em; }
.c-modeview { display: none; }
.c-modeview.is-active { display: block; }

/* ── Materials ────────────────────────────────────────────────────────── */
.c-materials { padding-bottom: var(--sp-10); }
.c-mat-intro { color: var(--text-secondary); font-size: var(--text-md); line-height: 1.6; max-width: 62ch; margin-bottom: var(--sp-6); }
.c-mat-section-title { font-size: var(--text-lg); font-weight: 700; margin: var(--sp-6) 0 var(--sp-4); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--border); }
.c-mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--sp-4); }
.c-mat-card { display: flex; gap: var(--sp-4); align-items: flex-start; padding: var(--sp-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); text-decoration: none; color: inherit; transition: box-shadow var(--transition), transform var(--transition); }
.c-mat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--primary-light); }
.c-mat-ico { flex-shrink: 0; width: 42px; height: 42px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; background: var(--primary-light); color: var(--primary-dark); font-size: 17px; }
.c-mat-ico.is-app { background: var(--excel-light); color: var(--excel); }
/* Body is a column so the eyebrow / title / description each get their own line
   (they're <span>s, which would otherwise run together). */
.c-mat-body { min-width: 0; display: flex; flex-direction: column; }
.c-mat-kind { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-bottom: 5px; }
.c-mat-body .t { font-weight: 700; font-size: var(--text-lg); line-height: 1.3; margin-bottom: 5px; }
.c-mat-body .d { color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.5; }

/* Sign-in gate (materials need login, not enrollment) */
.c-gate { text-align: center; padding: var(--sp-10) var(--sp-6); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-lg); }
.c-gate i { font-size: 28px; color: var(--text-muted); }
.c-gate h3 { font-size: var(--text-xl); margin: var(--sp-3) 0 var(--sp-2); }
.c-gate p { color: var(--text-secondary); margin-bottom: var(--sp-4); max-width: 46ch; margin-left: auto; margin-right: auto; }

/* ── Certificate as a locked item under the playlist ──────────────────── */
.c-cert-row { display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left; padding: var(--sp-4); border: none; border-top: 2px solid var(--border); background: var(--surface); font-family: var(--font); color: var(--text); cursor: default; }
.c-cert-row .c-cert-ico { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--border-light); color: var(--text-muted); font-size: var(--text-md); }
.c-cert-row .c-cert-meta { flex: 1; min-width: 0; }
.c-cert-row .c-cert-meta .t { font-size: var(--text-md); font-weight: 700; }
.c-cert-row .c-cert-meta .d { font-size: var(--text-xs); color: var(--text-muted); }
.c-cert-row.is-ready { cursor: pointer; }
.c-cert-row.is-ready .c-cert-ico { background: var(--primary-light); color: var(--primary); }
.c-cert-row.is-ready:hover { background: var(--primary-light); }
.c-cert-row.is-issued { cursor: pointer; }
.c-cert-row.is-issued .c-cert-ico { background: var(--success); color: #fff; }
.c-cert-row.is-issued:hover { background: var(--success-light); }

/* ── "Rate this course" as a sidebar item under the certificate row ────── */
.c-fb-row { display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left; padding: var(--sp-4); border: none; border-top: 1px solid var(--border); background: var(--surface); font-family: var(--font); color: var(--text); cursor: pointer; transition: background var(--transition-fast); }
.c-fb-row:hover { background: var(--primary-light); }
/* Primary tint, not the grey one: grey is this component family's "locked"
   signal (see .c-cert-row's default state directly above), so an always-
   available action wearing it read as disabled. Matches .c-cert-row.is-ready,
   which already means "you can do this now". */
.c-fb-row .c-fb-ico { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--primary-light); color: var(--primary); font-size: var(--text-md); }
/* The certificate row has no chevron; this one does, because it opens something. */
.c-fb-row .c-fb-go { flex-shrink: 0; color: var(--text-muted); font-size: var(--text-sm); transition: color var(--transition-fast), transform var(--transition-fast); }
.c-fb-row:hover .c-fb-go { color: var(--primary); transform: translateX(2px); }
.c-fb-row .c-fb-meta { flex: 1; min-width: 0; }
.c-fb-row .c-fb-meta .t { display: block; font-size: var(--text-md); font-weight: 700; }
.c-fb-row .c-fb-meta .d { display: block; font-size: var(--text-xs); color: var(--text-muted); }
.c-fb-row.is-rated .c-fb-ico { background: #fef3c7; color: #d97706; }
.c-fb-row.is-rated .c-fb-meta .d { color: #d97706; letter-spacing: 1px; }

/* Quiet "start over" link at the very bottom of the sidebar */
.c-reset-link { display: block; width: 100%; background: var(--surface); border: none; border-top: 1px solid var(--border-light); padding: 10px var(--sp-4); font-family: var(--font); font-size: var(--text-xs); color: var(--text-muted); cursor: pointer; text-align: center; }
.c-reset-link:hover { color: #dc2626; text-decoration: underline; }

/* ── Feedback modal: star picker + consent ──────────────────────────────── */
.c-fb-stars { display: flex; gap: 4px; margin-bottom: var(--sp-4); }
.c-fb-star { background: none; border: none; padding: 2px 4px; font-size: 30px; line-height: 1; color: var(--border); cursor: pointer; transition: transform var(--transition-fast), color var(--transition-fast); }
.c-fb-star:hover { transform: scale(1.15); }
.c-fb-star.is-on, .c-fb-star.is-hover { color: #f59e0b; }
.c-fb-star:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-sm); }
.c-modal__panel textarea { width: 100%; min-height: 96px; resize: vertical; font-family: var(--font); font-size: var(--text-md); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text); margin-bottom: var(--sp-3); }
.c-modal__panel textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(55, 114, 163, .15); }
.c-fb-consent { display: flex; align-items: flex-start; gap: 9px; font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.45; cursor: pointer; margin-bottom: var(--sp-4); }
.c-fb-consent input { flex-shrink: 0; margin-top: 2px; width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

/* ── Generic modal (certificate claim) ────────────────────────────────── */
.c-modal { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.c-modal__overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.c-modal__panel { position: relative; width: 100%; max-width: 440px; background: var(--surface); border-radius: var(--radius-lg); padding: var(--sp-6); box-shadow: var(--shadow-lg); }
.c-modal__panel h3 { font-size: var(--text-xl); margin-bottom: var(--sp-2); }
.c-modal__panel p { color: var(--text-secondary); font-size: var(--text-md); margin-bottom: var(--sp-4); line-height: 1.55; }
.c-modal__panel input[type=text] { width: 100%; padding: 11px var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-md); font-family: var(--font); font-size: var(--text-md); margin-bottom: var(--sp-4); }
.c-modal__panel input[type=text]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(55, 114, 163, .15); }
.c-modal__actions { display: flex; gap: var(--sp-3); justify-content: flex-end; }

/* ── Storefront landing ───────────────────────────────────────────────── */
.store-hero { padding: var(--sp-10) 0 var(--sp-6); max-width: 760px; }
.store-hero h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-bottom: var(--sp-3); }
.store-hero p { color: var(--text-secondary); font-size: var(--text-lg); line-height: 1.6; }
.store-card .c-card-cover { font-size: 40px; }
.store-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-3); }
.store-price { font-size: var(--text-lg); font-weight: 700; color: var(--text); }
.store-tag { font-size: var(--text-xs); font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--warning-light); color: #92400e; }
.store-tag--soon { background: var(--primary-light); color: var(--primary-dark); }

/* ── Final polish: micro-interactions & entrances ────────────────────────
   All motion sits behind prefers-reduced-motion. Page-level reveals are
   opacity-only on purpose: a transform on an ancestor would turn the
   mobile drawer's position:fixed into a trap. */
@media (prefers-reduced-motion: no-preference) {
  /* Content reveals: player/landing on load, view + tab switches */
  #c-app:not([hidden]), #c-locked:not([hidden]),
  .c-modeview.is-active { animation: cFadeIn 240ms ease; }
  .c-tabpanel.is-active { animation: cRiseIn 200ms ease; }
  /* Modals get the same entrance as the shared confirm dialog */
  .c-modal__overlay { animation: cFadeIn 160ms ease; }
  .c-modal__panel { animation: cRiseIn 180ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  .c-upnext { animation: cFadeIn 200ms ease; }
  /* Tactile buttons: primary lifts on hover, everything presses down */
  .c-btn { transition: background var(--transition-fast), border-color var(--transition-fast), transform 120ms ease, box-shadow 120ms ease; }
  .c-btn--primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
  .c-btn:active:not(:disabled) { transform: scale(0.97); }
  /* Card covers zoom gently under the existing hover lift */
  .c-card-cover { transition: transform 300ms ease; }
  .c-card:hover .c-card-cover { transform: scale(1.03); }
}
@keyframes cFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cRiseIn { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }

/* Keyboard focus: one consistent ring across all interactive chrome */
.c-btn:focus-visible, .c-mode:focus-visible, .c-tab:focus-visible, .c-vote:focus-visible,
.c-reply-btn:focus-visible, .c-cur-sec-head:focus-visible, .c-cur-row:focus-visible,
.c-replies-toggle:focus-visible, .c-cert-row:focus-visible, .c-fb-row:focus-visible,
.c-reset-link:focus-visible, .c-side-toggle:focus-visible, .c-cur-expand:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.c-lesson-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Slim, quiet scrollbar for the lesson list (the Windows default is chunky) */
.c-lessons::-webkit-scrollbar { width: 8px; }
.c-lessons::-webkit-scrollbar-track { background: transparent; }
.c-lessons::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.c-lessons::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Brand-tinted text selection */
::selection { background: rgba(55, 114, 163, 0.18); }

/* A touch of depth under the video stage */
.c-video { box-shadow: var(--shadow-md); }

[hidden] { display: none !important; }
