:root {
  color-scheme: dark;
  --bg: #0b0f0b;
  --ink: #f1f5ef;
  --muted: rgba(241, 245, 239, 0.68);
  --faint: rgba(241, 245, 239, 0.44);
  --line: rgba(241, 245, 239, 0.12);
  --line-strong: rgba(241, 245, 239, 0.24);
  --panel: #121712;
  --panel-strong: #1a211a;
  --edge: rgba(241, 245, 239, 0.26);
  --sticker-shadow: none;
  --accent: #22c55e;
  --accent-hover: #4ade80;
  --accent-ink: #052310;
  --accent-soft: rgba(34, 197, 94, 0.16);
  --accent-text: #5ce791;
  --mark: rgba(34, 197, 94, 0.28);
  --code-bg: #080b08;
  --code-text: #ccd3ca;
  --code-header-bg: rgba(241, 245, 239, 0.03);
  --code-header-border: rgba(241, 245, 239, 0.08);

  --radius-lg: 1.1rem;
  --radius-md: 0.7rem;
  --radius-sm: 0.4rem;
  --gap: 2rem;
  --font-display: "MonoLisaText", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-sans: "MonoLisaText", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "MonoLisaCode", "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;

  --tok-keyword: #f472b6;
  --tok-string: #fbbf24;
  --tok-number: #c084fc;
  --tok-comment: #76b364;
  --tok-constant: #93c5fd;
  --tok-type: #22d3ee;
  --tok-function: #4ade80;
  --tok-operator: #e2e8f0;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #faf6ec;
  --ink: #16150f;
  --muted: rgba(22, 21, 15, 0.64);
  --faint: rgba(22, 21, 15, 0.46);
  --line: rgba(22, 21, 15, 0.14);
  --line-strong: rgba(22, 21, 15, 0.24);
  --panel: #fffdf6;
  --panel-strong: #f1ebdc;
  --edge: #1b1a12;
  --sticker-shadow: 5px 5px 0 #1b1a12;
  --accent: #15a34a;
  --accent-hover: #0f7a37;
  --accent-ink: #ffffff;
  --accent-soft: rgba(21, 163, 74, 0.12);
  --accent-text: #137a39;
  --mark: rgba(21, 163, 74, 0.30);
  --code-bg: #fbf8f0;
  --code-text: #24292e;
  --code-header-bg: #f1ebdc;
  --code-header-border: rgba(22, 21, 15, 0.10);

  --tok-keyword: #c026d3;
  --tok-string: #c2620a;
  --tok-number: #7c3aed;
  --tok-comment: #57803a;
  --tok-constant: #2563eb;
  --tok-type: #0d9488;
  --tok-function: #15803d;
  --tok-operator: #475569;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-sans);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* The UA stylesheet's `code { font-family: monospace }` beats inheritance,
   so without this floor the code inside styled <pre> panels renders in the
   browser default instead of the site's mono face. */
pre,
code {
  font-family: var(--font-mono);
}

/* Faint dot-grid paper texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  color: var(--ink);
  background-image: radial-gradient(currentColor 1px, transparent 1.2px);
  background-size: 24px 24px;
  opacity: 0.045;
}

a {
  color: var(--ink);
  text-decoration: none;
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.site-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

/* Brand motif primitives */

.brand-sprite {
  position: absolute;
}

.spark {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  fill: currentColor;
  vertical-align: -0.08em;
  flex-shrink: 0;
}

.vee {
  display: inline-block;
  width: 0.78em;
  height: 0.78em;
  fill: var(--accent);
  flex-shrink: 0;
}

/* Sticker treatment: hard offset shadow in light, crisp edge in dark */
.sticker {
  border: 1.5px solid var(--line-strong);
  box-shadow: none;
}

[data-theme="light"] .sticker {
  border: 1.5px solid var(--edge);
  box-shadow: var(--sticker-shadow);
}

/* Hand-drawn highlighter mark */
.mark {
  position: relative;
  white-space: nowrap;
}

.mark::before {
  content: "";
  position: absolute;
  left: -0.12em;
  right: -0.12em;
  top: 0.06em;
  bottom: 0.06em;
  z-index: -1;
  background: var(--mark);
  border-radius: 0.4em 0.55em 0.45em 0.6em;
  transform: rotate(-1.4deg);
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.75rem 0 3rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand:hover {
  color: var(--ink);
}

.brand-logo {
  height: 23px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-logo-light {
  display: none;
}

[data-theme="light"] .brand-logo-dark {
  display: none;
}

[data-theme="light"] .brand-logo-light {
  display: block;
}

.brand-version {
  padding: 0.2rem 0.55rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--muted);
  transform: rotate(-3deg);
}

[data-theme="light"] .brand-version {
  border-color: var(--edge);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.site-nav a {
  position: relative;
  color: var(--muted);
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--ink);
}

.site-nav a.is-active::after {
  content: "";
  position: absolute;
  left: -0.1rem;
  right: -0.1rem;
  bottom: -0.4rem;
  height: 3px;
  background: var(--accent);
  border-radius: 999px;
  transform: rotate(-1.2deg);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: transform 120ms ease;
}

[data-theme="light"] .theme-toggle {
  border-color: var(--edge);
}

.theme-toggle:hover {
  color: var(--ink);
  transform: rotate(-12deg);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun,
:root:not([data-theme]) .theme-toggle .icon-sun {
  display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* Shared text */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.eyebrow .spark {
  width: 0.95rem;
  height: 0.95rem;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
}

/* Buttons */

.button,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.4;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.button {
  background: var(--accent);
  color: var(--accent-ink);
}

[data-theme="light"] .button {
  border-color: var(--edge);
  box-shadow: 4px 4px 0 var(--edge);
}

.button:hover {
  background: var(--accent-hover);
  color: var(--accent-ink);
  transform: translate(-1px, -1px);
}

[data-theme="light"] .button:hover {
  box-shadow: 6px 6px 0 var(--edge);
}

.button:active {
  transform: translate(2px, 2px);
}

[data-theme="light"] .button:active {
  box-shadow: 1px 1px 0 var(--edge);
}

.button-secondary {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--panel);
}

[data-theme="light"] .button-secondary {
  border-color: var(--edge);
  box-shadow: 4px 4px 0 var(--edge);
}

.button-secondary:hover {
  color: var(--ink);
  transform: translate(-1px, -1px);
}

[data-theme="light"] .button-secondary:hover {
  box-shadow: 6px 6px 0 var(--edge);
}

.button-secondary:active {
  transform: translate(2px, 2px);
}

[data-theme="light"] .button-secondary:active {
  box-shadow: 1px 1px 0 var(--edge);
}

.run-button {
  width: 100%;
  padding: 0.85rem 1.5rem;
}

.run-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Hero */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: var(--gap);
  align-items: center;
  padding-top: 1.5rem;
  margin-bottom: 6.5rem;
}

.hero-decor {
  position: absolute;
  inset: -2.5rem -1rem 0;
  z-index: 0;
  pointer-events: none;
}

.hero-decor .spark {
  position: absolute;
  opacity: 0.9;
}

.hero-decor .s2 { top: 32%; right: 1%; width: 18px; height: 18px; color: var(--tok-keyword); transform: rotate(-6deg); opacity: 0.8; }
.hero-decor .s3 { bottom: 6%; left: 46%; width: 14px; height: 14px; color: var(--tok-string); opacity: 0.75; }
.hero-decor .s4 { top: 8%; right: 32%; width: 11px; height: 11px; color: var(--accent); opacity: 0.6; }

@keyframes twinkle {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.hero-decor .spark {
  animation: twinkle 3.4s ease-in-out infinite;
}

.hero-decor .s2 { animation-delay: 0.7s; }
.hero-decor .s3 { animation-delay: 1.5s; }
.hero-decor .s4 { animation-delay: 2.2s; }

.hero-copy,
.hero-panel {
  position: relative;
  z-index: 1;
}

.hero-copy h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(2.6rem, 1.6rem + 3.1vw, 3.85rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 900;
  text-wrap: balance;
  max-width: 16ch;
}

.hero-lede {
  margin: 0;
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-wrap: pretty;
  max-width: 52ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2rem;
}

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 1.6rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.hero-meta .spark {
  width: 0.85rem;
  height: 0.85rem;
  color: var(--accent);
}

.hero-panel {
  transform: rotate(1.4deg);
}

.hero-panel .code-window {
  transition: transform 160ms ease;
}

.hero-panel:hover .code-window {
  transform: rotate(-1.4deg);
}

/* Code windows */

.code-window {
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--code-bg);
  overflow: hidden;
}

[data-theme="light"] .hero-panel .code-window,
[data-theme="light"] .feature .code-window {
  border-color: var(--edge);
  box-shadow: var(--sticker-shadow);
}

.code-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--code-header-border);
  background: var(--code-header-bg);
}

.code-window-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.code-window-title::before {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0C12 6.6 17.4 12 24 12 17.4 12 12 17.4 12 24 12 17.4 6.6 12 0 12 6.6 12 12 6.6 12 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0C12 6.6 17.4 12 24 12 17.4 12 12 17.4 12 24 12 17.4 6.6 12 0 12 6.6 12 12 6.6 12 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
  flex-shrink: 0;
}

.code-window-version {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  white-space: nowrap;
}

.code-window pre {
  margin: 0;
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--code-text);
}

/* Section intros */

.section-intro {
  margin-bottom: 2.75rem;
}

.section-intro h2,
.section-header h2 {
  margin: 0 0 0.875rem;
  font-size: clamp(1.85rem, 1.3rem + 1.7vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.08;
  text-wrap: balance;
  max-width: 22ch;
}

.section-sub,
.section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-wrap: pretty;
  max-width: 56ch;
}

/* Section divider motif */

.motif-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: -2rem 0 6rem;
  color: var(--accent);
}

.motif-divider::before,
.motif-divider::after {
  content: "";
  height: 1.5px;
  width: min(28%, 14rem);
  background: linear-gradient(to var(--dir, right), transparent, var(--line-strong));
}

.motif-divider::after {
  --dir: left;
}

.motif-divider .spark {
  opacity: 0.9;
}

.motif-divider .spark:nth-child(2) {
  width: 1.4em;
  height: 1.4em;
}

/* Features */

.features {
  margin-bottom: 6.5rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3rem var(--gap);
  margin: 0;
}

.feature dt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.45rem;
}

.feature dt .spark {
  color: var(--accent);
}

.feature {
  display: flex;
  flex-direction: column;
}

.feature dd {
  margin: 0;
}

/* Stretch the code panel so side-by-side features match height */
.feature dd:last-child {
  flex: 1;
  display: flex;
}

.feature dd:last-child .code-window {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.feature dd:last-child .code-window pre {
  flex: 1;
}

.feature .feature-desc {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
  text-wrap: pretty;
  margin: 0 0 1.1rem;
}

.feature-desc code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--panel-strong);
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
}

/* Philosophy + guardrails */

.philosophy {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: var(--gap);
  align-items: start;
  margin-bottom: 6.5rem;
}

.philosophy-copy h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.85rem, 1.3rem + 1.7vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.08;
  text-wrap: balance;
  max-width: 20ch;
}

.philosophy-copy p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-wrap: pretty;
  max-width: 54ch;
}

.philosophy-copy p:last-child {
  margin-bottom: 0;
}

.guardrails {
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: 1.85rem;
  border: 1.5px solid var(--line-strong);
  transform: rotate(-1.1deg);
  transition: transform 200ms ease;
}

.guardrails:hover {
  transform: rotate(0deg);
}

[data-theme="light"] .guardrails {
  border-color: var(--edge);
  box-shadow: var(--sticker-shadow);
}

.guardrails h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.35rem;
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.guardrails h3 .spark {
  color: var(--accent);
}

.guardrails > p {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.guardrail-list {
  margin: 0;
}

.guardrail {
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
}

.guardrail:first-child {
  border-top: 0;
  padding-top: 0;
}

.guardrail:last-child {
  padding-bottom: 0;
}

.guardrail dt {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 700;
}

.guardrail dt .vee {
  align-self: center;
}

.guardrail dt .guardrail-default {
  margin-left: auto;
}

.guardrail-default {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.guardrail dd {
  margin: 0.35rem 0 0 1.28rem;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* Featured examples + shared cards */

.featured {
  margin-bottom: 2rem;
}

.featured .card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}

.example-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1.6rem;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1.5px solid var(--line-strong);
  overflow: hidden;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

[data-theme="light"] .example-card {
  border-color: var(--edge);
  box-shadow: var(--sticker-shadow);
}

.example-card::after {
  content: "";
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 1.1rem;
  height: 1.1rem;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0C12 6.6 17.4 12 24 12 17.4 12 12 17.4 12 24 12 17.4 6.6 12 0 12 6.6 12 12 6.6 12 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0C12 6.6 17.4 12 24 12 17.4 12 12 17.4 12 24 12 17.4 6.6 12 0 12 6.6 12 12 6.6 12 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0;
  transform: scale(0.4) rotate(-30deg);
  transition: transform 160ms ease, opacity 160ms ease;
}

.example-card:hover {
  border-color: var(--accent);
  color: var(--ink);
  transform: translate(-2px, -2px);
}

[data-theme="light"] .example-card:hover {
  box-shadow: 7px 7px 0 var(--accent);
}

.example-card:hover::after {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.example-card h3 {
  margin: 0;
  padding-right: 1.4rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.example-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
  flex-grow: 1;
}

.example-card[hidden] {
  display: none;
}

.tag-row,
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-row {
  margin-top: 0.25rem;
}

.tag,
.meta-pill,
.card-category {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  color: var(--muted);
}

a.tag {
  text-decoration: none;
  transition: color 120ms ease, background 120ms ease;
}

a.tag:hover {
  color: var(--ink);
  background: var(--panel-hover, var(--panel-strong));
}

.card-category {
  align-self: flex-start;
}

.link-subtle {
  color: var(--muted);
}

/* Section panel (404) */

.section-panel {
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: 2.5rem;
  margin-bottom: 2rem;
  border: 1.5px solid var(--line-strong);
}

[data-theme="light"] .section-panel {
  border-color: var(--edge);
  box-shadow: var(--sticker-shadow);
}

/* Examples catalog */

.catalog {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--gap);
  min-height: 60vh;
}

.catalog-sidebar {
  position: sticky;
  top: 2rem;
  align-self: start;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  padding-right: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.catalog-sidebar-header {
  margin-bottom: 1.5rem;
}

.catalog-sidebar-header h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.catalog-sidebar-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.catalog-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.catalog-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.catalog-nav-item:hover {
  background: var(--panel-strong);
  color: var(--ink);
}

.catalog-nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 700;
}

.catalog-nav-count {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.catalog-nav-item.is-active .catalog-nav-count {
  color: var(--accent-text);
}

.catalog-toolbar {
  margin-bottom: 1rem;
  min-height: 2rem;
}

.catalog-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.filter-pill:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.filter-pill .filter-x {
  font-size: 0.7rem;
  opacity: 0.7;
}

/* Example detail */

.detail-shell {
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: 2rem;
  border: 1.5px solid var(--line-strong);
}

[data-theme="light"] .detail-shell {
  border-color: var(--edge);
  box-shadow: var(--sticker-shadow);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.detail-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.detail-summary {
  margin: 0 0 0.75rem;
  color: var(--muted);
  line-height: 1.6;
}

.runner-compact {
  flex-shrink: 0;
  padding-top: 1.5rem;
}

.runner-compact .run-button {
  width: auto;
  white-space: nowrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 1.5rem;
}

.code-panel {
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--code-bg);
  color: var(--code-text);
}

.code-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--code-header-border);
  background: var(--code-header-bg);
  font-size: 0.85rem;
  font-weight: 600;
}

.code-block,
.runner-output {
  margin: 0;
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.runner-panel {
  align-self: start;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--code-bg);
}

.runner-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--code-header-border);
  background: var(--code-header-bg);
  font-size: 0.85rem;
  font-weight: 700;
}

.expand-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.expand-toggle:hover {
  color: var(--ink);
}

.detail-grid.output-expanded .runner-panel {
  grid-column: 1 / -1;
  order: -1;
}

.detail-grid.output-expanded .runner-output {
  min-height: 300px;
}

.runner-output {
  min-height: 180px;
  background: var(--code-bg);
  color: var(--code-text);
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

/* Footer */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-top: 6.5rem;
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.site-footer-mark .spark {
  color: var(--accent);
}

.site-footer-links {
  display: flex;
  gap: 1.5rem;
}

.site-footer a {
  color: var(--muted);
  font-weight: 600;
}

.site-footer a:hover {
  color: var(--ink);
}

/* Animations */

.fade-in {
  animation: rise 460ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.delay-1 {
  animation-delay: 80ms;
}

.delay-2 {
  animation-delay: 150ms;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    animation: none;
  }

  .hero-panel,
  .brand-version,
  .site-nav a.is-active::after,
  .guardrails,
  .mark::before {
    transform: none;
  }

  .hero-decor .spark {
    animation: none;
  }
}

/* Syntax tokens */

.tok-keyword { color: var(--tok-keyword); }
.tok-string { color: var(--tok-string); }
.tok-number { color: var(--tok-number); }
.tok-comment { color: var(--tok-comment); font-style: italic; }
.tok-constant { color: var(--tok-constant); }
.tok-type { color: var(--tok-type); }
.tok-function { color: var(--tok-function); }
.tok-operator { color: var(--tok-operator); }

/* Responsive */

@media (max-width: 960px) {
  .hero,
  .feature-grid,
  .philosophy,
  .featured .card-grid,
  .card-grid,
  .detail-grid,
  .catalog {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 0.5rem;
    margin-bottom: 5rem;
  }

  .hero-panel {
    transform: rotate(0.8deg);
  }

  .guardrails {
    transform: none;
  }

  .features,
  .philosophy,
  .motif-divider {
    margin-bottom: 5rem;
  }

  .feature-grid {
    gap: 2.5rem;
  }

  .detail-header {
    flex-direction: column;
  }

  .runner-compact {
    padding-top: 0;
  }

  .detail-grid .runner-panel {
    order: -1;
  }

  .catalog-sidebar {
    position: static;
    max-height: none;
  }

  .site-footer {
    margin-top: 5rem;
  }
}

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 2.25rem;
  }

  .site-nav {
    flex-wrap: wrap;
    gap: 1.25rem;
  }

  .hero-decor {
    display: none;
  }

  .hero-panel {
    transform: none;
  }

  .hero-copy h1 {
    font-size: clamp(1.75rem, 1.05rem + 4vw, 2.4rem);
    letter-spacing: -0.02em;
    max-width: none;
  }

  .example-card p,
  .feature .feature-desc,
  .guardrail dd {
    font-size: 1rem;
  }

  .section-panel,
  .detail-shell,
  .guardrails {
    padding: 1.25rem;
  }

  .code-window pre {
    padding: 1rem;
    font-size: 0.78rem;
  }
}
