:root {
  --bg: #ffffff;
  --bg-elevated: #fafafa;
  --bg-code: #f6f6f6;
  --fg: #0a0a0a;
  --fg-muted: #525252;
  --fg-faint: #a3a3a3;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --accent: #0a0a0a;
  --accent-fg: #ffffff;
  --link: #2563eb;
  --link-hover: #1d4ed8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --bg-elevated: #131313;
    --bg-code: #161616;
    --fg: #f5f5f5;
    --fg-muted: #a3a3a3;
    --fg-faint: #525252;
    --border: #1f1f1f;
    --border-strong: #2a2a2a;
    --accent: #f5f5f5;
    --accent-fg: #0a0a0a;
    --link: #93c5fd;
    --link-hover: #bfdbfe;
  }
}

* { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Hero ---------- */
.hero {
  padding: 6rem 0 4rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.hero-title {
  margin: 0;
  font-size: clamp(2.75rem, 7vw, 4.25rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
}

.hero-tagline {
  margin: 0.875rem 0 0;
  font-size: clamp(1.125rem, 2.5vw, 1.4rem);
  color: var(--fg-muted);
  font-weight: 400;
  letter-spacing: -0.015em;
}

.hero-description {
  margin: 1.75rem auto 0;
  max-width: 580px;
  color: var(--fg-muted);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.hero-cta {
  margin-top: 2.25rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 0.5rem;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--fg);
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
  white-space: nowrap;
}
.btn:hover {
  background: var(--bg-elevated);
  border-color: var(--fg-muted);
  color: var(--fg);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  opacity: 0.86;
}

/* ---------- Content ---------- */
.content {
  padding: 3rem 1.5rem 1rem;
}

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--fg);
}

h2 {
  font-size: 1.625rem;
  margin: 4rem 0 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

h3 {
  font-size: 1.1875rem;
  margin: 2.25rem 0 0.75rem;
}

h4 {
  font-size: 1rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8125rem;
}

p { margin: 1rem 0; }

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease;
}
a:hover {
  color: var(--link-hover);
  border-bottom-color: currentColor;
}

strong {
  font-weight: 600;
  color: var(--fg);
}

ul, ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
}
li { margin: 0.5rem 0; }
li > ul, li > ol { margin: 0.5rem 0; }

blockquote {
  margin: 1.5rem 0;
  padding: 0.875rem 1.25rem;
  border-left: 3px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--fg-muted);
  border-radius: 0 0.375rem 0.375rem 0;
}
blockquote p { margin: 0.5rem 0; }
blockquote strong { color: var(--fg); }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* ---------- Code ---------- */
code, pre, kbd, samp {
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.875em;
}

p code, li code, td code, h2 code, h3 code, h4 code {
  background: var(--bg-code);
  padding: 0.125em 0.375em;
  border-radius: 0.3125em;
  border: 1px solid var(--border);
  font-size: 0.875em;
}

pre {
  margin: 1.5rem 0;
  padding: 1.125rem 1.25rem;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  overflow-x: auto;
  line-height: 1.6;
  font-size: 0.8125rem;
}
pre code {
  padding: 0;
  background: transparent;
  border: 0;
  font-size: inherit;
  color: var(--fg);
}

.highlight {
  margin: 1.5rem 0;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  overflow: hidden;
}
.highlight pre {
  margin: 0;
  padding: 1.125rem 1.25rem;
  background: transparent;
  border: 0;
  border-radius: 0;
}

/* ---------- Tables ---------- */
.table-wrap, .content table {
  display: block;
  width: 100%;
  margin: 1.5rem 0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  white-space: nowrap;
}

thead {
  background: var(--bg-elevated);
}

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

th {
  font-weight: 600;
  color: var(--fg-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

tbody tr:hover {
  background: var(--bg-elevated);
}

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

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 5rem;
  padding-top: 2.5rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.875rem;
  text-align: center;
}
.site-footer p { margin: 0.5rem 0; }
.site-footer a {
  color: var(--fg-muted);
  border-bottom-color: transparent;
}
.site-footer a:hover {
  color: var(--fg);
  border-bottom-color: currentColor;
}
.footer-credits {
  font-size: 0.8125rem;
  color: var(--fg-faint);
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .container { padding: 0 1.125rem; }
  .hero { padding: 4rem 0 2.5rem; }
  .hero-cta { flex-direction: column; gap: 0.5rem; }
  .btn { width: 100%; }
  .content { padding: 2rem 1.125rem 0.5rem; }
  h2 { margin-top: 3rem; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
