/* ================================================================
   main.css — AB731 Training Portal
   askfarouk.net · Ahmed Farouk · Microsoft Certified Trainer
   ================================================================ */

/* ── GOOGLE FONTS ── */
/* ── SELF-HOSTED FONTS ── */
/* Drop font files into the fonts/ folder next to main.css */

@font-face {
  font-family: 'DM Serif Display';
  src: url('fonts/DMSerifDisplay-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Serif Display';
  src: url('fonts/DMSerifDisplay-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ================================================================
   1. CSS VARIABLES
   ================================================================ */
:root {
  /* Colors */
  --cream:          #faf8f5;
  --white:          #ffffff;
  --ink:            #1a1a2e;
  --ink-soft:       #3d3d5c;
  --ink-muted:      #8888a8;
  --accent:         #0d9488;
  --accent-hover:   #0f766e;
  --accent-soft:    #f0fdfa;
  --accent-mid:     #99f6e4;
  --border:         #e8e4de;
  --border-light:   #f2efe9;
  --success:        #2e9e5b;
  --success-soft:   #edf7f2;

  /* Sidebar */
  --sidebar-w:      268px;
  --sidebar-bg:     #16162a;
  --sidebar-border: rgba(255,255,255,0.07);
  --sidebar-text:   #c8c8e0;
  --sidebar-muted:  #6666888;
  --sidebar-active-bg:  rgba(232,88,10,0.15);
  --sidebar-active-border: var(--accent);
  --sidebar-hover-bg: rgba(255,255,255,0.05);

  /* Typography */
  --font-display:   'DM Serif Display', Georgia, serif;
  --font-body:      'DM Sans', system-ui, sans-serif;

  /* Spacing */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   40px;
  --space-2xl:  64px;

  /* Radii */
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  16px;

  /* Shadows */
  --shadow-xs:  0 1px 3px rgba(26,26,46,0.05);
  --shadow-sm:  0 2px 8px rgba(26,26,46,0.07);
  --shadow-md:  0 4px 20px rgba(26,26,46,0.09);
  --shadow-lg:  0 8px 36px rgba(26,26,46,0.12);
  --shadow-accent: 0 4px 14px rgba(232,88,10,0.28);

  /* Transitions */
  --ease:       cubic-bezier(.4,0,.2,1);
  --dur-fast:   0.15s;
  --dur:        0.22s;
  --dur-slow:   0.35s;
}

/* ================================================================
   2. RESET & BASE
   ================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }

/* ================================================================
   3. LAYOUT — SIDEBAR + MAIN
   ================================================================ */

/* The sidebar is fixed; the page content shifts right */
.page-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar slot — filled by sidebar.js */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  transition: transform var(--dur-slow) var(--ease);
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Main content area */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR (mobile) ── */
.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.topbar-brand {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.hamburger-btn {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast);
}

.hamburger-btn:hover { background: var(--border-light); }

.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform var(--dur) var(--ease), opacity var(--dur-fast);
}

.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 190;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.visible { display: block; }

/* ================================================================
   4. PAGE INNER — content container
   ================================================================ */
.page-inner {
  flex: 1;
  padding: var(--space-xl) var(--space-xl) var(--space-2xl);
  max-width: 1100px;
  width: 100%;
}

/* ================================================================
   5. TYPOGRAPHY
   ================================================================ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.eyebrow::before {
  content: '';
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  flex-shrink: 0;
}

h1.page-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
  color: var(--ink);
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}

h1.page-title em {
  font-style: italic;
  color: var(--accent);
}

h2.section-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.3px;
  margin-bottom: 10px;
}

h3.group-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

h3.group-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.page-desc {
  font-size: 15px;
  color: var(--ink-soft);
  font-weight: 300;
  line-height: 1.75;
}

/* ================================================================
   6. META ROW
   ================================================================ */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-muted);
  font-weight: 400;
}

.meta-item svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

/* ================================================================
   7. CARDS
   ================================================================ */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.card:hover { box-shadow: var(--shadow-md); }
.card.accent { border-top: 3px solid var(--accent); }
.card.open { border-color: var(--accent-mid); box-shadow: var(--shadow-md); }

.card-body { padding: var(--space-lg) var(--space-lg); }
.card-body-lg { padding: var(--space-xl) var(--space-xl); }

/* ================================================================
   8. ACCORDION
   ================================================================ */
.accordion-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  cursor: pointer;
  user-select: none;
  transition: background var(--dur-fast);
}

.accordion-header:hover { background: #fdfcfb; }

.accordion-body {
  display: none;
  border-top: 1px solid var(--border-light);
  padding: 20px 22px 24px 72px;
  animation: fade-slide var(--dur) var(--ease);
}

.accordion-body.open { display: block; }

.chevron-icon {
  width: 20px;
  height: 20px;
  color: var(--ink-muted);
  transition: transform var(--dur) var(--ease);
  flex-shrink: 0;
}

.accordion-header[aria-expanded="true"] .chevron-icon { transform: rotate(180deg); }

/* ================================================================
   9. TOPIC NUMBER BADGE
   ================================================================ */
.topic-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.topic-badge.large {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 16px;
}

/* ================================================================
   10. SUBTOPIC LIST
   ================================================================ */
.subtopic-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subtopic-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--ink-soft);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--cream);
  border: 1px solid var(--border-light);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}

.subtopic-list li:hover {
  background: var(--accent-soft);
  border-color: var(--accent-mid);
  color: var(--ink);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  opacity: 0.55;
}

/* ================================================================
   11. SUBTOPIC GROUP
   ================================================================ */
.subtopic-group {
  margin-top: 18px;
}

.subtopic-group:first-child { margin-top: 14px; }

/* ================================================================
   12. MEDIA SLOTS
   ================================================================ */
/*
  USAGE:
  ─────────────────────────────────────────────────────────────────
  IMAGE:
    <div class="media-slot">
      <img src="YOUR_URL" alt="Description">
      <p class="media-caption">Caption text</p>
    </div>

  VIDEO (hosted file):
    <div class="media-slot">
      <video controls>
        <source src="YOUR_URL" type="video/mp4">
      </video>
      <p class="media-caption">Caption text</p>
    </div>

  VIDEO (YouTube embed):
    <div class="media-slot media-slot--video">
      <iframe src="https://www.youtube.com/embed/VIDEO_ID"
        frameborder="0" allowfullscreen></iframe>
      <p class="media-caption">Caption text</p>
    </div>

  PLACEHOLDER (waiting for content):
    <div class="media-slot media-slot--placeholder">
      <div class="media-placeholder-inner">
        <svg>…</svg>
        <span>Image coming soon</span>
      </div>
    </div>
  ─────────────────────────────────────────────────────────────────
*/

.media-slot {
  margin-top: 22px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--white);
}

.media-slot img {
  width: 100%;
  height: auto;
  display: block;
}

.media-slot video {
  width: 100%;
  display: block;
  background: #000;
}

/* 16:9 iframe wrapper */
.media-slot--video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.media-slot--video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Placeholder state */
.media-slot--placeholder {
  border: 1.5px dashed var(--accent-mid);
  background: var(--accent-soft);
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-placeholder-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 32px;
  color: var(--accent);
  opacity: 0.55;
}

.media-placeholder-inner svg { width: 30px; height: 30px; }

.media-placeholder-inner span {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: var(--ink-muted);
}

.media-caption {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink-muted);
  font-style: italic;
  border-top: 1px solid var(--border-light);
  background: var(--cream);
}

/* ================================================================
   13. BREADCRUMB
   ================================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--ink-muted);
  text-decoration: none;
  transition: color var(--dur-fast);
}

.breadcrumb a:hover { color: var(--accent); }

.breadcrumb-sep {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.4;
}

.breadcrumb-current { color: var(--ink-soft); font-weight: 500; }

/* ================================================================
   14. NAVIGATION ARROWS (prev / next topic)
   ================================================================ */
.topic-nav {
  display: flex;
  gap: 12px;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.topic-nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur-fast);
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}

.topic-nav-btn:hover {
  border-color: var(--accent-mid);
  box-shadow: var(--shadow-md);
  background: var(--accent-soft);
}

.topic-nav-btn.next { flex-direction: row-reverse; text-align: right; }

.nav-btn-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.nav-btn-icon svg { width: 16px; height: 16px; }

.nav-btn-text { flex: 1; min-width: 0; }

.nav-btn-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 2px;
}

.nav-btn-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================================================================
   15. PILLS & BADGES
   ================================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.pill-accent {
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  color: var(--accent);
}

.pill-neutral {
  background: var(--border-light);
  border: 1px solid var(--border);
  color: var(--ink-muted);
}

.pill-count {
  background: var(--border-light);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 11.5px;
  padding: 3px 10px;
}

/* ================================================================
   16. DIVIDER
   ================================================================ */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-lg) 0;
}

.divider-lg { margin: var(--space-xl) 0; }

/* ================================================================
   17. FORM ELEMENTS
   ================================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

label.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.1px;
}

label.form-label .optional {
  font-weight: 400;
  color: var(--ink-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--cream);
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
  line-height: 1.55;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,88,10,0.10);
  background: var(--white);
}

input::placeholder,
textarea::placeholder { color: var(--ink-muted); }

textarea { resize: vertical; min-height: 90px; }

/* ================================================================
   18. BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition: background var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  /* was var(--accent): 3.74:1 with white text, below WCAG AA */
  background: var(--accent-hover);
  color: white;
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 18px rgba(232,88,10,0.30);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--border-light); border-color: var(--border); }

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-full { width: 100%; }

/* ================================================================
   19. STAR RATING
   ================================================================ */
.star-row { display: flex; gap: 4px; }

.star-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--border);
  padding: 0;
  line-height: 1;
  transition: color var(--dur-fast), transform var(--dur-fast);
  cursor: pointer;
}

.star-btn:hover,
.star-btn.lit { color: #f5a623; }

.star-btn.lit:last-child { transform: scale(1.15); }

/* ================================================================
   20. ANIMATIONS
   ================================================================ */
@keyframes fade-slide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-in-left {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

/* ================================================================
   21. FOOTER
   ================================================================ */
.page-footer {
  margin-top: auto;
  padding: 20px var(--space-xl);
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page-footer a { color: var(--accent); }
.page-footer a:hover { text-decoration: underline; }

/* ================================================================
   22. RESPONSIVE — Mobile (sidebar collapses)
   ================================================================ */
@media (max-width: 768px) {

  #sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  #sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content { margin-left: 0; }

  .topbar { display: flex; }

  .page-inner {
    padding: var(--space-lg) var(--space-lg) var(--space-xl);
  }

  .topic-nav { flex-direction: column; }

  .page-footer { padding: var(--space-lg); }
}

@media (max-width: 480px) {
  .page-inner { padding: var(--space-md) var(--space-md) var(--space-xl); }
  .accordion-body { padding-left: var(--space-md); }
}

/* ================================================================
   23. CUSTOM CHECKLIST
   ================================================================ */
.custom-checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.checklist-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.checklist-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.checklist-check svg {
  width: 11px;
  height: 11px;
  display: block;
}


/* ================================================================
   AB731 LESSON LAYER
   ----------------------------------------------------------------
   The Module 1 lesson pages were authored for a DARK theme
   (gold / sage / teal / rose on near-black). AB731 uses the light
   cream-and-teal theme above.

   Rather than rewrite ~60KB of lesson markup, this section maps the
   dark theme's TOKEN NAMES onto light-theme values. The lesson
   pages keep their own inline component CSS and simply resolve to
   light colours.

   Every colour below was contrast-checked against both #ffffff and
   the cream page background: all body-text tokens clear WCAG AA
   (4.5:1). --gold-light is a UI/border accent only (3.0:1) and is
   never used for body copy.
   ================================================================ */

:root {
  /* Text — remapped onto the light palette */
  --text:         #1a1a2e;   /* 16.1:1 on cream */
  --text-muted:   #3d3d5c;   /*  9.8:1 */
  --text-faint:   #6b6b8a;   /*  4.8:1 — deliberately darker than
                                 --ink-muted (#8888a8), which only
                                 reaches 3.2:1 and fails AA for body */

  /* Surfaces */
  --bg-2:         #ffffff;
  --bg-3:         #f6f3ee;

  /* Accents, light-theme safe */
  --gold:         #b45309;   /* 4.7:1 — safe for body text */
  --gold-light:   #d97706;   /* 3.0:1 — UI/borders/badges only */
  --gold-dim:     #fffbeb;
  --border-gold:  #fcd9a0;

  --sage:         #15803d;   /* 4.7:1 */
  --sage-dim:     #eef7f1;

  --teal:         #0f766e;   /* 5.2:1 */
  --teal-dim:     #f0fdfa;

  --rose:         #dc2626;   /* 4.6:1 */
  --rose-dim:     #fef2f2;

  --transition:   var(--dur, .22s) var(--ease, cubic-bezier(.4,0,.2,1));
}

/* ── Page shell used by the lesson pages ─────────────────────── */
.page-container { width: 100%; }

.page-hero {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius, 12px);
  padding: 26px 30px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.page-hero h1 {
  font-family: var(--font-display, 'DM Serif Display', serif);
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 500;
  color: var(--ink);
  margin: 10px 0 12px;
  line-height: 1.2;
}
.page-hero .breadcrumb { margin-bottom: 4px; }

.lead {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0 0 16px;
  max-width: 68ch;
}

.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .1px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-3); color: var(--ink-soft);
}
.hero-tag.gold { background: var(--gold-dim);  border-color: var(--border-gold); color: var(--gold); }
.hero-tag.teal { background: var(--teal-dim);  border-color: var(--accent-mid);  color: var(--teal); }
.hero-tag.sage { background: var(--sage-dim);  border-color: #bfe3cd;            color: var(--sage); }

.content-area {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  padding: 30px 34px;
  box-shadow: var(--shadow-sm);
}
.content-area > h2 {
  font-family: var(--font-display, 'DM Serif Display', serif);
  font-size: 23px; font-weight: 500; color: var(--ink);
  margin: 34px 0 12px; padding-bottom: 9px;
  border-bottom: 1px solid var(--border-light);
}
.content-area > h2:first-child { margin-top: 0; }
.content-area > h3 { font-size: 17px; font-weight: 700; color: var(--ink); margin: 24px 0 8px; }
.content-area p  { font-size: 15px; line-height: 1.75; color: var(--ink-soft); margin: 0 0 14px; }
.content-area ul, .content-area ol { margin: 0 0 16px; padding-left: 22px; }
.content-area li { font-size: 15px; line-height: 1.7; color: var(--ink-soft); margin-bottom: 7px; }
.content-area strong { color: var(--ink); font-weight: 600; }

.section-divider { height: 1px; background: var(--border-light); border: 0; margin: 30px 0; }

/* Utility colour classes used inline by the lessons */
.gold { color: var(--gold); }
.teal { color: var(--teal); }
.sage { color: var(--sage); }

/* ── Info boxes ──────────────────────────────────────────────── */
.info-box {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm, 8px);
  padding: 16px 18px; margin: 18px 0;
}
.ib-icon  { font-size: 19px; line-height: 1.3; flex-shrink: 0; }
.ib-text  { flex: 1; min-width: 0; }
.ib-title { font-weight: 700; font-size: 14.5px; color: var(--ink); margin-bottom: 4px; }
.ib-body  { font-size: 14px; line-height: 1.65; color: var(--ink-soft); }
.ib-body p:last-child { margin-bottom: 0; }

.info-box.note    { background: var(--accent-soft); border-color: var(--accent-mid); border-left-color: var(--accent); }
.info-box.tip     { background: var(--sage-dim);    border-color: #bfe3cd;           border-left-color: var(--sage); }
.info-box.success { background: var(--sage-dim);    border-color: #bfe3cd;           border-left-color: var(--sage); }
.info-box.warning { background: var(--gold-dim);    border-color: var(--border-gold); border-left-color: var(--gold-light); }

/* ── Callouts ────────────────────────────────────────────────────
   NOTE: login.php and register.php in the ITIL build reference
   .callout / .callout-icon / .callout-body / .callout-alert, but
   those classes are defined NOWHERE in that project — not in
   main.css, not inline. Login error messages have been rendering
   completely unstyled. Defining them here fixes AB731; the same
   block can be pasted into ITIL/main.css to fix it there too.
   ──────────────────────────────────────────────────────────────── */
.callout {
  display: flex; gap: 13px; align-items: flex-start;
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm, 8px);
  padding: 14px 17px; margin: 18px 0;
}
.callout-icon {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; line-height: 1;
  background: var(--accent); color: #fff;
}
.callout-body { flex: 1; min-width: 0; font-size: 14px; line-height: 1.65; color: var(--ink-soft); }
.callout-body p:last-child { margin-bottom: 0; }

.callout-alert            { background: var(--rose-dim); border-color: #f8c8c8; border-left-color: var(--rose); }
.callout-alert .callout-icon { background: var(--rose); }
.callout-success            { background: var(--sage-dim); border-color: #bfe3cd; border-left-color: var(--sage); }
.callout-success .callout-icon { background: var(--sage); }

@media (max-width: 640px) {
  .page-hero    { padding: 20px 18px; }
  .content-area { padding: 22px 18px; }
}

/* ── Missing button variant ──────────────────────────────────────
   .btn-gold is used by login.php, register.php and the quiz engine
   (inherited from the ITIL build) but, like .callout, was never
   defined anywhere in that project — so the primary action button
   on those pages renders with no background at all. Defined here
   as the course's primary action, mapped to the AB731 accent.
   ──────────────────────────────────────────────────────────────── */
.btn-gold {
  /* --accent (#0d9488) with white text is only 3.74:1 and fails WCAG AA.
     --accent-hover (#0f766e) reaches 5.47:1, so it is the button base. */
  background: var(--accent-hover);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.btn-gold:hover  { background: #0b6b63; transform: translateY(-1px); }
.btn-gold:active { transform: translateY(0); }

/* Bare .btn with no variant — used by the lesson "previous" links */
.btn:not(.btn-primary):not(.btn-gold):not(.btn-ghost) {
  background: var(--white);
  color: var(--ink-soft);
  border: 1px solid var(--border);
}
.btn:not(.btn-primary):not(.btn-gold):not(.btn-ghost):hover {
  background: var(--bg-3);
  border-color: var(--accent-mid);
  color: var(--ink);
}

/* ── Lesson footer navigation ───────────────────────────────── */
.lesson-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin: 26px 0 8px; padding-top: 20px;
  border-top: 1px solid var(--border-light);
}
.lesson-nav a { text-decoration: none; }
@media (max-width: 560px) {
  .lesson-nav { flex-direction: column; align-items: stretch; }
  .lesson-nav a { justify-content: center; }
}

/* Secondary outline button used by the lesson exercises */
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-soft);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ================================================================
   SIDEBAR
   ----------------------------------------------------------------
   Moved out of sidebar.js. In the ITIL build these rules lived in a
   JS template string that was injected into <head> at runtime, so
   the sidebar rendered unstyled for a beat on every page load and
   the CSS was invisible to any tooling. They are plain CSS here.
   ITIL's purple is remapped to the AB731 accent.
   ================================================================ */
.sb-inner { display:flex; flex-direction:column; height:100%; padding:0; }

    .sb-brand { display:flex; align-items:center; gap:11px; padding:22px 20px 18px; border-bottom:1px solid rgba(255,255,255,0.07); text-decoration:none; flex-shrink:0; }
    .sb-logo  { width:38px; height:38px; background:var(--accent-hover); border-radius:10px; display:flex; align-items:center; justify-content:center; font-family:'DM Serif Display',serif; font-size:18px; color:white; flex-shrink:0; box-shadow:0 2px 10px rgba(15,118,110,0.40); }
    .sb-brand-text { display:flex; flex-direction:column; line-height:1.25; }
    .sb-brand-name { font-size:14px; font-weight:600; color:#ffffff; letter-spacing:-0.1px; }
    .sb-brand-url  { font-size:11px; color:rgba(200,200,224,0.55); font-weight:400; }

    .sb-course { display:block; padding:22px 20px 14px; border-bottom:1px solid rgba(255,255,255,0.07); flex-shrink:0; text-decoration:none; }
    /* Top padding raised from 14px: this is now the first element in the
       sidebar, since the trainer-name brand row above it was removed. */
    .sb-course-link:hover .sb-course-title { color:#ffffff; }
    .sb-course-tag { display:inline-flex; align-items:center; gap:5px; font-size:10px; font-weight:600; letter-spacing:1px; text-transform:uppercase; color:var(--accent-hover); margin-bottom:4px; }
    .sb-course-title { font-size:13.5px; font-weight:600; color:rgba(255,255,255,0.88); letter-spacing:-0.1px; }

    .sb-progress { padding:12px 20px 14px; border-bottom:1px solid rgba(255,255,255,0.07); flex-shrink:0; }
    .sb-progress-row { display:flex; justify-content:space-between; font-size:11px; color:rgba(200,200,224,0.5); margin-bottom:6px; }
    #sb-progress-text { color:var(--accent-hover); font-weight:600; }
    .sb-progress-track { height:3px; background:rgba(255,255,255,0.08); border-radius:2px; overflow:hidden; }
    .sb-progress-fill  { height:100%; background:linear-gradient(90deg,var(--accent-hover),#5eead4); border-radius:2px; width:0%; transition:width 0.5s cubic-bezier(.4,0,.2,1); }

    .sb-nav { flex:1; overflow-y:auto; padding:10px 12px 8px; scrollbar-width:none; }
    .sb-nav::-webkit-scrollbar { display:none; }

    .sb-nav-label { font-size:10px; font-weight:600; letter-spacing:1.1px; text-transform:uppercase; color:rgba(200,200,224,0.35); padding:8px 8px 6px; }

    .sb-item { display:flex; align-items:center; gap:11px; padding:8px 10px; border-radius:9px; text-decoration:none; color:rgba(200,200,224,0.72); border-left:2.5px solid transparent; transition:background 0.15s,color 0.15s,border-color 0.15s; margin-bottom:2px; }
    .sb-item:hover { background:rgba(255,255,255,0.06); color:rgba(255,255,255,0.92); }
    .sb-item.active { background:rgba(15,118,110,0.14); border-left-color:var(--accent-hover); color:#ffffff; }

    .sb-item-icon { width:30px; height:30px; border-radius:7px; background:rgba(255,255,255,0.06); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
    .sb-item.active .sb-item-icon { background:rgba(15,118,110,0.22); }
    .sb-item-icon svg { width:14px; height:14px; color:inherit; }

    .sb-item-text { flex:1; min-width:0; display:flex; flex-direction:column; line-height:1.25; }
    .sb-item-sub  { font-size:9.5px; font-weight:600; letter-spacing:0.6px; text-transform:uppercase; color:rgba(200,200,224,0.38); }
    .sb-item.active .sb-item-sub { color:rgba(15,118,110,0.75); }
    .sb-item-label { font-size:12.5px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

    /* Collapsible Sections styles */
    .sb-section { margin-bottom: 4px; }
    .sb-section-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; font-size: 11px; font-weight: 700; color: rgba(200, 200, 224, 0.45); letter-spacing: 0.5px; cursor: pointer; border-radius: 6px; transition: background 0.15s, color 0.15s; text-transform: uppercase; }
    .sb-section-header:hover { background: rgba(255, 255, 255, 0.04); color: rgba(255, 255, 255, 0.9); }
    .sb-section.active-section .sb-section-header { color: #ffffff; }
    .sb-section-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
    
    .sb-chevron { width: 12px; height: 12px; color: inherit; transition: transform 0.22s cubic-bezier(.4,0,.2,1); flex-shrink: 0; opacity: 0.5; }
    .sb-section.expanded .sb-chevron { transform: rotate(90deg); opacity: 0.85; }

    .sb-section-children { display: none; flex-direction: column; padding-left: 10px; margin-top: 2px; gap: 2px; }
    .sb-section.expanded .sb-section-children { display: flex; }

    .sb-sub-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; text-decoration: none; color: rgba(200, 200, 224, 0.6); font-size: 12px; transition: background 0.15s, color 0.15s; }
    .sb-sub-item:hover { background: rgba(255, 255, 255, 0.04); color: rgba(255, 255, 255, 0.9); }
    .sb-sub-item.active { background: rgba(15,118,110,0.14); color: #ffffff; font-weight: 600; }
    
    .sb-sub-bullet { width: 4px; height: 4px; border-radius: 50%; background: rgba(200, 200, 224, 0.25); flex-shrink: 0; }
    .sb-sub-item.active .sb-sub-bullet { background: var(--accent-hover); box-shadow: 0 0 6px var(--accent-hover); }
    
    .sb-divider { height: 1px; background: rgba(255,255,255,0.07); margin: 4px 8px; }

    .sb-footer { padding:12px 20px 18px; border-top:1px solid rgba(255,255,255,0.07); display:flex; flex-direction:column; gap:4px; flex-shrink:0; }
    .sb-footer-link { display:inline-flex; align-items:center; gap:5px; font-size:11.5px; color:var(--accent-hover); text-decoration:none; transition:opacity 0.15s; }
    .sb-footer-link:hover { opacity:0.8; text-decoration:underline; }
    .sb-footer-copy { font-size:10.5px; color:rgba(200,200,224,0.3); }

/* ── Lesson layer additions (Lesson 4) ──────────────────────── */
.hero-tag.rose { background: var(--rose-dim); border-color: #f8c8c8; color: var(--rose); }
.rose { color: var(--rose); }

/* Numbered takeaway / objectives list */
.objectives { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.objective-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--white); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 13px 16px;
  font-size: 14.5px; line-height: 1.65; color: var(--ink-soft);
}
.obj-check {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-hover); color: #fff;
  font-size: 12.5px; font-weight: 700; line-height: 1;
}
