/* ==========================================================================
   CertQuests — course module styling (learning/<id>/index.html)

   The 28 course detail pages were authored across four markup generations.
   Their per-page inline <style> blocks each shipped only part of the module
   CSS, so most pages rendered their "Course Modules" section with no card
   chrome at all — module titles, lesson titles and study-notes collapsed
   into one undifferentiated wall of body text.

   This file is the shared fallback layer that supplies the missing rules for
   every generation. It is linked from <head>, so any page inline <style>
   still wins on conflict (later in source order, equal specificity) — pages
   that already ship their own module styling (ms-900, sc-900) are unchanged.

   Generation map:
     A  .module-block > summary > .module-number/.module-summary-text
        + .module-content > .lesson > .lesson-title + .study-note/.exam-tip
     B  .modules-grid > .module-card > .module-num/.module-body/.module-dur
        + .module-topics > .topic-chip
     C  .course-modules > .module-list > .module-card
        > .module-num/.module-title/.module-desc + .module-topics > .topic-tag
     B and C share the .chapter-toggle / .lesson-block deep-chapter markup,
     which pages already style inline.
   ========================================================================== */

.detail-shell,
.detail-body {
  --course-accent: var(--accent, #6366f1);
}

/* --------------------------------------------------------------------------
   Generation A — <details class="module-block"> accordions
   -------------------------------------------------------------------------- */

.module-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 0 0 14px;
  background: var(--surface);
  overflow: hidden;
}

.module-block summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.module-block summary::-webkit-details-marker { display: none; }
.module-block summary:hover { background: rgba(255, 255, 255, 0.03); }

.module-number {
  flex: none;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--course-accent);
  background: rgba(99, 102, 241, 0.14);
  background: color-mix(in srgb, var(--course-accent) 14%, transparent);
  border-radius: 8px;
  padding: 6px 10px;
}

.module-summary-text { flex: 1; min-width: 0; }

.module-block .module-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.module-lesson-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.module-toggle-icon { flex: none; }
.module-toggle-icon::before {
  content: "\25B8";
  color: var(--text-muted);
  font-size: 14px;
}
.module-block[open] .module-toggle-icon::before { content: "\25BE"; }

.module-content {
  padding: 4px 18px 18px;
  border-top: 1px solid var(--border);
}

/* Generation A variant used by comptia-a-plus / fortinet-nse4 */
.module-block summary .module-icon { flex: none; font-size: 20px; }

.module-weight {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}

.module-lessons { padding: 4px 18px 18px; border-top: 1px solid var(--border); }

.module-toggle { flex: none; }
.module-toggle::before {
  content: "\25B8";
  color: var(--text-muted);
  font-size: 14px;
}
.module-block[open] .module-toggle::before { content: "\25BE"; }

/* Lessons inside a generation-A module */
.module-content .lesson,
.module-lessons .lesson { margin: 0 0 22px; }

.module-content .lesson:last-child,
.module-lessons .lesson { margin-bottom: 0; }

.module-content .lesson-title,
.module-lessons .lesson-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 18px 0 4px;
  line-height: 1.35;
}

.lesson-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 4px;
}

.lesson-header .lesson-title { margin: 0; }

.lesson-number {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--course-accent);
}

.lesson-concepts { margin: 0; }

.lesson h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 12px 0 6px;
}

/* Callouts — amber for a study note, indigo for an exam tip */
.study-note {
  margin: 10px 0 0;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.07);
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.exam-tip {
  margin: 10px 0 0;
  padding: 12px 16px;
  background: rgba(99, 102, 241, 0.08);
  border-left: 3px solid #6366f1;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.study-note strong { color: #fcd34d; }
.exam-tip strong { color: #a5b4fc; }

/* --------------------------------------------------------------------------
   Generations B and C — .module-card grids
   -------------------------------------------------------------------------- */

.course-modules { margin: 0 0 28px; }

.modules-grid,
.module-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 0 14px;
}

.module-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 18px 22px;
}

.module-card .module-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--course-accent);
  margin-bottom: 6px;
}

.module-card .module-body h3,
.module-card > .module-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.3;
}

.module-card .module-body p,
.module-card .module-desc {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0 0 12px;
}

/* Duration is the third child, after the topic chips — pin it to the card
   corner so it reads as module metadata instead of a stray trailing line. */
.module-dur {
  position: absolute;
  top: 18px;
  right: 22px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.module-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 4px;
}

.topic-chip,
.topic-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Responsive — phone tuning
   -------------------------------------------------------------------------- */

@media (max-width: 560px) {
  .module-block summary { padding: 14px; gap: 10px; }
  .module-content,
  .module-lessons { padding: 4px 14px 16px; }
  .module-card { padding: 16px 14px; }

  /* Back into flow — an absolute corner would collide with a wrapped title. */
  .module-dur { position: static; margin: 0 0 6px; }

  .module-block .module-title { font-size: 15px; }
  .module-card .module-body h3,
  .module-card > .module-title { font-size: 16px; }

  .module-content .lesson-title,
  .module-lessons .lesson-title { font-size: 16px; }

  .study-note,
  .exam-tip { padding: 11px 13px; font-size: 13.5px; }

  .topic-chip,
  .topic-tag { font-size: 10.5px; padding: 3px 8px; }
}
