/*
 * Aptiro docs site styles.
 *
 * The brand tokens below are a vendored COPY of the ones in
 * ../../../../aptiro-site/styles.css (the Aptiro marketing site, a separate
 * repo and a separate deploy). Linking to that stylesheet across sites would
 * make this site's look depend on aptiro.io's cache and paths, and break the
 * moment either one moves, so the tokens are copied here instead. If the
 * brand changes, update both places.
 *
 * The marketing site has no light theme, so this docs site matches it with
 * one fixed dark theme rather than adding a toggle of its own. Every rule
 * below reads a --docs-* semantic alias, never a brand token or a literal
 * hex directly, so a light theme later is new values for the aliases (or a
 * media query around them), not a rewrite of the rules themselves.
 */
:root {
  color-scheme: dark;

  /* Brand tokens, vendored copy. The only literal colours in this file. */
  --indigo-700: #2E39A8;
  --indigo-600: #4757E0;
  --indigo-500: #5B6CFF;
  --indigo-400: #8390FF;
  --indigo-200: #C3C9FF;
  --base: #0D1015;
  --card: #161B23;
  --raised: #1F2630;
  --border: #2F3743;
  --muted: #98A3B3;
  --text: #E9EDF3;
  --sig-strong: #3FB950;
  --sig-medium: #E0A33E;
  --sig-weak: #EF5B54;
  --radius: 18px;

  /* Semantic aliases: every rule below uses one of these, never a brand token by name. */
  --docs-bg: var(--base);
  --docs-surface: var(--card);
  --docs-surface-raised: var(--raised);
  --docs-border: var(--border);
  --docs-rule: var(--raised);
  --docs-text: var(--text);
  --docs-muted: var(--muted);
  --docs-link: var(--indigo-400);
  --docs-focus: var(--indigo-400);
  --docs-code-bg: var(--card);
  --docs-code-border: var(--border);
  --docs-active-bg: var(--raised);
  /* Deliberate exception: amber is reserved for in-product attention states
     (see docs/brand/README.md, "Status colours"). Matt approved amber for
     docs warning callouts specifically, so this alias is the one place that
     exception lives. Do not quietly "fix" this back to indigo or red. */
  --docs-warning: var(--sig-medium);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2-variations');
  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;
}

body {
  margin: 0;
  background: var(--docs-bg);
  color: var(--docs-text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}
img { max-width: 100%; }
a { color: var(--docs-link); text-decoration: none; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--docs-focus); outline-offset: 3px; border-radius: 4px; }

/* Colour alone cannot carry a link in running text (WCAG 1.4.1), so prose
   links are underlined; chrome below (nav, menu, pagination, TOC) overrides
   this back to no-underline, since those are identifiable by position and
   structure, not by reading them as text. */
.docs-content a { text-decoration: underline; text-underline-offset: 2px; }

.docs-skip {
  position: absolute; left: 8px; top: -48px; z-index: 20;
  padding: 10px 16px; border-radius: 8px; background: var(--docs-surface); color: var(--docs-text);
  transition: top .15s;
}
.docs-skip:focus { top: 8px; }

.docs-topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px; padding: 0 24px;
  border-bottom: 1px solid var(--docs-rule);
  background: color-mix(in srgb, var(--docs-bg) 90%, transparent); backdrop-filter: blur(10px);
}
.docs-brand { display: flex; align-items: center; gap: 8px; }
.docs-brand img { display: block; }
.docs-brand span { color: var(--docs-muted); font-weight: 500; font-size: 15px; }
.docs-topnav { display: flex; gap: 20px; font-size: 14px; color: var(--docs-muted); }
.docs-topnav a { text-decoration: none; }
.docs-topnav a:hover { color: var(--docs-text); }

/* Mobile menu: the marketing site's own <details> disclosure pattern, not a
   new one. No overlay, no scroll lock, no focus trap: a native <details>
   needs none of them. Visible only below the sidebar breakpoint. */
.docs-menu { display: none; border-bottom: 1px solid var(--docs-rule); }
.docs-menu summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; min-height: 44px; padding: 0 20px;
  font-size: 14px; font-weight: 600; color: var(--docs-text);
}
.docs-menu summary::-webkit-details-marker { display: none; }
.docs-menu nav { padding: 4px 12px 16px; }
.docs-menu a { display: flex; align-items: center; min-height: 44px; padding: 0 8px; text-decoration: none; }

.docs-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 40px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.docs-nav {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
}
.docs-nav-section + .docs-nav-section { margin-top: 24px; }
.docs-nav h2 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--docs-muted);
}
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav li { margin: 0; }
.docs-nav a {
  display: block;
  padding: 6px 10px;
  margin: 0 -10px;
  border-radius: 8px;
  color: var(--docs-muted);
  font-size: 14px;
  text-decoration: none;
}
.docs-nav a:hover { color: var(--docs-text); background: var(--docs-surface); }
.docs-nav a.is-active { color: var(--docs-text); background: var(--docs-active-bg); font-weight: 600; }

.docs-content { min-width: 0; }
.docs-content article {
  max-width: 68ch;
  font-size: 16px;
}
.docs-content h1 { font-size: 34px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 24px; }
/* The hairline is the one thing here that does the most for scanning a long
   page: every h2 opens a new section, visibly, not just by a size change. */
.docs-content h2 {
  font-size: 22px; letter-spacing: -0.01em;
  margin-top: 40px; padding-top: 24px; margin-bottom: 12px;
  border-top: 1px solid var(--docs-rule);
  /* Sticky header is 64px; clears it with 16px of air beneath. */
  scroll-margin-top: 80px;
}
.docs-content h3 { font-size: 18px; margin: 28px 0 10px; scroll-margin-top: 80px; }
:target { scroll-margin-top: 80px; }
.docs-content p { margin: 0 0 16px; color: var(--docs-text); }
.docs-content ul, .docs-content ol { margin: 0 0 16px; padding-left: 1.3em; }
.docs-content li { margin-bottom: 6px; }
.docs-content li > p { margin-bottom: 4px; }
.docs-content strong { color: var(--docs-text); font-weight: 600; }
.docs-content code {
  font: 13px ui-monospace, 'SF Mono', Menlo, monospace;
  background: var(--docs-code-bg);
  border: 1px solid var(--docs-code-border);
  border-radius: 5px;
  padding: 1px 6px;
}
.docs-content pre {
  background: var(--docs-code-bg);
  border: 1px solid var(--docs-code-border);
  border-radius: 12px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 20px;
}
.docs-content pre code { border: 0; padding: 0; background: none; }
.docs-content blockquote {
  margin: 0 0 16px;
  padding: 4px 18px;
  border-left: 3px solid var(--docs-border);
  color: var(--docs-muted);
}
/* Warning callout: author opts in with raw HTML in the markdown source,
   <blockquote class="is-warning">...</blockquote>; see the --docs-warning
   comment above for why this is amber. */
.docs-content blockquote.is-warning { border-left-color: var(--docs-warning); color: var(--docs-text); }
.docs-content hr { border: 0; border-top: 1px solid var(--docs-rule); margin: 32px 0; }
.docs-content table { border-collapse: collapse; width: 100%; margin: 0 0 20px; font-size: 14px; }
.docs-content th, .docs-content td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--docs-rule); }
.docs-content th { color: var(--docs-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }

/* Page table of contents: generated only for a page with three or more h2s
   (see buildToc in docs-build.ts), desktop only. A plain block, not a float
   beside the text, so it never narrows an h2's hairline underneath it. */
.docs-toc {
  display: inline-block; max-width: 320px; margin: 0 0 32px; padding: 16px 20px;
  border: 1px solid var(--docs-rule); border-radius: 12px; background: var(--docs-surface);
  font-size: 13px;
}
.docs-toc p { margin: 0 0 8px; color: var(--docs-muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.06em; }
.docs-toc ul { margin: 0; padding-left: 1.1em; }
.docs-toc ul ul { margin-top: 4px; }
.docs-toc li { margin-bottom: 6px; }
.docs-toc a { text-decoration: none; }

.docs-pagination {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--docs-rule);
}
.docs-pagination a {
  display: flex; flex-direction: column; gap: 2px; max-width: 46%;
  text-decoration: none; font-weight: 600;
}
.docs-next { text-align: right; margin-left: auto; }
.docs-pagination a span:first-child { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--docs-muted); }

.docs-updated { margin-top: 16px; font-size: 13px; color: var(--docs-muted); }

@media (max-width: 860px) {
  .docs-menu { display: block; }
  .docs-nav { display: none; }
  .docs-toc { display: none; }
  .docs-body { grid-template-columns: 1fr; gap: 0; padding: 24px 20px 64px; }
  .docs-content article { max-width: none; }
}

@media (max-width: 480px) {
  .docs-topbar { padding: 0 16px; }
  .docs-topnav { gap: 12px; }
  .docs-pagination { flex-direction: column; }
  .docs-pagination a, .docs-next { max-width: none; text-align: left; margin-left: 0; }
}
