:root {
  --bg: #080b14;
  --bg-elevated: #0e1422;
  --bg-card: #111a2b;
  --bg-code: #0a0f1a;
  --border: #1e2b44;
  --border-bright: #2c3f63;
  --text: #e6edf7;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-2: #a78bfa;
  --accent-3: #34d399;
  --accent-warm: #fbbf24;
  --radius: 14px;
  --radius-sm: 8px;
  --max: 1140px;
  --mono: "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

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

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

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

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

a:hover {
  text-decoration: underline;
}

code,
pre,
kbd {
  font-family: var(--mono);
}

/* ---------- Navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 11, 20, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

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

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #05101f;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 800;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

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

.nav-links a:hover {
  color: var(--text);
  background: var(--bg-elevated);
  text-decoration: none;
}

.nav-links a[aria-current="page"] {
  color: var(--text);
  background: var(--bg-card);
}

.nav-cta {
  color: #05101f !important;
  background: linear-gradient(135deg, var(--accent), #7dd3fc) !important;
  font-weight: 650 !important;
}

/* ---------- Layout ---------- */

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 84px 0;
  border-top: 1px solid var(--border);
}

.section:first-of-type {
  border-top: 0;
}

.section-head {
  max-width: 720px;
  margin-bottom: 44px;
}

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
}

h1 {
  font-size: clamp(2.3rem, 5vw, 3.9rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 750;
}

h3 {
  font-size: 1.12rem;
  font-weight: 700;
}

p {
  margin: 0 0 16px;
}

.lead {
  font-size: 1.12rem;
  color: var(--text-muted);
  max-width: 680px;
}

.muted {
  color: var(--text-muted);
}

.dim {
  color: var(--text-dim);
}

.small {
  font-size: 0.86rem;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 96px 0 88px;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(56, 189, 248, 0.16), transparent 60%),
    radial-gradient(800px 400px at 88% 0%, rgba(167, 139, 250, 0.14), transparent 62%),
    linear-gradient(180deg, #0a1020 0%, var(--bg) 100%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, black 20%, transparent 72%);
  mask-image: radial-gradient(ellipse at 50% 0%, black 20%, transparent 72%);
  pointer-events: none;
}

.hero .wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  align-items: center;
}

.hero h1 span {
  background: linear-gradient(100deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 650;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #7dd3fc);
  color: #05101f;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-bright);
}

.hero-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.badge {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: rgba(17, 26, 43, 0.7);
  padding: 4px 9px;
  border-radius: 999px;
}

.badge b {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Code blocks ---------- */

.code-card {
  background: var(--bg-code);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.55);
  min-width: 0;
}

.code-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #0d1524;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--text-dim);
}

.dots {
  display: flex;
  gap: 6px;
}

.dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #334155;
}

.dots i:nth-child(1) {
  background: #f87171;
}

.dots i:nth-child(2) {
  background: #fbbf24;
}

.dots i:nth-child(3) {
  background: #34d399;
}

pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  max-width: 100%;
  font-size: 0.83rem;
  line-height: 1.72;
  color: #cbd5e1;
  tab-size: 2;
}

pre code {
  font-size: inherit;
}

.code-card pre {
  max-height: 480px;
}

.c-kw {
  color: #c084fc;
}

.c-str {
  color: #86efac;
}

.c-num {
  color: #fbbf24;
}

.c-com {
  color: #64748b;
  font-style: italic;
}

.c-fn {
  color: #7dd3fc;
}

.c-type {
  color: #fbbf24;
}

.c-edge {
  color: #a78bfa;
}

.c-good {
  color: #34d399;
}

.c-warn {
  color: #f87171;
}

.c-key {
  color: #7dd3fc;
}

/* Inline code */
p code,
li code,
td code,
th code,
.note code {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5px 6px;
  font-size: 0.84em;
  color: #bae6fd;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ---------- Cards & grids ---------- */

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

.grid > * {
  min-width: 0;
}

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

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

.card {
  background: linear-gradient(180deg, var(--bg-card), #0d1524);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

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

.card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

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

.icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  font-size: 1rem;
}

.icon.purple {
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.3);
}

.icon.green {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.3);
}

.icon.warm {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.3);
}

/* ---------- Steps ---------- */

.steps {
  counter-reset: step;
  display: grid;
  gap: 16px;
}

.steps > * {
  min-width: 0;
}

.step {
  position: relative;
  padding: 22px 24px 22px 68px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 22px;
  top: 22px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
}

.step h3 {
  margin-bottom: 6px;
}

.step p {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.step pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.8rem;
}

/* ---------- Architecture ---------- */

.arch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.arch-box {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 20px;
}

.arch-box h4 {
  margin-bottom: 6px;
  font-size: 0.98rem;
}

.arch-box p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.arch-box.span-3 {
  grid-column: span 3;
}

.arch-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 6px 0;
}

.arch-stack {
  display: grid;
  gap: 14px;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

th {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: #0d1524;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

td code {
  white-space: nowrap;
}

/* ---------- Tool reference ---------- */

.tool {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  margin-bottom: 18px;
  overflow: hidden;
}

.tool-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.tool-head code {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 700;
  background: none;
  border: 0;
  padding: 0;
}

.tool-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  flex: 1 1 320px;
}

.tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-bright);
  color: var(--text-muted);
}

.tag.dynamic {
  color: var(--accent-2);
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(167, 139, 250, 0.1);
}

.tag.analytics {
  color: var(--accent-3);
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.1);
}

.tag.core {
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.1);
}

.tool-body {
  padding: 18px 22px;
}

.tool-body table {
  font-size: 0.85rem;
}

.tool-body pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.8rem;
}

/* ---------- Notes ---------- */

.note {
  border-left: 3px solid var(--accent);
  background: rgba(56, 189, 248, 0.07);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 20px 0;
}

.note.warn {
  border-left-color: var(--accent-warm);
  background: rgba(251, 191, 36, 0.07);
}

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

ul,
ol {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--text-muted);
}

li {
  margin-bottom: 6px;
}

li::marker {
  color: var(--text-dim);
}

/* ---------- CTA ---------- */

.cta {
  text-align: center;
  padding: 76px 24px;
  border-top: 1px solid var(--border);
  background:
    radial-gradient(700px 260px at 50% 0%, rgba(167, 139, 250, 0.14), transparent 70%),
    var(--bg-elevated);
}

.cta h2 {
  margin-bottom: 10px;
}

.cta p {
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 24px;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 34px 0;
  color: var(--text-dim);
  font-size: 0.86rem;
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-inner a {
  color: var(--text-muted);
}

/* ---------- Page header ---------- */

.page-head {
  padding: 64px 0 40px;
  background:
    radial-gradient(700px 280px at 20% -20%, rgba(56, 189, 248, 0.12), transparent 65%),
    linear-gradient(180deg, #0a1020, var(--bg));
  border-bottom: 1px solid var(--border);
}

.page-head h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.page-head .lead {
  margin-bottom: 0;
}

.toc {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.toc a {
  font-size: 0.82rem;
  font-family: var(--mono);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
}

.toc a:hover {
  color: var(--accent);
  border-color: var(--border-bright);
  text-decoration: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .hero .wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

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

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

  .arch-box.span-3 {
    grid-column: span 1;
  }
}

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

  .hero {
    padding: 64px 0 56px;
  }

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

  .nav {
    height: auto;
    padding: 12px 18px;
    flex-wrap: wrap;
  }

  .nav-links {
    gap: 2px;
  }

  .nav-links a {
    padding: 6px 9px;
    font-size: 0.86rem;
  }

  .step {
    padding: 20px;
  }

  .step::before {
    position: static;
    margin-bottom: 10px;
  }

  pre {
    font-size: 0.78rem;
  }
}
