/* === Color tokens (ported from crates/app/static/css/theme.css) === */

:root {
  --background: 40 20% 97%;
  --foreground: 30 10% 12%;
  --muted: 40 12% 92%;
  --muted-foreground: 30 5% 50%;
  --card: 40 15% 95%;
  --card-foreground: 30 10% 12%;
  --popover: 40 20% 97%;
  --popover-foreground: 30 10% 12%;
  --border: 35 10% 86%;
  --input: 35 10% 86%;
  --primary: 30 10% 12%;
  --primary-foreground: 40 20% 97%;
  --secondary: 40 10% 92%;
  --secondary-foreground: 30 10% 20%;
  --accent: 40 10% 92%;
  --accent-foreground: 30 10% 20%;
  --destructive: 0 60% 45%;
  --destructive-foreground: 0 0% 98%;
  --ring: 30 8% 40%;
  --radius: 0.25rem;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 30 8% 8%;
    --foreground: 35 15% 88%;
    --muted: 30 6% 14%;
    --muted-foreground: 30 5% 52%;
    --card: 30 6% 11%;
    --card-foreground: 35 15% 88%;
    --popover: 30 6% 11%;
    --popover-foreground: 35 15% 88%;
    --border: 30 5% 18%;
    --input: 30 5% 18%;
    --primary: 35 15% 88%;
    --primary-foreground: 30 8% 8%;
    --secondary: 30 5% 16%;
    --secondary-foreground: 35 12% 80%;
    --accent: 30 5% 16%;
    --accent-foreground: 35 12% 80%;
    --destructive: 0 50% 40%;
    --destructive-foreground: 0 0% 95%;
    --ring: 30 5% 40%;
    color-scheme: dark;
  }
}

/* === Reset === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* === Base === */
html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* === Links === */
a {
  color: hsl(var(--foreground));
  text-decoration: underline;
  text-decoration-color: hsl(var(--border));
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: hsl(var(--foreground));
}

/* === Header === */
.site-header {
  border-bottom: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
}

.header-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  font-size: 1rem;
  color: hsl(var(--foreground));
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-title:hover {
  text-decoration: none;
}

.site-logo {
  display: block;
  color: hsl(var(--foreground));
}

.site-nav {
  display: flex;
  gap: 1.25rem;
}

.site-nav a {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  text-decoration: none;
}

.site-nav a:hover {
  color: hsl(var(--foreground));
}

/* === Footer === */
.site-footer {
  border-top: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
  padding: 2.5rem 1.5rem 1.5rem;
  margin-top: 4rem;
}

.footer-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
  font-size: 0.875rem;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.footer-brand {
  gap: 0.55rem;
}

.footer-title {
  font-weight: 600;
  color: hsl(var(--foreground));
  font-size: 0.95rem;
}

.footer-tagline {
  color: hsl(var(--muted-foreground));
  font-size: 0.825rem;
  line-height: 1.5;
  max-width: 300px;
}

.footer-heading {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.15rem;
}

.footer-col a {
  color: hsl(var(--muted-foreground));
  font-size: 0.825rem;
  text-decoration: none;
}

.footer-col a:hover {
  color: hsl(var(--foreground));
}

.footer-meta {
  max-width: 1040px;
  margin: 1.75rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid hsl(var(--border));
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* === Headings === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  color: hsl(var(--foreground));
  letter-spacing: -0.015em;
}

h1 {
  font-size: 1.875rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.375rem;
  font-weight: 600;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

h3 {
  font-size: 1.075rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
}

/* === Paragraphs & text === */
p {
  margin-bottom: 1rem;
}

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

em {
  font-style: italic;
}

/* === Lists === */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.35rem;
}

li::marker {
  color: hsl(var(--muted-foreground));
}

/* === Inline code === */
code {
  background-color: hsl(var(--muted));
  color: hsl(var(--foreground));
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* === Code blocks === */
pre {
  background-color: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  position: relative;
}

pre code {
  padding: 0;
  background: none;
  color: hsl(var(--foreground));
  font-size: 0.825rem;
  line-height: 1.55;
}

/* === Copy button === */
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.2rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

pre:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  color: hsl(var(--foreground));
  border-color: hsl(var(--foreground));
}

/* === Syntax highlighting (rouge) — kept monochromatic === */
.highlight { background-color: hsl(var(--muted)); }
.highlight .k, .highlight .kd, .highlight .kn,
.highlight .kp, .highlight .kr, .highlight .kt { color: hsl(var(--foreground)); font-weight: 600; }
.highlight .s, .highlight .s1, .highlight .s2,
.highlight .sb, .highlight .sc, .highlight .sd,
.highlight .sh, .highlight .sx { color: hsl(var(--muted-foreground)); }
.highlight .c, .highlight .c1, .highlight .cm,
.highlight .cp, .highlight .cs { color: hsl(var(--muted-foreground)); font-style: italic; }
.highlight .nf, .highlight .nb { color: hsl(var(--foreground)); }
.highlight .nc, .highlight .nn, .highlight .no { color: hsl(var(--foreground)); }
.highlight .mi, .highlight .mf, .highlight .mh,
.highlight .mo { color: hsl(var(--foreground)); }
.highlight .o, .highlight .ow { color: hsl(var(--muted-foreground)); }
.highlight .p { color: hsl(var(--foreground)); }
.highlight .na, .highlight .nv, .highlight .vi,
.highlight .vg, .highlight .vc { color: hsl(var(--foreground)); }
.highlight .err { color: hsl(var(--destructive)); background: none; }

/* === Blockquotes === */
blockquote {
  border-left: 3px solid hsl(var(--border));
  padding: 0.35rem 1rem;
  margin: 1.25rem 0;
  color: hsl(var(--muted-foreground));
}

blockquote p {
  margin: 0;
}

/* === Tables === */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.25rem 0;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
  font-weight: 600;
}

td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
}

/* === Horizontal rules === */
hr {
  border: none;
  height: 1px;
  background: hsl(var(--border));
  margin: 2.5rem 0;
}

/* === Selection === */
::selection {
  background-color: hsl(var(--accent));
  color: hsl(var(--foreground));
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground));
}

/* === Docs layout (sidebar + content) === */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2.5rem;
  max-width: 1040px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  flex: 1;
}

.sidebar-mobile {
  display: none;
}

/* === Sidebar === */
.sidebar {
  position: sticky;
  top: 2rem;
  align-self: start;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.sidebar-group {
  margin-bottom: 1.5rem;
}

.sidebar-heading {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
  border: none;
  padding: 0;
  margin-top: 0;
}

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

.sidebar-item {
  margin: 0;
}

.sidebar-item a {
  display: block;
  padding: 0.3rem 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  border-left: 2px solid transparent;
  text-decoration: none;
}

.sidebar-item a:hover {
  color: hsl(var(--foreground));
  border-left-color: hsl(var(--border));
  text-decoration: none;
}

.sidebar-item.active a {
  color: hsl(var(--foreground));
  border-left-color: hsl(var(--foreground));
  font-weight: 500;
}

/* === Docs content === */
.docs-content {
  max-width: 720px;
  min-width: 0;
}

.docs-content h1:first-child {
  margin-top: 0;
}

/* === 768px breakpoint === */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  .docs-layout {
    display: block;
    padding: 1.25rem;
  }

  .sidebar-desktop {
    display: none;
  }

  .sidebar-mobile {
    display: block;
    margin-bottom: 1.5rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
  }

  .sidebar-mobile summary {
    padding: 0.55rem 0.75rem;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    cursor: pointer;
    background-color: hsl(var(--muted));
  }

  .sidebar-mobile .sidebar {
    position: static;
    max-height: none;
    padding: 0.5rem;
  }

  main {
    padding: 1.25rem;
  }

  .header-inner {
    padding: 0.75rem 1rem;
  }

  pre {
    padding: 0.85rem;
  }

  pre code {
    font-size: 0.775rem;
  }

  table {
    display: block;
    overflow-x: auto;
    font-size: 0.8rem;
  }

  th, td {
    padding: 0.4rem 0.5rem;
    white-space: nowrap;
  }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
}
