/* ═══════════════════════════════════════════════════════════════════════════
   Microsoft Intune Leerplatform – Style Sheet
   Inspired by Microsoft Fluent Design System
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Microsoft color palette */
  --clr-primary:       #0078d4;
  --clr-primary-dark:  #005a9e;
  --clr-primary-light: #cfe4f5;
  --clr-primary-xlt:   #eff6fc;
  --clr-accent:        #00b294;

  /* Neutrals (Fluent gray scale) */
  --clr-bg:            #f3f2f1;
  --clr-surface:       #ffffff;
  --clr-surface-2:     #faf9f8;
  --clr-border:        #edebe9;
  --clr-border-dark:   #d2d0ce;

  /* Text */
  --clr-text:          #323130;
  --clr-text-2:        #605e5c;
  --clr-text-3:        #a19f9d;

  /* Callout variants */
  --clr-info:          #0078d4;
  --clr-info-bg:       #eff6fc;
  --clr-info-border:   #c7e0f4;
  --clr-tip:           #00b294;
  --clr-tip-bg:        #e8f7f4;
  --clr-tip-border:    #aee3d8;
  --clr-warning:       #c7310d;
  --clr-warning-bg:    #fff4ce;
  --clr-warning-border:#f3d978;
  --clr-exercise:      #5c2d91;
  --clr-exercise-bg:   #f4f0fa;
  --clr-exercise-border:#c8b3e6;
  --clr-new:           #107c10;
  --clr-new-bg:        #dff6dd;
  --clr-new-border:    #9de09d;

  /* Code */
  --clr-code-bg:       #1e1e1e;
  --clr-code-text:     #d4d4d4;
  --clr-inline-code-bg:#f4f4f4;

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

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);

  /* Layout */
  --sidebar-width:    280px;
  --header-height:    60px;
  --content-max-width:860px;
  --grid-max-width:  1280px;

  /* Typography */
  --font-sans:  "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono:  "Cascadia Code", "Consolas", "Courier New", monospace;
  --font-size-base: 15px;
  --lh-base:  1.6;
}

/* ── Reset & Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: var(--lh-base);
  min-height: 100vh;
}

a { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; border-radius: var(--radius-sm); }

/* ── Site Header ────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--clr-primary);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: var(--grid-max-width);
  margin: 0 auto;
  height: 100%;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

/* Brand */
.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}

.brand-subtitle {
  font-size: 11px;
  opacity: .8;
  white-space: nowrap;
}

/* Search in header */
.header-center { flex: 1; max-width: 480px; position: relative; }

.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  opacity: .6;
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 36px;
  padding: 0 36px 0 34px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 18px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  transition: background .15s, border-color .15s;
  outline: none;
}

.search-input::placeholder { color: rgba(255,255,255,.7); }
.search-input:focus {
  background: rgba(255,255,255,.25);
  border-color: rgba(255,255,255,.5);
}

.search-kbd {
  position: absolute;
  right: 8px;
  font-size: 11px;
  background: rgba(255,255,255,.2);
  border-radius: 3px;
  padding: 1px 5px;
  pointer-events: none;
  opacity: .7;
}

/* Search dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border-dark);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 360px;
  overflow-y: auto;
  color: var(--clr-text);
}

.search-result-item {
  display: block;
  padding: 10px var(--space-md);
  border-bottom: 1px solid var(--clr-border);
  cursor: pointer;
  transition: background .1s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover, .search-result-item.active {
  background: var(--clr-primary-xlt);
}
.search-result-module {
  font-size: 11px;
  font-weight: 600;
  color: var(--clr-primary);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 2px;
}
.search-result-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.search-result-snippet { font-size: 13px; color: var(--clr-text-2); }
.search-result-snippet mark {
  background: #fff3cd;
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}
.search-no-results {
  padding: var(--space-lg);
  color: var(--clr-text-2);
  text-align: center;
  font-size: 14px;
}

/* Progress chip */
.header-right { flex-shrink: 0; }
.progress-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 12px;
  padding: 3px 10px;
  white-space: nowrap;
}
.progress-chip svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Module header (module.html) */
.site-header--module .header-inner { gap: var(--space-md); }
.back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: rgba(255,255,255,.9);
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  transition: color .15s;
}
.back-link:hover { color: #fff; text-decoration: none; }
.back-link svg { width: 16px; height: 16px; }

.module-title-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
}
.module-num-badge {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.module-page-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--clr-primary-dark) 0%, var(--clr-primary) 60%, #0091e6 100%);
  color: #fff;
  padding: var(--space-2xl) var(--space-lg);
}
.hero-inner {
  max-width: var(--grid-max-width);
  margin: 0 auto;
}
.hero-title {
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: var(--space-sm);
}
.hero-desc {
  font-size: 16px;
  opacity: .9;
  max-width: 560px;
  margin-bottom: var(--space-lg);
}
.hero-progress-bar {
  height: 8px;
  background: rgba(255,255,255,.25);
  border-radius: 4px;
  overflow: hidden;
  max-width: 400px;
  margin-bottom: var(--space-sm);
}
.hero-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 4px;
  width: 0;
  transition: width .6s ease;
}
.hero-progress-label { font-size: 13px; opacity: .8; }

/* ── Main content ────────────────────────────────────────────────────────────── */
.main-content {
  max-width: var(--grid-max-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.section-heading {
  font-size: 20px;
  font-weight: 600;
  color: var(--clr-text);
}

.filter-row {
  display: flex;
  gap: var(--space-xs);
}

.filter-btn {
  padding: 5px 14px;
  border: 1px solid var(--clr-border-dark);
  border-radius: 16px;
  background: var(--clr-surface);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  color: var(--clr-text-2);
  transition: background .15s, color .15s, border-color .15s;
}
.filter-btn:hover {
  background: var(--clr-primary-xlt);
  border-color: var(--clr-primary-light);
  color: var(--clr-primary);
}
.filter-btn.active {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: #fff;
}

/* ── Module Grid ─────────────────────────────────────────────────────────────── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-lg);
}

.loading-placeholder {
  grid-column: 1/-1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-3xl);
  color: var(--clr-text-3);
}

/* Spinner */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--clr-border-dark);
  border-top-color: var(--clr-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Module Card */
.module-card {
  position: relative;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  box-shadow: var(--shadow-sm);
}
.module-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--clr-primary-light);
}
.module-card.is-done {
  border-color: var(--clr-accent);
}
.module-card.is-hidden { display: none; }

.card-top {
  padding: var(--space-md) var(--space-md) 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.card-module-num {
  width: 36px;
  height: 36px;
  background: var(--clr-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.module-card.is-done .card-module-num {
  background: var(--clr-accent);
}

.card-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--clr-new-bg);
  color: var(--clr-new);
  border: 1px solid var(--clr-new-border);
  display: none;
}
.module-card.is-done .card-badge {
  display: inline-block;
}

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

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--clr-text);
  margin-bottom: 6px;
  line-height: 1.3;
}

.card-meta {
  font-size: 12px;
  color: var(--clr-text-3);
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-meta-item svg { width: 12px; height: 12px; }

.card-progress-bar {
  height: 4px;
  background: var(--clr-border);
  border-radius: 0;
  overflow: hidden;
  margin-top: auto;
}
.card-progress-fill {
  height: 100%;
  background: var(--clr-primary);
  border-radius: 0;
  width: 0;
  transition: width .5s ease;
}
.module-card.is-done .card-progress-fill { background: var(--clr-accent); }

/* Card link overlay */
.card-link {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
}
.card-link:focus-visible {
  outline: 2px solid var(--clr-primary);
  outline-offset: 2px;
}

/* ── Site Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: var(--space-xl);
  font-size: 13px;
  color: var(--clr-text-3);
  border-top: 1px solid var(--clr-border);
  margin-top: var(--space-2xl);
}

/* ══════════════════════════════════════════════════════════════════════════════
   Module Page
   ══════════════════════════════════════════════════════════════════════════════ */

.page-module { background: var(--clr-surface-2); }

.module-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  max-width: 100%;
  min-height: calc(100vh - var(--header-height) - 64px);
  position: relative;
  align-items: start;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.module-sidebar {
  grid-column: 1;
  width: var(--sidebar-width);
  background: var(--clr-surface);
  border-right: 1px solid var(--clr-border);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-inner {
  padding: var(--space-lg) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Progress ring */
.sidebar-progress-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.progress-ring { width: 64px; height: 64px; }
.progress-ring-bg   { stroke: var(--clr-border); }
.progress-ring-fill { stroke: var(--clr-primary); transition: stroke-dashoffset .5s ease; }
.progress-ring-label {
  font-size: 13px;
  color: var(--clr-text-2);
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--clr-primary);
  color: #fff;
  border-color: var(--clr-primary);
}
.btn-primary:hover { background: var(--clr-primary-dark); text-decoration: none; }
.btn-outline {
  background: transparent;
  color: var(--clr-primary);
  border-color: var(--clr-primary);
}
.btn-outline:hover { background: var(--clr-primary-xlt); text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

.mark-all-btn { width: 100%; font-size: 13px; }

/* TOC nav */
.toc-nav { display: flex; flex-direction: column; gap: 1px; }

.toc-section-link {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--clr-text-2);
  text-decoration: none;
  transition: background .1s, color .1s;
  line-height: 1.3;
}
.toc-section-link:hover { background: var(--clr-primary-xlt); color: var(--clr-primary); text-decoration: none; }
.toc-section-link.active { background: var(--clr-primary-xlt); color: var(--clr-primary); font-weight: 600; }
.toc-section-link.is-done .toc-done-icon { opacity: 1; }

.toc-done-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--clr-accent);
  opacity: 0;
  transition: opacity .2s;
}

.toc-subsections { margin-left: var(--space-md); display: flex; flex-direction: column; gap: 1px; }
.toc-sub-link {
  display: block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--clr-text-3);
  text-decoration: none;
  transition: background .1s, color .1s;
  line-height: 1.3;
  border-left: 2px solid var(--clr-border);
  margin-left: 4px;
}
.toc-sub-link:hover { background: var(--clr-primary-xlt); color: var(--clr-primary); border-left-color: var(--clr-primary); text-decoration: none; }
.toc-sub-link.active { color: var(--clr-primary); border-left-color: var(--clr-primary); }

/* Mobile TOC toggle */
.toc-toggle {
  display: none;
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--clr-primary);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  z-index: 90;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.toc-toggle svg { width: 20px; height: 20px; }
.toc-toggle:hover { background: var(--clr-primary-dark); }

/* ── Module content area ──────────────────────────────────────────────────────── */
.module-content {
  grid-column: 2;
  min-width: 0;
  padding: var(--space-xl) var(--space-2xl);
  max-width: var(--content-max-width);
}

.content-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-3xl);
  color: var(--clr-text-3);
}

/* Content sections */
.content-section {
  margin-bottom: var(--space-3xl);
  scroll-margin-top: calc(var(--header-height) + var(--space-lg));
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--clr-primary-light);
}

.content-section h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--clr-primary-dark);
  line-height: 1.3;
  flex: 1;
}

/* Done checkbox */
.done-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--clr-text-2);
  cursor: pointer;
  flex-shrink: 0;
  padding-top: 4px;
  user-select: none;
}
.done-toggle input[type="checkbox"] { display: none; }
.done-checkbox-ui {
  width: 20px;
  height: 20px;
  border: 2px solid var(--clr-border-dark);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.done-toggle input:checked ~ .done-checkbox-ui {
  background: var(--clr-accent);
  border-color: var(--clr-accent);
}
.done-checkbox-ui svg { width: 12px; height: 12px; color: #fff; display: none; }
.done-toggle input:checked ~ .done-checkbox-ui svg { display: block; }
.content-section.is-done .section-header { border-bottom-color: var(--clr-accent); }
.content-section.is-done h2 { color: var(--clr-text); }

/* Sub-headings */
.content-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--clr-text);
  margin: var(--space-xl) 0 var(--space-md);
  scroll-margin-top: calc(var(--header-height) + var(--space-lg));
}

.content-section h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--clr-text-2);
  margin: var(--space-lg) 0 var(--space-sm);
  scroll-margin-top: calc(var(--header-height) + var(--space-lg));
}

/* Paragraphs */
.content-section p {
  margin-bottom: var(--space-md);
  max-width: 72ch;
}

.content-section p:last-child { margin-bottom: 0; }

/* Inline formatting */
.content-section strong { font-weight: 700; }
.content-section em { font-style: italic; }
.content-section code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--clr-inline-code-bg);
  border: 1px solid var(--clr-border);
  border-radius: 3px;
  padding: .1em .4em;
  color: #d63384;
}

/* ── Lists ───────────────────────────────────────────────────────────────────── */
.content-section ul,
.content-section ol {
  margin: 0 0 var(--space-md) var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.content-section ul { list-style: disc; }
.content-section ol { list-style: decimal; }
.content-section li { line-height: 1.5; }

/* Nested lists */
.content-section ul ul,
.content-section ol ol,
.content-section ul ol,
.content-section ol ul {
  margin-top: 4px;
  margin-bottom: 4px;
}

/* ── Code Blocks ─────────────────────────────────────────────────────────────── */
.code-block-wrapper {
  position: relative;
  margin: var(--space-lg) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #333;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #2d2d2d;
  font-size: 12px;
  color: #888;
}

.code-lang-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #6cb6f5;
}

.code-copy-btn {
  background: none;
  border: 1px solid #555;
  color: #aaa;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background .15s, color .15s;
}
.code-copy-btn:hover { background: #3d3d3d; color: #fff; }
.code-copy-btn.copied { color: #7ec8a0; border-color: #7ec8a0; }

.code-block-wrapper pre {
  background: var(--clr-code-bg);
  color: var(--clr-code-text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: var(--space-md);
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}
.code-block-wrapper pre code {
  white-space: pre;
  font-family: inherit;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* PowerShell syntax hints */
.ps-keyword { color: #569cd6; }
.ps-string   { color: #ce9178; }
.ps-comment  { color: #6a9955; font-style: italic; }
.ps-cmdlet   { color: #dcdcaa; }
.ps-variable { color: #9cdcfe; }
.ps-param    { color: #4ec9b0; }

/* ── Images ──────────────────────────────────────────────────────────────────── */
.content-figure {
  margin: var(--space-lg) 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
}
.content-figure img {
  max-width: 100%;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow .2s;
}
.content-figure img:hover { box-shadow: var(--shadow-md); }
.content-figure figcaption {
  font-size: 12px;
  color: var(--clr-text-3);
  font-style: italic;
}

/* Image lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  cursor: pointer;
}
.lightbox img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  margin: var(--space-lg) 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--clr-border);
}

.content-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.content-table th {
  background: var(--clr-primary);
  color: #fff;
  padding: 10px var(--space-md);
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.content-table td {
  padding: 9px var(--space-md);
  border-bottom: 1px solid var(--clr-border);
  vertical-align: top;
  line-height: 1.5;
}
.content-table tr:last-child td { border-bottom: none; }
.content-table tr:nth-child(even) td { background: var(--clr-surface-2); }
.content-table tr:hover td { background: var(--clr-primary-xlt); }

/* ── Callout Boxes ──────────────────────────────────────────────────────────── */
.callout {
  margin: var(--space-lg) 0;
  border-radius: var(--radius-md);
  border-left: 4px solid;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.callout-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.callout-icon { width: 18px; height: 18px; flex-shrink: 0; }
.callout-body { font-size: 14px; line-height: 1.6; }
.callout-body p { margin-bottom: var(--space-sm); }
.callout-body p:last-child { margin-bottom: 0; }

/* Info */
.callout--info {
  background: var(--clr-info-bg);
  border-color: var(--clr-info);
}
.callout--info .callout-header { color: var(--clr-info); }

/* Tip */
.callout--tip {
  background: var(--clr-tip-bg);
  border-color: var(--clr-tip);
}
.callout--tip .callout-header { color: var(--clr-tip); }

/* Warning */
.callout--warning {
  background: var(--clr-warning-bg);
  border-color: var(--clr-warning);
}
.callout--warning .callout-header { color: var(--clr-warning); }

/* Exercise */
.callout--exercise {
  background: var(--clr-exercise-bg);
  border-color: var(--clr-exercise);
}
.callout--exercise .callout-header { color: var(--clr-exercise); }

/* New */
.callout--new {
  background: var(--clr-new-bg);
  border-color: var(--clr-new);
}
.callout--new .callout-header { color: var(--clr-new); }

/* ── Module nav footer ──────────────────────────────────────────────────────── */
.module-nav-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: calc(var(--sidebar-width) + var(--content-max-width) + var(--space-2xl) * 2);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-2xl);
  border-top: 1px solid var(--clr-border);
  background: var(--clr-surface);
}

.btn-nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 14px;
  padding: 10px 20px;
}
.btn-nav svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Search overlay (modal) ──────────────────────────────────────────────────── */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}
/* Ensure [hidden] always wins over display:flex */
.search-overlay[hidden] { display: none !important; }

.search-modal {
  width: min(640px, 90vw);
  background: var(--clr-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--clr-border);
}
.search-modal-header .search-icon { width: 18px; height: 18px; color: var(--clr-text-3); flex-shrink: 0; }

.search-modal-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--clr-text);
  background: transparent;
}

.search-modal-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--clr-text-3);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background .1s;
}
.search-modal-close:hover { background: var(--clr-border); }

.search-modal-results {
  max-height: 440px;
  overflow-y: auto;
}

.search-hint {
  padding: var(--space-lg);
  color: var(--clr-text-3);
  font-size: 14px;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .module-layout {
    grid-template-columns: 1fr;
  }
  .module-sidebar {
    grid-column: 1;
    position: fixed;
    top: var(--header-height);
    left: 0;
    z-index: 80;
    transform: translateX(-100%);
    transition: transform .25s ease;
    height: calc(100vh - var(--header-height));
    box-shadow: var(--shadow-lg);
  }
  .module-sidebar.is-open {
    transform: translateX(0);
  }
  .toc-toggle {
    display: flex;
  }
  .module-content {
    grid-column: 1;
    padding: var(--space-lg);
  }
  .module-nav-footer {
    padding: var(--space-md) var(--space-lg);
  }
  .search-kbd { display: none; }
  .brand-subtitle { display: none; }
}

@media (max-width: 600px) {
  .header-inner { padding: 0 var(--space-md); gap: var(--space-sm); }
  .hero { padding: var(--space-xl) var(--space-md); }
  .main-content { padding: var(--space-lg) var(--space-md); }
  .module-grid { grid-template-columns: 1fr; }
  .search-input { width: 160px; }
  .progress-chip { display: none; }
  .module-nav-footer {
    flex-direction: column;
    gap: var(--space-sm);
  }
  .btn-nav { width: 100%; justify-content: center; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   IMPROVEMENTS — Dark Mode, Font Size, Reading Time, Enhanced UX
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Dark Mode ──────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --clr-primary:       #4da3e0;
  --clr-primary-dark:  #2d8bc4;
  --clr-primary-light: #1a3a52;
  --clr-primary-xlt:   #0d2130;
  --clr-accent:        #00c4a7;

  --clr-bg:            #111315;
  --clr-surface:       #1a1d20;
  --clr-surface-2:     #1f2226;
  --clr-border:        #2c3035;
  --clr-border-dark:   #373d45;

  --clr-text:          #e8e6e3;
  --clr-text-2:        #a8a5a1;
  --clr-text-3:        #6b6864;

  --clr-info-bg:       #0d2130;
  --clr-info-border:   #1a3a52;
  --clr-tip-bg:        #0a201c;
  --clr-tip-border:    #124d44;
  --clr-warning-bg:    #201a07;
  --clr-warning-border:#4a3c08;
  --clr-exercise-bg:   #160e26;
  --clr-exercise-border:#3a2460;
  --clr-new-bg:        #0a1f0a;
  --clr-new-border:    #174a17;

  --clr-inline-code-bg:#252930;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.6), 0 4px 8px rgba(0,0,0,.3);
}

[data-theme="dark"] .site-header {
  background: #0f1923;
  border-bottom: 1px solid var(--clr-border-dark);
}

[data-theme="dark"] .hero {
  background: linear-gradient(135deg, #0a1520 0%, #0f2640 60%, #0d1d38 100%);
}

[data-theme="dark"] .search-input {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.15);
}
[data-theme="dark"] .search-input:focus {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.3);
}

[data-theme="dark"] .module-card {
  background: var(--clr-surface);
  border-color: var(--clr-border);
}
[data-theme="dark"] .module-card:hover {
  border-color: var(--clr-primary);
}

[data-theme="dark"] .content-figure img {
  border-color: var(--clr-border-dark);
}

[data-theme="dark"] .code-block-wrapper {
  border-color: #2a2f38;
}

[data-theme="dark"] .content-table th {
  background: #1a3a52;
  color: var(--clr-text);
}

/* ── Theme Toggle Button ─────────────────────────────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 20px;
  color: rgba(255,255,255,.9);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.4);
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ── Font Size Controls ─────────────────────────────────────────────────────── */
.font-size-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px;
  padding: 2px 6px;
}
.font-size-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.85);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-family: var(--font-sans);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.font-size-btn:hover { background: rgba(255,255,255,.2); }
.font-size-btn:disabled { opacity: .35; cursor: not-allowed; }
.font-size-sep {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,.2);
}
.font-size-btn--a-small { font-size: 12px; }
.font-size-btn--a-large { font-size: 17px; }

/* Font size scale applied to content */
[data-font-size="sm"] .content-section { font-size: 14px; }
[data-font-size="md"] .content-section { font-size: 15px; }
[data-font-size="lg"] .content-section { font-size: 17px; }
[data-font-size="xl"] .content-section { font-size: 19px; }

/* ── Reading Time Badge ──────────────────────────────────────────────────────── */
.reading-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--clr-text-3);
  padding: 3px 9px;
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  background: var(--clr-surface-2);
  flex-shrink: 0;
}
.reading-time-badge svg { width: 12px; height: 12px; }

.card-reading-time {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--clr-text-3);
}
.card-reading-time svg { width: 11px; height: 11px; }

/* ── Enhanced Module Header ─────────────────────────────────────────────────── */
.module-page-header {
  padding: var(--space-2xl) var(--space-2xl) var(--space-xl);
  border-bottom: 1px solid var(--clr-border);
  margin-bottom: var(--space-xl);
}

.module-page-header h1 {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 700;
  color: var(--clr-primary-dark);
  line-height: 1.25;
  margin-bottom: var(--space-sm);
}

[data-theme="dark"] .module-page-header h1 {
  color: var(--clr-primary);
}

.module-meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* ── Lightbox Improvements ──────────────────────────────────────────────────── */
.lightbox {
  animation: lb-in .18s ease;
}
@keyframes lb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-toolbar {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
}

.lightbox-btn {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background .15s;
  backdrop-filter: blur(4px);
}
.lightbox-btn:hover { background: rgba(255,255,255,.3); }

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.5);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  backdrop-filter: blur(4px);
}
.lightbox-nav-btn:hover { background: rgba(0,0,0,.75); }
.lightbox-nav-btn--prev { left: 16px; }
.lightbox-nav-btn--next { right: 16px; }
.lightbox-nav-btn svg { width: 22px; height: 22px; }
.lightbox-nav-btn:disabled { opacity: .3; cursor: default; }

.lightbox-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.6);
  color: rgba(255,255,255,.85);
  font-size: 13px;
  padding: 5px 14px;
  border-radius: 16px;
  backdrop-filter: blur(4px);
}

.lightbox-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.lightbox-img-wrap img {
  max-width: 88vw;
  max-height: 84vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  transition: transform .2s ease;
  transform-origin: center;
  cursor: zoom-in;
}

.lightbox-img-wrap img.is-zoomed {
  transform: scale(1.8);
  cursor: zoom-out;
}

/* ── Progress Stats Card on Index ───────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon--blue  { background: var(--clr-primary-xlt);  color: var(--clr-primary); }
.stat-icon--green { background: var(--clr-new-bg);       color: var(--clr-new); }
.stat-icon--teal  { background: var(--clr-tip-bg);       color: var(--clr-tip); }
.stat-icon--purple{ background: var(--clr-exercise-bg);  color: var(--clr-exercise); }

.stat-content { min-width: 0; }
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--clr-text);
  line-height: 1;
  margin-bottom: 3px;
}
.stat-label {
  font-size: 12px;
  color: var(--clr-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Scroll-to-top button ────────────────────────────────────────────────────── */
.scroll-top-btn {
  position: fixed;
  bottom: 80px;
  right: var(--space-lg);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--clr-primary);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  z-index: 89;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .3s, transform .3s, background .15s;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}
.scroll-top-btn.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}
.scroll-top-btn:hover { background: var(--clr-primary-dark); }
.scroll-top-btn svg { width: 18px; height: 18px; }

/* ── Section fade-in animation ──────────────────────────────────────────────── */
@keyframes section-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.content-section {
  animation: section-in .35s ease both;
}
.content-section:nth-child(2)  { animation-delay: .05s; }
.content-section:nth-child(3)  { animation-delay: .10s; }
.content-section:nth-child(4)  { animation-delay: .15s; }
.content-section:nth-child(5)  { animation-delay: .18s; }
.content-section:nth-child(n+6){ animation-delay: .20s; }

/* Respect reduce-motion preference */
@media (prefers-reduced-motion: reduce) {
  .content-section { animation: none; }
  .lightbox { animation: none; }
}

/* ── Sidebar section counter ─────────────────────────────────────────────────── */
.toc-section-link .toc-count {
  margin-left: auto;
  font-size: 10px;
  background: var(--clr-border);
  color: var(--clr-text-3);
  border-radius: 8px;
  padding: 1px 6px;
  flex-shrink: 0;
}
.toc-section-link.is-done .toc-count {
  background: var(--clr-tip-bg);
  color: var(--clr-tip);
}

/* ── Progress ring tooltip in sidebar ──────────────────────────────────────── */
.sidebar-stats {
  text-align: center;
  font-size: 12px;
  color: var(--clr-text-3);
  line-height: 1.5;
}
.sidebar-stats strong {
  display: block;
  font-size: 13px;
  color: var(--clr-text-2);
  font-weight: 600;
  margin-bottom: 2px;
}



/* ── Module card animation ───────────────────────────────────────────────────── */
@keyframes card-in {
  from { opacity: 0; transform: translateY(20px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.module-card {
  animation: card-in .4s ease both;
}

/* ── Keyboard shortcut hint in sidebar ─────────────────────────────────────── */
.sidebar-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-md);
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--clr-text-3);
}
.sidebar-shortcuts-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--clr-text-3);
  margin-bottom: 4px;
}
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.shortcut-row kbd {
  background: var(--clr-border);
  border: 1px solid var(--clr-border-dark);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--clr-text-2);
}

/* ── Search result improvements ────────────────────────────────────────────── */
.search-result-item {
  transition: background .1s, transform .1s;
}
.search-result-item:hover {
  transform: translateX(3px);
}

/* ── Responsive additions ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .font-size-controls { display: none; }
  .module-page-header { padding: var(--space-lg) var(--space-md); }
}

/* ── Print & Screenshot Protection ─────────────────────────────────────────── */
@media print {
  body { display: none !important; }
}

/* ── Resume card (last visited module) ──────────────────────────────────────── */
#resume-card-container { margin-bottom: var(--space-lg); }

.resume-card {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  background: linear-gradient(135deg, var(--clr-primary-dark) 0%, var(--clr-primary) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  box-shadow: var(--shadow-md);
  animation: card-in .4s ease both;
}

.resume-card-icon {
  font-size: 28px;
  flex-shrink: 0;
  opacity: .9;
}

.resume-card-body { flex: 1; min-width: 0; }

.resume-card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .75;
  margin-bottom: 4px;
}

.resume-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resume-card-progress {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 12px;
  opacity: .85;
}

.resume-card-bar {
  flex: 1;
  max-width: 200px;
  height: 4px;
  background: rgba(255,255,255,.3);
  border-radius: 2px;
  overflow: hidden;
}

.resume-card-fill {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  transition: width .5s ease;
}

.resume-card-btn {
  flex-shrink: 0;
  background: #fff;
  color: var(--clr-primary-dark);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: opacity .15s, transform .15s;
  white-space: nowrap;
}
.resume-card-btn:hover { opacity: .9; transform: translateY(-1px); text-decoration: none; }

[data-theme="dark"] .resume-card {
  background: linear-gradient(135deg, #0a1520 0%, #0f2640 100%);
}

@media (max-width: 600px) {
  .resume-card { flex-wrap: wrap; gap: var(--space-md); padding: var(--space-md); }
  .resume-card-btn { width: 100%; text-align: center; }
}

/* ── Diepere TOC niveaus ─────────────────────────────────────────────────── */
/* Niveau 3+ subsecties krijgen een iets kleinere tekst en extra inspringing */
.toc-subsections .toc-subsections .toc-sub-link {
  font-size: 12px;
  padding: 3px 8px;
  border-left-width: 1px;
  color: var(--clr-text-3);
}
.toc-subsections .toc-subsections {
  margin-top: 1px;
  margin-bottom: 1px;
}

/* ── TOC nummering ───────────────────────────────────────────────────────── */
.toc-num {
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--clr-primary);
  opacity: .7;
  flex-shrink: 0;
  letter-spacing: .01em;
  margin-right: 5px;
}
.toc-section-link .toc-num { font-size: 11px; margin-right: 6px; }
.toc-sub-link {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

/* ── Section actions (bookmark + done toggle) ────────────────────────────── */
.section-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* ── Bookmark button ─────────────────────────────────────────────────────── */
.bookmark-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--clr-text-3);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
  display: flex;
  align-items: center;
}
.bookmark-btn svg { width: 18px; height: 18px; }
.bookmark-btn:hover { color: var(--clr-primary); background: var(--clr-primary-xlt); }
.bookmark-btn.is-bookmarked { color: var(--clr-primary); }
.bookmark-btn.is-bookmarked svg { fill: var(--clr-primary); }

/* ── Bookmarks sidebar panel ─────────────────────────────────────────────── */
.bookmarks-section {
  border-top: 1px solid var(--clr-border);
  padding-top: var(--space-md);
}
.bookmarks-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--clr-text-3);
  margin-bottom: var(--space-sm);
}
.bookmarks-title svg { width: 13px; height: 13px; }
.bookmarks-empty { font-size: 12px; color: var(--clr-text-3); padding: 4px 0; }
.bookmark-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--clr-text-2);
  text-decoration: none;
  transition: background .1s;
  line-height: 1.3;
}
.bookmark-item:hover { background: var(--clr-primary-xlt); color: var(--clr-primary); text-decoration: none; }
.bookmark-item svg { margin-top: 2px; }

/* ── Notes area ──────────────────────────────────────────────────────────── */
.notes-area {
  margin-top: var(--space-lg);
  border-top: 1px dashed var(--clr-border);
  padding-top: var(--space-md);
}
.notes-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--clr-text-3);
  padding: 0;
  transition: color .15s;
}
.notes-toggle:hover { color: var(--clr-primary); }
.notes-toggle svg { width: 14px; height: 14px; }
.notes-editor { margin-top: var(--space-sm); }
.notes-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--clr-border-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--clr-text);
  background: var(--clr-surface);
  resize: vertical;
  outline: none;
  line-height: 1.5;
  transition: border-color .15s;
  -webkit-user-select: text !important;
  user-select: text !important;
}
.notes-input:focus { border-color: var(--clr-primary); }
.notes-footer {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}
.notes-display {
  margin-top: var(--space-sm);
  background: var(--clr-primary-xlt);
  border-left: 3px solid var(--clr-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-sm) var(--space-md);
}
.note-text {
  font-size: 14px;
  color: var(--clr-text);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
  white-space: pre-wrap;
  -webkit-user-select: text !important;
  user-select: text !important;
}
.note-edit-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--clr-primary);
  cursor: pointer;
  padding: 0;
  font-family: var(--font-sans);
}
.note-edit-btn:hover { text-decoration: underline; }

[data-theme="dark"] .notes-input { background: var(--clr-surface-2); }
[data-theme="dark"] .notes-display { background: var(--clr-primary-xlt); }

/* ── Welcome screen ──────────────────────────────────────────────────────── */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fade-in .25s ease both;
}
.welcome-overlay.is-hiding {
  animation: fade-out .3s ease both;
}
@keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

.welcome-modal {
  background: var(--clr-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(580px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in .3s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.welcome-overlay.is-hiding .welcome-modal {
  animation: modal-out .25s ease both;
}
@keyframes modal-out {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(.97); }
}

.welcome-header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  border-bottom: 1px solid var(--clr-border);
}
.welcome-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--clr-text);
  margin-bottom: 4px;
  line-height: 1.2;
}
.welcome-subtitle {
  font-size: 13px;
  color: var(--clr-text-3);
}

.welcome-steps {
  padding: var(--space-lg) var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.welcome-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  transition: border-color .15s;
}
.welcome-step:hover { border-color: var(--clr-primary-light); }
.welcome-step-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.welcome-step-icon svg { width: 20px; height: 20px; }
.welcome-step-body strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--clr-text);
  margin-bottom: 3px;
}
.welcome-step-body p {
  font-size: 13px;
  color: var(--clr-text-2);
  line-height: 1.5;
  margin: 0;
}
.welcome-step-body kbd {
  background: var(--clr-border);
  border: 1px solid var(--clr-border-dark);
  border-radius: 3px;
  padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--clr-text-2);
}

.welcome-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--clr-border);
  gap: var(--space-md);
}
.welcome-skip-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--clr-text-3);
  cursor: pointer;
  user-select: none;
}
.welcome-skip-label input { cursor: pointer; }

@media (max-width: 600px) {
  .welcome-header { flex-direction: column; text-align: center; }
  .welcome-footer { flex-direction: column-reverse; }
  .welcome-footer .btn { width: 100%; }
}
