:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-muted: #efefeb;
  --surface-strong: #e6e6e0;
  --text: #101010;
  --text-soft: #4b4b46;
  --border: #161616;
  --border-soft: color-mix(in srgb, var(--text) 12%, transparent);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  --radius: 20px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #171717;
  --surface-muted: #222222;
  --surface-strong: #2d2d2d;
  --text: #f5f5f5;
  --text-soft: #c7c7c2;
  --border: #f5f5f5;
  --border-soft: color-mix(in srgb, var(--text) 14%, transparent);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(0, 0, 0, 0.05), transparent 28%),
    radial-gradient(circle at bottom right, rgba(0, 0, 0, 0.05), transparent 24%),
    var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

section[id] {
  scroll-margin-top: 7.5rem;
}

.shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--border-soft);
}

.site-header .shell {
  padding: 0.65rem 0;
}

.header-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.7rem 0.9rem;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 3rem;
  height: 3rem;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  padding: 0.35rem;
  background: var(--surface);
  flex: 0 0 auto;
}

.brand-copy {
  display: grid;
  gap: 0.1rem;
}

.brand-copy strong,
.section-heading h2,
.hero h1,
.step-number,
.card h3,
.api-card h3,
.tab-panel h3,
.footer-card h2,
.sidebar-card p {
  letter-spacing: -0.03em;
}

.brand-copy span,
.muted,
.hero-copy p,
.card p,
.api-card p,
.tab-panel p,
.setup-list p,
.footer-card p,
.sidebar-link,
.sidebar-eyebrow {
  color: var(--text-soft);
}

.sidebar-link,
.button,
.ghost-button,
.toggle,
.tab-button,
.copy-button,
.index-link {
  transition: all 0.3s ease;
}

.sidebar-link.active {
  background: var(--text);
  color: var(--bg);
}

.header-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toggle,
.tab-button,
.copy-button {
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.7rem 0.95rem;
  font: inherit;
  cursor: pointer;
}

.theme-toggle {
  min-width: 6.9rem;
  justify-content: space-between;
}

.language-toggle {
  min-width: 3.5rem;
}

.toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  font-size: 1.05rem;
}

.toggle:hover,
.tab-button:hover,
.button:hover,
.ghost-button:hover,
.sidebar-link:hover,
.copy-button:hover,
.index-link:hover {
  transform: translateY(-1px);
}

.hero {
  padding: 3.8rem 0 1.6rem;
}

.hero-grid,
.docs-grid,
.footer-grid,
.index-grid {
  display: grid;
  gap: 1.25rem;
}

.hero-copy,
.hero-card,
.index-card,
.card,
.step,
.api-card,
.tab-panel,
.footer-card,
.architecture-card,
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow,
.sidebar-eyebrow {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 0.88rem;
}

.hero-copy {
  padding: 1.6rem;
}

.hero h1 {
  margin: 1rem 0;
  font-size: clamp(2.2rem, 7vw, 4.8rem);
  line-height: 0.95;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.2rem;
  border-radius: 999px;
  text-decoration: none;
  min-height: 48px;
}

.button {
  background: var(--text);
  color: var(--bg);
}

.ghost-button {
  border: 1px solid color-mix(in srgb, var(--text) 16%, transparent);
}

.hero-card,
.index-card,
.architecture-card,
.footer-card,
.sidebar-card {
  padding: 1.6rem;
}

.hero-stats {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.85rem;
}

.hero-stats li,
.setup-list li {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}

.stat-bullet,
.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.9rem;
  flex: 0 0 auto;
}

section {
  padding: 1.25rem 0 2rem;
}

.section-heading {
  margin-bottom: 1.2rem;
}

.cards,
.api-grid,
.setup-list {
  display: grid;
  gap: 1rem;
}

.card,
.step,
.api-card,
.tab-panel {
  padding: 1.4rem;
}

.setup-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-grid {
  align-items: start;
}

.docs-grid > div {
  min-width: 0;
}

.docs-layout {
  margin-top: 0.2rem;
}

.config-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.config-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  background: var(--surface-muted);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

.config-shortcut:hover {
  transform: translateY(-1px);
}

.docs-layout .shell {
  width: 100%;
  margin: 0;
}

.docs-sidebar {
  display: none;
}

.sidebar-card {
  display: grid;
  gap: 1rem;
}

.sidebar-nav {
  display: grid;
  gap: 0.45rem;
}

.sidebar-link {
  display: block;
  padding: 0.8rem 0.95rem;
  border-radius: 14px;
  text-decoration: none;
  background: var(--surface-muted);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

.architecture-card img {
  border-radius: 16px;
  background: var(--surface-muted);
  padding: 0.9rem;
  width: 100%;
}

.api-card h3 {
  margin: 0 0 0.9rem;
}

.api-card code {
  display: block;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 1.1rem;
  line-height: 1.2;
}

.command,
pre,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.command {
  display: block;
  width: 100%;
  margin: 0.55rem 0 0;
  padding: 0.95rem 5.1rem 0.95rem 1rem;
  border-radius: 14px;
  background: var(--surface-muted);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.copy-block,
.copy-command {
  position: relative;
  margin-top: 0.55rem;
}

.copy-command {
  display: block;
}

.copy-command .command,
.copy-block pre {
  margin: 0;
}

.copy-button {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  min-height: auto;
  padding: 0;
  font-size: 0;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.copy-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
}

.copy-button.copied {
  background: var(--text);
  color: var(--bg);
  transform: scale(1.08);
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 1rem 1rem 1rem 1rem;
  border-radius: 16px;
  background: var(--surface-muted);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

pre code {
  background: transparent;
  padding: 0;
}

.tabs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.tab-button[aria-selected="true"] {
  background: var(--text);
  color: var(--bg);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.index-links {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.index-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  text-decoration: none;
  background: var(--surface-muted);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

.footer {
  padding: 2rem 0 3rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.support-actions {
  display: grid;
  gap: 0.9rem;
}

.support-card {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  min-height: 72px;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
  box-shadow: var(--shadow);
}

.support-card-paypal {
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 82%, transparent) 0%, var(--surface-strong) 100%);
}

.support-card-kofi {
  background: linear-gradient(135deg, var(--surface) 0%, color-mix(in srgb, var(--surface-muted) 84%, transparent) 100%);
}

.support-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 1.25rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.support-copy {
  display: grid;
  gap: 0.2rem;
  flex: 1 1 auto;
}

.support-copy strong {
  color: var(--text);
}

.support-copy span {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.support-icon-kofi {
  font-size: 1.05rem;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 1rem;
  background: var(--text);
  color: var(--bg);
  padding: 0.75rem 1rem;
  border-radius: 999px;
}

.skip-link:focus {
  top: 1rem;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--text) 60%, transparent);
  outline-offset: 3px;
}

@media (min-width: 760px) {
  .hero-grid {
    grid-template-columns: 1.4fr 1fr;
  }

  .index-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }

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

  .docs-grid,
  .footer-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }

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

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

@media (min-width: 1180px) {
  .docs-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1.25rem;
    align-items: start;
  }

  .docs-sidebar {
    display: block;
    position: sticky;
    top: 6.7rem;
  }

  .docs-main {
    min-width: 0;
  }

  .index-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 759px) {
  .header-panel {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .brand {
    width: 100%;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
  }

  .theme-toggle {
    min-width: 6.5rem;
  }

  .config-shortcuts {
    gap: 0.6rem;
  }

  .config-shortcut {
    width: calc(50% - 0.3rem);
  }

  .support-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
