:root {
  --bg: #0b1220;
  --fg: #e5e7eb;
  --muted: #9ca3af;
  --primary: #60a5fa;
  --primary-contrast: #0b1220;
  --card-bg: #0f172a;
  --link: #93c5fd;
}

html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

/* Layout */
.container { max-width: 900px; margin: 0 auto; padding: 0 1rem; }
.header, .footer { padding: 1rem; text-align: center; }
.footer { color: var(--muted); font-size: 0.9rem; }

/* Hero */
.hero { text-align: center; padding: 2rem 0; }
.hero h1 { margin-bottom: 0.5rem; }

/* Cards */
.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.card h3 { margin-top: 0; }
.card a { color: var(--link); text-decoration: none; }
.card a:hover { text-decoration: underline; }

/* Docs layout with sticky TOC */
.docs-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.toc {
  flex: 0 0 220px;
  position: sticky;
  top: 1rem;
  align-self: flex-start;
  background: var(--card-bg);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  box-shadow: 0 2px 8px rgba(2, 6, 23, 0.05);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
.toc h2 { margin-top: 0; font-size: 1.1rem; }
.toc ul { list-style: none; padding-left: 0; }
.toc li { margin: 0.3rem 0; }
.toc a { color: var(--link); text-decoration: none; font-size: 0.95rem; }
.toc a:hover { text-decoration: underline; }

.docs-content {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(2, 6, 23, 0.06);
}
.docs-content h2 { margin-top: 1.4rem; }
.docs-content pre {
  background: #0f172a;
  color: #e5e7eb;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
}
.docs-content code {
  background: rgba(2, 6, 23, 0.08);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
}

/* Back to top */
.back-to-top {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  text-align: right;
}
.back-to-top a {
  color: var(--link);
  text-decoration: none;
}
.back-to-top a:hover { text-decoration: underline; }

/* Responsive tweaks */
@media (max-width: 768px) {
  .docs-layout {
    flex-direction: column;
  }
  .toc {
    position: relative;
    max-height: none;
    margin-bottom: 1rem;
  }
}

/* Footer link fix */
.footer a {
  color: var(--link);
  text-decoration: none;
}
.footer a:visited {
  color: var(--link);
}
.footer a:hover {
  text-decoration: underline;
}

/* Inline arrow icon */
.inline-arrow {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.25rem;
  width: 1em;
  height: 1em;
  fill: currentColor;
}
