/* =============================================================================
   Rasmah docs — clean stylesheet
   Applied by docs/transform.py to the Documenter-built HTML after stripping the
   Documenter/Bulma classes. Matches the landing page (rasmah.ai) and the Quarto
   tutorials (dark, minimal, floating sidebar with scroll-spy).

   Design tokens:
     background  #05070b   surface  #0b0f16   surface-2  rgba(255,255,255,0.03)
     border      rgba(255,255,255,0.10)
     text        #cbd5e1   strong   #ffffff   muted   #94a3b8   faint   #64748b
     accent      #2f9e44   (hover)  #34d399
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #05070b;
  --surface: #0b0f16;
  --surface-2: rgba(255, 255, 255, 0.03);
  --surface-3: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #cbd5e1;
  --text-strong: #ffffff;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --accent: #2f9e44;
  --accent-soft: #34d399;
  --cyan: #67e8f9;
  --teal: #5eead4;
  --emerald-light: #6ee7b7;
  --red: #c93a3a;
  --green: #2f9e44;
  --purple: #7a5af8;
  --gradient: linear-gradient(90deg, #2f9e44 0%, #c93a3a 50%, #7a5af8 100%);
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JuliaMono", "Menlo", "Consolas",
    monospace;

  /* VTK.js viewer theming (dark, on-brand). The viewer reads these as its
     `data-theme="dark"` tokens; the light theme uses the viewer's built-in
     defaults. */
  --rasmah-vtk-bg-dark: var(--surface);
  --rasmah-vtk-bar-bg-dark: var(--surface);
  --rasmah-vtk-view-bg-dark: var(--bg);
  --rasmah-vtk-border-dark: var(--border);
  --rasmah-vtk-border-strong-dark: var(--border-strong);
  --rasmah-vtk-text-dark: var(--text);
  --rasmah-vtk-text-dim-dark: var(--text-muted);
  --rasmah-vtk-text-strong-dark: var(--text-strong);
  --rasmah-vtk-accent-dark: var(--accent);
  --rasmah-vtk-accent-text-dark: #05070b;
  --rasmah-vtk-hover-dark: var(--surface-3);
  --rasmah-vtk-scene-bg-dark: #0b0f16;
}

* { box-sizing: border-box; }

html { color-scheme: dark; scroll-padding-top: 4rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(122, 90, 248, 0.35); color: #fff; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-soft); }

/* ── Top bar ──────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 3.5rem;
  background: rgba(5, 7, 11, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 84rem;
  margin: 0 auto;
  height: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
}
.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-strong);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  justify-self: start;
}
.topbar-brand img { height: 1.6rem; width: auto; border-radius: 0.3rem; }
.topbar-brand:hover { color: var(--text-strong); }
/* Centered search bar in the top bar (moved out of the sidebar). */
.topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 26rem;
  justify-self: center;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.topbar-search:hover { border-color: var(--border-strong); color: var(--text-strong); }
.topbar-search i { color: var(--text-faint); font-size: 0.8rem; }
.topbar-search kbd {
  margin-left: auto;
  font-family: var(--font-sans);
  color: var(--text-faint);
  font-size: 0.7em;
}
.topbar-nav { display: flex; align-items: center; gap: 0.25rem; justify-self: end; }
.topbar-link {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.topbar-link:hover { color: var(--text-strong); background: var(--surface-2); }
.topbar-btn { color: #fff; font-weight: 600; }
.topbar-btn:hover { color: #fff; }
.topbar-green { background: var(--green); }
.topbar-green:hover { background: #3cb556; }
.topbar-red { background: var(--red); }
.topbar-red:hover { background: #d94a4a; }
.topbar-purple { background: var(--purple); }
.topbar-purple:hover { background: #8a6df8; }

/* ── Page layout: nav (left) + content (center) + TOC (right) ────────── */
.page {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr) 15rem;
  max-width: 84rem;
  margin: 0 auto;
}
/* Tutorial pages: no left nav — content + right TOC. */
.page.tutorial {
  grid-template-columns: minmax(0, 1fr) 15rem;
}
.page.tutorial .content { grid-column: 1; padding-left: 2.5rem; }
.page.tutorial .doc { max-width: none; }
.page.tutorial .toc-sidebar { grid-column: 2; }
.page.landing .doc h1 { text-align: center; }

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
  grid-column: 1;
  position: sticky;
  top: 3.5rem;
  height: calc(100vh - 3.5rem);
  overflow-y: auto;
  padding: 1.5rem 1.25rem 2.5rem;
  border-right: 1px solid var(--border);
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.sidebar-nav .menu {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  font-size: 0.82rem;
}
.menu-item { margin: 0; }

.menu-section {
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.9rem 0.75rem 0.3rem;
  cursor: pointer;
}
.menu-section::after {
  content: "▾";
  float: right;
  font-size: 0.7rem;
  color: var(--text-faint);
  transition: transform 0.2s ease;
}
.menu-section[aria-expanded="false"]::after { transform: rotate(-90deg); }

.menu-sub {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.9rem;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}
.menu-sub.open { max-height: 40rem; }

.menu-link {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 0.2rem 0.75rem;
  transition: color 0.15s ease;
}
.menu-link:hover { color: var(--text-strong); }
.menu-item > .menu-link {
  color: var(--text);
  font-weight: 600;
}
.menu-link.active { color: var(--emerald-light); font-weight: 600; }

/* ── "On this page" TOC (right margin, scroll-spy) ───────────────────── */
.toc-sidebar {
  grid-column: 3;
  position: sticky;
  top: 3.5rem;
  height: calc(100vh - 3.5rem);
  overflow-y: auto;
  padding: 1.5rem 1.25rem 2.5rem;
  border-left: 1px solid var(--border);
}
.toc-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 0 0 0.4rem;
  padding: 0 0.75rem 0.4rem;
  border-bottom: 1px solid var(--border);
}
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border);
}
.toc-item { margin: 0; }
.toc-link {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 0.2rem 0.75rem;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.toc-link:hover { color: var(--text-strong); }
.toc-link.active {
  color: var(--emerald-light);
  font-weight: 600;
  border-left-color: var(--accent);
}
/* Landing page TOC: white text; the highlighted (active) name + its line take
   the subsection colour. */
.page.landing .toc-link { color: var(--text-strong); }
.page.landing .toc-list .toc-item:nth-child(3n + 1) .toc-link.active { color: var(--green); border-left-color: var(--green); }
.page.landing .toc-list .toc-item:nth-child(3n + 2) .toc-link.active { color: var(--red); border-left-color: var(--red); }
.page.landing .toc-list .toc-item:nth-child(3n) .toc-link.active { color: var(--purple); border-left-color: var(--purple); }
.toc-h3 .toc-link { padding-left: 1.4rem; font-size: 0.78rem; }

/* ── Content ──────────────────────────────────────────────────────────── */
.content {
  grid-column: 2;
  padding: 2rem 1.75rem 4rem;
  min-width: 0;
}
.doc { max-width: 52rem; }

.doc h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  margin: 0.5rem 0 1.5rem;
}
.doc h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.02em;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.doc h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-strong);
  margin: 2rem 0 0.5rem;
}
.doc h4, .doc h5, .doc h6 {
  font-weight: 600;
  color: var(--text-strong);
  margin: 1.5rem 0 0.5rem;
}
.doc p { margin: 0.75rem 0; }
.doc img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
}
.doc ul, .doc ol { padding-left: 1.5rem; margin: 0.75rem 0; }
.doc li { margin: 0.25rem 0; }
.doc blockquote {
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--border-strong);
  color: var(--text-muted);
}

/* Heading anchors — subtle permalink on hover. */
.doc .docs-heading-anchor { color: inherit; }
.doc .docs-heading-anchor-permalink {
  color: var(--text-faint);
  opacity: 0;
  font-size: 0.85em;
  margin-left: 0.35rem;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.doc .docs-heading-anchor-permalink::after { content: "#"; }
.doc h1:hover .docs-heading-anchor-permalink,
.doc h2:hover .docs-heading-anchor-permalink,
.doc h3:hover .docs-heading-anchor-permalink,
.doc h4:hover .docs-heading-anchor-permalink,
.doc h5:hover .docs-heading-anchor-permalink,
.doc h6:hover .docs-heading-anchor-permalink { opacity: 1; }

/* Inline code */
.doc code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  color: var(--emerald-light);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

/* ── Code blocks ──────────────────────────────────────────────────────── */
.doc pre {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
}
.doc pre code {
  font-family: var(--font-mono);
  background: transparent;
  color: var(--text);
  padding: 0;
}

/* Copy-to-clipboard button (added by Documenter's JS) — top-right corner. */
.doc pre .copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.3rem 0.45rem;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.doc pre:hover .copy-button { opacity: 1; }
.doc pre .copy-button:hover { color: var(--text-strong); }

/* DocumenterCodeBlocks line numbers */
.doc .code-lines { display: table; }
.doc .line { display: table-row; }
.doc .line-num {
  display: table-cell;
  color: var(--text-faint);
  text-align: right;
  padding-right: 1rem;
  user-select: none;
  -webkit-user-select: none;
}

/* Code highlighting (highlight.js) — matches the Quarto/Pandoc palette. */
.doc pre code.hljs { color: var(--text); }
.hljs-keyword, .hljs-built_in, .hljs-type { color: var(--emerald-light); }
.hljs-string { color: var(--teal); }
.hljs-number, .hljs-literal, .hljs-symbol { color: var(--cyan); }
.hljs-comment { color: var(--text-faint); font-style: italic; }
.hljs-meta { color: #c4b5fd; }
.hljs-title, .hljs-title.function_, .hljs-function .hljs-title { color: #e2e8f0; }
.hljs-operator, .hljs-punctuation { color: var(--text-muted); }
.hljs-params, .hljs-variable { color: var(--text); }

/* ── Docstrings ───────────────────────────────────────────────────────── */
.doc article { margin: 1rem 0; }
.doc details.docstring {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0.75rem;
  padding: 0.9rem 1.1rem;
  margin: 0.75rem 0;
}
.doc details.docstring > summary {
  cursor: pointer;
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  list-style: none;
}
.doc details.docstring > summary::-webkit-details-marker { display: none; }
.doc details.docstring > summary .docstring-binding code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--emerald-light);
}
.doc details.docstring > summary .docstring-category {
  color: var(--text-faint);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.doc details.docstring > section { margin-top: 0.6rem; }
.doc details.docstring > section > a.docs-sourcelink {
  color: var(--text-faint);
  font-size: 0.75rem;
  text-decoration: none;
}
.doc details.docstring > section > a.docs-sourcelink:hover { color: var(--accent-soft); }

/* ── Admonitions ──────────────────────────────────────────────────────── */
.doc .admonition {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}
.doc .admonition .admonition-title {
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 0.25rem;
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.doc table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.doc th, .doc td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  color: var(--text);
  text-align: left;
}
.doc thead th {
  color: var(--text-strong);
  background: var(--surface-2);
  font-weight: 600;
}

/* ── Unified search (docs + tutorials, Pagefind-backed) ─────────────────
   The search box and command-palette results box are rendered by rasmah.js.
   Only the *index and search function* come from Pagefind; this UI is ours. */

.rasmah-find {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}
.rasmah-find.is-open {
  display: block;
}

.rasmah-find-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 11, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.rasmah-find-dialog {
  position: absolute;
  top: 12vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(100% - 2rem, 44rem);
  max-height: min(72vh, 48rem);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
/* Three-colour brand gradient hairline along the top edge. */
.rasmah-find-dialog::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient);
  opacity: 0.85;
  z-index: 1;
}

.rasmah-find-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.rasmah-find-head > i {
  color: var(--text-muted);
  font-size: 0.95rem;
  flex-shrink: 0;
}
.rasmah-find-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-strong);
  font-family: var(--font-sans);
  font-size: 1.15rem;
  caret-color: var(--purple);
}
.rasmah-find-input::placeholder {
  color: var(--text-faint);
}
.rasmah-find-input:focus {
  outline: none;
}
.rasmah-find-close {
  flex-shrink: 0;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 0.35rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.rasmah-find-close:hover {
  color: var(--text-strong);
  border-color: var(--border-strong);
}

.rasmah-find-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.5rem;
}
.rasmah-find-body::-webkit-scrollbar {
  width: 8px;
}
.rasmah-find-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.rasmah-find-result {
  display: block;
  padding: 0.65rem 0.8rem;
  border-radius: 0.6rem;
  color: var(--text);
  text-decoration: none;
  transition: background-color 0.12s ease;
}
.rasmah-find-result:hover,
.rasmah-find-result.is-active {
  background: var(--surface-2);
}
.rasmah-find-result-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.rasmah-find-result-title {
  color: var(--text-strong);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.rasmah-find-result-badge {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.55rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  color: var(--text-faint);
}
.rasmah-find-result-badge.documentation {
  color: var(--emerald-light);
  border-color: rgba(52, 211, 153, 0.35);
}
.rasmah-find-result-badge.tutorials {
  color: #e07b7b;
  border-color: rgba(201, 58, 58, 0.4);
}
.rasmah-find-result-excerpt {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.rasmah-find-result-excerpt mark,
.rasmah-find mark {
  background: rgba(52, 211, 153, 0.25);
  color: #fff;
  border-radius: 0.2rem;
  padding: 0 0.1em;
}

.rasmah-find-empty {
  padding: 2.25rem 1rem;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.9rem;
}

.rasmah-find-footer {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.72rem;
  flex-shrink: 0;
}
.rasmah-find-footer span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.rasmah-find-footer kbd {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 0.3rem;
  padding: 0.05rem 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Lock body scroll while the palette is open. */
body.rasmah-find-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  .rasmah-find-dialog {
    top: 6vh;
    max-height: 84vh;
  }
  .rasmah-find-footer {
    display: none;
  }
}

/* ── Footer ───────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
.site-footer-inner {
  max-width: 84rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.site-footer-copy {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.78rem;
  white-space: nowrap;
}
.site-footer-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.site-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-strong);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}
.site-footer-brand img { height: 1.4rem; width: auto; border-radius: 0.3rem; }
.site-footer-tag {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    grid-column: 1;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .toc-sidebar { display: none; }
  .content { grid-column: 1; padding: 1.5rem 1.25rem 3rem; }
}

/* ═════════════════════════════════════════════════════════════════════
   Tutorials (transformed Quarto pages — shared with the docs stylesheet)
   ═════════════════════════════════════════════════════════════════════ */

/* Pandoc skylighting token palette (Quarto code blocks). */
code span.al { color: #fca5a5; }
code span.an { color: var(--text-muted); }
code span.at { color: var(--cyan); }
code span.bn { color: var(--cyan); }
code span.bu { color: var(--emerald-light); }
code span.cf { color: var(--emerald-light); font-weight: 700; }
code span.ch { color: var(--teal); }
code span.cn { color: var(--cyan); }
code span.co { color: var(--text-faint); font-style: italic; }
code span.cv { color: var(--text-faint); font-style: italic; }
code span.do { color: var(--text-faint); font-style: italic; }
code span.dt { color: var(--cyan); }
code span.dv { color: var(--cyan); }
code span.er { color: #f87171; }
code span.ex { color: var(--text); }
code span.fl { color: var(--cyan); }
code span.fu { color: #e2e8f0; }
code span.im { color: var(--emerald-light); }
code span.in { color: var(--text-muted); }
code span.kw { color: var(--emerald-light); font-weight: 700; }
code span.op { color: var(--text-muted); }
code span.ot { color: var(--text); }
code span.pp { color: var(--emerald-light); }
code span.sc { color: var(--teal); }
code span.ss { color: var(--teal); }
code span.st { color: var(--teal); }
code span.va { color: var(--text); }
code span.vs { color: var(--teal); }
code span.wa { color: #fbbf24; font-style: italic; }

/* Quarto code cells and outputs. */
.doc .cell { margin: 1rem 0; }
.doc .cell .sourceCode { margin: 0; }
.doc .cell .code-copy-button {
  display: none;
}
.doc .cell-output {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.doc .cell-output pre {
  margin: 0.5rem 0;
}

/* Tutorial landing page: hero + card grid. */
.hero-section {
  margin: 0 0 2rem;
  text-align: center;
}
.hero-section p {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0;
}
.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.tutorial-card {
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.2s ease;
}
/* Alternate the card accent line per subsection: green → red → purple → … */
section.level2:nth-of-type(3n + 1) .tutorial-card { border-left-color: var(--green); }
section.level2:nth-of-type(3n + 2) .tutorial-card { border-left-color: var(--red); }
section.level2:nth-of-type(3n) .tutorial-card { border-left-color: var(--purple); }
/* Hover highlight matches the subsection colour. */
section.level2:nth-of-type(3n + 1) .tutorial-card:hover { border-color: rgba(47, 158, 68, 0.4); border-left-color: var(--green); }
section.level2:nth-of-type(3n + 2) .tutorial-card:hover { border-color: rgba(201, 58, 58, 0.4); border-left-color: var(--red); }
section.level2:nth-of-type(3n) .tutorial-card:hover { border-color: rgba(122, 90, 248, 0.4); border-left-color: var(--purple); }
.tutorial-card a {
  font-weight: 700;
  color: var(--text-strong);
  text-decoration: none;
}
/* Hover: the title text takes the subsection colour (matches the left line). */
section.level2:nth-of-type(3n + 1) .tutorial-card:hover a { color: var(--green); }
section.level2:nth-of-type(3n + 2) .tutorial-card:hover a { color: var(--red); }
section.level2:nth-of-type(3n) .tutorial-card:hover a { color: var(--purple); }
.tutorial-card > p:last-child {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
  margin: 0;
}
@media (max-width: 1200px) {
  .tutorial-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .tutorial-grid { grid-template-columns: 1fr; }
}


/* AI-readable GUI guides: present in the HTML source for the in-app assistant,
   hidden from the rendered page. */
div.ai-guide { display: none !important; }
