/* ==========================================================================
   hint-errors — site styles
   Design language: the product's own terminal output, extended into the
   chrome around it. Terminal blocks keep a constant dark palette in both
   site themes. Real terminals don't switch to "light mode" at noon, and
   neither does this one. Only the surrounding UI (nav, sidebar, prose,
   cards) responds to the theme toggle.

   Palette source of truth: the brand tokens below (--brand-*) come straight
   from assets/logo.svg. Everything else in the file is a semantic alias
   pointing back at those, adjusted per theme for contrast, so the base
   hues never actually change, only their theme-specific usage.
   ========================================================================== */

:root {
  /* fonts */
  --font-body:
    "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --font-head:
    "Cinzel", Cambria, "Times New Roman", Georgia, serif; /* Trajan Pro is not a web font; Cinzel is the closest licensed classical-capitals match */
  --mono:
    "JetBrains Mono", ui-monospace, "SF Mono", "SFMono-Regular", Menlo,
    Consolas, "Liberation Mono", monospace;
  --sans: var(--font-body);

  --fs-sm: 0.875rem;
  --fs-body: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5625rem;
  --fs-2xl: 1.953rem;
  --fs-3xl: 2.44rem;
  --fs-4xl: 3rem;

  /* brand tokens, fixed values from the logo */
  --brand-bg: #1e1e1c;
  --brand-bar: #2c2c2a;
  --brand-code-text: #c2c0b6;
  --brand-dim-text: #888780;
  --brand-amber: #ef9f27;
  --brand-red: #e24b4a;
  --brand-yellow: #ba7517;
  --brand-green: #639922;
  --brand-white: #ffffff;

  /* supporting shades, derived for contrast where the raw brand tone is
     too dark or too saturated to sit directly on text */
  --red-text: #ef6a5f; /* lightened --brand-red, ~5.2:1 on --brand-bg */
  --yellow-text: #d9a441; /* lightened --brand-yellow, ~7.4:1 on --brand-bg */
  --line: #34372f; /* hairline borders, between --brand-bg and --brand-bar */

  /* terminal palette, fixed regardless of site theme — this is a rendering
     of the product's real ANSI output (see src/formatter.js), so it stays
     constant even where it doesn't match the site's light/dark toggle.
     Traffic-light dots and the red/yellow fields reuse the brand tokens
     directly since those are also the logo's terminal-window colors. */
  --term-bg: var(--brand-bg);
  --term-header: var(--brand-bar);
  --term-border: var(--line);
  --term-text: var(--brand-code-text);
  --term-dim: var(--brand-dim-text);
  --term-red: var(--red-text);
  --term-yellow: var(--yellow-text);
  --term-cyan: #5fd9cb; /* real ANSI cyan the "hint" field renders in; not a brand hue */
  --term-bold: var(--brand-white);
  --term-green: var(--brand-green);

  /* Playground editor tokens. These stay bright against the terminal surface
     in both site themes so code remains readable when the chrome changes. */
  --code-text: #f1eee5;
  --code-line: #aaa497;
  --code-keyword: #ffd166;
  --code-string: #a8e063;
  --code-comment: #aab4c3;
  --code-number: #e2a8ff;

  /* radii / motion */
  --radius: 5px;
  --radius-lg: 8px;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);

  color-scheme: dark;
  /* site chrome palette — dark (default), aliased from brand tokens */
  --bg: var(--brand-bg);
  --bg-raised: var(--brand-bar);
  --bg-hover: #35362f;
  --border: var(--line);
  --border-strong: #464a3f;
  --text: var(--brand-white);
  --text-dim: var(--brand-code-text);
  --text-faint: var(--brand-dim-text);
  --accent: var(--brand-amber);
  --accent-strong: #ffb958;
  --accent-ink: #241804;
  --red: var(--red-text);
  --yellow: var(--yellow-text);
  --green: var(--brand-green);
  --shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.6);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f5f0;
  --bg-raised: #ffffff;
  --bg-hover: #efece2;
  --border: #ddd8c9;
  --border-strong: #c7c1ae;
  --text: #211f16;
  --text-dim: #4a4638;
  --text-faint: #746f5d;
  --accent: #96600a;
  --accent-strong: #7a4e07;
  --accent-ink: #fdf2e0;
  --red: #b83c31;
  --yellow: #7a5209;
  --green: #4a6d18;
  --shadow: 0 12px 30px -14px rgba(30, 27, 15, 0.16);
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  letter-spacing: 0.01em;
}
p {
  margin: 0 0 1em;
  max-width: 62ch;
  color: var(--text-dim);
}
a {
  color: inherit;
}
code,
pre,
.mono {
  font-family: var(--mono);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* skip link */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: top 0.15s var(--ease);
  z-index: 200;
}
.skip-link:focus {
  top: 1rem;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- top nav ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  /* Keep the sticky header opaque: content should never show through it while
     scrolling, especially when the light theme is active. */
  background: var(--bg);
  backdrop-filter: none;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text);
  font-family: var(--mono);
  font-weight: 600;
  font-size: var(--fs-md);
}
.brand-mark {
  display: block;
  width: 1.9rem;
  height: 1.9rem;
  flex: 0 0 auto;
}
.brand .dot {
  color: var(--accent);
}
.brand .version {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-links a {
  text-decoration: none;
  color: var(--text-dim);
  font-size: var(--fs-sm);
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
  transition:
    color 0.15s var(--ease),
    border-color 0.15s var(--ease);
}
.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
  border-color: var(--border-strong);
}
.nav-links a[aria-current="page"] {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.nav-links a.gh {
  color: var(--text);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.theme-toggle,
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover,
.menu-toggle:hover {
  background: var(--bg-hover);
}
.theme-toggle svg {
  width: 17px;
  height: 17px;
}
.theme-toggle .sun {
  display: none;
}
[data-theme="light"] .theme-toggle .moon {
  display: none;
}
[data-theme="light"] .theme-toggle .sun {
  display: block;
}
.menu-toggle {
  display: none;
}

/* ---------- hero ---------- */
.hero {
  padding: 4rem 1.25rem 3rem;
  max-width: 1100px;
  margin: 0 auto;
}
.hero-inner {
  max-width: 760px;
}
.hero-kicker {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--text-faint);
  margin: 0 0 1rem;
}
.hero h1 {
  font-size: clamp(2rem, 4.2vw, var(--fs-4xl));
  color: var(--text);
  margin-bottom: 1.1rem;
}
.hero p.lede {
  font-size: var(--fs-lg);
  color: var(--text-dim);
  max-width: 56ch;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
  margin: 1.6rem 0 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--fs-sm);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 0.12s var(--ease),
    background 0.15s var(--ease),
    border-color 0.15s var(--ease);
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent-strong);
}
.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover {
  background: var(--bg-hover);
}

.install-row {
  margin-top: 1.5rem;
  max-width: 30rem;
}
.install-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius);
  padding: 0.7rem 0.7rem 0.7rem 1rem;
}
.install-box code {
  color: var(--term-text);
  font-size: var(--fs-sm);
}
.install-box code .cmd-prompt {
  color: var(--term-dim);
  margin-right: 0.5rem;
}
.install-box code .cmd-pkg {
  color: var(--term-cyan);
}

/* ---------- copy button (shared) ---------- */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid var(--term-border);
  color: var(--term-dim);
  border-radius: var(--radius);
  padding: 0.35rem 0.55rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    color 0.15s var(--ease),
    border-color 0.15s var(--ease);
}
.copy-btn:hover {
  color: var(--term-text);
  border-color: var(--term-dim);
}
.copy-btn svg {
  width: 13px;
  height: 13px;
}
.copy-btn[data-copied="true"] {
  color: var(--term-green);
  border-color: var(--term-green);
}

/* ---------- transformation comparison ---------- */
.transform {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 4.5rem;
}
.transform-label {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--text-faint);
  margin: 0 0 1rem;
}
.transform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: stretch;
}
@media (max-width: 860px) {
  .transform-grid {
    grid-template-columns: 1fr;
  }
}

.term-window {
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.term-titlebar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  background: var(--term-header);
  border-bottom: 1px solid var(--term-border);
}
.term-dots {
  display: flex;
  gap: 0.4rem;
}
.term-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: block;
}
.term-dots span:nth-child(1) {
  background: var(--brand-red);
}
.term-dots span:nth-child(2) {
  background: var(--brand-yellow);
}
.term-dots span:nth-child(3) {
  background: var(--brand-green);
}
.term-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--term-dim);
  flex: 1;
  text-align: center;
}
.term-body {
  padding: 1rem 1.1rem 1.2rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--term-text);
  overflow-x: auto;
  flex: 1;
}
.term-body pre {
  margin: 0;
  white-space: pre;
}
.term-raw .lineno {
  color: var(--term-dim);
  user-select: none;
}
.term-raw .caret {
  color: var(--term-yellow);
}
.term-raw .err-type {
  color: var(--term-red);
}
.term-raw .stack-int {
  color: var(--term-dim);
}

.hint-block dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.9rem;
}
.hint-block dt {
  color: var(--term-dim);
  font-weight: 400;
}
.hint-block dd {
  margin: 0;
}
.hint-block .v-error {
  color: var(--term-red);
}
.hint-block .v-message {
  color: var(--term-bold);
  font-weight: 600;
}
.hint-block .v-location {
  color: var(--term-yellow);
}
.hint-block .v-hint {
  color: var(--term-cyan);
}

/* ---------- page layout: sidebar + content ---------- */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem 6rem;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 3rem;
}
@media (max-width: 900px) {
  .page {
    grid-template-columns: 1fr;
  }
}

.sidebar {
  position: sticky;
  top: 4.4rem;
  align-self: start;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  padding: 1.5rem 0;
}
.sidebar-group {
  margin-bottom: 1.5rem;
}
.sidebar-heading {
  font-size: 0.7rem;
  color: var(--text-faint);
  text-transform: none;
  margin: 0 0 0.5rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar li {
  margin: 0;
}
.sidebar a {
  position: relative;
  display: block;
  text-decoration: none;
  color: var(--text-faint);
  font-size: var(--fs-sm);
  padding: 0.32rem 0 0.32rem 0.9rem;
  border-left: 2px solid var(--border);
  transition:
    color 0.15s var(--ease),
    border-color 0.15s var(--ease);
}
.sidebar a:hover {
  color: var(--text);
}
.sidebar a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar a.active::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 50%;
  width: 2px;
  height: 60%;
  transform: translateY(-50%);
}
.sidebar a.sidebar-cta {
  margin: 0.45rem 0;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-raised);
  font-weight: 600;
}
.sidebar a.sidebar-cta:hover,
.sidebar a.sidebar-cta:focus-visible {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: var(--bg-hover);
}

.content {
  min-width: 0;
  padding-top: 1.5rem;
}

section.doc-section {
  padding-top: 3.2rem;
  margin-top: -1.6rem;
  border-top: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
section.doc-section:first-child {
  border-top: none;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.section-head h2 {
  font-size: var(--fs-2xl);
}
.anchor-link {
  display: inline-flex;
  align-items: center;
  opacity: 0;
  color: var(--text-faint);
  transition:
    opacity 0.15s var(--ease),
    color 0.15s var(--ease);
}
.anchor-link:hover {
  color: var(--accent);
}
.doc-section:hover .anchor-link,
.anchor-link:focus-visible {
  opacity: 1;
}

.section-intro {
  font-size: var(--fs-md);
  max-width: 64ch;
  margin-bottom: 1.75rem;
}

h3.sub-head {
  font-size: var(--fs-lg);
  margin: 2rem 0 0.75rem;
}
h4.sub-sub-head {
  font-size: var(--fs-body);
  margin: 1.4rem 0 0.5rem;
  color: var(--text);
}

/* ---------- code / terminal blocks in content ---------- */
.code-card {
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 1.1rem 0 1.6rem;
}
.code-card .code-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.7rem 0.5rem 1rem;
  background: var(--term-header);
  border-bottom: 1px solid var(--term-border);
}
.code-card .code-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--term-dim);
}
.code-card pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--term-text);
}
.code-card code {
  color: inherit;
}
.tok-kw {
  color: var(--term-red);
}
.tok-str {
  color: var(--term-green);
}
.tok-fn {
  color: var(--term-cyan);
}
.tok-com {
  color: var(--term-dim);
  font-style: italic;
}
.tok-num {
  color: var(--term-yellow);
}
.tok-prop {
  color: var(--term-dim);
}

/* ---------- tabs ---------- */
.tabs {
  margin: 1.25rem 0 1.75rem;
}
.tablist {
  display: flex;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.tablist button {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-faint);
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 0.55rem 0.2rem;
  margin-right: 1.1rem;
  cursor: pointer;
}
.tablist button:hover {
  color: var(--text);
}
.tablist button[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tabpanel[hidden] {
  display: none;
}
.tabpanel {
  padding-top: 1rem;
}

.callout {
  display: flex;
  gap: 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 0.95rem 1.1rem;
  background: var(--bg-raised);
  margin: 1.5rem 0;
}
.callout .callout-icon {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.callout p {
  margin: 0;
}
.callout.warn .callout-icon {
  color: var(--yellow);
}

/* ---------- pipeline carousel ---------- */
.pipeline-carousel {
  position: relative;
  margin: 1.5rem 0 2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.carousel-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
}
.carousel-viewport:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.carousel-track {
  display: flex;
  gap: 1rem;
  will-change: transform;
  cursor: grab;
}
.carousel-track.dragging {
  cursor: grabbing;
}

.pipe-stage {
  flex: 0 0 auto;
  width: 75%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  user-select: none;
}
.pipe-stage .pipe-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.pipe-stage h4 {
  font-size: var(--fs-body);
  margin-bottom: 0.35rem;
  font-family: var(--font-body);
  font-weight: 600;
}
.pipe-stage .pipe-file {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-bottom: 0.6rem;
  display: block;
}
.pipe-stage p {
  font-size: var(--fs-sm);
  margin: 0;
  flex: 1;
}
.pipe-next {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
}
.pipe-next svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.pipe-next.is-final {
  color: var(--text-faint);
}

.carousel-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
}
.carousel-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}
.carousel-btn svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 700px) {
  .pipe-stage {
    width: 210px;
  }
}
@media (max-width: 480px) {
  .pipe-stage {
    width: 100%;
  }
  .carousel-btn {
    width: 1.9rem;
    height: 1.9rem;
  }
}

/* ---------- timeline (feature history reused as usage / API tables) ---------- */
.def-list {
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}
.def-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 700px) {
  .def-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}
.def-row dt {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}
.def-row .def-meta {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.2rem;
}
.def-row dd {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-dim);
}

/* ---------- gallery ---------- */
.gallery-controls {
  margin-bottom: 1.5rem;
}
.filter-input-wrap {
  position: relative;
  max-width: 26rem;
}
.filter-input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.65rem 0.9rem 0.65rem 2.3rem;
  font-family: var(--sans);
  font-size: var(--fs-sm);
}
.filter-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.filter-input-wrap svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}
.filter-meta {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 0.5rem;
}

.category-group {
  margin-bottom: 2rem;
}
.category-group h3 {
  font-size: var(--fs-body);
  font-family: var(--mono);
  color: var(--text);
  margin-bottom: 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.gallery-card {
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.gallery-card .g-match {
  color: var(--term-red);
  margin-bottom: 0.5rem;
  word-break: break-word;
}
.gallery-card .g-hint {
  color: var(--term-cyan);
  line-height: 1.55;
  white-space: pre-line;
}
.gallery-card.hidden {
  display: none;
}
.gallery-empty {
  color: var(--text-faint);
  font-size: var(--fs-sm);
  padding: 1.5rem 0;
  display: none;
}
.gallery-empty.show {
  display: block;
}

.playground-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding: 1.35rem 0 0;
  border-top: 1px solid var(--border);
}
.playground-cta .playground-copy {
  margin-bottom: 0;
}
.playground-cta .btn {
  flex-shrink: 0;
}

/* ---------- playground ---------- */
.playground {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  padding: 1.25rem;
  margin: 1.5rem 0 2.5rem;
  overflow: hidden;
}
.playground-main {
  width: min(100% - 3rem, 1280px);
  min-height: calc(100vh - 12rem);
  margin: 0 auto;
  padding: 3.25rem 0 4.5rem;
}
.playground-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 2.25rem;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.74rem;
}
.playground-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}
.playground-breadcrumb a:hover {
  text-decoration: underline;
}
.playground-hero {
  max-width: 52rem;
  margin-bottom: 2.25rem;
}
.playground-hero .hero-kicker {
  margin-bottom: 0.65rem;
}
.playground-hero h1 {
  font-size: clamp(2.25rem, 5vw, var(--fs-4xl));
  margin-bottom: 0.8rem;
}
.playground-lede {
  max-width: 62ch;
  margin: 0;
  color: var(--text-dim);
  font-size: var(--fs-md);
}
.playground-page-card {
  margin: 0;
  padding: 1.35rem;
  box-shadow: var(--shadow);
}
.playground-page-card .pg-workbench {
  min-height: 25rem;
}
.playground-page-card .pg-panel {
  min-height: 25rem;
}
.playground-page-card .pg-editor-shell {
  min-height: 21.5rem;
}
.playground-footer {
  margin-top: 0;
}
.playground-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.playground-heading {
  min-width: 0;
}
.playground-kicker {
  margin: 0 0 0.15rem;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.playground-copy {
  margin: 0;
  color: var(--text-faint);
  font-size: var(--fs-sm);
}
.playground-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pg-select-label {
  color: var(--text-faint);
  font-size: 0.76rem;
  font-weight: 600;
}
.pg-scenario,
.pg-btn {
  min-height: 2.15rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.78rem;
}
.pg-scenario {
  max-width: 12rem;
  padding: 0.35rem 0.55rem;
}
.pg-btn {
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  transition:
    background 0.15s var(--ease),
    border-color 0.15s var(--ease),
    color 0.15s var(--ease);
}
.pg-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}
.pg-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.pg-btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.pg-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(23rem, 0.86fr);
  border: 1px solid var(--term-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--term-bg);
}
.pg-panel {
  min-width: 0;
  min-height: 21rem;
  display: flex;
  flex-direction: column;
  background: var(--term-bg);
}
.pg-output-stack {
  display: grid;
  /* Keep raw Node output compact so the useful hint stays in view. Long raw
     traces scroll inside their own pane instead of pushing the hint away. */
  grid-template-rows: 8.5rem minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--term-border);
}
.pg-output-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pg-output-panel + .pg-output-panel {
  border-top: 1px solid var(--term-border);
}
.pg-panel-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.35rem;
  padding: 0.55rem 0.85rem;
  background: var(--term-header);
  border-bottom: 1px solid var(--term-border);
}
.pg-panel-title,
.pg-panel-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
}
.pg-panel-title {
  color: var(--term-text);
}
.pg-panel-meta {
  color: var(--term-dim);
}
.pg-editor-shell {
  display: grid;
  grid-template-columns: 3.35rem minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  padding: 1.15rem 0;
}
.pg-line-numbers,
.pg-code-highlight,
.pg-code {
  margin: 0;
  font-family: "Cascadia Code", "JetBrains Mono", var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.7;
  letter-spacing: -0.01em;
  tab-size: 2;
}
.pg-line-numbers {
  padding: 0 0.8rem 0 0.9rem;
  color: var(--code-line);
  text-align: right;
  user-select: none;
  overflow: hidden;
  white-space: pre;
}
.pg-code-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.pg-code-highlight,
.pg-code {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0 1.2rem 0 0.25rem;
  white-space: pre;
  overflow: auto;
}
.pg-code-highlight {
  pointer-events: none;
  color: var(--code-text);
  background: var(--term-bg);
  overflow: hidden;
}
.pg-code-highlight .tok-keyword {
  color: var(--code-keyword);
}
.pg-code-highlight .tok-string {
  color: var(--code-string);
}
.pg-code-highlight .tok-comment {
  color: var(--code-comment);
  font-style: italic;
}
.pg-code-highlight .tok-number {
  color: var(--code-number);
}
.pg-code {
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: transparent;
  caret-color: var(--accent);
  overflow: auto;
  -webkit-text-fill-color: transparent;
}
.pg-code::selection {
  color: transparent;
  background: rgba(239, 159, 39, 0.28);
}
.pg-code:focus {
  box-shadow: inset 2px 0 var(--accent);
}
.pg-result {
  flex: 1;
  min-width: 0;
  padding: 1rem 1.1rem 1.2rem;
  overflow: auto;
}
.pg-raw-result {
  flex: 1;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 1rem 1.1rem 1.2rem;
  overflow: auto;
  color: var(--term-text);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pg-result .term-window {
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.pg-result .term-titlebar {
  display: none;
}
.pg-result .term-body {
  padding: 0;
}
.pg-note {
  margin: 0.75rem 0 0;
  color: var(--text-faint);
  font-size: 0.76rem;
}
.pg-note::before {
  content: "↳ ";
  color: var(--accent);
}
@media (max-width: 760px) {
  .playground-main {
    width: min(100% - 1.5rem, 1280px);
    padding-top: 2rem;
  }
  .playground-breadcrumb {
    margin-bottom: 1.5rem;
  }
  .playground-hero {
    margin-bottom: 1.5rem;
  }
  .playground-page-card {
    padding: 0.85rem;
  }
  .playground-page-card .pg-workbench {
    min-height: 0;
  }
  .playground-page-card .pg-panel {
    min-height: 0;
  }
  .playground-page-card .pg-editor-shell {
    min-height: 18rem;
  }
  .playground-cta {
    align-items: flex-start;
    flex-direction: column;
  }
  .playground-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .playground-actions {
    justify-content: flex-start;
  }
  .pg-workbench {
    grid-template-columns: 1fr;
  }
  .pg-output-stack {
    grid-template-rows: 9rem minmax(18rem, auto);
    border-top: 1px solid var(--term-border);
    border-left: 0;
  }
  .pg-output-panel + .pg-output-panel {
    border-top: 1px solid var(--term-border);
  }
  .pg-panel {
    min-height: 0;
  }
  .pg-editor-shell {
    min-height: 18rem;
  }
  .pg-result {
    min-height: 19rem;
  }
}

/* ---------- limitations ---------- */
.limit-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.limit-list li {
  display: flex;
  gap: 0.75rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}
.limit-list li:last-child {
  border-bottom: none;
}
.limit-list .limit-icon {
  color: var(--yellow);
  flex-shrink: 0;
  margin-top: 0.2rem;
}
.limit-list strong {
  color: var(--text);
  display: block;
  margin-bottom: 0.15rem;
  font-size: var(--fs-sm);
}
.limit-list span.detail {
  font-size: var(--fs-sm);
  color: var(--text-dim);
}

/* ---------- footer ---------- */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.25rem 3rem;
  max-width: 1180px;
  margin: 0 auto;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: center;
  justify-content: space-between;
}
.footer-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: var(--fs-sm);
}
.footer-links a:hover {
  color: var(--text);
}
.footer-meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* ---------- mobile sidebar (slide-over) ---------- */
@media (max-width: 900px) {
  .menu-toggle {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    inset: 0 20% 0 0;
    top: 0;
    height: 100vh;
    max-height: none;
    background: var(--bg);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.2s var(--ease);
    z-index: 150;
    padding: 5.5rem 1.5rem 2rem;
    overflow-y: auto;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 140;
  }
  .sidebar-scrim.show {
    display: block;
  }
}

@media (max-width: 480px) {
  .hero {
    padding-top: 3rem;
  }
  .nav-links {
    display: none;
  }
}
