/* ============================================================
   EDD Training - Expert Driven Development
   Shared Stylesheet for GitHub Pages
   https://jeranaias.github.io/ExpertDrivenDevelopment/
   ============================================================
   Color Palette:
     Accents only: USMC Scarlet #CC0000, Gold #F5D130
     Backgrounds:  White #ffffff, Warm Gray #f8f7f5
     Text:         Near-black #1a1a1a
   ============================================================ */

/* ==========================================================
   1. CSS CUSTOM PROPERTIES
   ========================================================== */

:root {
  /* --- Colors --- */
  --color-scarlet: #CC0000;
  --color-scarlet-dark: #a30000;
  --color-scarlet-light: #e63939;
  --color-gold: #F5D130;
  --color-gold-dark: #d4b11a;
  --color-gold-light: #f9e06b;

  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f8f7f5;
  --color-bg-dark: #1a1a1a;
  --color-bg-code: #f4f3f0;

  --color-text-primary: #1a1a1a;
  --color-text-secondary: #4a4a4a;
  --color-text-muted: #6e6e6e;
  --color-text-inverse: #ffffff;

  --color-border: #d9d8d4;
  --color-border-light: #e8e7e3;

  --color-link: #CC0000;
  --color-link-hover: #a30000;
  --color-link-visited: #8a0000;

  --color-info-bg: #e8f0fe;
  --color-info-border: #4285f4;
  --color-info-text: #1a3a6b;

  --color-warning-bg: #fef7e0;
  --color-warning-border: #f9ab00;
  --color-warning-text: #5f4b08;

  --color-instructor-bg: #fce8e8;
  --color-instructor-border: #CC0000;
  --color-instructor-text: #5c0000;

  --color-success-bg: #e6f4ea;
  --color-success-border: #34a853;
  --color-success-text: #0d652d;

  /* --- Typography --- */
  --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-family-mono: "Cascadia Code", "Fira Code", "Consolas", "Monaco",
    "Courier New", monospace;

  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-md: 1.125rem;   /* 18px */
  --font-size-lg: 1.25rem;    /* 20px */
  --font-size-xl: 1.5rem;     /* 24px */
  --font-size-2xl: 2rem;      /* 32px */
  --font-size-3xl: 2.5rem;    /* 40px */
  --font-size-4xl: 3rem;      /* 48px */

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.25;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.75;

  /* --- Spacing --- */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */
  --space-4xl: 6rem;     /* 96px */

  /* --- Layout --- */
  --max-width: 1200px;
  --max-width-narrow: 800px;
  --max-width-wide: 1400px;
  --sidebar-width: 260px;
  --header-height: 64px;

  /* --- Borders --- */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* --- Shadows --- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);

  /* --- Transitions --- */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
}


/* ==========================================================
   2. BASE RESET & TYPOGRAPHY
   ========================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-lg));
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
  margin-bottom: var(--space-md);
}

h1 {
  font-size: var(--font-size-3xl);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--font-size-2xl);
  letter-spacing: -0.01em;
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-border-light);
  margin-top: var(--space-2xl);
}

h3 {
  font-size: var(--font-size-xl);
  margin-top: var(--space-xl);
}

h4 {
  font-size: var(--font-size-lg);
  margin-top: var(--space-lg);
}

h5 {
  font-size: var(--font-size-md);
  margin-top: var(--space-lg);
}

h6 {
  font-size: var(--font-size-base);
  margin-top: var(--space-md);
  color: var(--color-text-secondary);
}

/* Body text */
p {
  margin-bottom: var(--space-md);
}

/* Links */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-link-hover);
  text-decoration-thickness: 2px;
}

a:visited {
  color: var(--color-link-visited);
}

a:focus-visible {
  outline: 2px solid var(--color-scarlet);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Lists */
ul, ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-xl);
}

li {
  margin-bottom: var(--space-xs);
}

li > ul,
li > ol {
  margin-top: var(--space-xs);
  margin-bottom: 0;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Horizontal rule */
hr {
  border: none;
  height: 1px;
  background-color: var(--color-border);
  margin: var(--space-xl) 0;
}

/* Blockquote */
blockquote {
  border-left: 4px solid var(--color-gold);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
  background-color: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Inline code */
code {
  font-family: var(--font-family-mono);
  font-size: 0.9em;
  background-color: var(--color-bg-code);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-light);
}

/* Preformatted / code blocks */
pre {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  background-color: var(--color-bg-dark);
  color: #e0e0e0;
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-lg);
  border: 1px solid #333;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* Keyboard input */
kbd {
  font-family: var(--font-family-mono);
  font-size: 0.85em;
  padding: 0.15em 0.5em;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-bg-secondary);
  box-shadow: 0 1px 0 var(--color-border);
}

/* Selection */
::selection {
  background-color: var(--color-gold-light);
  color: var(--color-text-primary);
}


/* ==========================================================
   3. LAYOUT
   ========================================================== */

.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main {
  flex: 1;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

.container--wide {
  max-width: var(--max-width-wide);
}

/* Content section */
.section {
  padding: var(--space-3xl) 0;
}

.section--alt {
  background-color: var(--color-bg-secondary);
}

/* Page content with optional sidebar */
.page-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  padding: var(--space-2xl) 0;
}

@media (min-width: 1024px) {
  .page-layout--sidebar {
    grid-template-columns: var(--sidebar-width) 1fr;
  }

  .page-layout--sidebar-right {
    grid-template-columns: 1fr var(--sidebar-width);
  }
}

.page-content {
  min-width: 0; /* Prevent grid blowout */
}


/* ==========================================================
   4. NAVIGATION - HEADER & TOP NAV
   ========================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  height: var(--header-height);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* Site branding / logo */
.site-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--color-text-primary);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
  white-space: nowrap;
}

.site-brand:hover {
  color: var(--color-scarlet);
}

.site-brand:visited {
  color: var(--color-text-primary);
}

.site-brand__mark {
  display: inline-block;
  width: 6px;
  height: 24px;
  background-color: var(--color-scarlet);
  border-radius: 2px;
  flex-shrink: 0;
}

/* Desktop navigation */
.nav-list {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-xs);
}

.nav-list a {
  display: block;
  padding: var(--space-sm) var(--space-md);
  text-decoration: none;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  white-space: nowrap;
  position: relative;
}

.nav-list a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: var(--space-md);
  right: var(--space-md);
  height: 2px;
  background-color: var(--color-scarlet);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-list a:hover::after {
  transform: scaleX(1);
}

.nav-list a:hover {
  color: var(--color-scarlet);
  background-color: var(--color-bg-secondary);
}

.nav-list a:visited {
  color: var(--color-text-secondary);
}

.nav-list a.active,
.nav-list a[aria-current="page"] {
  color: var(--color-scarlet);
  font-weight: var(--font-weight-semibold);
}

@media (min-width: 768px) {
  .nav-list {
    display: flex;
  }
}

/* Hamburger menu button */
.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-md);
}

.nav-toggle:hover {
  background-color: var(--color-bg-secondary);
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--color-scarlet);
  outline-offset: 2px;
}

.nav-toggle__icon {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--color-text-primary);
  position: relative;
  transition: background-color var(--transition-fast);
}

.nav-toggle__icon::before,
.nav-toggle__icon::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--color-text-primary);
  position: absolute;
  left: 0;
  transition: transform var(--transition-base);
}

.nav-toggle__icon::before {
  top: -7px;
}

.nav-toggle__icon::after {
  bottom: -7px;
}

/* Active hamburger state */
.nav-toggle[aria-expanded="true"] .nav-toggle__icon {
  background-color: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon::before {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon::after {
  transform: translateY(-7px) rotate(-45deg);
}

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
}

/* Mobile navigation overlay */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-bg-primary);
  z-index: 99;
  padding: var(--space-lg);
  overflow-y: auto;
}

.mobile-nav.is-open {
  display: block;
}

.mobile-nav .nav-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.mobile-nav .nav-list a {
  font-size: var(--font-size-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  border-radius: 0;
}

@media (min-width: 768px) {
  .mobile-nav {
    display: none !important;
  }
}


/* ==========================================================
   5. HERO SECTION
   ========================================================== */

.hero {
  background: linear-gradient(135deg, #ffffff 0%, #f8f7f5 50%, #fce8e8 100%);
  padding: var(--space-4xl) 0;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(204, 0, 0, 0.03) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero__content {
  max-width: var(--max-width-narrow);
}

.hero__title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: var(--space-md);
  border-bottom: none;
  padding-bottom: 0;
  margin-top: 0;
}

.hero__title .accent {
  color: var(--color-scarlet);
}

.hero__subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
  max-width: 60ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

@media (min-width: 768px) {
  .hero {
    padding: var(--space-4xl) 0 calc(var(--space-4xl) + var(--space-xl));
  }

  .hero__subtitle {
    font-size: var(--font-size-xl);
  }
}


/* ==========================================================
   6. CARD COMPONENTS
   ========================================================== */

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .card-grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), border-color var(--transition-base), transform var(--transition-base);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-scarlet) 0%, var(--color-gold) 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-scarlet-light);
  transform: translateY(-2px);
}

.card:hover::before {
  opacity: 1;
}

.card--featured {
  border-top: 3px solid var(--color-scarlet);
}

.card__tag {
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-scarlet);
  margin-bottom: var(--space-sm);
}

.card__title {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-sm);
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.card__title a {
  color: var(--color-text-primary);
  text-decoration: none;
}

.card__title a:hover {
  color: var(--color-scarlet);
}

.card__desc {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  flex: 1;
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.card__meta dt {
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card__meta dd {
  margin-left: 0;
}

.card__footer {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
}


/* ==========================================================
   7. TABLE STYLES
   ========================================================== */

.table-wrapper {
  overflow-x: auto;
  margin-bottom: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

thead {
  background: linear-gradient(180deg, var(--color-bg-secondary) 0%, #f0efeb 100%);
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  font-weight: var(--font-weight-semibold);
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: top;
}

tbody tr:nth-child(even) {
  background-color: rgba(248, 247, 245, 0.5);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color var(--transition-fast);
}

tbody tr:hover {
  background-color: var(--color-bg-secondary);
}

/* Compact table variant */
.table--compact th,
.table--compact td {
  padding: var(--space-sm) var(--space-md);
}

/* Striped variant */
.table--striped tbody tr:nth-child(even) {
  background-color: var(--color-bg-secondary);
}


/* ==========================================================
   8. CODE BLOCK & PROMPT STYLING
   ========================================================== */

/* Code block with label */
.code-block {
  position: relative;
  margin-bottom: var(--space-lg);
}

.code-block__label {
  display: inline-block;
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: var(--color-bg-dark);
  color: #999;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border: 1px solid #333;
  border-bottom: none;
}

.code-block pre {
  margin-top: 0;
  border-top-left-radius: 0;
}

/* Copy button for code blocks */
.code-block__copy {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: #999;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
  z-index: 2;
}

.code-block:hover .code-block__copy,
.prompt-block:hover .code-block__copy {
  opacity: 1;
}

.code-block__copy:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.code-block__copy:active {
  transform: scale(0.95);
}

/* Prompt block for AI/LLM prompt examples */
.prompt-block {
  background: linear-gradient(135deg, #1e1e2e 0%, #252540 100%);
  border: 1px solid #444;
  border-left: 4px solid var(--color-gold);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  padding-top: calc(var(--space-lg) + var(--space-md));
  margin-bottom: var(--space-lg);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  color: #cdd6f4;
  line-height: var(--line-height-relaxed);
  white-space: pre-wrap;
  overflow-x: auto;
  position: relative;
}

.prompt-block::before {
  content: "PROMPT";
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.1em;
  color: var(--color-gold);
  opacity: 0.5;
}

.prompt-block__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid #444;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-gold);
}

/* Command-line style */
.cli-example {
  background-color: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  overflow-x: auto;
  margin-bottom: var(--space-lg);
}

.cli-example .prompt-symbol {
  color: #58a6ff;
  user-select: none;
}

.cli-example .output {
  color: #8b949e;
}


/* ==========================================================
   9. CALLOUT / ALERT BOXES
   ========================================================== */

.callout {
  border-left: 4px solid var(--color-border);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  background-color: var(--color-bg-secondary);
  box-shadow: var(--shadow-sm);
}

.callout > *:last-child {
  margin-bottom: 0;
}

.callout__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Info callout */
.callout--info {
  background: linear-gradient(135deg, var(--color-info-bg) 0%, #f0f7ff 100%);
  border-left-color: var(--color-info-border);
}

.callout--info .callout__title {
  color: var(--color-info-text);
}

.callout--info .callout__title::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='9' stroke='%234285f4' stroke-width='2'/%3E%3Ctext x='10' y='15' text-anchor='middle' font-size='13' font-weight='bold' fill='%234285f4'%3Ei%3C/text%3E%3C/svg%3E");
  background-size: 20px 20px;
  background-repeat: no-repeat;
}

/* Warning callout */
.callout--warning {
  background: linear-gradient(135deg, var(--color-warning-bg) 0%, #fffbeb 100%);
  border-left-color: var(--color-warning-border);
}

.callout--warning .callout__title {
  color: var(--color-warning-text);
}

.callout--warning .callout__title::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M10 2L1 18h18L10 2z' stroke='%23f9ab00' stroke-width='2' fill='none'/%3E%3Ctext x='10' y='16' text-anchor='middle' font-size='12' font-weight='bold' fill='%23f9ab00'%3E!%3C/text%3E%3C/svg%3E");
  background-size: 20px 20px;
  background-repeat: no-repeat;
}

/* Instructor notes */
.callout--instructor {
  background: linear-gradient(135deg, var(--color-instructor-bg) 0%, #fff0f0 100%);
  border-left-color: var(--color-instructor-border);
}

.callout--instructor .callout__title {
  color: var(--color-instructor-text);
}

.callout--instructor .callout__title::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='6' r='4' stroke='%23CC0000' stroke-width='2'/%3E%3Cpath d='M3 18c0-4 3-7 7-7s7 3 7 7' stroke='%23CC0000' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-size: 20px 20px;
  background-repeat: no-repeat;
}

/* Success callout */
.callout--success {
  background: linear-gradient(135deg, var(--color-success-bg) 0%, #f0faf2 100%);
  border-left-color: var(--color-success-border);
}

.callout--success .callout__title {
  color: var(--color-success-text);
}

.callout--success .callout__title::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='9' stroke='%2334a853' stroke-width='2'/%3E%3Cpath d='M6 10l3 3 5-6' stroke='%2334a853' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 20px 20px;
  background-repeat: no-repeat;
}


/* ==========================================================
   10. SIDEBAR & TABLE OF CONTENTS
   ========================================================== */

.sidebar {
  position: relative;
}

@media (min-width: 1024px) {
  .sidebar--sticky {
    position: sticky;
    top: calc(var(--header-height) + var(--space-xl));
    max-height: calc(100vh - var(--header-height) - var(--space-2xl));
    overflow-y: auto;
    align-self: start;
  }
}

.toc {
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.toc__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc__list li {
  margin-bottom: 0;
}

.toc__list a {
  display: block;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast),
              background-color var(--transition-fast), padding-left var(--transition-fast);
}

.toc__list a:hover {
  color: var(--color-scarlet);
  border-left-color: var(--color-scarlet);
  padding-left: var(--space-md);
}

.toc__list a:visited {
  color: var(--color-text-secondary);
}

.toc__list a.active {
  color: var(--color-scarlet);
  font-weight: var(--font-weight-semibold);
  border-left: 3px solid var(--color-scarlet);
  background-color: rgba(204, 0, 0, 0.06);
}

/* Nested TOC levels */
.toc__list .toc__list {
  padding-left: var(--space-md);
}

.toc__list .toc__list a {
  font-size: var(--font-size-xs);
}


/* ==========================================================
   11. BUTTON STYLES
   ========================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1.5;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast),
              box-shadow var(--transition-fast),
              transform var(--transition-fast);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--color-scarlet);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.97);
}

/* Primary button - scarlet */
.btn--primary {
  background-color: var(--color-scarlet);
  border-color: var(--color-scarlet);
  color: var(--color-text-inverse);
  box-shadow: 0 4px 6px rgba(204, 0, 0, 0.2);
}

.btn--primary:hover {
  background-color: var(--color-scarlet-dark);
  border-color: var(--color-scarlet-dark);
  color: var(--color-text-inverse);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(204, 0, 0, 0.3);
}

.btn--primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 4px rgba(204, 0, 0, 0.2);
}

.btn--primary:visited {
  color: var(--color-text-inverse);
}

/* Secondary button - outline */
.btn--secondary {
  background-color: transparent;
  border-color: var(--color-scarlet);
  color: var(--color-scarlet);
}

.btn--secondary:hover {
  background-color: var(--color-scarlet);
  color: var(--color-text-inverse);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(204, 0, 0, 0.2);
}

.btn--secondary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 4px rgba(204, 0, 0, 0.15);
}

.btn--secondary:visited {
  color: var(--color-scarlet);
}

/* Ghost button */
.btn--ghost {
  background-color: transparent;
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

.btn--ghost:hover {
  border-color: var(--color-text-secondary);
  color: var(--color-text-primary);
}

.btn--ghost:visited {
  color: var(--color-text-secondary);
}

/* Gold accent button */
.btn--gold {
  background-color: var(--color-gold);
  border-color: var(--color-gold);
  color: var(--color-text-primary);
}

.btn--gold:hover {
  background-color: var(--color-gold-dark);
  border-color: var(--color-gold-dark);
  color: var(--color-text-primary);
}

.btn--gold:visited {
  color: var(--color-text-primary);
}

/* Size variants */
.btn--sm {
  font-size: var(--font-size-xs);
  padding: var(--space-xs) var(--space-md);
}

.btn--lg {
  font-size: var(--font-size-base);
  padding: var(--space-md) var(--space-xl);
}


/* ==========================================================
   12. FORM ELEMENTS
   ========================================================== */

.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
}

.form-hint {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-scarlet);
  box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.12);
  outline: none;
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a4a4a' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: var(--space-2xl);
}

/* Checkbox / Radio custom */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  margin-top: 0.25em;
  accent-color: var(--color-scarlet);
}

.form-check label {
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  cursor: pointer;
}

/* Fieldset */
fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

legend {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  padding: 0 var(--space-sm);
}

/* Template display (read-only formatted blocks) */
.template-display {
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.template-display__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
}

.template-display__title {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  margin: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.template-display__content {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  white-space: pre-wrap;
  color: var(--color-text-secondary);
}


/* ==========================================================
   13. RESPONSIVE BREAKPOINTS (mobile-first)
   ========================================================== */

/* --- Base: 320px+ (mobile) --- */
/* All base styles above are mobile-first */

/* --- 768px+ (tablet) --- */
@media (min-width: 768px) {
  h1 {
    font-size: var(--font-size-3xl);
  }

  .section {
    padding: var(--space-3xl) 0;
  }

  .container {
    padding: 0 var(--space-xl);
  }
}

/* --- 1024px+ (desktop) --- */
@media (min-width: 1024px) {
  h1 {
    font-size: var(--font-size-4xl);
  }

  .container {
    padding: 0 var(--space-2xl);
  }
}

/* --- 1200px+ (wide desktop) --- */
@media (min-width: 1200px) {
  .container {
    padding: 0 var(--space-2xl);
  }
}


/* ==========================================================
   14. PRINT STYLESHEET
   ========================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
  }

  /* Hide navigation, interactive elements */
  .site-header,
  .site-footer,
  .nav-toggle,
  .mobile-nav,
  .skip-link,
  .sidebar,
  .btn,
  .hero__actions {
    display: none !important;
  }

  /* Show the content fully */
  .site-main {
    padding: 0;
  }

  .page-layout {
    display: block;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  /* Links: show URL */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    font-weight: normal;
    color: #555 !important;
  }

  a[href^="#"]::after,
  a[href^="javascript"]::after {
    content: "";
  }

  /* Ensure content does not break awkwardly */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    break-after: avoid;
  }

  pre, blockquote, table, .callout, .card {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  img {
    max-width: 100% !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Code blocks: light theme for print */
  pre {
    border: 1px solid #ccc !important;
    padding: 1em !important;
    font-size: 9pt;
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  /* Tables */
  table {
    border-collapse: collapse;
  }

  th, td {
    border: 1px solid #ccc !important;
  }

  thead {
    display: table-header-group;
  }

  tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Callouts: border only */
  .callout {
    border: 1px solid #999 !important;
    border-left-width: 4px !important;
    padding: 0.75em !important;
  }

  /* Page margins */
  @page {
    margin: 2cm;
  }
}


/* ==========================================================
   15. UTILITY CLASSES
   ========================================================== */

/* --- Text --- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

.text-sm   { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg   { font-size: var(--font-size-lg); }
.text-xl   { font-size: var(--font-size-xl); }

.text-muted     { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-scarlet   { color: var(--color-scarlet); }
.text-gold      { color: var(--color-gold-dark); }

.font-mono   { font-family: var(--font-family-mono); }
.font-bold   { font-weight: var(--font-weight-bold); }
.font-medium { font-weight: var(--font-weight-medium); }

.uppercase {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Spacing --- */
.mt-0  { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-0  { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.pt-0  { padding-top: 0; }
.pt-lg { padding-top: var(--space-lg); }
.pt-xl { padding-top: var(--space-xl); }

.pb-0  { padding-bottom: 0; }
.pb-lg { padding-bottom: var(--space-lg); }
.pb-xl { padding-bottom: var(--space-xl); }

.px-md { padding-left: var(--space-md); padding-right: var(--space-md); }
.px-lg { padding-left: var(--space-lg); padding-right: var(--space-lg); }

.py-md { padding-top: var(--space-md); padding-bottom: var(--space-md); }
.py-lg { padding-top: var(--space-lg); padding-bottom: var(--space-lg); }
.py-xl { padding-top: var(--space-xl); padding-bottom: var(--space-xl); }

/* --- Display & Layout --- */
.d-none   { display: none; }
.d-block  { display: block; }
.d-flex   { display: flex; }
.d-grid   { display: grid; }

.flex-wrap    { flex-wrap: wrap; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* --- Borders & Decoration --- */
.border-top    { border-top: 1px solid var(--color-border); }
.border-bottom { border-bottom: 1px solid var(--color-border); }

.rounded    { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

/* --- Background --- */
.bg-white   { background-color: var(--color-bg-primary); }
.bg-gray    { background-color: var(--color-bg-secondary); }

/* --- Width --- */
.w-full { width: 100%; }
.max-w-narrow { max-width: var(--max-width-narrow); }

/* --- Visibility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Show only at specific breakpoints */
.hide-mobile {
  display: none;
}

@media (min-width: 768px) {
  .hide-mobile {
    display: initial;
  }

  .hide-desktop {
    display: none;
  }
}

/* --- Misc --- */
.no-list {
  list-style: none;
  padding-left: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ==========================================================
   16. SKIP-TO-CONTENT (Accessibility)
   ========================================================== */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  z-index: 200;
  padding: var(--space-sm) var(--space-lg);
  background-color: var(--color-scarlet);
  color: var(--color-text-inverse);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.skip-link:focus {
  top: 0;
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
  color: var(--color-text-inverse);
}


/* ==========================================================
   17. FOOTER
   ========================================================== */

.site-footer {
  background-color: var(--color-bg-dark);
  color: #b0b0b0;
  padding: var(--space-2xl) 0;
  margin-top: auto;
  font-size: var(--font-size-sm);
}

.site-footer a {
  color: #d0d0d0;
  text-decoration: none;
}

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

.site-footer a:visited {
  color: #d0d0d0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-section__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-inverse);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section li {
  margin-bottom: var(--space-xs);
}

.footer-bottom {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid #333;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-md);
  color: #777;
  font-size: var(--font-size-xs);
}

/* Gold accent bar at bottom of page */
.site-footer::after {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(
    to right,
    var(--color-scarlet) 0%,
    var(--color-scarlet) 50%,
    var(--color-gold) 50%,
    var(--color-gold) 100%
  );
  margin-top: var(--space-2xl);
}


/* ==========================================================
   ADDITIONAL: Page-specific helpers
   ========================================================== */

/* Page header (used on inner pages below the nav) */
.page-header {
  background-color: var(--color-bg-secondary);
  padding: var(--space-2xl) 0;
  border-bottom: 2px solid var(--color-border-light);
}

.page-header__title {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-xs);
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.page-header__desc {
  color: var(--color-text-secondary);
  font-size: var(--font-size-md);
  margin-bottom: 0;
  max-width: 65ch;
}

/* Breadcrumb navigation */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  padding: var(--space-md) 0;
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.breadcrumb li + li::before {
  content: "\203A";
  margin: 0 var(--space-sm);
  color: var(--color-border);
  font-size: var(--font-size-lg);
  line-height: 1;
}

.breadcrumb a {
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--color-scarlet);
  background-color: var(--color-bg-secondary);
  text-decoration: none;
}

.breadcrumb a:visited {
  color: var(--color-text-secondary);
}

/* Badge / tag component */
.badge {
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  padding: 0.15em 0.6em;
  border-radius: 999px;
  background-color: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-light);
}

.badge--scarlet {
  background-color: #fce8e8;
  color: var(--color-scarlet);
  border-color: #f5c6c6;
}

.badge--gold {
  background-color: #fef7e0;
  color: #8a6d0b;
  border-color: #f5e6a3;
}

.badge--success {
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
  border-color: #a8dab5;
}

/* Step-by-step / numbered list for procedures */
.steps {
  counter-reset: step-counter;
  list-style: none;
  padding-left: 0;
}

.steps > li {
  counter-increment: step-counter;
  position: relative;
  padding-left: var(--space-2xl);
  margin-bottom: var(--space-lg);
}

.steps > li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: var(--color-scarlet);
  color: var(--color-text-inverse);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  border-radius: 50%;
}

/* Accordion (CSS-only with details/summary) */
@keyframes accordion-slide-down {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

details {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

details:hover {
  border-color: var(--color-scarlet-light);
  box-shadow: var(--shadow-sm);
}

details[open] {
  border-color: var(--color-scarlet);
  box-shadow: var(--shadow-md);
}

summary {
  padding: var(--space-md) var(--space-lg);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

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

summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 6px solid var(--color-text-secondary);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

details[open] > summary::before {
  transform: rotate(90deg);
}

details[open] > summary {
  border-bottom: 1px solid var(--color-border-light);
}

summary:hover {
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-md);
}

summary:focus-visible {
  outline: 2px solid var(--color-scarlet);
  outline-offset: -2px;
  border-radius: var(--radius-md);
}

details > :not(summary) {
  padding: 0 var(--space-lg) var(--space-lg);
  animation: accordion-slide-down 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Definition list styling */
dl.definition-list dt {
  font-weight: var(--font-weight-bold);
  margin-top: var(--space-md);
  color: var(--color-text-primary);
}

dl.definition-list dd {
  margin-left: var(--space-lg);
  margin-bottom: var(--space-sm);
  color: var(--color-text-secondary);
}

/* Figure / image with caption */
figure {
  margin: var(--space-lg) 0;
}

figcaption {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
  text-align: center;
  font-style: italic;
}


/* ==========================================================
   NEW: READING PROGRESS BAR
   ========================================================== */

.progress-reading {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--color-bg-secondary);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.progress-reading.is-visible {
  opacity: 1;
}

.progress-reading__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-scarlet) 0%, var(--color-gold) 100%);
  width: 0%;
  transition: width 0.1s ease-out;
}


/* ==========================================================
   NEW: BACK-TO-TOP BUTTON
   ========================================================== */

.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--color-scarlet);
  color: var(--color-text-inverse);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity var(--transition-base),
              visibility var(--transition-base),
              transform var(--transition-base),
              background-color var(--transition-fast),
              box-shadow var(--transition-fast);
  z-index: 90;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background-color: var(--color-scarlet-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.back-to-top:active {
  transform: scale(0.95);
}

.back-to-top::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  border-left: 2.5px solid var(--color-text-inverse);
  border-top: 2.5px solid var(--color-text-inverse);
  transform: rotate(45deg) translateY(3px);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}


/* ==========================================================
   NEW: EXERCISE BLOCKS
   ========================================================== */

.exercise {
  background: linear-gradient(135deg, #fef7e0 0%, #fffbeb 50%, #fff9db 100%);
  border-left: 6px solid var(--color-gold);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.exercise::before {
  content: "EXERCISE";
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-gold-dark);
  opacity: 0.4;
}

.exercise > *:last-child {
  margin-bottom: 0;
}

.exercise__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
}


/* ==========================================================
   NEW: MODULE DURATION BADGES
   ========================================================== */

.module-duration {
  display: inline-block;
  margin-left: var(--space-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  padding: 0.15em 0.6em;
  border-radius: var(--radius-sm);
  vertical-align: middle;
}


/* ==========================================================
   NEW: MOBILE TABLE CARD TRANSFORMATION
   ========================================================== */

@media (max-width: 767px) {
  .table-wrapper {
    border: none;
    border-radius: 0;
    overflow-x: visible;
  }

  .table-wrapper table,
  .table-wrapper thead,
  .table-wrapper tbody,
  .table-wrapper tr,
  .table-wrapper th,
  .table-wrapper td {
    display: block;
  }

  .table-wrapper thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .table-wrapper tbody tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    background-color: var(--color-bg-primary);
    box-shadow: var(--shadow-sm);
  }

  .table-wrapper tbody tr:nth-child(even) {
    background-color: var(--color-bg-primary);
  }

  .table-wrapper td {
    padding: var(--space-xs) 0;
    border-bottom: none;
    text-align: right;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-md);
  }

  .table-wrapper td + td {
    border-top: 1px solid var(--color-border-light);
    padding-top: var(--space-xs);
  }

  .table-wrapper td::before {
    content: attr(data-label);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    text-align: left;
    flex-shrink: 0;
  }
}


/* ==========================================================
   MOBILE RESPONSIVE OVERHAUL
   ========================================================== */

@media (max-width: 767px) {
  /* --- Touch targets --- */
  .btn {
    min-height: 48px;
  }

  .nav-toggle {
    width: 48px;
    height: 48px;
  }

  .mobile-nav .nav-list a {
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .toc__list a {
    padding: var(--space-sm) var(--space-md);
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* --- Typography --- */
  h1 {
    font-size: var(--font-size-xl);
  }

  h2 {
    font-size: var(--font-size-lg);
    margin-top: var(--space-xl);
  }

  h3 {
    font-size: var(--font-size-md);
  }

  .hero__title {
    font-size: var(--font-size-2xl);
  }

  .page-header__title {
    font-size: var(--font-size-xl);
  }

  /* --- Spacing --- */
  .section {
    padding: var(--space-xl) 0;
  }

  .hero {
    padding: var(--space-2xl) 0;
  }

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

  .callout {
    padding: var(--space-md);
  }

  .card-grid {
    gap: var(--space-md);
  }

  /* --- Code blocks --- */
  pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
  }

  /* --- Back-to-top mobile --- */
  .back-to-top {
    width: 44px;
    height: 44px;
    bottom: 24px;
    right: 24px;
  }
}


/* ==========================================================
   EXTRA SMALL SCREENS (max-width: 400px)
   ========================================================== */

@media (max-width: 400px) {
  .site-brand {
    font-size: var(--font-size-base);
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 374px) {
  h1 {
    font-size: var(--font-size-lg);
  }

  .hero__title {
    font-size: var(--font-size-xl);
  }

  .container {
    padding: 0 var(--space-md);
  }

  .hero {
    padding: var(--space-xl) 0;
  }

  .card {
    padding: var(--space-md);
  }

  .exercise {
    padding: var(--space-md);
  }
}


/* ==========================================================
   KNOWLEDGE CHECK COMPONENT
   ========================================================== */

.knowledge-check {
  margin: var(--space-2xl) 0;
  padding: var(--space-xl);
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.knowledge-check__title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-lg);
  margin-top: 0;
  border-bottom: 2px solid var(--color-border-light);
  padding-bottom: var(--space-sm);
}

.knowledge-check__question {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.knowledge-check__question:last-of-type {
  border-bottom: none;
  margin-bottom: var(--space-md);
  padding-bottom: 0;
}

.knowledge-check__prompt {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-md);
}

.knowledge-check__options {
  list-style: none;
  padding: 0;
  margin: 0;
}

.knowledge-check__option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.knowledge-check__option:hover {
  background: var(--color-bg-secondary);
}

.knowledge-check__option input[type="radio"] {
  margin-top: 0.25rem;
  accent-color: var(--color-scarlet);
  flex-shrink: 0;
}

.knowledge-check__option input[type="radio"]:disabled {
  cursor: not-allowed;
}

/* Correct answer selected */
.knowledge-check__question.is-correct .knowledge-check__option--selected {
  background: #e8f5e9;
  border-left: 3px solid #2e7d32;
}

/* Wrong answer selected */
.knowledge-check__question.is-incorrect .knowledge-check__option--selected {
  background: #ffebee;
  border-left: 3px solid #c62828;
}

/* Always highlight the correct answer after grading */
.knowledge-check__question.is-correct .knowledge-check__option--correct,
.knowledge-check__question.is-incorrect .knowledge-check__option--correct {
  background: #e8f5e9;
  border-left: 3px solid #2e7d32;
}

/* Feedback block */
.knowledge-check__feedback {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-scarlet);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* Result display */
.knowledge-check__result {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-md);
  text-align: center;
}

.knowledge-check__result--pass {
  background: #e8f5e9;
  color: #2e7d32;
}

.knowledge-check__result--fail {
  background: #fff3e0;
  color: #e65100;
}

/* Submit and retry buttons */
.knowledge-check__submit,
.knowledge-check__retry {
  margin-top: var(--space-md);
}

.knowledge-check__retry {
  margin-left: var(--space-sm);
}

.knowledge-check__question.is-unanswered {
  border-left: 3px solid var(--color-scarlet);
  padding-left: var(--space-md);
  background-color: var(--color-warning-bg, #fff8e6);
}

.knowledge-check__status-msg {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-scarlet);
  padding: var(--space-sm) 0;
  margin-top: var(--space-sm);
}


/* ==========================================================
   COURSE PROGRESS / CHECKLIST COMPONENT
   ========================================================== */

.course-checklist {
  margin: var(--space-xl) 0;
  padding: var(--space-lg);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
}

.course-checklist__title {
  margin: 0 0 var(--space-md);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  border-bottom: none;
  padding-bottom: 0;
}

.course-progress-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-lg);
  position: relative;
}

.course-progress-bar__fill {
  height: 100%;
  background: var(--color-scarlet);
  border-radius: var(--radius-sm);
  transition: width 0.4s ease;
  width: 0%;
}

.course-progress-bar__text {
  display: block;
  margin-top: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: right;
}

.course-checklist__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.course-checklist__item {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
}

.course-checklist__item:last-child {
  border-bottom: none;
}

.course-checklist__item label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
}

.course-checklist__item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-scarlet);
  flex-shrink: 0;
}

.course-checklist__item input[type="checkbox"]:checked + span {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.course-checklist__complete {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border-radius: var(--radius-lg);
  font-weight: var(--font-weight-semibold);
  text-align: center;
  border: 1px solid var(--color-success-border);
}


/* ==========================================================
   USER IDENTITY SYSTEM
   ========================================================== */

/* --- Registration Banner --- */

.edd-identity-banner {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.edd-identity-banner__text {
  font-weight: 600;
  flex-basis: 100%;
}

.edd-identity-banner input {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
}

.edd-identity-banner input:focus {
  border-color: var(--color-scarlet);
  box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.12);
  outline: none;
}

.edd-identity-banner__actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

/* --- Header User Indicator --- */

.edd-user-indicator {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  opacity: 0.9;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
}

.edd-user-indicator:hover {
  background-color: var(--color-bg-secondary);
}

.edd-user-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.25rem;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  font-size: 0.85rem;
  color: var(--color-text-primary);
}

.edd-user-dropdown a:visited {
  color: var(--color-link);
}

.edd-user-dropdown .edd-user-clear:visited {
  color: var(--color-scarlet);
}

/* --- Responsive: Mobile banner stacks inputs --- */

@media (max-width: 767px) {
  .edd-identity-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .edd-identity-banner input {
    width: 100%;
  }

  .edd-identity-banner__actions {
    margin-left: 0;
    justify-content: flex-end;
  }

  .edd-user-indicator {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
  }
}

/* --- Print: hide identity elements --- */

@media print {
  .edd-identity-banner,
  .edd-user-indicator {
    display: none !important;
  }
}


/* ==========================================================
   SCROLL-BASED AUTO-CHECK HIGHLIGHT
   ========================================================== */

.course-checklist__item.is-auto-checked {
    background: rgba(245, 209, 48, 0.2);  /* gold flash */
    transition: background 1.5s ease;
}
.course-checklist__item.is-auto-checked.fade-out {
    background: transparent;
}

/* Locked checklist items (require verification to unlock) */
.course-checklist__item.is-locked label {
    cursor: not-allowed;
    opacity: 0.6;
}
.course-checklist__item.is-locked input[type="checkbox"] {
    cursor: not-allowed;
}
.course-checklist__item.is-locked.is-verified label {
    cursor: default;
    opacity: 1;
}
.course-checklist__item.is-locked.is-verified input[type="checkbox"] {
    cursor: default;
}
.course-checklist__lock-msg {
    display: none;
    margin-left: 0.5rem;
    font-size: 0.8rem;
    color: var(--color-scarlet, #CC0000);
    font-weight: 600;
}
