/* ══════════════════════════════════════════════════════════════
<!-- # Course frontend: conventions (data-mining, part 1)

Short reference for anyone (or any AI run) editing the lesson pages. Source of truth for values is the code: `core.css` for design tokens, `terms.json` for Kazakh wording, `verify.js` for behaviour. This file only says where things are and which rules to keep.

Not reviewed when this was written: `course.css`, `fonts.css`, `components.js`, `progress.js`, `lesson-state.js` (not available). Check them before relying on the sections marked (*).

## 1. Files and layout

- One lesson = one self-contained `index.html` at `course/data-mining/part-N/lesson-M/` with its own `<style>` and `<script>` (no build step, no framework).
- Shared: `/assets/css/core.css` (theme, nav, buttons), `/course/course.css` (*), `/course/data-mining/progress.js` → `DMProgress`, `/course/data-mining/lesson-state.js` → `DMState` (*), `/assets/js/components.js` (*).
- Part landing page: `part-N/index.html`. A lesson shows "soon" until its number is in `LIVE`.

## 2. Design tokens (from `core.css`)

- Use CSS variables only, never hard-coded colours: `--bg --bg2 --bg3 --text --muted --accent --accent2 --accent-foreground --border --glow`, font `--font-display`.
- Dark theme is `[data-theme="dark"]` on the root and redefines the same variables. Text on an accent background must use `--accent-foreground`.
- Layout is mobile first: base styles for ~375px, `@media (min-width: 640px)` for wider (some lessons also use 480px). Wrap `prefers-reduced-motion` for any animation.
- Buttons: `btn-hero` (primary action), `btn-ghost` (secondary). Focus rings come from `core.css`; do not remove them.

## 3. Lesson page structure

```
main.course-main > div.lesson-wrap
  breadcrumb, h1.lesson-title, p.lesson-meta-line, details.outcomes
  div.chain (stage chain + #pbar progressbar + #stepNo)
  section.screen[lang=kk] × N      (h2[tabindex=-1] first, one screen visible at a time)
  nav.lesson-nav (#back, #next)
last screen holds #quiz
```

- Inside a screen: paragraphs, `p.course-note` for hints/examples, `button.term[data-g]` for glossary words, and `div.act[data-act="id"]` for each task.
- Tasks inside a screen can be chained with `.task-step` (the next one stays hidden until the previous is solved).
- Decorative SVG gets `aria-hidden="true"`. Screen-reader-only text uses the `.vh` class (never `left:-9999px` inline).

## 4. Interaction contract (what `verify.js` relies on)

- **Gating:** Next is disabled until every `[data-act]` on the screen is solved. A wrong answer sets `data-r="wrong"` and keeps the gate; a right one sets `data-r="right"`.
- **Focus:** after Next/Back, focus moves to the new screen's `<h2>`.
- **Task types:** `choice`, `multi`, `order`, `sort`, `match`, `plan` / `form` (textareas). Every `[data-act]` box exposes `box._replay(value)`, which runs the normal handler path (used for restore and tests). Forms that stay editable also expose `box._current()`.
- **Feedback:** every `.fb` node has `aria-live="polite"`.
- **Plans/forms:** only "not empty" is checked (completion is not a quality verdict). Unsent text is saved as `acts['<id>_draft']` through `box._onDraft` and refilled by `box._restoreDraft` (no auto-submit).
- **Local state:** `DMState` saves `{ idx, n, acts }` under `dm:part-N:lesson-M:v1`. Storage is untrusted: unknown ids are ignored and the saved screen is clamped to what is unlocked. The server stays the source of truth for completion.
- **Glossary:** `.term` toggles `aria-expanded`; the pop-up `.term-pop` has `role="status"`. Each term has one definition sentence, identical in every lesson (see `terms.json` → `decisions`).
- **Tables:** every `<table>` has a `<caption>` (use `class="vh"` if it must be invisible) and every `<th>` has `scope`.

## 5. Quiz and progress saving

- 7 questions per lesson, 12 in the last lesson of a part. Pass mark 70% (5 of 7, 9 of 12). Retake always allowed.
- On pass call `DMProgress.save(N)`. Messages (same text in every lesson):
  - saved → «Үлгерім сақталды.»
  - logged out (`DMProgress.get()` returns `loggedIn === false`) → "not saved" + login link «Жүйеге кіру»
  - any other failure → «Үлгерімді сақтау мүмкін болмады…» with **no** login link and a retake button
- The "back to part" link appears only after the save has settled.

## 6. Text rules

- Learner text is Kazakh. Look every term up in `terms.json` before writing; do not invent a second form. Check its `banned` list. Terms in `keep_english` stay English. Add new terms in the same change as the lesson.
- Stage names: first use on a page «деректерді өндіру (Data Mining)», later Kazakh only; labels and table headers are Kazakh only, with at least one place per screen showing the English in brackets.

## 7. Testing

- Run `node verify.js --public <site-root> --json out.json` before and after every change and diff the two JSON files. It needs Playwright with Chromium and the site laid out like production (`/course/data-mining/part-N/lesson-M/index.html`, `/assets/...`).
- Pages include a localhost-only DEV toolbar (`?unlock=1`, `?screen=7`, `?mock=ok|fail|error`). It can cover the Next button in tests; hide it with `[aria-label="DEV"]{display:none}` in the test site's `course.css`.
- Layout changes: also compare element positions and sizes before and after. Quizzes in lessons 5 and 6 shuffle answers, so seed the shuffle the same way for pixel comparisons.

## 8. Change rules

- One change per step; no learner-facing text changed unless the step says so.
- Do not extract shared CSS/JS (e.g. a common `lesson.js`) without a full `verify.js` run on all lessons, because one bug would then hit every lesson.
 ══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   course/course.css
   Shared by /course/ (future catalogue) and every course page,
   e.g. /course/data-mining/. Same conventions as
   galym_robots/robots_hub.css: ONE centred column, mobile-first,
   tokens and fonts from core.css / fonts.css only.
   No literal font names, no new colours.
   ══════════════════════════════════════════════════════════════ */

.course-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(var(--nav-h, 80px) + 1.5rem) 5vw 4rem;
}
@media (min-width: 768px) {
  .course-main { padding: calc(var(--nav-h, 80px) + 2rem) 8vw 5rem; }
}

.course-main section { margin-top: 3rem; scroll-margin-top: 6rem; }
.course-main .sec-title { font-size: clamp(22px, 4vw, 32px); color: var(--accent2); margin-bottom: 0.75rem; }
.course-lead { font-size: 14.5px; color: var(--muted); line-height: 1.7; max-width: 46rem; margin-bottom: 1.5rem; }
.course-main p, .course-main li { overflow-wrap: break-word; }

/* ── Hero ── */
.course-hero { margin-top: 0 !important; }
.course-hero .breadcrumb { margin-bottom: 1.5rem; }
.course-badge {
  display: inline-block;
  font-size: 12px; font-weight: 600;
  color: var(--accent2); background: var(--glow);
  border: 0.5px solid var(--border);
  padding: 0.35rem 0.9rem; border-radius: 100px;
  margin-bottom: 1rem;
}
.course-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 7vw, 56px);
  font-weight: 800; line-height: 1.08; letter-spacing: -1.5px;
  color: var(--text); max-width: 18ch; margin-bottom: 0.9rem;
}
.course-subtitle { font-size: clamp(15px, 2.2vw, 18px); font-weight: 600; color: var(--accent2); line-height: 1.5; text-wrap: wrap; margin-bottom: 1.25rem; }
.course-hero-text { font-size: 14.5px; color: var(--muted); line-height: 1.75; text-wrap: wrap; margin-bottom: 0.9rem; }
.course-hero-text--main { font-size: 16px; color: var(--text); }

.course-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 2rem; }
.course-start-btn { min-width: 14.5em; justify-content: center; text-align: center; }

.btn-ghost {
  display: inline-flex; align-items: center;
  font-weight: 700; font-size: 13.5px;
  padding: 0.8rem 1.5rem; border-radius: 4px;
  color: var(--accent2); text-decoration: none;
  border: 1px solid var(--accent); background: transparent;
  transition: background 0.2s, transform 0.2s;
}
.btn-ghost:hover, .btn-ghost:focus-visible { background: var(--glow); transform: translateY(-2px); }
@media (min-width: 768px) {
  .btn-ghost { font-size: 14.5px; padding: 0.95rem 1.9rem; }
}

/* ── Facts ── */
.course-facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--border);
  border: 0.5px solid var(--border); border-radius: 8px; overflow: hidden;
}
.course-fact { background: var(--bg2); padding: 0.9rem 1rem; }
.course-fact dt { font-size: 12px; color: var(--muted); margin-bottom: 0.2rem; }
.course-fact dd { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4; }
@media (min-width: 768px) {
  .course-facts { grid-template-columns: repeat(4, 1fr); }
}

/* ── Check lists ── */
.course-checks { list-style: none; display: grid; gap: 0.7rem; }
.course-checks li { position: relative; padding-left: 1.7rem; font-size: 14.5px; line-height: 1.6; }
.course-checks li::before {
  content: ""; position: absolute; left: 0; top: 0.35em;
  width: 0.95rem; height: 0.5rem;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg) scale(0.85);
}
@media (min-width: 768px) {
  .course-checks--2col { grid-template-columns: 1fr 1fr; column-gap: 2.5rem; }
}

/* ── Program (a real sequence, so numbered) ── */
.course-modules { list-style: none; display: grid; gap: 0.9rem; counter-reset: mod; }
.course-module {
  counter-increment: mod; position: relative;
  background: var(--bg2); border: 0.5px solid var(--border); border-radius: 8px;
  padding: 1.1rem 1.1rem 1.1rem 3.6rem;
}
.course-module::before {
  content: counter(mod);
  position: absolute; left: 1.1rem; top: 1.05rem;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 13px; font-weight: 800;
  background: var(--accent); color: var(--accent-foreground);
}
.course-module h3 { font-family: var(--font-display); font-size: 15.5px; font-weight: 800; letter-spacing: -0.2px; line-height: 1.35; color: var(--text); margin-bottom: 0.4rem; }
.course-module p { font-size: 13.5px; color: var(--muted); line-height: 1.65; }
.course-module--final { border-color: var(--accent); background: var(--glow); }
.course-module-link { margin-top: 0.9rem; padding: 0.55rem 1.1rem; font-size: 13px; }
@media (min-width: 768px) {
  .course-modules { grid-template-columns: 1fr 1fr; gap: 1.1rem; }
  .course-module--final { grid-column: 1 / -1; }
}

/* ── Two-column text + list blocks ── */
.course-split { display: grid; gap: 1.5rem; }
@media (min-width: 768px) {
  .course-split { grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
}
.course-note { font-size: 13.5px; color: var(--muted); line-height: 1.7; border-left: 2px solid var(--accent); padding-left: 1rem; margin-top: 1.25rem; max-width: 46rem; }

/* ── Chips (tools) ── */
.course-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.course-chips li { font-size: 13px; font-weight: 600; padding: 0.45rem 0.9rem; border-radius: 4px; background: var(--bg2); border: 0.5px solid var(--border); color: var(--text); }

/* ── Career tiers ── */
.course-tiers { list-style: none; display: grid; gap: 0.75rem; margin-top: 1.25rem; }
.course-tier { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.9rem 1.1rem; border: 0.5px solid var(--border); border-radius: 8px; background: var(--bg2); }
.course-tier span { font-size: 12px; color: var(--muted); }
.course-tier strong { font-family: var(--font-display); font-size: 16px; font-weight: 800; color: var(--text); }
.course-tier--primary { border-color: var(--accent); background: var(--glow); }
.course-tier--primary strong { color: var(--accent2); }
@media (min-width: 768px) {
  .course-tiers { grid-template-columns: 1.3fr 1fr 1fr; }
}

/* ── Price band ── */
.course-price { background: var(--bg2); border: 0.5px solid var(--border); border-radius: 8px; padding: clamp(1.5rem, 4.5vw, 2.25rem); }
.course-price .sec-title { margin-bottom: 0.5rem; }
.course-price p { font-size: 14px; color: var(--muted); line-height: 1.7; max-width: 40rem; }

/* ── FAQ (native <details>) ── */
.course-faq { border-top: 0.5px solid var(--border); }
.course-faq details { border-bottom: 0.5px solid var(--border); }
.course-faq summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem 0;
  font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text);
}
.course-faq summary::-webkit-details-marker { display: none; }
.course-faq summary::after { content: "+"; font-size: 20px; font-weight: 400; color: var(--accent); flex-shrink: 0; transition: transform 0.2s; }
.course-faq details[open] summary::after { transform: rotate(45deg); }
.course-faq details p { font-size: 14px; color: var(--muted); line-height: 1.7; padding: 0 2rem 1.1rem 0; max-width: 46rem; }

/* ── FAQ: diploma figure + references ── */
.course-diploma { margin: 0.25rem 0 1.25rem; max-width: 420px; }
.course-diploma a {
  display: block; overflow: hidden;
  border: 0.5px solid var(--border); border-radius: 8px;
  background: #fff;
}
.course-diploma img { display: block; width: 100%; height: auto; }
.course-diploma figcaption { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 0.5rem; }
.course-faq details p + p { margin-top: -0.4rem; }
.course-faq details strong { color: var(--text); font-weight: 600; }
.course-refs { font-size: 14px; color: var(--muted); line-height: 1.7; padding: 0 0 1.1rem 1.3rem; max-width: 46rem; }
.course-refs li { margin-bottom: 0.6rem; padding-left: 0.2rem; overflow-wrap: anywhere; }
.course-refs a { color: var(--accent2); }

/* ── Final CTA ── */
.course-cta { background: var(--bg2); border: 0.5px solid var(--border); border-radius: 8px; padding: clamp(1.75rem, 5vw, 3rem); text-align: center; }
.course-cta h2 { font-family: var(--font-display); font-size: clamp(20px, 3.4vw, 28px); font-weight: 800; letter-spacing: -0.5px; color: var(--accent2); margin-bottom: 0.6rem; }
.course-cta p { font-size: 14px; color: var(--muted); line-height: 1.7; max-width: 32rem; margin: 0 auto 1.4rem; }

@media (prefers-reduced-motion: reduce) {
  .btn-ghost, .course-faq summary::after { transition: none; }
  .btn-ghost:hover { transform: none; }
}
/* ── Lesson figure: row of small illustrated cards (3 or 4 stages) ── */
.flow-fig { margin: 1.25rem 0; }
.flow { list-style: none; display: grid; gap: 0.75rem; grid-template-columns: 1fr 1fr; }
.flow--3 { grid-template-columns: 1fr; }
.flow li { position: relative; display: flex; flex-direction: column; gap: 0.4rem; padding: 0.8rem; background: var(--bg2); border: 0.5px solid var(--border); border-radius: 8px; }
.flow svg { display: block; width: 100%; height: auto; }
.flow h3 { font-family: var(--font-display); font-size: 15px; font-weight: 800; letter-spacing: -0.2px; color: var(--text); }
.flow .fl-sub { font-size: 13px; line-height: 1.5; color: var(--muted); margin: 0; }
.flow .fl-ex { font-size: 12.5px; line-height: 1.45; color: var(--accent2); background: var(--glow); border-radius: 4px; padding: 0.4rem 0.55rem; margin: auto 0 0; }
.flow-fig figcaption { font-size: 12.5px; line-height: 1.55; color: var(--muted); margin-top: 0.6rem; }
.flow .fs, .flow .fl, .flow .fa, .flow .ffa, .flow .ffm { stroke-linecap: round; stroke-linejoin: round; }
.flow .fs { fill: none; stroke: var(--muted); stroke-width: 1.2; }
.flow .fl { fill: none; stroke: var(--accent); stroke-width: 1.2; }
.flow .fa { fill: none; stroke: var(--accent); stroke-width: 2; }
.flow .fd { stroke-dasharray: 4 4; }
.flow .ffa { fill: var(--glow); stroke: var(--accent); stroke-width: 1.2; }
.flow .ffm { fill: var(--bg); stroke: var(--muted); stroke-width: 1.2; }
.flow .ft { font-family: inherit; font-size: 11px; font-weight: 600; fill: var(--text); }
.flow .fq { font-size: 16px; fill: var(--accent); }
@media (min-width: 640px) {
  .flow { grid-template-columns: repeat(4, 1fr); gap: 1.4rem; }
  .flow--3 { grid-template-columns: repeat(3, 1fr); }
  .flow li:not(:last-child)::after { content: "→"; position: absolute; top: 3rem; right: -1.4rem; width: 1.4rem; text-align: center; font-weight: 700; color: var(--accent); }
}

/* ── Flow figure: 5-card variant + "set" variant (no arrows between cards) ── */
@media (max-width: 639px) {
  .flow--5 li:last-child { grid-column: 1 / -1; }
  .flow--5 li:last-child svg { max-width: 50%; margin-inline: auto; }
}
@media (min-width: 640px) {
  .flow--5 { grid-template-columns: repeat(5, 1fr); gap: 1.2rem; }
  .flow--5 li:not(:last-child)::after { right: -1.2rem; width: 1.2rem; }
  .flow--5 h3 { font-size: 14px; }
  .flow--5 .fl-sub, .flow--5 .fl-ex { font-size: 12px; }
  .flow.flow--set li:not(:last-child)::after { content: none; }
}

/* ── Language switch (course landing, part landings, lessons) ──
   Markup: <div class="crumb-row"> breadcrumb + <nav class="lang-switch"> </div>
   Current language is a <span aria-current="true">, the other one a link to the same page. */
.crumb-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; }
.course-hero .crumb-row { margin-bottom: 1.5rem; }
.course-hero .crumb-row .breadcrumb { margin-bottom: 0; }
.lesson-wrap .crumb-row { align-items: flex-start; } /* lessons keep the breadcrumb's own bottom margin */
.lang-switch { display: inline-flex; flex: none; border: 0.5px solid var(--border); border-radius: 100px; background: var(--bg2); overflow: hidden; font-size: 12.5px; font-weight: 600; }
.lang-switch a, .lang-switch span { display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 0.9rem; color: var(--muted); text-decoration: none; }
.lang-switch a:hover { color: var(--text); }
.lang-switch a:focus-visible { outline-offset: -3px; }
.lang-switch [aria-current] { background: var(--accent); color: var(--accent-foreground); }



.lesson-wrap { max-width: 56rem !important; }
.lesson-wrap .screen { padding-inline: 1.5rem; }
html[lang="en"] .screen p:not([class]) { font-size: 16px; line-height: 1.65; }

/* ── Course progress (landing page, top of hero) ── */
.course-progress { margin-bottom: 1.25rem; background: var(--bg2); border: 0.5px solid var(--border); border-radius: 8px; padding: 0.8rem 1rem; }
.course-progress[hidden] { display: none; }
.course-progress-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.2rem 1rem; margin-bottom: 0.55rem; }
.course-progress-text { font-family: var(--font-display); font-size: 15px; font-weight: 800; color: var(--text); }
.course-progress-hint { font-size: 13.5px; color: var(--muted); }
.course-progress-track { height: 6px; border-radius: 100px; background: var(--border); overflow: hidden; }
.course-progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 100px; transition: width 0.4s ease; }
@media (prefers-reduced-motion: reduce) { .course-progress-fill { transition: none; } }

/* ── Part landing pages: progress card at the top of the hero ──
   Scoped to .part-progress because .progress-card/.progress-rows are also reused for the dataset/Colab cards. */
.part-progress { margin-bottom: 1.25rem; }
.part-progress .progress-card { padding: 0.8rem 1rem; }
.part-progress .progress-count { font-size: 15px; margin-bottom: 0.55rem; }
.part-progress .progress-track { height: 6px; }
.part-progress .progress-rows { display: flex; flex-wrap: wrap; gap: 0.2rem 1.5rem; margin-top: 0.65rem; background: none; border: 0; border-radius: 0; overflow: visible; }
.part-progress .progress-row { justify-content: flex-start; gap: 0.35rem; background: none; padding: 0; font-size: 13px; }
.part-progress .progress-row dt::after { content: ":"; }
.part-progress .progress-row dd { text-align: left; }
.part-progress .progress-resume { margin-top: 0.55rem; font-size: 13.5px; }