/* sr-only utility (#20) */
.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;
}

/* Hide all marker spans — prevent FOUC (#8) */
.callout-start, .callout-end,
.tab-group-start, .tab-group-end, .tab-start, .tab-end,
.steps-start, .steps-end, .step-marker, .step-end,
.card-group-start, .card-group-end, .card-start, .card-end,
.platform-availability { display: none; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  font-size: 0.8em;
  font-weight: 500;
  margin: 0.1em 0.2em;
  text-decoration: none;
}

.badge a {
  text-decoration: none;
  color: inherit;
}

.badge-source {
  background: #e3f2fd;
  color: #1565c0;
}

.badge-type {
  background: #f3e5f5;
  color: #7b1fa2;
}

.badge-topic {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-difficulty.badge-beginner {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-difficulty.badge-intermediate {
  background: #fff3e0;
  color: #e65100;
}

.badge-difficulty.badge-advanced {
  background: #fce4ec;
  color: #c62828;
}

.badge-article {
  background: #fff3e0;
  color: #e65100;
  font-weight: 600;
  border: 1px solid #ffb74d;
}

.artifact-author {
  margin: 0.5em 0;
  font-size: 0.9em;
  color: var(--gray-500);
}

/* Artifact page */
.artifact-action {
  margin: 1em 0;
}

.artifact-meta {
  margin: 1em 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em;
}

.artifact-summary {
  margin: 1em 0;
  padding: 0.75em 1em;
  background: var(--gray-100);
  border-left: 3px solid var(--color-link);
  border-radius: 3px;
}

.artifact-source-label {
  margin: 0.5em 0;
  font-size: 0.9em;
  color: var(--gray-500);
}

.artifact-notes {
  margin: 1.5em 0;
}

.artifact-paths {
  margin: 1.5em 0;
  padding: 1em;
  background: var(--gray-100);
  border-radius: 4px;
}

.artifact-verified {
  margin-top: 2em;
  color: var(--gray-500);
}

.external-link-icon {
  font-size: 0.6em;
  vertical-align: super;
  text-decoration: none;
}

/* Learning paths */
.path-meta {
  margin: 1em 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  align-items: center;
}

.path-hours, .path-step-count {
  font-size: 0.85em;
  color: var(--gray-500);
}

.path-prereqs {
  margin: 1em 0;
  padding: 0.75em 1em;
  background: #fff8e1;
  border-radius: 4px;
}

.step-list {
  counter-reset: step-counter;
}

.step-item {
  margin: 1em 0;
  padding: 0.75em 1em;
  background: var(--gray-100);
  border-radius: 4px;
  border-left: 3px solid var(--color-link);
}

.step-summary {
  font-size: 0.9em;
  color: var(--gray-500);
  margin: 0.3em 0;
}

.step-note {
  font-size: 0.85em;
  font-style: italic;
  color: var(--gray-600);
  margin: 0.3em 0;
  padding-left: 0.5em;
  border-left: 2px solid var(--gray-300);
}

.step-missing {
  color: #c62828;
  font-style: italic;
}

/* Audience callout on paths page */
.paths-audience-callout {
  margin: 0 0 1.5em;
  padding: 0.8em 1.2em;
  background: #e8eaf6;
  border-left: 4px solid #5c6bc0;
  border-radius: 4px;
  font-size: 0.95em;
}

.paths-audience-callout a {
  font-weight: 600;
  text-decoration: underline;
}

/* Path group headings */
.paths-group-heading {
  margin: 1.5em 0 0.5em;
  padding-bottom: 0.3em;
  border-bottom: 2px solid var(--gray-200);
  font-size: 1.3em;
}

.paths-group-heading:first-of-type {
  margin-top: 0.5em;
}

/* Path cards */
.paths-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1em;
  margin: 1em 0;
}

.path-card {
  padding: 1em;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
}

.path-card h3 {
  margin-top: 0;
}

.path-card-meta {
  display: flex;
  gap: 0.5em;
  align-items: center;
  margin-bottom: 0.5em;
}

.path-card-topics {
  margin-bottom: 0.5em;
}

/* ── Courses ─────────────────────────────────────────────────────── */

/* Audience callout */
.courses-audience-callout {
  margin: 0 0 1.5em;
  padding: 0.8em 1.2em;
  background: #e0f2f1;
  border-left: 4px solid #00897b;
  border-radius: 4px;
  font-size: 0.95em;
}

.courses-audience-callout a {
  font-weight: 600;
  text-decoration: underline;
}

/* Filter bar */
.course-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  align-items: center;
  margin: 0 0 1.5em;
  padding: 0.6em 0;
}

.course-filter-btn {
  padding: 0.3em 0.7em;
  border: 1px solid var(--gray-200);
  border-radius: 3px;
  background: none;
  cursor: pointer;
  font-size: 0.85em;
  color: var(--body-font-color);
}

.course-filter-btn:hover {
  background: var(--gray-100);
}

.course-filter-btn.active {
  background: var(--color-link);
  color: #fff;
  border-color: var(--color-link);
}

.course-filter-sep {
  color: var(--gray-300);
  margin: 0 0.2em;
}

/* Group headings */
.courses-group-heading {
  margin: 1.5em 0 0.5em;
  padding-bottom: 0.3em;
  border-bottom: 2px solid var(--gray-200);
  font-size: 1.3em;
}

.courses-group-heading:first-of-type {
  margin-top: 0.5em;
}

/* Course cards grid */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1em;
  margin: 1em 0;
}

.course-card {
  padding: 1em;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
}

.course-card h3 {
  margin-top: 0;
}

.course-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  align-items: center;
  margin-bottom: 0.4em;
}

.course-card-extras {
  display: flex;
  gap: 0.4em;
  margin-bottom: 0.4em;
}

.course-card-topics {
  margin-bottom: 0.5em;
}

.course-hours {
  font-size: 0.85em;
  color: var(--gray-500);
}

/* Course badges */
.badge-platform {
  background: #e0f2f1;
  color: #00695c;
}

.badge-cost-free {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-cost-freemium {
  background: #fff3e0;
  color: #e65100;
}

.badge-cost-paid {
  background: #fce4ec;
  color: #c62828;
}

.badge-format {
  background: #f3e5f5;
  color: #7b1fa2;
  font-size: 0.75em;
}

.badge-certification {
  background: #fff8e1;
  color: #f9a825;
  border: 1px solid #fdd835;
  font-size: 0.75em;
}

/* Single course page */
.course-meta {
  margin: 1em 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  align-items: center;
}

.course-cost-detail {
  font-size: 0.9em;
  color: var(--gray-500);
  margin: 0.5em 0;
}

.course-prereqs {
  margin: 1em 0;
  padding: 0.75em 1em;
  background: #fff8e1;
  border-radius: 4px;
}

.course-description {
  margin: 1.5em 0;
}

.course-action {
  margin: 1.5em 0;
}

.course-enroll-btn {
  display: inline-block;
  padding: 0.6em 1.5em;
  background: #1565c0;
  color: #ffffff !important;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
}

.course-enroll-btn:hover {
  background: #0d47a1;
  text-decoration: none;
  color: #ffffff !important;
}

.course-related-paths {
  margin: 1.5em 0;
  padding: 1em;
  background: var(--gray-100);
  border-radius: 4px;
}

/* Pagefind — fix text visibility in both light and dark modes */
.pagefind-search {
  margin: 1em 0;
}

.pagefind-ui__result-link {
  color: var(--color-link) !important;
}

.pagefind-ui__result-excerpt {
  color: var(--body-font-color) !important;
}

.pagefind-ui__result-title {
  color: var(--body-font-color) !important;
}

.pagefind-ui__message {
  color: var(--body-font-color) !important;
}

.pagefind-ui__search-input {
  color: var(--body-font-color) !important;
  background: var(--body-background) !important;
  border: 1px solid var(--gray-200) !important;
}

.pagefind-ui__result {
  border-top-color: var(--gray-200) !important;
}

.pagefind-ui__filter-panel {
  color: var(--body-font-color) !important;
}

.pagefind-ui__filter-name {
  color: var(--body-font-color) !important;
}

.pagefind-ui mark {
  color: var(--body-font-color) !important;
  background: #fff3cd !important;
}

/* Divider between editorial notes and original docs */
.artifact-content-divider {
  margin: 2em 0 0.5em;
  border: none;
  border-top: 2px solid var(--gray-200);
}

/* Embedded docs */
.artifact-embed {
  margin: 1.5em 0;
  position: relative;
}

.artifact-embed-iframe {
  width: 100%;
  height: 80vh;
  min-height: 600px;
  border: none;
  display: block;
  border-radius: 4px;
}

.artifact-embed-loading {
  text-align: center;
  padding: 0.75em;
  font-size: 0.9em;
  color: var(--gray-500);
}

.artifact-embed-error {
  color: #c62828;
}

/* Freshness notice */
.artifact-freshness {
  margin: 1em 0;
  padding: 0.5em 1em;
  background: var(--gray-100);
  border-radius: 3px;
  font-size: 0.85em;
  color: var(--gray-500);
}

.artifact-freshness a {
  color: var(--color-link);
}

/* Path progress bar */
.path-progress-bar {
  position: relative;
  background: var(--gray-100);
  border-radius: 4px;
  height: 28px;
  margin: 1em 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #4caf50;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8em;
  font-weight: 500;
  color: var(--body-font-color);
}

.step-checkbox {
  margin-right: 0.5em;
  cursor: pointer;
  vertical-align: middle;
}

.step-item.completed {
  opacity: 0.6;
  border-left-color: #4caf50;
}

/* Code block overflow safety net. The theme sets overflow-x: auto on pre,
   but remote content containers can be narrower; belt-and-suspenders. */
.artifact-remote-content pre {
  overflow-x: auto;
  max-width: 100%;
}

/* Recovered content (from fixFalseCodeBlocks in components.js): when a
   pre/code block is unwrapped back to prose, style it as a plain paragraph. */
.artifact-remote-content .recovered-content {
  margin: 1em 0;
  line-height: 1.6;
}

/* Collapsible sections (from <section title="...">) */
.artifact-remote-content details.collapsible-section {
  margin: 1em 0;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.artifact-remote-content details.collapsible-section > summary {
  cursor: pointer;
  padding: 0.6em 1em;
  background: var(--gray-100);
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.artifact-remote-content details.collapsible-section > summary::before {
  content: "\25B6";
  font-size: 0.7em;
  transition: transform 0.2s;
}

.artifact-remote-content details.collapsible-section[open] > summary::before {
  transform: rotate(90deg);
}

.artifact-remote-content details.collapsible-section > summary::-webkit-details-marker {
  display: none;
}

.artifact-remote-content details.collapsible-section > *:not(summary) {
  padding: 0 1em;
}

/* Callout boxes */
.artifact-remote-content .callout {
  margin: 1em 0;
  padding: 0.75em 1em;
  border-radius: 4px;
  border-left: 3px solid;
}

.artifact-remote-content .callout-title {
  font-weight: 600;
  margin: 0 0 0.25em 0;
  font-size: 0.9em;
}

.callout-tip {
  background: #e8f5e9;
  border-left-color: #4caf50;
}
.callout-tip .callout-title { color: #2e7d32; }

.callout-note {
  background: #e3f2fd;
  border-left-color: #2196f3;
}
.callout-note .callout-title { color: #1565c0; }

.callout-info {
  background: #e8eaf6;
  border-left-color: #5c6bc0;
}
.callout-info .callout-title { color: #283593; }

.callout-warning {
  background: #fff3e0;
  border-left-color: #ff9800;
}
.callout-warning .callout-title { color: #e65100; }

.callout-check {
  background: #e8f5e9;
  border-left-color: #4caf50;
}
.callout-check .callout-title { color: #2e7d32; }

/* Callout important (#4c) */
.callout-important {
  background: #f3e5f5;
  border-left-color: #9c27b0;
}
.callout-important .callout-title { color: #7b1fa2; }

/* Tabs */
.artifact-remote-content .tabs-container {
  margin: 1em 0;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.artifact-remote-content .tabs-bar {
  display: flex;
  overflow-x: auto;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
}

.artifact-remote-content .tab-button {
  padding: 0.5em 1em;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  color: var(--body-font-color);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
}

.artifact-remote-content .tab-button:hover {
  background: var(--gray-200);
}

.artifact-remote-content .tab-button.active {
  border-bottom-color: var(--color-link);
  color: var(--color-link);
}

/* Tab focus-visible (#17) */
.artifact-remote-content .tab-button:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: -2px;
}

.artifact-remote-content .tab-panel {
  padding: 1em;
}

/* Steps (MDX component — distinct from learning path steps) */
.artifact-remote-content .steps-container {
  margin: 1em 0;
  padding-left: 2em;
  border-left: 2px solid var(--gray-200);
}

.artifact-remote-content .mdx-step-block {
  position: relative;
  margin: 1.5em 0;
  padding-bottom: 0.5em;
}

.artifact-remote-content .mdx-step-number {
  position: absolute;
  left: -2.65em;
  top: 0;
  min-width: 1.6em;
  height: 1.6em;
  border-radius: 50%;
  background: var(--color-link);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  font-weight: 600;
}

.artifact-remote-content .mdx-step-title {
  margin: 0 0 0.5em 0;
  font-size: 1.1em;
}

.artifact-remote-content .mdx-step-body {
  font-size: 0.95em;
}

/* Cards (#23) */
.artifact-remote-content .card-grid {
  display: grid;
  gap: 1em;
  margin: 1em 0;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.artifact-remote-content .card-grid[data-cols="3"] {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.artifact-remote-content .card-grid[data-cols="4"] {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.artifact-remote-content .doc-card {
  display: block;
  padding: 1em;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  text-decoration: none;
  color: var(--body-font-color);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.artifact-remote-content a.doc-card:hover {
  border-color: var(--color-link);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}

.artifact-remote-content .doc-card-title {
  font-weight: 600;
  margin-bottom: 0.5em;
  color: var(--color-link);
}

.artifact-remote-content .doc-card-body {
  font-size: 0.9em;
  color: var(--gray-500);
}

.artifact-remote-content .doc-card-body p {
  margin: 0.25em 0;
}

/* Tooltips */
.artifact-remote-content .tooltip-text {
  border-bottom: 1px dotted var(--gray-500);
  cursor: help;
}

/* Platform availability badges */
.artifact-remote-content .platform-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin: 0.75em 0;
}

.artifact-remote-content .platform-badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 3px;
  font-size: 0.8em;
  font-weight: 500;
}

/* Component placeholder */
.artifact-remote-content .component-placeholder {
  margin: 1em 0;
  padding: 0.75em 1em;
  border: 1px dashed var(--gray-200);
  border-radius: 4px;
  color: var(--gray-500);
  font-size: 0.9em;
}

/* Card grid responsive */
@media (max-width: 600px) {
  .artifact-remote-content .card-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Sidebar: un-collapse sections so content is visible */
.book-menu nav ul li.book-section-flat > a + ul {
  display: block;
}

/* ── Dark mode (#7, #14) ── */
@media (prefers-color-scheme: dark) {
  /* Badges */
  .badge-source {
    background: #1a3a5c;
    color: #90caf9;
  }
  .badge-type {
    background: #3a1a4c;
    color: #ce93d8;
  }
  .badge-topic {
    background: #1a3a1a;
    color: #a5d6a7;
  }
  .badge-difficulty.badge-beginner {
    background: #1a3a1a;
    color: #a5d6a7;
  }
  .badge-difficulty.badge-intermediate {
    background: #3a2a0a;
    color: #ffcc80;
  }
  .badge-difficulty.badge-advanced {
    background: #3a1a1a;
    color: #ef9a9a;
  }
  .badge-article {
    background: #3a2a0a;
    color: #ffcc80;
    border-color: #8a6d3b;
  }

  /* Callouts */
  .callout-tip {
    background: #1b3a1b;
    border-left-color: #4caf50;
  }
  .callout-tip .callout-title { color: #81c784; }

  .callout-note {
    background: #1a2a3a;
    border-left-color: #2196f3;
  }
  .callout-note .callout-title { color: #64b5f6; }

  .callout-info {
    background: #1a1a3a;
    border-left-color: #5c6bc0;
  }
  .callout-info .callout-title { color: #9fa8da; }

  .callout-warning {
    background: #3a2a0a;
    border-left-color: #ff9800;
  }
  .callout-warning .callout-title { color: #ffb74d; }

  .callout-check {
    background: #1b3a1b;
    border-left-color: #4caf50;
  }
  .callout-check .callout-title { color: #81c784; }

  .callout-important {
    background: #2a1a3a;
    border-left-color: #9c27b0;
  }
  .callout-important .callout-title { color: #ce93d8; }

  /* Course badges (dark) */
  .badge-platform {
    background: #0a3a3a;
    color: #80cbc4;
  }
  .badge-cost-free {
    background: #1a3a1a;
    color: #a5d6a7;
  }
  .badge-cost-freemium {
    background: #3a2a0a;
    color: #ffcc80;
  }
  .badge-cost-paid {
    background: #3a1a1a;
    color: #ef9a9a;
  }
  .badge-format {
    background: #2a1a3a;
    color: #ce93d8;
  }
  .badge-certification {
    background: #3a3a0a;
    color: #fff176;
    border-color: #8a8a3b;
  }
  .courses-audience-callout {
    background: #0a3a3a;
    border-left-color: #4db6ac;
  }
  .course-prereqs {
    background: #3a2a0a;
  }

  /* Audience callout (dark) */
  .paths-audience-callout {
    background: #1a1a3a;
    border-left-color: #7986cb;
  }

  /* Path prereqs (#14) */
  .path-prereqs {
    background: #3a2a0a;
  }

  /* Platform badges */
  .artifact-remote-content .platform-badge {
    filter: brightness(0.8);
  }

  /* Card hover shadow */
  .artifact-remote-content a.doc-card:hover {
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.08);
  }

  /* Syntax-highlighted code blocks: Hugo Chroma uses inline background-color:#f7f7f7
     on <pre> and inline color on some <span>s but NOT all tokens. Unstyled tokens
     inherit --body-font-color which in dark mode is light (#e9ecef) — nearly
     invisible on the light #f7f7f7 background. Force dark text on these blocks. */
  .highlight pre,
  .highlight code,
  .artifact-remote-content pre[style*="background-color"],
  .artifact-remote-content pre[style*="background-color"] code {
    color: #1f2328 !important;
  }

  /* Pagefind */
  .pagefind-ui mark {
    background: #5a4800 !important;
    color: #fff !important;
  }
  .pagefind-ui__search-input {
    background: var(--body-background) !important;
    color: var(--body-font-color) !important;
  }
  .firebase-sign-in-btn {
    background: #3367d6;
  }
  .firebase-sign-in-btn:hover {
    background: #2851a3;
  }
  #firebase-sign-out {
    color: var(--gray-400);
  }
  .firebase-auth-widget {
    background: var(--body-background, #1a1a1a);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
}

/* ── Firebase auth widget ─────────────────────────────────────────── */

.firebase-auth-widget {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  padding: 0.5em 1em;
  font-size: 0.85em;
  background: var(--body-background, #fff);
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.firebase-sign-in-btn {
  background: #4285f4;
  color: white;
  border: none;
  padding: 0.4em 0.8em;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.9em;
}

.firebase-sign-in-btn:hover {
  background: #3367d6;
}

.firebase-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  vertical-align: middle;
}

#firebase-user-info {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

#firebase-user-name {
  font-size: 0.9em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

#firebase-sign-out {
  font-size: 0.85em;
  color: var(--gray-500);
  margin-left: auto;
}

/* ── Artifact read checkbox ───────────────────────────────────────── */

.artifact-read-status {
  margin: 0.5em 0;
}

.artifact-read-status label {
  cursor: pointer;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 0.4em;
  color: var(--gray-500);
}

/* ── Sidebar menu dividers ─────────────────────────────────────────── */

.menu-divider {
  border: none;
  border-top: 1px solid var(--gray-200, #e0e0e0);
  margin: 0.5em 0;
}

/* ── Path list card progress ───────────────────────────────────────── */

.path-card-progress {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: 0.4em 0;
}

.path-card-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--gray-200, #e0e0e0);
  border-radius: 3px;
  overflow: hidden;
}

.path-card-progress-fill {
  height: 100%;
  background: #4caf50;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.path-card-progress-text {
  font-size: 0.8em;
  color: var(--gray-500);
  white-space: nowrap;
}

.path-card-complete .path-card-progress-text {
  color: #4caf50;
  font-weight: 500;
}

.artifact-read-status .read-badge {
  color: #4caf50;
  font-weight: 500;
}
