/* Logos site — hand-rolled theme. Light + dark, responsive, no framework. */

/* ── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --bg: #ffffff;
  --bg-subtle: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --border: #e6e8ee;
  --text: #1c2230;
  --text-muted: #5b6472;
  --accent: #5b4be0;
  --accent-hover: #4a3bc9;
  --accent-soft: rgba(91, 75, 224, 0.1);
  --code-bg: #f6f7f9;
  --code-border: #e6e8ee;
  --shadow: 0 1px 2px rgba(16, 20, 30, 0.04), 0 8px 24px rgba(16, 20, 30, 0.06);

  /* syntax */
  --hl-keyword: #b5259e;
  --hl-string: #2f8f4e;
  --hl-comment: #8a93a2;
  --hl-number: #b26a00;
  --hl-func: #3b6fe0;
  --hl-type: #7a3fd8;
  --hl-punct: #5b6472;

  --sidebar-w: 250px;
  --toc-w: 200px;
  --header-h: 60px;
  --content-max: 760px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1117; --bg-subtle: #0c0e14; --surface: #151925; --surface-2: #1b2130;
    --border: #262d3d; --text: #e7eaf1; --text-muted: #9aa4b4;
    --accent: #8f82ff; --accent-hover: #a99dff; --accent-soft: rgba(143, 130, 255, 0.14);
    --code-bg: #0c0e14; --code-border: #232a39;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.4);
    --hl-keyword: #ff7bd5; --hl-string: #7ee0a0; --hl-comment: #6b7486;
    --hl-number: #ffb454; --hl-func: #7aa2ff; --hl-type: #c3a6ff; --hl-punct: #9aa4b4;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1117; --bg-subtle: #0c0e14; --surface: #151925; --surface-2: #1b2130;
  --border: #262d3d; --text: #e7eaf1; --text-muted: #9aa4b4;
  --accent: #8f82ff; --accent-hover: #a99dff; --accent-soft: rgba(143, 130, 255, 0.14);
  --code-bg: #0c0e14; --code-border: #232a39;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.4);
  --hl-keyword: #ff7bd5; --hl-string: #7ee0a0; --hl-comment: #6b7486;
  --hl-number: #ffb454; --hl-func: #7aa2ff; --hl-type: #c3a6ff; --hl-punct: #9aa4b4;
}

/* ── Base ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
img { max-width: 100%; }
hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ── Header ────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  height: 100%; max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0 1.25rem;
}
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 800; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 8px; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #b06dff);
  box-shadow: 0 2px 8px var(--accent-soft);
}
.top-nav { display: flex; gap: 1.25rem; margin-left: 0.5rem; }
.top-nav a { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; }
.top-nav a:hover, .top-nav a.active { color: var(--text); text-decoration: none; }
.header-actions { margin-left: auto; display: flex; gap: 0.4rem; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text-muted); font-size: 1.05rem; cursor: pointer; transition: all 0.15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.menu-only { display: none; }

/* ── Home / landing ────────────────────────────────────────────────────── */
.home-main { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.hero { padding: 5rem 0 3.5rem; text-align: center; }
.hero-badge {
  display: inline-block; padding: 0.3rem 0.8rem; margin-bottom: 1.5rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-muted); font-size: 0.82rem; font-weight: 500;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem); margin: 0 0 1rem; letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p.lead { font-size: clamp(1.05rem, 2.5vw, 1.35rem); color: var(--text-muted); max-width: 640px; margin: 0 auto 2rem; }
.hero-cta { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.4rem; border-radius: 10px; font-weight: 600; font-size: 0.98rem;
  border: 1px solid transparent; cursor: pointer; transition: all 0.15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero-code { max-width: 720px; margin: 3rem auto 0; text-align: left; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; padding: 3.5rem 0; }
.feature {
  padding: 1.5rem; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow); transition: transform 0.15s, border-color 0.15s;
}
.feature:hover { transform: translateY(-2px); border-color: var(--accent); }
.feature .ico { font-size: 1.5rem; margin-bottom: 0.6rem; }
.feature h3 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.feature p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
.home-cta-row { text-align: center; padding: 1rem 0 5rem; }

/* ── Doc shell (sidebar / content / toc) ───────────────────────────────── */
.doc-shell { max-width: 1240px; margin: 0 auto; display: flex; align-items: flex-start; }
.sidebar {
  position: sticky; top: var(--header-h); flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 2rem 1rem 2rem 1.25rem;
}
.nav-group { margin-bottom: 1.5rem; }
.nav-group-title { margin: 0 0 0.5rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar-nav li a {
  display: block; padding: 0.35rem 0.7rem; margin: 0.1rem 0; border-radius: 7px;
  color: var(--text-muted); font-size: 0.92rem; border-left: 2px solid transparent;
}
.sidebar-nav li a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.sidebar-nav li a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.doc-main { flex: 1 1 auto; min-width: 0; display: flex; gap: 2rem; padding: 2.5rem 1.5rem 4rem; }
.doc-content { flex: 1 1 auto; min-width: 0; max-width: var(--content-max); }
.doc-title { font-size: 2.2rem; margin: 0 0 1.5rem; letter-spacing: -0.02em; }
.doc-content h2 { font-size: 1.5rem; margin: 2.5rem 0 1rem; padding-top: 0.5rem; }
.doc-content h3 { font-size: 1.2rem; margin: 2rem 0 0.75rem; }
.doc-content p, .doc-content li { color: var(--text); }
.doc-content ul, .doc-content ol { padding-left: 1.4rem; }
.doc-content li { margin: 0.35rem 0; }
.doc-content blockquote {
  margin: 1.5rem 0; padding: 0.6rem 1.2rem; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--text-muted);
}
.doc-content table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.92rem; }
.doc-content th, .doc-content td { padding: 0.55rem 0.85rem; border: 1px solid var(--border); text-align: left; }
.doc-content th { background: var(--surface-2); font-weight: 600; }

/* header anchor links from markdown-it-anchor */
.header-anchor { color: var(--text-muted); opacity: 0; margin-left: 0.4rem; text-decoration: none; font-weight: 400; }
h2:hover .header-anchor, h3:hover .header-anchor { opacity: 1; }

/* on-page TOC */
.toc { flex: 0 0 var(--toc-w); width: var(--toc-w); position: sticky; top: calc(var(--header-h) + 2.5rem); align-self: flex-start; font-size: 0.85rem; }
.toc-title { margin: 0 0 0.6rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc li a { display: block; padding: 0.25rem 0 0.25rem 0.9rem; margin-left: -1px; color: var(--text-muted); border-left: 2px solid transparent; }
.toc li a:hover { color: var(--accent); text-decoration: none; }
.toc-l3 a { padding-left: 1.7rem; font-size: 0.82rem; }

/* ── Code ──────────────────────────────────────────────────────────────── */
code {
  font-family: var(--font-mono); font-size: 0.88em;
  background: var(--code-bg); border: 1px solid var(--code-border);
  padding: 0.12em 0.4em; border-radius: 5px;
}
pre {
  margin: 1.5rem 0; padding: 1.1rem 1.25rem; overflow-x: auto;
  background: var(--code-bg); border: 1px solid var(--code-border); border-radius: 12px;
  font-size: 0.88rem; line-height: 1.6;
}
pre code { background: none; border: none; padding: 0; font-size: inherit; }

.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-meta-keyword, .hljs-doctag, .hljs-section { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-symbol, .hljs-template-tag, .hljs-meta-string { color: var(--hl-string); }
.hljs-number, .hljs-literal, .hljs-bullet { color: var(--hl-number); }
.hljs-title, .hljs-title.function_, .hljs-function .hljs-title { color: var(--hl-func); }
.hljs-type, .hljs-class .hljs-title, .hljs-title.class_, .hljs-built_in, .hljs-builtin-name { color: var(--hl-type); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-property { color: var(--hl-func); }
.hljs-punctuation, .hljs-operator { color: var(--hl-punct); }
.hljs-meta { color: var(--hl-comment); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* ── Footer ────────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-subtle); margin-top: 2rem; }
.footer-inner { max-width: 1240px; margin: 0 auto; padding: 2rem 1.5rem; color: var(--text-muted); font-size: 0.9rem; }
.footer-inner p { margin: 0.2rem 0; }
.footer-muted { opacity: 0.7; font-size: 0.85rem; }

/* ── Mobile nav ────────────────────────────────────────────────────────── */
.nav-scrim { display: none; }

@media (max-width: 1080px) {
  .toc { display: none; }
}
@media (max-width: 860px) {
  .menu-only { display: grid; }
  .top-nav { display: none; }
  .doc-main { padding: 1.5rem 1.25rem 3rem; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; z-index: 40;
    width: 280px; flex-basis: 280px; background: var(--bg);
    border-right: 1px solid var(--border); transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow); }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: var(--header-h) 0 0 0; z-index: 30; background: rgba(0,0,0,0.4); }
  .hero { padding: 3rem 0 2rem; }
}
