:root {
  --bg: #ffffff;
  --bg-soft: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #526078;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-soft: #eef0ff;
  --accent: #06b6d4;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --code-bg: #0d1424;
  --radius: 16px;
}

:root[data-theme="dark"] {
  --bg: #0a0f1f;
  --bg-soft: #0f1630;
  --card: #121a36;
  --text: #e6eaf6;
  --muted: #9aa7c7;
  --border: #223058;
  --primary: #8b93ff;
  --primary-soft: #1a2350;
  --accent: #22d3ee;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --code-bg: #070b17;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(1120px, 100% - 40px);
  margin-inline: auto;
}

/* ---------- header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border);
}

.header .container {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 1rem;
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.nav a:hover,
.nav a.active {
  color: var(--text);
  background: var(--bg-soft);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 1.05rem;
}

.icon-button:hover {
  background: var(--bg-soft);
}

/* ---------- buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
}

.button:hover {
  text-decoration: none;
  border-color: var(--primary);
}

.button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), #6d5dfc);
  color: #fff;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

.button.primary:hover {
  filter: brightness(1.08);
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 84px 0 56px;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto;
  height: 520px;
  background:
    radial-gradient(600px 300px at 20% 30%, color-mix(in srgb, var(--primary) 22%, transparent), transparent),
    radial-gradient(600px 300px at 80% 20%, color-mix(in srgb, var(--accent) 20%, transparent), transparent);
  z-index: -1;
}

.pill {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.hero h1 {
  margin: 20px auto 16px;
  max-width: 820px;
  font-size: clamp(2.2rem, 5.5vw, 3.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead {
  margin: 0 auto 28px;
  max-width: 640px;
  color: var(--muted);
  font-size: 1.15rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 22px;
}

.badges img {
  height: 20px;
}

/* ---------- demo window ---------- */
.window {
  margin: 48px 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-align: left;
}

.window-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}

.window-bar span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff5f57;
}

.window-bar span:nth-child(2) {
  background: #febc2e;
}

.window-bar span:nth-child(3) {
  background: #28c840;
}

.window-bar small {
  margin-left: 10px;
  color: var(--muted);
}

/* ---------- sections ---------- */
section {
  padding: 72px 0;
}

section.soft {
  background: var(--bg-soft);
}

.section-head {
  max-width: 640px;
  margin: 0 auto 40px;
  text-align: center;
}

.section-head h2 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 3.5vw, 2.3rem);
  letter-spacing: -0.01em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 20px;
}

.grid.four {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.card.hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  transition: 0.2s;
}

.card h3 {
  margin: 14px 0 6px;
  font-size: 1.1rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.97rem;
}

.icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--primary-soft);
  font-size: 1.4rem;
}

.steps {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  margin-bottom: 10px;
  padding-left: 34px;
  color: var(--muted);
  font-size: 0.95rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
}

/* ---------- architecture ---------- */
.figure {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.figure a {
  display: block;
}

/* the picture is tall, so keep it inside one screen and centered. Click opens it full size */
.figure img {
  width: auto;
  max-height: 70vh;
  margin-inline: auto;
}

.figure-caption {
  margin-top: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- code ---------- */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}

.tab {
  padding: 8px 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.93rem;
  cursor: pointer;
}

.tab.active {
  background: var(--primary);
  color: #fff;
}

.code {
  position: relative;
  margin-top: 18px;
}

.code pre,
.md pre {
  margin: 0;
  padding: 20px 22px;
  overflow-x: auto;
  border-radius: 14px;
  background: var(--code-bg);
  color: #e6edf7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.7;
}

.copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.copy:hover {
  background: rgba(255, 255, 255, 0.16);
}

.hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.hidden {
  display: none;
}

/* ---------- tech chips ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.chip {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.93rem;
  font-weight: 500;
}

/* ---------- docs viewer ---------- */
.docs-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.docs-tabs {
  display: flex;
  gap: 4px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  overflow-x: auto;
}

.md {
  padding: 28px 32px 36px;
  min-height: 240px;
}

.md h1 {
  margin-top: 0;
  font-size: 1.9rem;
}

.md h2 {
  margin-top: 2rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 1.35rem;
}

.md h3 {
  margin-top: 1.6rem;
}

.md p,
.md li {
  color: var(--text);
}

.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.md :not(pre) > code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
}

.md pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.md pre {
  margin: 1rem 0;
}

.md table {
  width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.md th,
.md td {
  padding: 9px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.md th {
  background: var(--bg-soft);
}

.md .table-wrap {
  overflow-x: auto;
}

.md-message {
  padding: 40px 0;
  color: var(--muted);
  text-align: center;
}

/* ---------- footer ---------- */
.footer {
  padding: 36px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.93rem;
}

.footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
}

.footer-links {
  display: flex;
  gap: 18px;
}

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .nav {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }

  .hero {
    padding-top: 56px;
  }

  section {
    padding: 52px 0;
  }

  .md {
    padding: 20px 16px 28px;
  }

  .brand {
    font-size: 0.95rem;
  }

  /* keep the copy button away from the first line of code */
  .code pre {
    padding-top: 46px;
  }
}

/* the highlight library sets its own background, keep the one of the block */
pre code.hljs {
  padding: 0;
  background: transparent;
}
