/* Kethosbase developer docs (ADR-0021). Shares the product identity with the
   dashboard + marketing site: indigo→violet gradient, Space Grotesk (display) +
   Inter (body), self-hosted woff2 (no runtime CDN — the docs CSP is strict:
   style-src 'self', script-src 'none'), atmospheric accent glow. Dark only. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/assets/fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/assets/fonts/space-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #090b12;
  --surface: #14171f;
  --surface-2: #1a1e29;
  --surface-3: #222836;
  --border: #242a38;
  --border-strong: #353e52;
  --text: #edf0f8;
  --muted: #98a1b4;
  --faint: #5c6477;
  --accent: #7c8cff;
  --accent-2: #9b6bff;
  --accent-soft: rgba(124, 140, 255, 0.14);
  --grad: linear-gradient(135deg, #7c8cff, #9b6bff 55%, #b06bff);
  --grad-glow: 0 6px 18px rgba(124, 110, 255, 0.35);
  --ok: #34d8a0;
  --glow-1: rgba(155, 107, 255, 0.16);
  --glow-2: rgba(124, 140, 255, 0.13);

  --r: 9px;
  --r-lg: 13px;
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.4);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;

  font-size: 16px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Atmosphere: soft accent glow pinned behind the content. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1000px 520px at 85% -10%, var(--glow-1), transparent 70%),
    radial-gradient(800px 480px at 0% -12%, var(--glow-2), transparent 70%);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

::selection {
  background: var(--accent-soft);
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.08em 0.36em;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  line-height: 1.55;
  box-shadow: var(--elev-1);
}
pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.9em;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: 1.1rem 0;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
th,
td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:last-child td {
  border-bottom: none;
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
}

/* ---- Header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 60px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo:hover {
  text-decoration: none;
}
/* Brand mark: a gradient tile, matching the dashboard/marketing identity. */
.logo::before {
  content: "";
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--grad);
  box-shadow: var(--grad-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  flex: none;
}
.logo small {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
  font-family: var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-header nav {
  margin-left: auto;
  display: flex;
  gap: 1.25rem;
}
.site-header nav a {
  color: var(--muted);
  font-size: 0.94rem;
}
.site-header nav a:hover {
  color: var(--text);
  text-decoration: none;
}

/* ---- Layout: sidebar + article ---- */

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
  padding: 2.5rem 0 4rem;
}
@media (max-width: 820px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  /* On phones the full section list is a ~1000px wall before the article.
     Cap it to a compact, scrollable bar pinned under the header so the doc
     content starts near the top. CSS-only (docs CSP forbids JS). */
  .docs-nav {
    position: sticky;
    top: 56px;
    z-index: 5;
    max-height: 38vh;
    overflow-y: auto;
    margin: 0 -1.5rem;
    padding: 0.85rem 1.5rem 0.6rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .docs-nav h2:first-child {
    margin-top: 0;
  }
  .docs-nav ul {
    margin-bottom: 1rem;
  }
}

.docs-nav {
  position: sticky;
  top: calc(60px + 1.25rem);
  align-self: start;
  font-size: 0.95rem;
}
.docs-nav h2 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
  margin: 0 0 0.5rem;
}
.docs-nav ul {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}
.docs-nav li {
  padding: 0.1rem 0;
}
.docs-nav a {
  display: block;
  color: var(--muted);
  padding: 0.25rem 0.6rem;
  border-radius: var(--r);
  border-left: 2px solid transparent;
}
.docs-nav a:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  text-decoration: none;
}
.docs-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

/* ---- Article ---- */

article {
  min-width: 0;
}
article h1 {
  font-family: var(--display);
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}
article h2 {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 2.4rem 0 0.8rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}
article h3 {
  font-family: var(--display);
  font-size: 1.08rem;
  font-weight: 600;
  margin: 1.6rem 0 0.5rem;
}
article p.lead {
  color: var(--muted);
  font-size: 1.08rem;
  margin-top: 0;
}

.endpoint {
  font-family: var(--mono);
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
  padding: 0.55rem 0.9rem;
  margin: 0.7rem 0;
}

.note {
  background: color-mix(in srgb, var(--surface) 70%, var(--bg));
  border: 1px solid var(--border);
  border-left: 3px solid var(--ok);
  border-radius: var(--r);
  padding: 0.8rem 1rem;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    var(--surface),
    color-mix(in srgb, var(--surface) 55%, var(--bg))
  );
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  box-shadow: var(--elev-1);
  transition: border-color 0.16s ease, transform 0.16s ease;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--grad);
  opacity: 0;
  transition: opacity 0.16s ease;
}
.card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translateY(-2px);
}
.card:hover::before {
  opacity: 0.85;
}
.card h3 {
  font-family: var(--display);
  font-weight: 600;
  margin: 0 0 0.4rem;
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---- Footer ---- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---- 404 ---- */

.notfound {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.notfound h1 {
  font-family: var(--display);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .card {
    transition: none;
  }
}
