/* kabot documentation. Colours come from the logo: ink, paper and pigeon red. */

:root {
  --bg: #f6f4f0;
  --surface: #ffffff;
  --surface-2: #efece6;
  --border: #e4dfd7;
  --border-strong: #d4cec4;
  --text: #1c1b19;
  --text-2: #4a4640;
  --muted: #7a746b;
  --accent: #d23a2c;
  --accent-hover: #b52f22;
  --accent-soft: #fbe9e6;
  --code-bg: #fbfaf7;
  --inline-code: #f0ece5;
  --shadow: 0 1px 2px rgb(28 27 25 / 0.04), 0 8px 24px -12px rgb(28 27 25 / 0.12);
  --note: #2f6fdb; --tip: #1f8a5b; --important: #7a4cd9; --warning: #b7791f; --caution: #d23a2c;

  --font: "Inter", "Vazirmatn", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --topbar: 60px;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131211; --surface: #1b1a18; --surface-2: #23211f; --border: #2d2b28; --border-strong: #3a3733;
    --text: #ece8e1; --text-2: #c4beb4; --muted: #8f897f;
    --accent: #ef5b4b; --accent-hover: #ff7062; --accent-soft: #2e1c19;
    --code-bg: #181715; --inline-code: #262421;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.5);
    --note: #6ea0f5; --tip: #4cc38a; --important: #a98bf0; --warning: #e0a945; --caution: #ef5b4b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131211; --surface: #1b1a18; --surface-2: #23211f; --border: #2d2b28; --border-strong: #3a3733;
  --text: #ece8e1; --text-2: #c4beb4; --muted: #8f897f;
  --accent: #ef5b4b; --accent-hover: #ff7062; --accent-soft: #2e1c19;
  --code-bg: #181715; --inline-code: #262421;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.5);
  --note: #6ea0f5; --tip: #4cc38a; --important: #a98bf0; --warning: #e0a945; --caution: #ef5b4b;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar) + 20px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.7 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
img, svg { display: block; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1440px; height: 100%; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -0.03em; }
.version { font: 500 12px var(--mono); color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; }
.top-links { display: flex; gap: 4px; margin-left: 16px; }
.top-links a { text-decoration: none; color: var(--text-2); font-size: 14.5px; font-weight: 500; padding: 6px 10px; border-radius: 8px; }
.top-links a:hover { color: var(--text); background: var(--surface-2); }
.top-actions { margin-left: auto; display: flex; gap: 4px; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0;
  background: transparent; color: var(--text-2); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: block; }
}
.menu-btn { display: none; margin-left: -8px; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}

/* Three-column shell */
.shell { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: 260px minmax(0, 1fr) 232px; }
.sidebar {
  position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto;
  padding: 28px 16px 40px 20px; border-right: 1px solid var(--border); scrollbar-width: thin;
}
.nav-group + .nav-group { margin-top: 26px; }
.nav-title { margin: 0 0 8px 12px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a {
  display: block; position: relative; padding: 6px 12px; border-radius: 8px;
  text-decoration: none; color: var(--text-2); font-size: 14.5px; font-weight: 500; line-height: 1.45;
}
.sidebar a:hover { background: var(--surface-2); color: var(--text); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }

.main { min-width: 0; padding: 44px 56px 0; }
.prose { max-width: 760px; margin: 0 auto; }

.toc { position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto; padding: 44px 20px 40px 8px; }
.toc-title { margin: 0 0 10px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent; text-decoration: none; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.toc .toc-3 a { padding-left: 26px; font-size: 13px; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }

/* Typography */
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: clamp(32px, 4vw, 42px); line-height: 1.12; letter-spacing: -0.035em; font-weight: 800; margin: 0 0 16px; }
.prose h1 + p { font-size: 19px; line-height: 1.6; color: var(--text-2); margin-bottom: 36px; }
.prose h2 { font-size: 26px; line-height: 1.25; letter-spacing: -0.025em; font-weight: 750; margin: 56px 0 14px; padding-top: 28px; border-top: 1px solid var(--border); }
.prose h3 { font-size: 19px; line-height: 1.35; letter-spacing: -0.015em; font-weight: 700; margin: 36px 0 10px; }
.prose h4 { font-size: 16px; font-weight: 700; margin: 28px 0 8px; }
.prose h2, .prose h3, .prose h4 { position: relative; }
.anchor { position: absolute; left: -1.1em; padding-right: 0.3em; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 500; }
.prose :is(h2, h3, h4):hover .anchor { opacity: 1; }
.prose p, .prose ul, .prose ol { margin: 0 0 18px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 650; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.prose a:hover { text-decoration-color: currentColor; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }
.prose :not(pre) > code {
  font: 500 0.86em var(--mono); background: var(--inline-code); border: 1px solid var(--border);
  padding: 0.12em 0.4em; border-radius: 6px; overflow-wrap: anywhere;
}
.prose blockquote { margin: 0 0 18px; padding: 4px 18px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.prose blockquote p:last-child { margin-bottom: 0; }

/* Code blocks */
.code { position: relative; margin: 0 0 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--code-bg); overflow: hidden; }
.code-label { padding: 8px 16px; border-bottom: 1px solid var(--border); font: 600 11.5px var(--font); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; background: transparent !important; font: 400 13.5px/1.65 var(--mono); tab-size: 2; }
.code pre code { font: inherit; }
.shiki span { color: var(--shiki-light); }
:root[data-theme="dark"] .shiki span { color: var(--shiki-dark); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .shiki span { color: var(--shiki-dark); } }
.copy {
  position: absolute; top: 6px; right: 8px; z-index: 1; padding: 3px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font: 500 12px var(--font); cursor: pointer; opacity: 0; transition: opacity 0.15s;
}
.code:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { color: var(--text); }
.copy.done { color: var(--tip); opacity: 1; }
.code:not(:has(.code-label)) .copy { top: 10px; }

/* Tables */
.table-wrap { margin: 0 0 24px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.55; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { font-size: 12.5px; font-weight: 650; letter-spacing: 0.02em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; }
td code { white-space: nowrap; }

/* Callouts */
.callout { --c: var(--note); margin: 0 0 22px; padding: 14px 18px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--c) 28%, var(--border)); background: color-mix(in srgb, var(--c) 7%, var(--surface)); }
.callout-tip { --c: var(--tip); } .callout-important { --c: var(--important); } .callout-warning { --c: var(--warning); } .callout-caution { --c: var(--caution); }
.callout-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; color: var(--c); font-weight: 650; font-size: 14.5px; }
.callout p:last-child { margin-bottom: 0; }

/* Pager and footer */
.pager { max-width: 760px; margin: 64px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager a { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.pager a:hover { border-color: var(--accent); }
.pager span { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.pager span svg { width: 15px; height: 15px; }
.pager strong { font-size: 16px; font-weight: 650; }
.pager-next { text-align: right; align-items: flex-end; }
.edit { max-width: 760px; margin: 28px auto 0; }
.edit a { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); text-decoration: none; }
.edit a:hover { color: var(--accent); }
.edit svg { width: 15px; height: 15px; }
.site-footer { max-width: 760px; margin: 48px auto 0; padding: 28px 0 48px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--muted); }
.site-footer p { margin: 0 0 6px; }
.site-footer a { color: var(--text-2); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .heart { display: inline-block; vertical-align: -2px; color: #e5363d; }

/* Home */
.home main { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.home .site-footer { max-width: none; text-align: center; }
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: center; padding: 88px 0 72px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 20px; font: 500 13px var(--mono); color: var(--muted); }
.spark { color: var(--accent); }
.hero h1 { margin: 0 0 22px; font-size: clamp(38px, 5.4vw, 62px); line-height: 1.04; letter-spacing: -0.045em; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { margin: 0 0 32px; max-width: 34em; font-size: 18.5px; line-height: 1.6; color: var(--text-2); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 22px; border-radius: 12px; font-weight: 600; font-size: 15.5px; text-decoration: none; transition: background 0.15s, border-color 0.15s, transform 0.15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: #fff; }
.btn-ghost { border: 1px solid var(--border-strong); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--text); }
.btn svg { width: 17px; height: 17px; }

.hero-demo { display: flex; flex-direction: column; }
.window { position: relative; z-index: 1; width: 100%; border: 1px solid var(--border); border-radius: 16px; background: var(--code-bg); box-shadow: var(--shadow); overflow: hidden; }
.window-bar { display: flex; align-items: center; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.window-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.window-bar span { margin-left: 8px; font: 500 12px var(--mono); color: var(--muted); }
.window pre { margin: 0; padding: 20px 20px 34px; font: 13.5px/1.75 var(--mono); overflow-x: auto; }
.t-tag { color: var(--accent); } .t-attr { color: var(--important); } .t-str { color: var(--tip); }
.chat { position: relative; z-index: 2; align-self: flex-end; width: 300px; margin: -18px -12px 0 0; padding: 14px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.chat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 700; font-size: 14px; }
.bubble { padding: 12px 14px; border-radius: 14px 14px 14px 4px; background: var(--surface-2); font-size: 13.5px; line-height: 1.5; }
.bubble p { margin: 0 0 4px; } .bubble p:last-child { margin: 8px 0 0; }
.bubble .muted { color: var(--muted); }
.chat-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.chat-buttons span { padding: 7px; border-radius: 10px; background: var(--surface-2); text-align: center; font-size: 12.5px; font-weight: 600; color: var(--text-2); }

.flow { display: grid; grid-template-columns: 1fr 40px 1fr 40px 1fr; align-items: center; padding: 8px 0 72px; }
.flow-step { height: 100%; padding: 22px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.flow-step h3 { margin: 12px 0 6px; font-size: 16.5px; letter-spacing: -0.01em; }
.flow-step p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--text-2); }
.num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font: 700 13px var(--mono); }
.flow-arrow { height: 2px; margin: 0 8px; background: repeating-linear-gradient(90deg, var(--border-strong) 0 6px, transparent 6px 11px); }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-bottom: 88px; border: 1px solid var(--border); border-radius: 18px; overflow: hidden; background: var(--border); }
.feature { padding: 28px; background: var(--surface); }
.feature svg { width: 22px; height: 22px; color: var(--accent); }
.feature h3 { margin: 14px 0 6px; font-size: 16.5px; letter-spacing: -0.01em; }
.feature p { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--text-2); }

.doc-map h2 { margin: 0 0 24px; font-size: 30px; letter-spacing: -0.03em; }
.doc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.doc-card { padding: 22px 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.doc-card h3 { margin: 0 0 4px; font-size: 15px; }
.doc-card-intro { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.doc-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.doc-card a { display: block; margin: 0 -10px; padding: 8px 10px; border-radius: 10px; text-decoration: none; }
.doc-card a:hover { background: var(--surface-2); }
.doc-card a strong { display: block; font-size: 14.5px; font-weight: 600; }
.doc-card a:hover strong { color: var(--accent); }
.doc-card a span { display: block; font-size: 13px; line-height: 1.45; color: var(--muted); }

/* Responsive */
@media (max-width: 1240px) {
  .shell { grid-template-columns: 250px minmax(0, 1fr); }
  .toc { display: none; }
  .doc-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .menu-btn { display: grid; }
  .top-links { display: none; }
  .sidebar {
    position: fixed; z-index: 50; top: var(--topbar); left: 0; bottom: 0; width: min(300px, 85vw); height: auto;
    background: var(--bg); transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; z-index: 45; inset: var(--topbar) 0 0 0; background: rgb(0 0 0 / 0.35); }
  .main { padding: 32px 20px 0; }
  .anchor { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 40px; padding: 56px 0 48px; }
  .hero > * { min-width: 0; }
  .eyebrow { flex-wrap: wrap; }
  .chat { width: min(300px, 92%); margin-right: 0; }
  .flow { grid-template-columns: 1fr; gap: 12px; padding-bottom: 56px; }
  .flow-arrow { width: 2px; height: 20px; margin: 0 auto; background: repeating-linear-gradient(180deg, var(--border-strong) 0 6px, transparent 6px 11px); }
  .features { grid-template-columns: 1fr; margin-bottom: 56px; }
}
@media (max-width: 560px) {
  .doc-grid { grid-template-columns: 1fr; }
  .version { display: none; }
  .pager { grid-template-columns: 1fr; }
  .prose h1 + p { font-size: 17.5px; }
  td:first-child { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } html { scroll-behavior: auto; } }
@media print { .topbar, .sidebar, .toc, .pager, .edit, .copy { display: none !important; } .shell { display: block; } }
