/*
 * @license
 * SPDX-License-Identifier: Apache-2.0
 *
 * Shared stylesheet for the @datastripes/dashboard documentation site.
 * Same tokens as the package's own theme.css (pure-black dark UI, green
 * accent) so the docs look like an extension of the product, not a
 * separate brand.
 */
:root {
  --bg: #000000;
  --surface: #0d0d0f;
  --surface-raised: #141417;
  --border: rgba(255, 255, 255, 0.08);
  --text-primary: #f5f5f4;
  --text-secondary: #a3a2a0;
  --text-muted: #6f6e6c;
  --accent: #00d86f;
  --accent-dim: rgba(0, 216, 111, 0.12);
  --code-bg: #111113;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 18px;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: none;
}

code,
pre {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ---------------------------------------------------------------------- */
/* Top bar */
/* ---------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.topbar__brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.topbar__nav {
  display: flex;
  gap: 28px;
  font-size: 0.85rem;
  font-weight: 500;
}

.topbar__nav a {
  color: var(--text-secondary);
  transition: color 0.12s ease;
}

.topbar__nav a:hover {
  color: var(--text-primary);
}

.topbar__nav a.active {
  color: var(--accent);
}

/* ---------------------------------------------------------------------- */
/* Layout */
/* ---------------------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 240px;
  max-width: 1440px;
  margin: 0 auto;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}

/* ---------------------------------------------------------------------- */
/* Sidebar */
/* ---------------------------------------------------------------------- */

.sidebar {
  padding: 28px 20px;
  border-right: 1px solid var(--border);
  height: calc(100vh - 64px);
  overflow-y: auto;
  position: sticky;
  top: 64px;
}

.sidebar__section {
  margin-bottom: 26px;
}

.sidebar__section h4 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.sidebar__section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__section a {
  display: block;
  padding: 6px 10px;
  margin: 0 -10px;
  border-radius: 6px;
  font-size: 0.86rem;
  color: var(--text-secondary);
  transition: background 0.12s ease, color 0.12s ease;
}

.sidebar__section a:hover {
  color: var(--text-primary);
  background: var(--surface-raised);
}

.sidebar__section a.active {
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 600;
}

/* ---------------------------------------------------------------------- */
/* Content */
/* ---------------------------------------------------------------------- */

.content {
  padding: 40px 48px 80px;
  min-width: 0;
}

.content h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}

.content > p.lede {
  font-size: 1.02rem;
  color: var(--text-secondary);
  max-width: 68ch;
  margin: 0 0 24px;
}

.content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 40px 0 14px;
  padding-top: 8px;
  letter-spacing: -0.01em;
  scroll-margin-top: 72px;
}

.content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 26px 0 10px;
  scroll-margin-top: 72px;
}

.content p {
  color: var(--text-secondary);
  max-width: 72ch;
}

.content ul,
.content ol {
  color: var(--text-secondary);
  max-width: 72ch;
  padding-left: 22px;
}

.content li {
  margin-bottom: 6px;
}

.content li > strong {
  color: var(--text-primary);
}

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
}

.content code:not(pre code) {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.85em;
  color: #7ee6ab;
}

.content a:not(.topbar__nav a):not(.sidebar__section a) {
  color: var(--accent);
  border-bottom: 1px solid transparent;
}

.content a:not(.topbar__nav a):not(.sidebar__section a):hover {
  border-bottom-color: var(--accent);
}

/* ---------------------------------------------------------------------- */
/* Code blocks */
/* ---------------------------------------------------------------------- */

.code-block {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 16px 0 24px;
  overflow: hidden;
}

.code-block__lang {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.code-block pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #d9d8d4;
}

.code-block .tok-kw { color: #ff79c6aa; color: #c792ea; }
.code-block .tok-str { color: #7ee6ab; }
.code-block .tok-com { color: var(--text-muted); font-style: italic; }
.code-block .tok-fn { color: #82aaff; }
.code-block .tok-tag { color: #ff8585; }

/* ---------------------------------------------------------------------- */
/* Misc components */
/* ---------------------------------------------------------------------- */

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 24px;
}

.pill {
  display: inline-flex;
  align-items: center;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 18px 0 28px;
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card h4 {
  margin: 0 0 6px;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.card p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.callout {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 18px 0;
  max-width: 72ch;
}

.callout--warn {
  border-left-color: #ff8585;
}

.callout p {
  margin: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0 28px;
  font-size: 0.85rem;
}

th,
td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

th {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  font-weight: 600;
}

td:first-child,
th:first-child {
  color: var(--text-primary);
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.82rem;
}

/* ---------------------------------------------------------------------- */
/* TOC */
/* ---------------------------------------------------------------------- */

.toc {
  padding: 40px 20px;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.toc h4 {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.toc a {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.toc a:hover,
.toc a.active {
  color: var(--accent);
}
