/* ============================================================
   Verso gallery: card grid + read-only notebook viewer.
   The viewer reproduces the product's default Notebook layout
   (Material cards) using the real --verso-* theme tokens, mapped
   to the site's light/dark toggle. Loaded after css/site.css.
   ============================================================ */

/* ---- Product theme tokens (verso-light) ---- */
:root {
  --verso-bg-default: #ffffff;
  --verso-bg-elevated: #f3f3f3;
  --verso-fg-default: #1e1e1e;
  --verso-fg-muted: #858585;
  --verso-accent-primary: #0078d4;
  --verso-border-default: #e0e0e0;
  --verso-cell-background: #ffffff;
  --verso-cell-border: #e0e0e0;
  --verso-cell-hover-background: #f8f8f8;
  --verso-cell-output-background: #f5f5f5;
  --verso-cell-output-foreground: #1e1e1e;
  --verso-cell-error-background: #fde7e9;
  --verso-cell-error-foreground: #a1260d;
  --verso-toolbar-background: #f3f3f3;
  --verso-toolbar-foreground: #1e1e1e;
  --verso-toolbar-separator: #d4d4d4;
  --verso-editor-background: #ffffff;
  --verso-editor-foreground: #1e1e1e;
  --verso-editor-line-number: #858585;
  --verso-status-success: #28a745;
  --verso-status-error: #dc3545;
  --verso-cell-padding: 12px;
  --verso-cell-gap: 8px;
  --verso-output-padding: 8px;
  --verso-cell-border-radius: 4px;
  --verso-button-border-radius: 4px;
  --verso-editor-font-family: 'Cascadia Code', 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --verso-code-output-font-family: 'Cascadia Mono', 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --verso-prose-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  /* Material tokens the product's Notebook layout derives from --verso-* */
  --md-surface: var(--verso-bg-default);
  --md-on-surface: var(--verso-fg-default);
  --md-on-surface-variant: var(--verso-fg-muted);
  --md-primary: var(--verso-accent-primary);
  --md-outline: var(--verso-border-default);
  --md-elev-1: 0 1px 2px rgba(0, 0, 0, 0.18), 0 1px 3px 1px rgba(0, 0, 0, 0.10);
  --md-elev-2: 0 2px 4px rgba(0, 0, 0, 0.18), 0 4px 8px 3px rgba(0, 0, 0, 0.12);
  --md-shape-md: 12px;
  --md-shape-lg: 16px;
  --md-shape-full: 999px;

  /* Syntax highlighting (VS Code Light+, matching the product's vs theme) */
  --syn-kw: #0000ff;
  --syn-ty: #267f99;
  --syn-st: #a31515;
  --syn-nm: #098658;
  --syn-cm: #008000;
  --syn-fn: #795e26;
  --syn-op: #1e1e1e;
  --syn-mg: #af00db;
}

html[data-theme="dark"] {
  --verso-bg-default: #1e1e1e;
  --verso-bg-elevated: #252526;
  --verso-fg-default: #d4d4d4;
  --verso-fg-muted: #858585;
  --verso-accent-primary: #007acc;
  --verso-border-default: #3c3c3c;
  --verso-cell-background: #1e1e1e;
  --verso-cell-border: #3c3c3c;
  --verso-cell-hover-background: #2a2d2e;
  --verso-cell-output-background: #252526;
  --verso-cell-output-foreground: #d4d4d4;
  --verso-cell-error-background: #5a1d1d;
  --verso-cell-error-foreground: #f48771;
  --verso-toolbar-background: #333333;
  --verso-toolbar-foreground: #cccccc;
  --verso-toolbar-separator: #474747;
  --verso-editor-background: #1e1e1e;
  --verso-editor-foreground: #d4d4d4;
  --verso-editor-line-number: #858585;
  --verso-status-success: #4ec9b0;
  --verso-status-error: #f14c4c;

  /* VS Code Dark+ syntax colors */
  --syn-kw: #569cd6;
  --syn-ty: #4ec9b0;
  --syn-st: #ce9178;
  --syn-nm: #b5cea8;
  --syn-cm: #6a9955;
  --syn-fn: #dcdcaa;
  --syn-op: #d4d4d4;
  --syn-mg: #c586c0;
}

/* ===== Gallery landing ===== */
.gallery-main { padding: 48px 0 88px; }

.gallery-hero { padding: 34px 0 8px; }
.gallery-hero h1 {
  font-size: clamp(34px, 6.4vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 500;
  margin: 10px 0 14px;
  text-wrap: balance;
}
.gallery-hero .hero-sub { max-width: 640px; }

/* An author `display` rule outranks the browser's own `[hidden]` rule, so
   every element the filter script toggles has to opt back out explicitly. */
.gallery-filters[hidden],
.gallery-card[hidden],
.gallery-empty[hidden],
.filter-clear[hidden] { display: none; }

/* ===== Filter bar ===== */
.gallery-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 30px;
  padding: 18px 20px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
}
.filter-row { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.filter-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  min-width: 68px;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 7px; flex: 1; }
.filter-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.filter-chip:hover { border-color: var(--accent-line); color: var(--ink-1); }
.filter-chip[aria-pressed="true"] {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
  color: var(--paper);
}
.filter-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-3);
}
.filter-clear {
  font: inherit;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-ink);
  cursor: pointer;
  text-decoration: underline;
}
.gallery-empty {
  margin-top: 28px;
  text-align: center;
  color: var(--ink-3);
}

/* Someone at the bottom of the gallery has just spent a while reading notebooks
   in this exact format, which is the one moment they are likely to want the
   same treatment for one of their own. */
.gallery-share {
  margin-top: 64px;
  /* Deeper at the foot than at the head. The heading's first line carries its
     leading above the letters, so equal padding reads as bottom-heavy against
     the hard edge of a filled button. */
  padding: 32px 32px 36px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  text-align: center;
}
.gallery-share h2 {
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  text-wrap: balance;
  /* This is a section, so the homepage's own section h2 rule reaches it and
     brings a measure meant for a 52px display heading. Left in place, the
     heading centers inside that narrower box rather than inside the card, and
     sits visibly left of the paragraph and the button below it. The line
     height comes from the same rule and is far too tight for this size. */
  max-width: none;
  line-height: 1.25;
}
.gallery-share p {
  max-width: 600px;
  margin: 0 auto 20px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink-3);
  /* Centered text whose lines are nearly the same length reads as a mistake:
     the eye catches the few pixels of difference precisely because it expects
     none. Balancing makes the two lines equal, so the shape looks chosen.
     Browsers without it simply wrap as they always did. */
  text-wrap: balance;
}
.gallery-share code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--ink-2);
}
@media (max-width: 640px) {
  .gallery-share { margin-top: 48px; padding: 26px 20px 30px; }
}
.gallery-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-top: 36px;
}
@media (min-width: 720px) { .gallery-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1060px) { .gallery-cards { grid-template-columns: repeat(3, 1fr); } }

.gallery-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  overflow: hidden;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
.gallery-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-line);
  box-shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.35);
}
.gallery-card-thumb {
  aspect-ratio: 16 / 9.4;
  background: var(--paper-3);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}
.gallery-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.gallery-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.gallery-card h3 { margin: 0; font-size: 19px; font-weight: 500; letter-spacing: -0.01em; }
.gallery-card p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-3); flex: 1; }
.gallery-card-langs { display: flex; flex-wrap: wrap; gap: 6px; }
.lang-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--ink-3);
  background: var(--paper);
}
/* Both modifiers must stay after .lang-chip. They share its specificity, so
   order alone decides, and .lang-chip sets every property they override. */
.lang-chip--topic {
  border-color: var(--accent-line);
  color: var(--accent-ink);
}
/* Library names carry their own capitalization and the uppercase treatment
   destroys it, so ScottPlot, DuckDB and NumPy read as their projects write
   them. The quiet fill separates them from the outlined topic and language
   chips without competing with the topic chip's accent. */
.lang-chip--lib {
  text-transform: none;
  letter-spacing: 0.02em;
  border-color: transparent;
  background: var(--paper-3);
  color: var(--ink-2);
}

/* ===== Viewer page shell ===== */
.gv-main { padding: 36px 0 88px; }
.gv-crumb { margin-bottom: 18px; display: flex; align-items: baseline; gap: 12px; }
.gv-crumb a { color: var(--accent-ink); }
.gv-crumb a:hover { text-decoration: underline; }

.gv-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
  margin-bottom: 26px;
}
.gv-head h1 {
  font-size: clamp(26px, 4.6vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 500;
  margin: 0;
  flex: 1 1 380px;
  text-wrap: balance;
}
.gv-head-actions { display: flex; gap: 10px; align-items: center; }
.gv-desc { max-width: 720px; color: var(--ink-3); font-size: 16px; line-height: 1.6; margin: 0 0 30px; }

/* ===== The notebook viewport (product look) ===== */
.gv-frame {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--verso-bg-default);
  box-shadow: 0 30px 70px -32px rgba(24, 22, 15, 0.38);
}
html[data-theme="dark"] .gv-frame { box-shadow: 0 30px 70px -28px #000; }

/* Product toolbar, simplified for read-only */
.gv-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 16px;
  background: var(--verso-toolbar-background);
  color: var(--verso-toolbar-foreground);
  border-bottom: 1px solid var(--verso-border-default);
  font-family: 'Segoe UI', var(--font-sans), sans-serif;
  font-size: 13px;
}
.gv-doc-info { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.gv-doc-icon { color: var(--verso-accent-primary); flex-shrink: 0; display: inline-flex; }
.gv-doc-text { display: flex; flex-direction: column; min-width: 0; }
.gv-doc-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gv-doc-meta { font-size: 11px; color: var(--verso-fg-muted); white-space: nowrap; }
.gv-toolbar-spacer { flex: 1; }

.gv-readonly-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 11px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--verso-fg-muted);
  background: color-mix(in srgb, var(--verso-fg-muted) 12%, transparent);
  white-space: nowrap;
}
.gv-readonly-pill svg { flex-shrink: 0; }

.gv-download {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--verso-button-border-radius);
  background: var(--verso-accent-primary);
  color: #ffffff;
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  transition: filter 120ms ease;
}
.gv-download:hover { filter: brightness(1.12); }

/* Notebook body: Material cards on the product surface */
.gv-cells {
  padding: 22px 24px 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@media (max-width: 640px) { .gv-cells { padding: 16px 10px 22px; } }

.gv-cell {
  position: relative;
  display: flex;
  gap: 8px;
  border-radius: var(--md-shape-lg);
  background: var(--md-surface);
  border: 1px solid var(--md-outline);
  box-shadow: var(--md-elev-1);
  transition: box-shadow 140ms ease;
}
.gv-cell:hover { box-shadow: var(--md-elev-2); }

/* Leading accent stripe, as in the product's Notebook layout */
.gv-cell::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--md-primary);
  opacity: 0;
  transition: opacity 140ms ease;
}
.gv-cell:hover::before { opacity: 1; }

/* Markdown cells read as flowing document content, not cards */
.gv-cell--prose {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.gv-cell--prose:hover { box-shadow: none; }
.gv-cell--prose::before { display: none; }
/* No card, so no card inset: prose and its heading rules run flush to where
   the neighbouring cards' right edge sits, as the editors draw them. */
.gv-cell--prose .gv-cell-body { padding-right: 0; }

.gv-gutter {
  width: 52px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 0 10px 12px;
  color: var(--verso-editor-line-number);
  font-family: var(--verso-editor-font-family);
  font-size: 11px;
}
.gv-exec-index { margin-top: auto; padding-bottom: 2px; }
@media (max-width: 640px) { .gv-gutter { width: 34px; padding-left: 8px; } }

.gv-cell-body { flex: 1; min-width: 0; padding: 8px 14px 12px 0; }

.gv-cell-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0 6px;
  font-family: 'Segoe UI', var(--font-sans), sans-serif;
}
.gv-type-badge {
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--verso-cell-output-background);
  color: var(--verso-editor-line-number);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}
.gv-lang-badge {
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--verso-accent-primary);
  font-size: 11px;
}
.gv-cell-toolbar .spacer { flex: 1; }

.gv-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--verso-button-border-radius);
  border: none;
  background: transparent;
  color: var(--verso-editor-line-number);
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}
.gv-cell:hover .gv-copy { opacity: 1; }
.gv-copy:hover { background: var(--verso-cell-output-background); color: var(--verso-fg-default); }
.gv-copy.copied { color: var(--verso-status-success); opacity: 1; }
/* Tabbing to a button held at zero opacity lands on something invisible. */
.gv-copy:focus-visible { opacity: 1; }

/* Code block: Monaco stand-in */
.gv-code {
  border: 1px solid var(--verso-border-default);
  border-radius: 2px;
  background: var(--verso-editor-background);
  font-family: var(--verso-editor-font-family);
  font-size: 13.5px;
  line-height: 1.5;
  overflow-x: auto;
}
.gv-code pre { margin: 0; padding: 8px 0; }
.gv-line { display: flex; min-width: max-content; padding-right: 16px; }
.gv-ln {
  width: 40px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 14px;
  color: var(--verso-editor-line-number);
  user-select: none;
}
.gv-lt { color: var(--verso-editor-foreground); white-space: pre; }

/* Pygments token classes (prefixed pyg- by build-gallery.py) -> product syntax palette */
.gv-code .pyg-k, .gv-code .pyg-kd, .gv-code .pyg-kn, .gv-code .pyg-kr, .gv-code .pyg-kc, .gv-code .pyg-kp, .gv-code .pyg-ow { color: var(--syn-kw); }
.gv-code .pyg-kt, .gv-code .pyg-nc, .gv-code .pyg-nn { color: var(--syn-ty); }
.gv-code .pyg-s, .gv-code .pyg-s1, .gv-code .pyg-s2, .gv-code .pyg-sb, .gv-code .pyg-sx, .gv-code .pyg-sa, .gv-code .pyg-si, .gv-code .pyg-se, .gv-code .pyg-sd { color: var(--syn-st); }
.gv-code .pyg-m, .gv-code .pyg-mi, .gv-code .pyg-mf, .gv-code .pyg-mh, .gv-code .pyg-mo { color: var(--syn-nm); }
.gv-code .pyg-c, .gv-code .pyg-c1, .gv-code .pyg-cm, .gv-code .pyg-cs, .gv-code .pyg-ch { color: var(--syn-cm); font-style: italic; }
.gv-code .pyg-nf, .gv-code .pyg-fm, .gv-code .pyg-nd { color: var(--syn-fn); }
.gv-code .pyg-nb, .gv-code .pyg-bp { color: var(--syn-ty); }
.gv-code .pyg-o, .gv-code .pyg-p { color: var(--syn-op); }
.gv-code .pyg-no, .gv-code .pyg-ne { color: var(--syn-ty); }

/* Execution status strip */
.gv-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 2px 0;
  font-family: 'Segoe UI', var(--font-sans), sans-serif;
  font-size: 11px;
  color: var(--verso-fg-muted);
  border-top: 1px solid transparent;
}
.gv-status .ok { color: var(--verso-status-success); }
.gv-status .err { color: var(--verso-status-error); }

/* ===== Outputs (product wrapper conventions) ===== */
.gv-outputs { padding-top: var(--verso-output-padding); }
.verso-output { margin-top: 4px; border-radius: 2px; overflow-x: auto; }
.verso-output--text {
  background: var(--verso-cell-output-background);
  color: var(--verso-cell-output-foreground);
  padding: var(--verso-output-padding);
  max-height: 340px;
  overflow: auto;
}
.verso-output--text pre {
  margin: 0;
  font-family: var(--verso-code-output-font-family);
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.verso-output--html {
  padding: var(--verso-output-padding);
  color: var(--verso-fg-default);
  font-family: var(--verso-prose-font-family);
  font-size: 15px;
  line-height: 1.6;
}
/* A widget output, mounted in a frame of its own by js/gallery.js. The frame
   is sized from inside by the widget's own height report, so it draws
   nothing itself and never scrolls on its own account. */
.gv-widget-frame {
  display: block;
  width: 100%;
  border: 0;
}
.verso-output--error {
  background: var(--verso-cell-error-background);
  color: var(--verso-cell-error-foreground);
  padding: var(--verso-output-padding);
  border-left: 3px solid var(--verso-status-error);
  border-radius: 0 var(--verso-cell-border-radius) var(--verso-cell-border-radius) 0;
}
.verso-output--error .name { font-weight: 700; }
.verso-output--error pre {
  margin: 4px 0 0;
  font-family: var(--verso-code-output-font-family);
  font-size: 11px;
  opacity: 0.75;
  white-space: pre-wrap;
}
.verso-output img { max-width: 100%; height: auto; border-radius: 3px; }
html[data-theme="dark"] .verso-output img.gv-plot { background: #ffffff; padding: 6px; }

/* Markdown prose inside cells (mirrors the product's .verso-output--html rules) */
.gv-prose {
  font-family: var(--verso-prose-font-family);
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--verso-fg-default);
  padding: 2px 0 4px 0;
  /* Full width, no reading measure: the editors render markdown flush with
     the cell border below it, and these pages show the product. The page
     container bounds the line length instead. */
}
.gv-prose h1, .gv-prose h2, .gv-prose h3, .gv-prose h4 {
  font-family: 'Segoe UI', var(--font-sans), sans-serif;
  font-weight: 600;
  line-height: 1.25;
  margin: 24px 0 14px;
}
.gv-prose > :first-child { margin-top: 0; }
.gv-prose > :last-child { margin-bottom: 0; }
.gv-prose h1 { font-size: 1.9em; padding-bottom: 0.3em; border-bottom: 1px solid var(--verso-border-default); }
.gv-prose h2 { font-size: 1.45em; padding-bottom: 0.3em; border-bottom: 1px solid var(--verso-border-default); }
.gv-prose h3 { font-size: 1.22em; }
.gv-prose p { margin: 0 0 14px; }
.gv-prose a { color: var(--verso-accent-primary); }
.gv-prose a:hover { text-decoration: underline; }
.gv-prose code {
  font-family: var(--verso-editor-font-family);
  font-size: 0.88em;
  background: rgba(175, 184, 193, 0.2);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

/* A fenced block written in prose, which is where a block with no language
   tag ends up. It needs a rule of its own: the inline code style above would
   otherwise apply inside the pre, and since a pre keeps its newlines every
   line becomes a separate inline fragment drawing its own background, which
   reads as a ragged staircase instead of a block. The surface belongs to the
   block, so the code inside it carries none. Borrowed from .gv-code above so
   that a fenced block and a code cell look like siblings. */
.gv-prose pre {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--verso-border-default);
  border-radius: 2px;
  background: var(--verso-editor-background);
  font-family: var(--verso-editor-font-family);
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
}
.gv-prose pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  white-space: pre;
}

/* The wrapper the frame adds to hang a copy button on. It holds the margin so
   that the button, positioned against it, sits on the block's own corner. */
.gv-prose-code { position: relative; margin: 0 0 14px; }
.gv-prose-code pre { margin: 0; }
.gv-prose-code .gv-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  /* Opaque, because it sits over the code rather than beside it. */
  background: var(--verso-editor-background);
}
.gv-prose-code:hover .gv-copy { opacity: 1; }
.gv-prose-code .gv-copy:hover { background: var(--verso-cell-output-background); }

/* Hover is not available on touch, and a button that only exists on hover is
   one a keyboard user can reach but not see. */
@media (hover: none) {
  .gv-prose-code .gv-copy { opacity: 1; }
}
.gv-prose ul, .gv-prose ol { margin: 0 0 14px; padding-left: 26px; }
.gv-prose li { margin: 3px 0; }
.gv-prose table { border-collapse: collapse; margin: 0 0 14px; display: block; overflow-x: auto; }
.gv-prose th, .gv-prose td { padding: 6px 13px; border: 1px solid var(--verso-border-default); }
.gv-prose th { font-weight: 600; background: var(--verso-cell-output-background); }
.gv-prose tr:nth-child(2n) { background: var(--verso-cell-output-background); }
.gv-prose blockquote {
  margin: 0 0 14px;
  padding: 2px 14px;
  border-left: 3px solid var(--verso-border-default);
  color: var(--verso-fg-muted);
}

/* Mermaid output */
.gv-mermaid { display: flex; justify-content: center; padding: 8px 0; }
.gv-mermaid svg { max-width: 100%; height: auto; }

/* Math in prose. The placeholder holds the TeX source until KaTeX typesets it,
   and keeps holding it when KaTeX never arrives. A long formula scrolls inside
   its own line rather than widening the page. */
.gv-math--display { display: block; padding: 4px 0; overflow-x: auto; overflow-y: hidden; }

/* Parameters cell: read-only rendition of the parameter form */
.gv-params {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 18px;
  padding: 4px 2px 2px 0;
  font-family: 'Segoe UI', var(--font-sans), sans-serif;
}
@media (min-width: 720px) { .gv-params { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gv-param { min-width: 0; }
.gv-param-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 5px;
}
.gv-param-name {
  font-family: var(--verso-editor-font-family);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--verso-fg-default);
}
.gv-param-req { color: var(--verso-status-error); font-weight: 700; }
.gv-param-type {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--verso-cell-output-background);
  color: var(--verso-editor-line-number);
}
.gv-param-input {
  border: 1px solid var(--verso-border-default);
  border-radius: 2px;
  background: var(--verso-editor-background);
  color: var(--verso-editor-foreground);
  font-family: var(--verso-editor-font-family);
  font-size: 13px;
  padding: 5px 9px;
  min-height: 18px;
}
.gv-param-desc {
  font-size: 12px;
  color: var(--verso-fg-muted);
  margin-top: 4px;
  line-height: 1.45;
}
.gv-params-note {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--verso-fg-muted);
  border-top: 1px solid var(--verso-border-default);
  padding-top: 10px;
  margin-top: 2px;
}
.gv-params-note code {
  font-family: var(--verso-editor-font-family);
  font-size: 0.95em;
  background: rgba(175, 184, 193, 0.2);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

/* ===== Below the frame ===== */
.gv-after {
  margin-top: 34px;
  display: grid;
  gap: 22px;
  grid-template-columns: 1fr;
}
@media (min-width: 860px) { .gv-after { grid-template-columns: 1.2fr 1fr; } }
.gv-after-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  padding: 22px 24px;
}
.gv-after-card h2 { font-size: 19px; font-weight: 500; margin: 0 0 10px; letter-spacing: -0.01em; }
.gv-after-card p { font-size: 14.5px; line-height: 1.6; color: var(--ink-3); margin: 0 0 14px; }
.gv-after-card p a {
  color: var(--accent-ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
}
.gv-after-card p a:hover { text-decoration-color: var(--accent-ink); }
.gv-after-card .cmdline {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 8px;
  overflow-x: auto;
}
.gv-after-card .cmdline code { white-space: nowrap; }
.gv-after-card .cmdline .copy-btn {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--ink-4);
  display: inline-flex;
  padding: 4px;
  border-radius: 4px;
}
.gv-after-card .cmdline .copy-btn:hover { color: var(--ink); background: var(--paper-3); }
.gv-after-card .cmdline .copy-btn.copied { color: var(--accent-ink); }
