/* Tarang site: clean multi-card showcase and wide, readable documentation. */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0c0e;
  --surface: #121215;
  --surface-hover: #18181c;
  --topbar-bg: rgba(12, 12, 14, 0.86);
  --code-bg: #111114;
  --inline-code-bg: rgba(255, 255, 255, 0.06);

  --fg-1: #ececee;
  --fg-2: #9d9da6;
  --fg-3: #82828e;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  --accent: #f082a8;
  --accent-soft: rgba(240, 130, 168, 0.11);

  --tok-comment: #858594;
  --tok-keyword: #f082a8;
  --tok-string: #86d9a8;
  --tok-number: #f2b974;
  --tok-func: #7dc4f8;
  --tok-type: #c4a7f7;
  --tok-punct: #8e8e9a;
  --term-border: rgba(255, 255, 255, 0.08);
  --backdrop: rgba(0, 0, 0, 0.76);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hover: #f1f1f4;
  --topbar-bg: rgba(250, 250, 250, 0.88);
  --code-bg: #f4f4f6;
  --inline-code-bg: rgba(0, 0, 0, 0.05);

  --fg-1: #111113;
  --fg-2: #52525b;
  --fg-3: #666670;

  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);

  --accent: #ae2856;
  --accent-soft: rgba(174, 40, 86, 0.08);

  --tok-comment: #6b6b76;
  --tok-keyword: #b83264;
  --tok-string: #176d44;
  --tok-number: #9e5308;
  --tok-func: #1759a8;
  --tok-type: #6938a8;
  --tok-punct: #63636e;
  --term-border: rgba(0, 0, 0, 0.1);
  --backdrop: rgba(17, 17, 19, 0.52);
}

:root {
  /* Terminal cards stay dark in both themes so true-color ANSI renders accurately. */
  --term-bg: #0a0a0c;
  --term-fg: #d4d4d8;
  --term-muted: #767682;
  --term-hi: #f4f4f5;
  --term-line: rgba(255, 255, 255, 0.08);
  --term-accent: #f082a8;

  --font-sans: "Geist", "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --container: 1480px;
  --docs-container: 1380px;
}

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

html {
  background: var(--bg);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

main {
  flex: 1 0 auto;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--bg);
  background: var(--fg-1);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  transform: translateY(calc(-100% - 16px));
  transition: transform 150ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

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

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

::selection {
  background: var(--accent-soft);
  color: var(--fg-1);
}

kbd {
  display: inline-block;
  min-width: 18px;
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 17px;
  text-align: center;
  color: var(--fg-2);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
}

.docs-container {
  max-width: var(--docs-container);
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  background: var(--topbar-bg);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--fg-1);
}

.brand-mark {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

.section-tabs {
  display: flex;
  gap: 4px;
}

.section-tab {
  padding: 6px 10px;
  font-size: 13.5px;
  color: var(--fg-2);
  border-radius: var(--radius-sm);
  transition: color 150ms ease, background 150ms ease;
}

.section-tab:hover {
  color: var(--fg-1);
}

.section-tab.is-active {
  color: var(--fg-1);
  background: var(--surface-hover);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sponsor-button {
  padding: 4px 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: 0;
  transition: color 150ms ease;
}

.sponsor-button:hover {
  color: color-mix(in srgb, var(--accent) 78%, var(--fg-1));
  text-decoration: underline;
  text-underline-offset: 3px;
}

.topbar .sponsor-button {
  margin-right: 8px;
  padding-inline: 4px;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--fg-2);
  transition: color 150ms ease, background 150ms ease;
}

.nav-icon:hover {
  color: var(--fg-1);
  background: var(--surface-hover);
}

[data-theme="dark"] .icon-moon,
[data-theme="light"] .icon-sun {
  display: none;
}

/* ── Views ──────────────────────────────────────────────────────────────── */

.view {
  padding-bottom: 96px;
}

.view-docs {
  padding-top: 44px;
}

.view[hidden] {
  display: none;
}

/* ── Hero ───────────────────────────────────────────────────────────────── */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 64px 0 48px;
}

.hero-title {
  margin: 0 0 16px;
  line-height: 1;
}

.hero-logo {
  display: block;
  width: min(272px, 72vw);
  height: auto;
  color: var(--fg-1);
  overflow: visible;
}

.hero-logo > g {
  animation: wordmark-wave 4.2s ease-in-out infinite;
  will-change: transform;
  backface-visibility: hidden;
}

.hero-logo > g:nth-child(2) { animation-delay: 110ms; }
.hero-logo > g:nth-child(3) { animation-delay: 220ms; }
.hero-logo > g:nth-child(4) { animation-delay: 330ms; }
.hero-logo > g:nth-child(5) { animation-delay: 440ms; }
.hero-logo > g:nth-child(6) { animation-delay: 550ms; }

@keyframes wordmark-wave {
  0%, 31%, 100% { transform: translateY(0); }
  12% { transform: translateY(-6px); }
  23% { transform: translateY(2px); }
}

/* Phones and touch screens paint SVG transforms slowly: keep the wordmark still. */
@media (hover: none), (max-width: 720px) {
  .hero-logo > g {
    animation: none;
    will-change: auto;
  }
}

.hero-lead {
  margin: 0 0 24px;
  font-size: 17px;
  color: var(--fg-2);
}

/* Compact docs landing masthead: same wordmark and wave as the showcase hero. */
.docs-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.docs-hero[hidden] {
  display: none;
}

.docs-hero-brand {
  display: inline-flex;
  color: var(--fg-1);
  transition: color 150ms ease;
}

.docs-hero-brand:hover {
  color: var(--accent);
}

.docs-logo {
  width: min(196px, 54vw);
  height: auto;
}

.docs-hero-lead {
  margin: 0;
  font-size: 14px;
  color: var(--fg-3);
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 100%;
}

.quick-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  transition: background 150ms ease, border-color 150ms ease;
}

.quick-start span {
  color: var(--accent);
}

.quick-start:hover {
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.install {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  height: 42px;
  padding: 0 6px 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.install-prompt {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-3);
  user-select: none;
}

.install code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-1);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.install code::-webkit-scrollbar {
  display: none;
}

.icon-copy {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--fg-3);
  transition: color 150ms ease, background 150ms ease;
}

.icon-copy:hover {
  color: var(--fg-1);
  background: var(--surface-hover);
}

.icon-copy > svg {
  grid-area: 1 / 1;
}

.icon-copy .i-check,
.icon-copy.is-copied .i-copy {
  display: none;
}

.icon-copy.is-copied .i-check {
  display: block;
  color: var(--accent);
}

/* ── Showcase Gallery ───────────────────────── */

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cat-chip {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--fg-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.cat-chip:hover {
  color: var(--fg-1);
  border-color: var(--border-strong);
}

.cat-chip.is-active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
}

.cat-chip-count {
  margin-left: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
}

.cat-chip.is-active .cat-chip-count {
  color: var(--accent);
  opacity: 0.85;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 200px;
}

.search input {
  width: 100%;
  height: 30px;
  padding: 0 30px 0 10px;
  font-size: 13px;
  color: var(--fg-1);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 150ms ease;
}

.search input::placeholder {
  color: var(--fg-3);
}

.search input:focus {
  outline: none;
  border-color: var(--border-strong);
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.search kbd {
  position: absolute;
  right: 7px;
  pointer-events: none;
  color: var(--fg-3);
  border-color: var(--border);
}

.gallery-layout {
  display: grid;
  grid-template-columns: 192px minmax(0, 1fr);
  align-items: start;
  gap: 28px;
}

.gallery-content {
  grid-column: -2;
  min-width: 0;
}

.effects-sidebar {
  position: sticky;
  top: 80px;
  padding-right: 12px;
  border-right: 1px solid var(--border);
}

.effects-nav {
  max-height: calc(100dvh - 128px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.fx-card {
  position: relative;
  scroll-margin-top: 12px;
  display: flex;
  flex-direction: column;
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 150ms ease;
}

.fx-card:hover {
  border-color: var(--border-strong);
}

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

/* 76 columns x 24 rows at 1.92 cell height equals a 76 / 46.08 canvas. */
.card-screen {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 76 / 46.08;
  padding: 0;
  background: var(--term-bg);
  overflow: hidden;
}

.card-player {
  width: 100%;
  line-height: 0;
}

.term-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: var(--term-bg);
}

.card-zoom {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--term-muted);
  background: rgba(10, 10, 12, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0.6;
  transition: opacity 150ms ease, color 150ms ease, border-color 150ms ease;
}

.fx-card:hover .card-zoom,
.card-zoom:focus-visible {
  opacity: 1;
}

.card-zoom:hover {
  color: var(--term-hi);
  border-color: rgba(255, 255, 255, 0.24);
}

.card-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 38px;
  padding: 0 8px 0 14px;
  border-top: 1px solid var(--term-line);
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--term-bg);
}

.card-name {
  color: var(--term-hi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.card-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--term-muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  transition: color 150ms ease, background 150ms ease;
}

.card-btn:hover {
  color: var(--term-hi);
  background: rgba(255, 255, 255, 0.06);
}

.card-btn.is-copied {
  color: var(--term-accent);
}

.bar-sep {
  width: 1px;
  height: 14px;
  margin: 0 4px;
  background: var(--term-line);
}

.terminal-skeleton {
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
  color: var(--term-muted);
}

.terminal-skeleton code {
  color: var(--term-fg);
}

.empty-state {
  margin: 32px 0 0;
  font-size: 13.5px;
  color: var(--fg-3);
}

.empty-state[hidden] {
  display: none;
}

.wip-section {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.wip-section[hidden] {
  display: none;
}

.wip-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.wip-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-3);
}

.wip-note {
  font-size: 12px;
  color: var(--fg-3);
  opacity: 0.8;
}

.wip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.wip-item {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-3);
  opacity: 0.6;
  user-select: none;
}

.support-line {
  margin: 56px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
  color: var(--fg-3);
}

.support-line[hidden] {
  display: none;
}

.support-line .sponsor-button {
  padding: 0;
  font-size: inherit;
  vertical-align: baseline;
}

/* ── Zoom Lightbox Dialog ───────────────────────────────────────────────── */

.zoom-dialog {
  width: min(1040px, calc(100vw - 32px), calc((100vh - 110px) * 1.649));
  max-width: none;
  padding: 0;
  background: transparent;
  border: none;
  overflow: visible;
}

.zoom-dialog::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.zoom-frame {
  background: var(--term-bg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.zoom-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 76 / 46.08;
  padding: 0;
  background: var(--term-bg);
}

.zoom-screen > * {
  width: 100%;
}

.zoom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 44px;
  padding: 0 10px 0 18px;
  border-top: 1px solid var(--term-line);
  font-family: var(--font-mono);
  font-size: 13px;
}

.zoom-name {
  color: var(--term-hi);
}

.zoom-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── Docs (wide, Niri-inspired 3-column layout) ─────────────────────────── */

.docs-layout {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr) 204px;
  gap: 48px;
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.docs-nav-title {
  margin: 0 0 10px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-nav-group {
  margin: 10px 0 2px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-3);
}

.docs-nav a,
.effects-nav button {
  display: block;
  padding: 7px 10px;
  font-size: 14px;
  color: var(--fg-2);
  border-radius: var(--radius-sm);
  transition: color 150ms ease, background 150ms ease;
}

.docs-nav a:hover,
.effects-nav button:hover {
  color: var(--fg-1);
  background: var(--surface-hover);
}

.docs-nav a.is-active {
  color: var(--accent);
  font-weight: 500;
  background: var(--accent-soft);
}

.effects-nav button {
  width: 100%;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 13px;
}

.effects-nav button:focus-visible {
  outline-offset: -2px;
}

.docs-sidebar-extra {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
  padding: 16px 10px 0;
  border-top: 1px solid var(--border);
}

.docs-sidebar-extra a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-3);
  transition: color 150ms ease;
}

.docs-sidebar-extra a:hover {
  color: var(--fg-1);
}

.docs-article {
  min-width: 0;
  width: 100%;
  max-width: none;
}

.docs-toc {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  font-size: 12.5px;
}

.docs-toc[hidden] {
  display: none;
}

.docs-toc-title {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.docs-toc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--border);
}

.docs-toc-list a {
  display: block;
  padding: 4px 0 4px 12px;
  margin-left: -1px;
  border-left: 1.5px solid transparent;
  color: var(--fg-3);
  line-height: 1.45;
  transition: color 150ms ease, border-color 150ms ease;
}

.docs-toc-list a.toc-h3 {
  padding-left: 22px;
  font-size: 12px;
}

.docs-toc-list a:hover {
  color: var(--fg-1);
}

.docs-toc-list a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.docs-loading {
  font-size: 14px;
  color: var(--fg-3);
}

.prose {
  font-size: 16px;
  line-height: 1.72;
  color: var(--fg-2);
}

.prose > :first-child {
  margin-top: 0;
}

/* The docs landing already shows this wordmark in the animated hero. */
#docs-content .readme-logo {
  display: none;
}

.prose > p,
.prose > ul,
.prose > ol,
.prose > blockquote {
  max-width: 48rem;
}

.prose .code-wrap,
.prose pre,
.prose .table-wrap,
.prose img {
  width: 100%;
  max-width: 100%;
}

.prose img {
  height: auto;
}

.prose a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 38%, transparent);
  text-underline-offset: 3px;
}

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

.prose h1,
.prose h2,
.prose h3 {
  position: relative;
  color: var(--fg-1);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.prose h1 {
  margin: 0 0 24px;
  font-size: 34px;
  font-weight: 600;
}

.prose h2 {
  margin: 48px 0 14px;
  padding-bottom: 0;
  border-bottom: none;
  font-size: 23px;
  font-weight: 600;
}

.prose h2:not(:first-child) {
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.prose h3 {
  margin: 30px 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.prose h2,
.prose h3 {
  scroll-margin-top: 84px;
}

.prose .heading-anchor {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.82em;
  color: var(--fg-3);
  text-decoration: none;
  opacity: 0;
  transition: opacity 150ms ease, color 150ms ease;
}

.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.prose .heading-anchor:focus-visible {
  opacity: 1;
}

.prose .heading-anchor:hover {
  color: var(--accent);
}

.prose p {
  margin: 0 0 16px;
}

.prose strong {
  color: var(--fg-1);
  font-weight: 500;
}

.prose ul,
.prose ol {
  margin: 0 0 22px;
  padding-left: 22px;
}

.prose li {
  margin: 6px 0;
}

.prose li::marker {
  color: var(--fg-3);
}

.prose code {
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--fg-1);
  background: var(--inline-code-bg);
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.prose .code-wrap {
  position: relative;
  margin: 0 0 24px;
}

.prose pre {
  margin: 0;
  padding: 16px 20px;
  overflow-x: auto;
  line-height: 1.65;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.prose pre code {
  padding: 0;
  font-size: 13px;
  background: none;
  overflow-wrap: normal;
  tab-size: 4;
  font-variant-ligatures: none;
}

/* Syntax tokens for highlighted documentation code blocks (#docs-content .prose). */
.prose pre code .tok-comment {
  color: var(--tok-comment);
  font-style: italic;
}

.prose pre code .tok-keyword {
  color: var(--tok-keyword);
}

.prose pre code .tok-string {
  color: var(--tok-string);
}

.prose pre code .tok-number {
  color: var(--tok-number);
}

.prose pre code .tok-func {
  color: var(--tok-func);
}

.prose pre code .tok-type {
  color: var(--tok-type);
}

.prose pre code .tok-punct {
  color: var(--tok-punct);
}

.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 26px;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-3);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity 150ms ease, color 150ms ease, border-color 150ms ease;
}

.code-wrap:hover .code-copy,
.code-copy:focus-visible,
.code-copy.is-copied {
  opacity: 1;
}

.code-copy:hover {
  color: var(--fg-1);
  border-color: var(--border-strong);
}

.code-copy.is-copied {
  color: var(--accent);
}

@media (hover: none) {
  .code-copy,
  .card-zoom,
  .prose .heading-anchor {
    opacity: 1;
  }
}

.prose .table-wrap {
  margin: 0 0 24px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.prose th,
.prose td {
  padding: 10px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.prose tbody tr:last-child td {
  border-bottom: none;
}

.prose tbody tr:hover {
  background: var(--surface-hover);
}

.prose th {
  font-weight: 500;
  color: var(--fg-1);
  background: var(--surface);
}

.prose blockquote {
  margin: 0 0 24px;
  padding: 4px 0 4px 16px;
  border-left: 2px solid var(--accent);
  color: var(--fg-2);
}

.prose details {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.prose details:last-of-type {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.prose summary {
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--fg-1);
}

.prose details[open] summary {
  margin-bottom: 8px;
}

.prose details > :last-child {
  margin-bottom: 0;
}

.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.docs-pager[hidden] {
  display: none;
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 46%;
  padding: 4px 0;
  background: none;
  border: 0;
  border-radius: 0;
}

.pager-link.is-next {
  margin-left: auto;
  text-align: right;
}

.pager-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-3);
}

.pager-title {
  font-size: 13.5px;
  font-weight: 400;
  color: var(--fg-2);
  transition: color 150ms ease;
}

.pager-link:hover .pager-title {
  color: var(--fg-1);
}

.noscript-note {
  padding: 24px;
  font-size: 14px;
  color: var(--fg-2);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.site-footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-3);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-footer a {
  color: var(--fg-2);
  transition: color 150ms ease;
}

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

/* ── Sponsor dialog ─────────────────────────────────────────────────────── */

.sponsor-dialog {
  width: min(400px, calc(100vw - 32px));
  padding: 24px;
  color: var(--fg-1);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}

.sponsor-dialog::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(4px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

.dialog-close {
  margin-right: -8px;
  font-size: 13px;
}

.dialog-lead {
  margin: 0 0 20px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--fg-2);
}

.sponsor-list {
  display: grid;
  gap: 8px;
}

.sponsor-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--fg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 150ms ease, border-color 150ms ease;
}

.sponsor-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.sponsor-item svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: currentColor;
}

.sponsor-item-arrow {
  margin-left: auto;
  font-size: 13px;
  color: var(--fg-3);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

.effects-label,
.mobile-toggle,
.docs-mobile-bar,
.docs-drawer {
  display: none;
}

@media (hover: none) {
  .search kbd {
    display: none;
  }
}

@media (max-width: 1200px) {
  .docs-layout {
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 40px;
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 1099px) {
  .gallery-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .effects-sidebar {
    display: none;
  }
}

@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 880px) {
  .search kbd {
    display: none;
  }

  .section-tabs {
    display: none;
  }

  .topbar .brand,
  .topbar .nav-icon,
  .topbar .sponsor-button:not([hidden]) {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .topbar .nav-icon {
    width: 44px;
  }

  .hero {
    padding: 40px 0 32px;
  }

  .gallery-toolbar {
    gap: 8px;
    margin-bottom: 16px;
  }

  .search {
    flex: 1;
    min-width: 0;
    width: auto;
  }

  .search input {
    height: 44px;
    padding: 0 12px;
    font-size: 16px;
  }

  .search input::-webkit-search-cancel-button {
    display: block;
  }

  .mobile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--fg-1);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
  }

  .mobile-toggle:disabled {
    opacity: 0.6;
  }

  #filter-toggle.is-active,
  #filter-toggle[aria-expanded="true"] {
    color: var(--accent);
    background: var(--accent-soft);
  }

  #filter-toggle.is-active::after {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: "";
  }

  .category-chips {
    display: none;
    order: 1;
    width: 100%;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }

  .gallery-toolbar:has(#filter-toggle[aria-expanded="true"]) .category-chips {
    display: flex;
  }

  .cat-chip {
    height: 44px;
    font-size: 13px;
  }

  .card-bar {
    height: 52px;
    gap: 8px;
    padding: 0 6px 0 12px;
    font-size: 13px;
  }

  .card-btn,
  .card-zoom {
    height: 44px;
    min-width: 44px;
    color: var(--term-fg);
  }

  .card-zoom {
    position: static;
    background: none;
    border: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 1;
  }

  .view-docs {
    padding-top: 16px;
  }

  .docs-mobile-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--fg-2);
    font-size: 14px;
  }

  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .docs-layout > .docs-sidebar {
    display: none;
  }

  .docs-drawer[open] {
    position: fixed;
    inset: 0 auto 0 0;
    display: block;
    width: min(320px, calc(100% - 48px));
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    color: var(--fg-1);
    background: var(--bg);
    border: 0;
    border-right: 1px solid var(--border);
    overscroll-behavior: contain;
    animation: docs-drawer-in 200ms ease-out;
  }

  .docs-drawer::backdrop {
    background: var(--backdrop);
  }

  html:has(.docs-drawer[open]) {
    overflow: hidden;
  }

  .docs-drawer-content {
    min-height: 100%;
    padding: 12px 16px 24px;
  }

  .docs-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }

  .docs-drawer-head h2 {
    margin: 0 0 0 10px;
    font-size: 16px;
    font-weight: 600;
  }

  .docs-drawer-head .nav-icon {
    width: 44px;
    height: 44px;
  }

  .docs-drawer .docs-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .docs-drawer .docs-nav-title {
    display: none;
  }

  .docs-drawer .docs-nav a,
  .docs-drawer .docs-sidebar-extra a {
    display: flex;
    align-items: center;
    min-height: 44px;
  }

  .docs-drawer .docs-sidebar-extra {
    gap: 0;
    margin-top: 16px;
    padding-top: 8px;
  }

  .prose {
    overflow-wrap: anywhere;
  }

  .prose th,
  .prose td {
    min-width: 9ch;
    padding-inline: 12px;
    overflow-wrap: normal;
  }

  .prose .code-wrap pre {
    padding: 52px 14px 14px;
  }

  .code-copy {
    min-width: 44px;
    height: 36px;
    opacity: 1;
  }
}

@keyframes docs-drawer-in {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@media (max-width: 680px) {
  .container {
    padding: 0 16px;
  }

  .docs-pager {
    flex-direction: column;
    gap: 16px;
  }

  .pager-link {
    max-width: 100%;
  }

  .pager-link.is-next {
    margin-left: 0;
    text-align: left;
  }

  .topbar-left {
    gap: 16px;
  }

  .docs-hero {
    margin-bottom: 28px;
    padding-bottom: 24px;
  }

  .hero-lead {
    font-size: 15.5px;
  }

  .install {
    gap: clamp(6px, 2vw, 12px);
    padding-left: 9px;
  }

  .install code {
    font-size: clamp(11px, 3vw, 13px);
  }

  .prose h1 {
    font-size: 28px;
  }

  .prose h2 {
    margin-top: 36px;
    font-size: 22px;
  }

  .prose h2:not(:first-child) {
    padding-top: 22px;
  }
}

@media (max-width: 460px) {
  .topbar-inner,
  .topbar-right {
    gap: 2px;
  }

  .topbar-left {
    gap: 8px;
  }

  .brand {
    font-size: 13px;
  }

  .brand-mark {
    display: none;
  }

  .topbar .sponsor-button {
    margin: 0;
    padding-inline: 8px;
    font-size: 13px;
  }

  .hero {
    padding: 32px 0 28px;
  }

  .hero-lead {
    margin-bottom: 18px;
  }

  .hero-actions {
    flex-direction: column;
  }

  .install {
    height: 46px;
  }

  .install .icon-copy {
    width: 44px;
    height: 44px;
  }

  .quick-start {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-logo > g,
  .docs-drawer[open] {
    animation: none;
  }

  .hero-logo > g {
    will-change: auto;
  }

  a,
  button,
  input,
  .fx-card,
  .card-zoom,
  .cat-chip,
  .card-btn {
    transition-duration: 0.01ms !important;
  }
}
