/* ==========================================================================
   Online training module — layered on style.css (and test.css for .km)
   ========================================================================== */

:root {
  --step-done: #1f7a4d;
}

.km {
  font-family: 'Noto Sans Khmer', 'Khmer OS', 'Inter', sans-serif;
  line-height: 1.9;
}

/* --- Module header -------------------------------------------------------- */

.module-intro .eyebrow { margin-bottom: 1rem; }

.module-intro h1 { font-size: 2.8rem; }

.intro-km {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0.6rem;
}

.module-facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 2rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.92);
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  max-width: 620px;
  margin: 1.5rem auto 0;
}

.module-facts li { display: inline-flex; align-items: center; gap: 0.45rem; }
.module-facts strong { font-weight: 600; }

/* --- The learning path ---------------------------------------------------- */

.path {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  counter-reset: step;
}

.path > li {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.path > li:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(15, 76, 92, 0.08);
  transform: translateY(-1px);
}

.path .step-num {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--skill-bg);
  color: var(--skill-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.path .step-body { flex: 1; }

.path .step-title {
  display: block;
  font-weight: 600;
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 0.1rem;
}

.path a.step-title:hover { color: var(--accent); }

.path .step-km {
  display: block;
  font-size: 0.9rem;
  color: #3d4d61;
  margin-bottom: 0.15rem;
}

.path .step-desc {
  display: block;
  font-size: 0.87rem;
  color: var(--muted);
}

.path .step-time {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 0.35rem;
}

.path li.is-test { background: var(--skill-bg); border-color: #bcd7dd; }
.path li.is-test .step-num { background: var(--primary); color: #fff; }

/* --- Lesson body ---------------------------------------------------------- */

.lesson-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.objectives {
  background: var(--skill-bg);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
}

.objectives h2 {
  font-size: 1rem;
  border: none;
  padding: 0;
  margin-bottom: 0.5rem;
  color: var(--primary-dark);
}

.objectives h2::after { display: none; }

.objectives ul {
  padding-left: 1.1rem;
  font-size: 0.93rem;
  margin: 0;
}

.objectives li { margin-bottom: 0.3rem; }
.objectives .km { display: block; color: #3d4d61; font-size: 0.9rem; }

.lesson h3 {
  font-size: 1.08rem;
  color: var(--primary);
  margin: 1.75rem 0 0.5rem;
}

.lesson h3 .km {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

.lesson p { font-size: 0.97rem; margin-bottom: 0.75rem; color: #374456; }
.lesson p.km { font-size: 0.93rem; color: #4a5a6e; margin-bottom: 1rem; }

.lesson ul, .lesson ol { padding-left: 1.2rem; font-size: 0.95rem; color: #374456; }
.lesson li { margin-bottom: 0.35rem; }
.lesson li .km { display: block; color: #55677d; font-size: 0.9rem; }

/* Key term */
.term {
  border-left: 3px solid var(--accent);
  background: #fffaf5;
  border-radius: 0 6px 6px 0;
  padding: 0.8rem 1rem;
  margin: 1rem 0;
}

.term dt {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 0.95rem;
}

.term dt .km { font-weight: 500; color: var(--muted); font-size: 0.88rem; }
.term dd { margin: 0.2rem 0 0; font-size: 0.93rem; color: #374456; }
.term dd .km { display: block; color: #55677d; font-size: 0.89rem; margin-top: 0.15rem; }
.term + .term { margin-top: -0.4rem; }

/* CaWSIP worked example */
.example {
  border: 1px solid #bcd7dd;
  border-radius: 8px;
  background: #f6fbfc;
  padding: 1rem 1.2rem;
  margin: 1.25rem 0;
}

.example-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.example p:last-child, .example ul:last-child { margin-bottom: 0; }

/* Source-needed marker — content that must come from CaWSIP documents */
.gap {
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: #fffaf5;
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
  font-size: 0.9rem;
  color: #7a4a1a;
}

.gap strong { color: var(--accent); }

/* --- Results-chain diagram ------------------------------------------------ */

.chain {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  margin: 1.25rem 0;
  overflow-x: auto;
  padding-bottom: 0.4rem;
}

.chain > li {
  list-style: none;
  flex: 1 1 0;
  min-width: 8.5rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 6px;
  padding: 0.7rem 0.75rem;
  background: #fff;
  font-size: 0.85rem;
  margin: 0;
}

.chain > li:nth-child(4) { border-top-color: var(--accent); }
.chain > li:nth-child(5) { border-top-color: var(--step-done); }

.chain .chain-name {
  display: block;
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 0.9rem;
}

.chain .chain-km { display: block; color: var(--muted); font-size: 0.82rem; margin-bottom: 0.25rem; }
.chain .chain-eg { display: block; color: #55677d; font-size: 0.82rem; }

.chain-caption {
  font-size: 0.83rem;
  color: var(--muted);
  font-style: italic;
  margin-top: -0.5rem;
}

/* --- Check yourself ------------------------------------------------------- */

.check {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin-top: 2rem;
  background: #fafbfc;
}

.check h3 { margin-top: 0; }

.check details {
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
}

.check details:last-of-type { border-bottom: none; padding-bottom: 0; }

.check summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
  list-style: none;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.check summary::-webkit-details-marker { display: none; }

.check summary::before {
  content: "?";
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--skill-bg);
  color: var(--skill-text);
  font-weight: 700;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.check details[open] summary::before { content: "✓"; background: var(--step-done); color: #fff; }

.check summary .km { display: block; color: var(--muted); font-size: 0.88rem; font-weight: 400; }

.check .answer {
  margin: 0.6rem 0 0 1.9rem;
  padding: 0.7rem 0.9rem;
  background: #fff;
  border-left: 3px solid var(--step-done);
  border-radius: 0 6px 6px 0;
  font-size: 0.92rem;
  color: #374456;
}

.check .answer .km { display: block; color: #55677d; font-size: 0.89rem; margin-top: 0.2rem; }

/* --- Prev / next ---------------------------------------------------------- */

.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--border);
}

.lesson-nav a {
  flex: 1 1 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
}

.lesson-nav a:hover { border-color: var(--primary); background: var(--skill-bg); }

.lesson-nav .nav-dir {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.lesson-nav .next { text-align: right; }
.lesson-nav .next:only-child { margin-left: auto; flex: 0 1 50%; }

/* --- Responsive & print --------------------------------------------------- */

@media (max-width: 720px) {
  .module-intro h1 { font-size: 1.9rem; }
  .path > li { flex-wrap: wrap; }
  .path .step-time { width: 100%; padding-left: 2.9rem; padding-top: 0; }
  .lesson-nav { flex-direction: column; }
  .lesson-nav .next { text-align: left; }
}

@media print {
  .lesson-nav, .path .step-time { display: none; }
  .module-intro { background: #fff !important; color: #000 !important; }
  .module-intro h1, .module-intro .tagline, .module-intro .intro-km { color: #000 !important; text-shadow: none !important; }
  .check details { display: block; }
  .check .answer { display: block; }
  .example, .term, .objectives { page-break-inside: avoid; }
}
