/* Markcat docs — standalone stylesheet for the prerendered /docs pages.
   Brand palette inlined (mirrors markcat-design tokens) so the docs ship
   without pulling in the SPA bundle. Light + dark via prefers-color-scheme. */

:root {
  --accent: #c96442;
  --accent-strong: #a84b26;
  --bg: #fbf9f3;
  --bg-soft: #f2eee5;
  --border: #e2dccc;
  --text: #2e2a25;
  --text-soft: #5c5548;
  --text-muted: #6f6656;
  --code-bg: #ece7da;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Cascadia Mono', 'Fira Code', 'JetBrains Mono', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #06b6d4;
    --accent-strong: #22d3ee;
    --bg: #0a0e16;
    --bg-soft: #131a2b;
    --border: #1e2942;
    --text: #e6edf7;
    --text-soft: #c6d2e4;
    --text-muted: #9fb0c9;
    --code-bg: #131a2b;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Skip link — visually hidden until keyboard focus. Fixed clay fill:
   white on it passes AA in both schemes (5.7:1). */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 20;
  padding: 8px 16px;
  background: #a84b26;
  color: #fff;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 0; }

/* Header */
.docs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.docs-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
}
.docs-openapp {
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  background: var(--accent-strong);
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
}
.docs-openapp:hover { background: #8f3f20; }
@media (prefers-color-scheme: dark) {
  /* Dark scheme is Circuit: cyan fills carry dark text — white on cyan fails AA
     (10.4:1 dark resting, 7.7:1 hover). */
  .docs-openapp { background: #22d3ee; color: #04141a; }
  .docs-openapp:hover { background: #06b6d4; }
}

/* Layout */
.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 48px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px;
}
.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: start;
  position: sticky;
  top: 88px;
}
.docs-nav a {
  padding: 7px 12px;
  border-radius: 6px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
}
.docs-nav a:hover { background: var(--bg-soft); color: var(--text); }
.docs-nav a[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-strong);
  font-weight: 600;
}
.docs-nav-home {
  font-weight: 600;
  color: var(--text-muted) !important;
  font-size: 12px !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

/* Content */
.docs-content { min-width: 0; }
.docs-content h1 { font-size: 32px; line-height: 1.2; margin: 0 0 16px; }
.docs-content h2 { font-size: 22px; margin: 36px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.docs-content h3 { font-size: 17px; margin: 24px 0 8px; }
.docs-content h4 { font-size: 15px; margin: 20px 0 6px; color: var(--text-soft); }
.docs-content p, .docs-content li { color: var(--text-soft); }
.docs-content a { color: var(--accent-strong); }
.docs-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: 4px;
}
.docs-content pre {
  background: var(--code-bg);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid var(--border);
}
.docs-content pre code { background: none; padding: 0; font-size: 13px; }
.docs-content blockquote {
  margin: 16px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  border-radius: 0 6px 6px 0;
  color: var(--text-muted);
}
.docs-content table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
  font-size: 14px;
}
.docs-content th, .docs-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.docs-content th { background: var(--bg-soft); font-weight: 600; color: var(--text); }
.docs-content img { max-width: 100%; height: auto; border-radius: 8px; }

/* Index cards */
.docs-lead { font-size: 17px; color: var(--text-muted); margin-bottom: 28px; }
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.docs-card {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  background: var(--bg-soft);
  transition: border-color 150ms ease, transform 150ms ease;
}
.docs-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.docs-card h2 { margin: 0 0 6px; font-size: 17px; border: none; padding: 0; color: var(--text); }
.docs-card p { margin: 0; font-size: 14px; color: var(--text-muted); }

/* Footer */
.docs-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.docs-footer a { color: var(--accent-strong); }

@media (max-width: 760px) {
  .docs-layout { grid-template-columns: 1fr; gap: 24px; padding: 24px 16px; }
  .docs-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
  }
  .docs-nav-home { width: 100%; }
}
