/* Course pages.
 *
 * Layered over assets/style.css and guides/guides.css. The harvested markup
 * keeps the original course class names — callout, trap, examdef, story and so
 * on — because those distinctions are pedagogically meaningful. They are
 * restyled here into the site's palette rather than stripped, so the pages read
 * as part of exaamnxt instead of an embedded foreign document.
 */

.course .lesson {
  padding-top: 26px;
  margin-top: 34px;
  border-top: 2px solid var(--border-color);
}

.course .lesson:first-of-type { border-top: none; }

.lesson-num {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 4px;
}

.course .lesson h2 {
  border-top: none;
  padding-top: 0;
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.lesson-question {
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 22px;
}

.lesson-part {
  margin-bottom: 22px;
}

.part-name {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 6px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.part-body { font-size: 0.95rem; }
.part-body p { margin-bottom: 12px; line-height: 1.7; }
.part-body h3 { font-size: 1rem; margin: 18px 0 6px; }
.part-body ul, .part-body ol { padding-left: 22px; margin-bottom: 14px; }
.part-body li { margin-bottom: 6px; line-height: 1.65; color: var(--text-secondary); }
.part-body b, .part-body strong { color: var(--text-primary); font-weight: 600; }
.part-body a { color: var(--primary); }

/* --- Course-native blocks, restyled --- */
.part-body .callout,
.part-body .note,
.part-body .story,
.part-body .examdef,
.part-body .trap {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 14px 0;
  border-left: 3px solid var(--primary);
  background: rgba(79, 70, 229, 0.04);
}

.part-body .note { border-left-color: #0891b2; background: rgba(8, 145, 178, 0.05); }
.part-body .story { border-left-color: #7c3aed; background: rgba(124, 58, 237, 0.05); }
.part-body .examdef { border-left-color: var(--success); background: var(--success-bg); }
.part-body .trap { border-left-color: var(--error); background: var(--error-bg); }

.part-body .callout p:last-child,
.part-body .note p:last-child,
.part-body .story p:last-child,
.part-body .examdef p:last-child,
.part-body .trap p:last-child { margin-bottom: 0; }

.part-body .split,
.part-body .field-grid,
.part-body .chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.part-body .chip-grid > * {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.88rem;
}

.part-body .steps { counter-reset: step; }
.part-body .relation { font-size: 0.92rem; color: var(--text-secondary); }

.part-body .tech-section { margin: 16px 0; }
.part-body .tech-head {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.part-body .tech-jump { font-size: 0.82rem; color: var(--text-muted); }

.part-body details {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 10px 0;
  background: var(--bg-card);
}
.part-body summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* --- Table of contents --- */
.course-toc ol {
  counter-reset: toc;
  list-style: none;
  padding: 0;
}

.course-toc li {
  counter-increment: toc;
  position: relative;
  padding: 9px 0 9px 38px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.93rem;
}

.course-toc li::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--primary);
}

.course-toc li.locked { color: var(--text-muted); }
.course-toc li.locked::before { color: var(--text-muted); }
.course-toc a { color: var(--text-primary); text-decoration: none; }
.course-toc a:hover { color: var(--primary); text-decoration: underline; }

/* Marks where the free lessons end. Replaces a "Study Pass" pill that used to
   repeat on every locked row. */
.course-toc .toc-divider {
  counter-increment: none;
  padding: 14px 0 12px;
  margin-top: 6px;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.course-toc .toc-divider::before { content: none; }

.course-toc .lock {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: var(--primary-glow);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}

/* --- Gate --- */
.course-gate {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-top: 40px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

.course-gate h2 { border-top: none; padding-top: 0; margin-top: 0; }
.gate-msg { font-size: 0.88rem; color: var(--text-muted); }

#gated-lessons { text-align: left; }
#gated-lessons .lesson:first-of-type { border-top: 2px solid var(--border-color); }

@media (max-width: 600px) {
  .course .lesson h2 { font-size: 1.3rem; }
  .course-gate { padding: 20px; }
}

/* A subject listed but not yet published. Deliberately not a link and visibly
   inert, so it reads as a roadmap entry rather than something broken. */
.guide-card.is-upcoming {
  cursor: default;
  opacity: 0.72;
  border-style: dashed;
  box-shadow: none;
}

.guide-card.is-upcoming:hover {
  transform: none;
  border-color: var(--border-color);
  box-shadow: none;
}

.guide-card.is-upcoming .guide-card-title { color: var(--text-secondary); }

.guide-card.is-upcoming .guide-card-meta {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--primary);
}
