/* ============================================================
   dev-bookstack documentation site
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f8fafc;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text:        #1e293b;
  --text-muted:  #64748b;
  --accent:      #2563eb;
  --accent-dark: #1d4ed8;
  --accent-bg:   #eff6ff;
  --sidebar-bg:  #0f172a;
  --sidebar-text:#cbd5e1;
  --sidebar-head:#f1f5f9;
  --sidebar-act: #2563eb;
  --code-bg:     #0f172a;
  --code-text:   #e2e8f0;
  --warn-bg:     #fffbeb;
  --warn-border: #f59e0b;
  --tip-bg:      #f0fdf4;
  --tip-border:  #22c55e;
  --sidebar-w:   260px;
  --header-h:    56px;
}

/* ── Base ─────────────────────────────────────────────────── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

/* ── Top header bar ───────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--sidebar-bg);
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  z-index: 100;
  gap: 1rem;
}

.site-header .logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--sidebar-head);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-header .logo .icon {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.header-tagline {
  color: #475569;
  font-size: 0.8rem;
  border-left: 1px solid #1e3a5f;
  padding-left: 1rem;
  margin-left: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-badges {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.header-badges a img { height: 20px; display: block; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  background: var(--sidebar-bg);
  border-right: 1px solid #1e293b;
  overflow-y: auto;
  padding: 1.5rem 0 2rem;
  z-index: 90;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-label {
  padding: 0 1.25rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
}

.sidebar nav a {
  display: block;
  padding: 0.45rem 1.25rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.sidebar nav a:hover {
  background: #1e293b;
  color: var(--sidebar-head);
}

.sidebar nav a.active {
  background: #1e3a5f;
  color: #93c5fd;
  border-left-color: var(--accent);
  font-weight: 500;
}

/* ── Main content ─────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  padding-top: var(--header-h);
  min-height: 100vh;
}

.content {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* ── Page hero ────────────────────────────────────────────── */
.page-hero {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.page-hero .label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.page-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.page-hero p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 640px;
}

/* ── Headings ─────────────────────────────────────────────── */
h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 2.5rem 0 0.75rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.75rem 0 0.5rem;
}

h4 {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 1.25rem 0 0.4rem;
}

/* ── Paragraphs & lists ───────────────────────────────────── */
p { margin-bottom: 1rem; }

ul, ol {
  margin: 0.5rem 0 1rem 1.5rem;
}

li { margin-bottom: 0.3rem; }

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

a:hover { text-decoration: underline; }

/* ── Code ─────────────────────────────────────────────────── */
code {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  font-size: 0.82em;
  background: #e2e8f0;
  color: #0f172a;
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  font-size: 0.85rem;
  line-height: 1.7;
  border: 1px solid #1e293b;
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.code-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.875rem;
}

thead tr {
  background: var(--sidebar-bg);
  color: var(--sidebar-head);
}

thead th {
  padding: 0.6rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--accent-bg); }

td {
  padding: 0.6rem 1rem;
  vertical-align: top;
}

td code { font-size: 0.8em; }

/* ── Callouts ─────────────────────────────────────────────── */
.callout {
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-left: 4px solid;
  font-size: 0.9rem;
}

.callout-warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.callout-tip {
  background: var(--tip-bg);
  border-color: var(--tip-border);
}

.callout-info {
  background: var(--accent-bg);
  border-color: var(--accent);
}

.callout strong { display: block; margin-bottom: 0.3rem; font-size: 0.85rem; }

/* ── Cards / step grid ────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.card h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  margin: 0 0 0.4rem;
}

.card p { font-size: 0.83rem; color: var(--text-muted); margin: 0; }
.card .card-icon { font-size: 1.4rem; margin-bottom: 0.5rem; }

/* ── Pipeline step list ───────────────────────────────────── */
.steps { list-style: none; margin: 0 0 1.5rem; padding: 0; }

.steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.steps li:last-child { border-bottom: none; }

.step-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.05rem;
}

.step-body h4 { margin: 0 0 0.2rem; font-size: 0.9rem; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
.step-body p  { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

/* ── Section divider ──────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── Badge pill ───────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.15em 0.55em;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-slate  { background: #f1f5f9; color: #475569; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .content { padding: 1.5rem 1rem 3rem; }
  .page-hero h1 { font-size: 1.5rem; }
  .header-tagline { display: none; }
}
