/* Module courses (how-to/build-claude/*.html): course sidebar, one-lesson-at-a-time player, lesson heads and ends,
   progress, search, bookmarks, maths, the optional Python runner and the course overview page.
   Loaded after howto.css (which still styles code, callouts, quizzes, diagrams and demos). Tokens only, no fixed colours. */

/* ---------- Lesson player: one lesson visible at a time once course.js runs ---------- */
html.cl-ready .cl .cl-lesson:not(.cl-current) { display: none; }
html.cl-ready .cl-module-pager { display: none; }
html:not(.js) .cl-js-only { display: none !important; }
.cl-lesson { scroll-margin-top: 76px; }
.cl .hx-article { max-width: 820px; }
.cl-head { padding-top: 22px; }
.cl-head h1 { font-size: clamp(1.45rem, 2.8vw, 2rem); }
.cl-head .hx-sub { font-size: 1rem; }
/* Without JS every lesson is shown: separate them clearly. */
html:not(.cl-ready) .cl-lesson + .cl-lesson { border-top: 2px solid var(--border); margin-top: 2.5em; padding-top: 1em; }

/* ---------- Lesson head ---------- */
.cl-lesson-head { margin: 4px 0 18px; padding: 18px 20px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); box-shadow: var(--shadow); }
.cl-lesson-eyebrow { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 4px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.cl-lesson-eyebrow span:last-child { color: var(--muted); font-weight: 600; }
.hx-article .cl-lesson-head h2 { margin: 0 0 10px !important; padding: 0; font-size: clamp(1.3rem, 2.6vw, 1.7rem); }
.cl-lesson-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; list-style: none; margin: 0 !important; padding: 0 !important; font-size: .85rem; color: var(--muted); }
.hx-article .cl-lesson-meta li { margin: 0; color: var(--muted); }
.cl-lesson-meta b { color: var(--text); }
.cl-lesson-meta .cl-js-only { margin-left: auto !important; }
.cl-lvl { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem !important; font-weight: 700; padding: .15em .6em; border-radius: 99px; border: 1px solid var(--c, var(--border)); color: var(--c, var(--muted)) !important; background: var(--cs, var(--surface-2)); white-space: nowrap; }
.cl-lvl::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.lvl-beginner { --c: var(--ok); --cs: var(--ok-soft); }
.lvl-intermediate { --c: var(--t2); --cs: var(--t2-soft); }
.lvl-advanced { --c: var(--t4); --cs: var(--t4-soft); }
.cl-bm[aria-pressed="true"] { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }

/* ---------- Learning objectives ---------- */
.cl-objectives { margin: 0 0 1.4em; padding: 14px 18px; border: 1px solid var(--border); border-left: 4px solid var(--ok); border-radius: 10px; background: var(--surface); }
.hx-article .cl-objectives h3 { margin: 0 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ok); }
.cl-objectives ul { margin: 0; padding-left: 1.2em; }

/* ---------- Content helpers used inside lessons ---------- */
.cl-eq { margin: 1em 0 1.2em; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow-x: auto; text-align: center; }
.cl-eq math { font-size: 1.18em; }
.cl-eq math[display="block"] { margin: 0 auto; }
.cl-eq .cl-eq-read { margin: 10px 0 0; font-size: .86rem; color: var(--muted); text-align: left; }
.hx-article p math, .hx-article li math, .hx-article td math { font-size: 1.05em; }
.cl-deep { border-color: var(--t3) !important; }
.cl-deep > summary { color: var(--t3) !important; }
.cl-deep > summary::before { content: "Deeper · "; font-weight: 800; }
.cl-deep > :not(summary) { margin-left: 14px; margin-right: 14px; }
.hx-more > :not(summary) { margin-left: 14px; margin-right: 14px; }
.hx-more > figure.code, .hx-more > .cl-eq { margin-left: 14px; margin-right: 14px; }
.cl-badge { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; padding: .12em .55em; border-radius: 99px; border: 1px solid var(--c); color: var(--c); background: var(--cs); vertical-align: middle; white-space: nowrap; }
.cl-badge.public { --c: var(--ok); --cs: var(--ok-soft); }
.cl-badge.industry { --c: var(--t2); --cs: var(--t2-soft); }
.cl-badge.unknown { --c: var(--err); --cs: var(--err-soft); }
.cl-badge.simplified { --c: var(--t5); --cs: var(--t5-soft); }
.cl-badge.optional { --c: var(--muted); --cs: var(--surface-2); }
.cl-project { margin: 1.6em 0; padding: 16px 18px; border: 2px solid var(--t4); border-radius: var(--radius); background: linear-gradient(135deg, var(--t4-soft), var(--surface) 75%); }
.hx-article .cl-project > h3:first-child { margin-top: 0; color: var(--t4); }
.cl-project .cl-project-steps { counter-reset: s; list-style: none; padding: 0; }
.cl-project .cl-project-steps > li { counter-increment: s; position: relative; padding-left: 34px; }
.cl-project .cl-project-steps > li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--t4); color: var(--on-accent); font-size: .78rem; font-weight: 700; }
.cl-figure { margin: 1.2em 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
.cl-figure svg { display: block; width: 100%; height: auto; max-width: 100%; }
.cl-figure > figcaption { margin-top: 8px; font-size: .86rem; color: var(--muted); }
.cl-check-title { display: flex; align-items: center; gap: 8px; }
.hx-exercise details.hx-more { background: var(--surface); }

/* ---------- End of a lesson ---------- */
.cl-lesson-end { margin-top: 2.2em; padding-top: 1.2em; border-top: 1px solid var(--border); }
.cl-done-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 14px; }
.cl-done-note { font-size: .82rem; color: var(--muted); }
.cl-done[aria-pressed="true"] { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); font-weight: 700; }
.cl-pager { margin-top: 0; }

/* ---------- Sidebar: course contents ---------- */
.cl-side .hx-side-body { padding-right: 4px; }
.cl-side-home { display: inline-block; margin: 0 0 10px; font-size: .84rem; font-weight: 600; }
.cl-progress { margin: 0 0 12px; font-size: .8rem; color: var(--muted); }
.cl-progress i { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 5px; }
.cl-progress i span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), var(--accent)); transition: width .3s; }
.cl-progress-big { max-width: 420px; margin-top: 16px; font-size: .9rem; }
.cl-progress-big i { height: 9px; }
.cl-search { position: relative; margin: 0 0 12px; }
.cl-search input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text); font: 14px var(--sans); }
.cl-search input:focus { outline: 2px solid var(--ring, var(--accent)); outline-offset: 1px; border-color: var(--accent); }
.cl-results { list-style: none; margin: 6px 0 0; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); max-height: 420px; overflow: auto; }
.cl-results li { margin: 0 !important; }
.cl-results a { display: block; padding: 7px 9px; border-radius: 7px; color: var(--text); font-size: .86rem; line-height: 1.35; }
.cl-results a:hover, .cl-results a:focus { background: var(--accent-soft); text-decoration: none; }
.cl-results a small { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; }
.cl-results a mark { background: var(--warn-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.cl-results .cl-noresult { padding: 8px 10px; color: var(--muted); font-size: .85rem; }
.cl-modules { list-style: none; margin: 0 0 14px; padding: 0; }
.cl-modules > li { margin: 0 0 2px; }
.cl-modules summary, .cl-modcard summary { list-style: none; cursor: pointer; }
.cl-modules summary::-webkit-details-marker, .cl-modcard summary::-webkit-details-marker { display: none; }
.cl-modules summary { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 6px; border-radius: 8px; font-size: .86rem; font-weight: 600; line-height: 1.3; }
.cl-modules summary:hover { background: var(--surface-2); }
.cl-mod-n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); font-size: .72rem; font-weight: 800; color: var(--muted); }
.cl-mod.current .cl-mod-n { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cl-mod.complete .cl-mod-n, .cl-modcard.complete .cl-mod-n { background: var(--ok); border-color: var(--ok); color: var(--on-accent); }
.cl-mod-c { font-size: .72rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.cl-lessons { list-style: none; margin: 2px 0 8px; padding: 0 0 0 14px; border-left: 2px solid var(--border); margin-left: 17px; }
.cl-lessons li { margin: 0 !important; }
.cl-lessons a { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 6px; align-items: baseline; padding: 4px 6px; border-radius: 7px; color: var(--text); font-size: .83rem; line-height: 1.35; }
.cl-lessons a:hover { background: var(--surface-2); text-decoration: none; }
.cl-l-n { font: 600 .72rem var(--mono); color: var(--muted); }
.cl-lessons a.current { background: var(--accent-soft); font-weight: 600; }
.cl-lessons a.current .cl-l-n { color: var(--accent); }
.cl-lessons a.done .cl-l-n { color: var(--ok); }
.cl-lessons a.done .cl-l-n::before { content: "✓ "; }
.cl-lessons a.done .cl-l-t { color: var(--muted); }
.cl-lessons a.bm::after { content: "★"; color: var(--warn); font-size: .8rem; }
.cl-side-bm ol { list-style: none; margin: 0; padding: 0; }
.cl-side-bm a { display: block; padding: 4px 8px; border-radius: 7px; font-size: .83rem; color: var(--text); }
.cl-side-bm a:hover { background: var(--surface-2); text-decoration: none; }

/* ---------- Optional Python runner (Pyodide) ---------- */
.code-head .cl-run-btn { color: var(--ok); border-color: var(--ok); font-weight: 700; }
.cl-run { border-top: 1px solid var(--border); background: var(--surface); padding: 8px 12px 10px; }
.cl-run-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); }
.cl-run-status .spacer { flex: 1; }
.cl-run pre { margin: 8px 0 0; padding: 10px 12px; max-height: 320px; overflow: auto; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); font: 12.5px/1.55 var(--mono); white-space: pre-wrap; color: var(--text); }
.cl-run pre .err { color: var(--err); }
.cl-run textarea { width: 100%; min-height: 220px; margin-top: 8px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 12.5px/1.55 var(--mono); tab-size: 4; resize: vertical; }
.cl-run-note { font-size: .78rem; color: var(--muted); margin: 6px 0 0; }

/* ---------- Course overview page ---------- */
.cl-overview { padding-bottom: 20px; }
.cl-hero { padding: 26px 0 8px; }
.cl-hero-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 32px; align-items: center; }
.cl-hero h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); letter-spacing: -.025em; margin: 4px 0 10px; }
.cl-hero .hx-sub { font-size: 1.12rem; }
.cl-hero-art svg { width: 100%; height: auto; display: block; }
.cl-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; list-style: none; padding: 0; margin: 20px 0 18px; }
.cl-stats li { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.cl-stats b { display: block; font-size: 1.25rem; letter-spacing: -.01em; }
.cl-stats span { font-size: .78rem; color: var(--muted); }
.cl-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.cl-resume-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0; padding: 14px 18px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); }
.cl-resume-box .hx-side-title { margin: 0 0 2px; }
.cl-resume-title { margin: 0; font-weight: 700; }
.cl-modlist { margin-top: 26px; }
.cl-modlist-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; margin-bottom: 12px; }
.cl-modlist-head h2 { margin: 0; }
.cl-search-wide { flex: 0 1 440px; margin: 0; }
.cl-search-wide .cl-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; }
.cl-modcards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.cl-modcard > details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.cl-modcard > details[open] { border-color: var(--accent); }
.cl-modcard summary { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; align-items: start; padding: 14px 16px; }
.cl-modcard .cl-mod-n { width: 40px; height: 40px; border-radius: 11px; font-size: 1rem; }
.cl-modcard-text { display: grid; gap: 4px; min-width: 0; }
.cl-modcard-text b { font-size: 1.04rem; }
.cl-modcard-text small { color: var(--muted); font-size: .88rem; line-height: 1.45; }
.cl-modcard-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .78rem; color: var(--muted); }
.cl-modbar { display: block; height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.cl-modbar span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .3s; }
.cl-modcard .cl-lessons { margin: 0 16px 10px 70px; }
.cl-modcard .cl-lessons a { grid-template-columns: 34px minmax(0, 1fr) auto; font-size: .9rem; padding: 6px 8px; }
.cl-l-meta { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.cl-modcard-open { margin: 0 16px 14px 70px; }
.cl-bookmarks, .cl-outcomes, .cl-honest, .cl-howitworks, .cl-capstone { margin-top: 34px; }
.cl-bookmarks ol { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.cl-bookmarks a { display: inline-block; padding: 6px 12px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); font-size: .88rem; color: var(--text); }
.cl-outcome-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.cl-outcome-grid li { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: grid; gap: 4px; }
.cl-outcome-grid b::before { content: "✓ "; color: var(--ok); }
.cl-outcome-grid span { font-size: .9rem; color: var(--muted); line-height: 1.5; }
.cl-honest-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cl-honest-grid .hx-callout { margin: 0; font-size: .93rem; line-height: 1.6; }
.cl-how-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cl-how-grid > div { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: .94rem; line-height: 1.6; }
.cl-how-grid h3 { margin: 0 0 6px; font-size: 1rem; }
.cl-how-grid p { margin: 0; }
.cl-capstone { padding: 18px 20px; border: 2px solid var(--t4); border-radius: var(--radius-lg, 16px); background: linear-gradient(135deg, var(--t4-soft), var(--surface) 70%); }
.cl-capstone h2 { margin-top: 0; }

@media (max-width: 960px) {
  .cl-hero-grid { grid-template-columns: minmax(0, 1fr); }
  .cl-hero-art { display: none; }
  .cl-honest-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .cl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cl-how-grid { grid-template-columns: minmax(0, 1fr); }
  .cl-modcard .cl-lessons, .cl-modcard-open { margin-left: 16px; }
  .cl-lessons a .cl-l-meta { display: none; }
  .cl-lesson-head { padding: 14px 14px 12px; }
  .cl-lesson-meta .cl-js-only { margin-left: 0 !important; }
  .cl-eq { padding: 10px; }
}
@media print {
  html.cl-ready .cl .cl-lesson:not(.cl-current) { display: block; }
  .cl-js-only, .cl-run { display: none !important; }
}
