/* ═══════════════════════════════════════════
   docs.css — growthOS documentation page
   Inherits tokens from ../src/css/tokens.css
   Layout: sidebar nav + main content
   ═══════════════════════════════════════════ */

/* ── Base (docs needs its own since it doesn't load base.css) ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: rgba(167, 139, 250, 0.2); }

/* ── Layout ── */
.docs {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

@media (max-width: 860px) {
  .docs { grid-template-columns: 1fr; }
  .docs-sidebar { display: none; }
  .docs-sidebar.is-open { display: flex; position: fixed; inset: 0; z-index: 200; background: var(--bg); }
  .docs-mobile-toggle { display: flex !important; }
}

/* ── Sidebar ── */
.docs-sidebar {
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-3) transparent;
}

.docs-sidebar__header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.docs-sidebar__logo {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.15em; color: var(--ink);
  text-decoration: none; display: block;
}

.docs-sidebar__back {
  font-family: var(--font-mono); font-size: 0.5625rem;
  color: var(--ink-4); text-decoration: none;
  display: flex; align-items: center; gap: 4px;
  margin-top: 0.5rem;
  transition: color 120ms;
}
.docs-sidebar__back:hover { color: var(--vi); }

.docs-sidebar__nav {
  padding: 1rem 0; flex: 1;
}

.docs-nav-group { padding: 0 0.75rem; margin-bottom: 0.5rem; }

.docs-nav-label {
  font-family: var(--font-mono); font-size: 0.5625rem;
  font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-4);
  padding: 0.5rem 0.5rem 0.375rem;
  display: block;
}

.docs-nav-link {
  display: block; padding: 0.375rem 0.5rem;
  font-size: 0.8125rem; color: var(--ink-3);
  text-decoration: none;
  transition: color 100ms, background 100ms;
}
.docs-nav-link:hover { color: var(--ink); background: var(--bg-1); }
.docs-nav-link.is-active { color: var(--vi); background: var(--vi-dim); }

.docs-nav-link--sub {
  padding-left: 1.25rem;
  font-size: 0.75rem;
}

/* ── Main content ── */
.docs-main {
  max-width: 780px;
  padding: 3rem clamp(1.5rem, 4vw, 3rem) 6rem;
}

.docs-main h1 {
  font-family: var(--font-display); font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700; line-height: 1.1; letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.docs-main h2 {
  font-family: var(--font-display); font-size: 1.5rem;
  font-weight: 600; letter-spacing: -0.02em;
  margin-top: 3rem; margin-bottom: 0.75rem;
  padding-top: 1.5rem; border-top: 1px solid var(--line);
}

.docs-main h3 {
  font-family: var(--font-display); font-size: 1.125rem;
  font-weight: 600; letter-spacing: -0.01em;
  margin-top: 2rem; margin-bottom: 0.5rem;
}

.docs-main p {
  color: var(--ink-2); line-height: 1.7;
  margin-bottom: 1rem; max-width: 65ch;
}

.docs-main strong { color: var(--ink); }

.docs-main ul, .docs-main ol {
  color: var(--ink-2); padding-left: 1.25rem;
  margin-bottom: 1rem; line-height: 1.7;
}
.docs-main li { margin-bottom: 0.375rem; }

.docs-main code {
  font-family: var(--font-mono); font-size: 0.8125rem;
  color: var(--vi); background: var(--bg-1);
  padding: 1px 5px;
}

.docs-main pre {
  background: var(--bg-code); border: 1px solid var(--line);
  padding: 1rem 1.25rem; margin-bottom: 1.5rem;
  overflow-x: auto; font-family: var(--font-mono);
  font-size: 0.8125rem; line-height: 1.7;
  color: var(--ink-2);
}

.docs-main a { color: var(--vi); text-decoration: none; }
.docs-main a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Table ── */
.docs-table-wrap { overflow-x: auto; margin-bottom: 1.5rem; border: 1px solid var(--line); }
.docs-main table { width: 100%; border-collapse: collapse; min-width: 500px; }
.docs-main th {
  font-family: var(--font-mono); font-size: 0.625rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-4);
  text-align: left; padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--line); background: var(--bg-1);
}
.docs-main td {
  font-size: 0.8125rem; color: var(--ink-2);
  padding: 0.625rem 1rem; border-bottom: 1px solid var(--line);
}
.docs-main tr:hover td { background: var(--bg-1); }

/* ── Cards grid ── */
.docs-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  margin-bottom: 1.5rem;
}
.docs-card {
  background: var(--bg); padding: 1.25rem;
  transition: background 120ms;
}
.docs-card:hover { background: var(--bg-1); }
.docs-card__title {
  font-family: var(--font-mono); font-size: 0.8125rem;
  font-weight: 500; color: var(--ink);
}
.docs-card__desc {
  font-size: 0.75rem; color: var(--ink-3); margin-top: 0.25rem; line-height: 1.5;
}
.docs-card__tag {
  display: inline-block; font-family: var(--font-mono); font-size: 0.5625rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--vi); margin-top: 0.5rem;
}

/* ── Callout ── */
.docs-callout {
  border-left: 1px solid var(--vi);
  background: var(--bg-1); padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem; color: var(--ink-2);
}
.docs-callout strong { color: var(--vi); }

/* ── Badge ── */
.docs-badge {
  display: inline-block; font-family: var(--font-mono); font-size: 0.5625rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 6px; border: 1px solid var(--vi-line); color: var(--vi);
}

/* ── Mobile toggle ── */
.docs-mobile-toggle {
  display: none; position: fixed; bottom: 1rem; right: 1rem; z-index: 201;
  width: 44px; height: 44px; background: var(--vi); color: var(--bg);
  border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600;
  align-items: center; justify-content: center;
}

/* ── On this page (right sidebar on wide screens) ── */
.docs-toc {
  position: fixed; right: 1rem; top: 4rem;
  width: 180px; display: none;
}
@media (min-width: 1200px) {
  .docs-toc { display: block; }
}
.docs-toc__label {
  font-family: var(--font-mono); font-size: 0.5625rem;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-4); margin-bottom: 0.5rem;
}
.docs-toc a {
  display: block; font-size: 0.6875rem; color: var(--ink-4);
  text-decoration: none; padding: 0.25rem 0;
  transition: color 100ms;
}
.docs-toc a:hover { color: var(--ink-2); }
.docs-toc a.is-active { color: var(--vi); }
