/* ============================================================
   Glozr Docs — design system
   Light only mode by default per brand spec, with optional dark
   ============================================================ */

:root {
  /* Type */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Surfaces */
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-muted: #f1f5f9;
  --bg-code: #f8fafc;
  --bg-callout: #eff6ff;
  --bg-card: #ffffff;
  --bg-search: #ffffff;

  /* Borders */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-callout: #bfdbfe;

  /* Text */
  --text: #0f172a;
  --text-soft: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --text-invert: #ffffff;

  /* Accents */
  --accent: #2563eb;
  --accent-soft: #1d4ed8;
  --accent-bg: #eff6ff;
  --accent-ring: rgba(37, 99, 235, 0.18);

  /* Eyebrow */
  --eyebrow: #64748b;

  /* Layout */
  --sidebar-w: 264px;
  --toc-w: 224px;
  --content-max: 760px;
  --topbar-h: 56px;

  /* Radii / shadows */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 16px -8px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-subtle: #0f0f10;
  --bg-muted: #1a1a1c;
  --bg-code: #111113;
  --bg-callout: #11213b;
  --bg-card: #121214;
  --bg-search: #1a1a1c;

  --border: #1f1f23;
  --border-strong: #2a2a30;
  --border-callout: #1e3a8a;

  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --accent: #60a5fa;
  --accent-soft: #93c5fd;
  --accent-bg: #11213b;
  --accent-ring: rgba(96, 165, 250, 0.22);

  --eyebrow: #94a3b8;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 16px -8px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ===== Top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: #0f172a;
  color: #fff;
  flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; }
[data-theme="dark"] .brand-mark { background: #1f1f23; }
.brand-tag { color: var(--text-muted); font-weight: 500; }

.search {
  flex: 1;
  max-width: 460px;
  position: relative;
}
.search input {
  width: 100%;
  height: 36px;
  padding: 0 36px 0 36px;
  border: 1px solid var(--border);
  background: var(--bg-search);
  border-radius: var(--radius);
  font: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--text-faint); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.search .icon-search {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); pointer-events: none;
}
.search .kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 6px; background: var(--bg-subtle);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 360px;
  overflow-y: auto;
  display: none;
  padding: 4px;
}
.search-results.open { display: block; }
.search-results a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}
.search-results a:hover { background: var(--bg-muted); text-decoration: none; }
.search-results .group {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 8px 12px 2px;
  font-family: var(--font-mono);
}
.search-results .empty { padding: 16px; color: var(--text-muted); font-size: 14px; }

/* Audience toggle (Users / Reseller), sits between brand and search */
.audience-toggle {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  gap: 2px;
}
.audience-link {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  transition: background .15s, color .15s, box-shadow .15s;
}
.audience-link:hover {
  color: var(--text);
  text-decoration: none;
}
.audience-link.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .audience-link.active { background: #2a2a30; }

.topbar-spacer { flex: 1; }
.topbar-nav {
  display: flex; align-items: center; gap: 4px;
}
.topbar-nav a, .topbar-nav button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border-radius: 8px;
  color: var(--text-soft);
  font: inherit; font-size: 14px; font-weight: 500;
  background: transparent; border: 0; cursor: pointer;
}
.topbar-nav a:hover, .topbar-nav button:hover {
  background: var(--bg-muted); color: var(--text); text-decoration: none;
}
.theme-toggle { width: 36px; padding: 0; justify-content: center; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }

.menu-toggle { display: none; }

/* ===== Layout ===== */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 0;
  max-width: 100%;
  margin: 0;
}

/* ===== Sidebar ===== */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 28px 12px 48px 14px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.sidebar-group { margin-bottom: 24px; }
.sidebar-group-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--eyebrow);
  font-family: var(--font-mono);
  padding: 0 10px 8px;
}
.sidebar-link {
  display: block;
  padding: 6px 10px;
  margin: 1px 0;
  font-size: 13.5px;
  border-radius: 6px;
  color: var(--text-soft);
  line-height: 1.45;
}
.sidebar-link:hover {
  background: var(--bg-muted);
  color: var(--text);
  text-decoration: none;
}
.sidebar-link.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 500;
}

/* ===== Main ===== */
.main {
  min-width: 0;
  padding: 40px 56px 80px;
  display: flex;
  justify-content: center;
}
.main > article {
  width: 100%;
  max-width: var(--content-max);
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--eyebrow);
  margin: 0 0 10px;
}

.main h1 {
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text);
}
.main h2 {
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin: 40px 0 12px;
  color: var(--text);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.main h3 {
  font-size: 17px;
  line-height: 1.35;
  font-weight: 600;
  margin: 28px 0 8px;
  color: var(--text);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.main p { margin: 12px 0; color: var(--text-soft); }
.main strong { color: var(--text); font-weight: 600; }
.main ul, .main ol { padding-left: 20px; color: var(--text-soft); }
.main li { margin: 6px 0; }
.main li::marker { color: var(--text-faint); }

.lead { font-size: 17px; color: var(--text-soft); margin: 12px 0 24px; }

/* Inline code */
.main code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-muted);
  color: var(--text);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Code blocks */
.main pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  overflow-x: auto;
  color: var(--text);
  margin: 16px 0;
}
.main pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* Callouts */
.callout {
  display: flex; gap: 12px;
  background: var(--bg-callout);
  border: 1px solid var(--border-callout);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 20px 0;
  color: var(--text);
  font-size: 14.5px;
}
.callout .callout-icon {
  flex-shrink: 0;
  width: 18px; height: 18px;
  color: var(--accent);
  margin-top: 2px;
}
.callout p { margin: 0; color: var(--text); }
.callout strong { color: var(--text); }

.callout.warn { background: #fff7ed; border-color: #fed7aa; }
.callout.warn .callout-icon { color: #c2410c; }
[data-theme="dark"] .callout.warn { background: #2a1505; border-color: #7c2d12; }
[data-theme="dark"] .callout.warn .callout-icon { color: #fb923c; }

/* Tables */
.main table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.main thead th {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-subtle);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.main tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-soft);
}
.main tbody tr:last-child td { border-bottom: 0; }
.main tbody td code { white-space: nowrap; }

/* Feature cards grid (Welcome) */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 24px;
}
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 16px 18px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.card-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  margin: 0 0 6px;
}
.card-body {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* Page footer / pagination */
.page-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.page-footer a {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--bg-card);
  transition: border-color .15s, transform .15s;
}
.page-footer a:hover { border-color: var(--border-strong); transform: translateY(-1px); text-decoration: none; }
.page-footer .label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 2px; }
.page-footer .title { font-size: 14px; color: var(--text); font-weight: 600; }
.page-footer .next { text-align: right; }

/* ===== On this page (right TOC) ===== */
.toc {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 40px 20px 48px;
  font-size: 13px;
}
.toc-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--eyebrow);
  margin: 0 0 10px;
}
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 4px 0;
  color: var(--text-muted);
  line-height: 1.4;
  border-left: 2px solid transparent;
  padding-left: 10px;
  margin-left: -10px;
}
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.toc .level-3 { padding-left: 22px; font-size: 12.5px; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
  .main { padding: 32px 36px 64px; }
}

@media (max-width: 820px) {
  :root { --topbar-h: 52px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    width: 80%;
    max-width: 320px;
    height: calc(100vh - var(--topbar-h));
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 30;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: 0; background: transparent; cursor: pointer;
    color: var(--text-soft); border-radius: 8px;
    margin-right: 4px;
  }
  .menu-toggle:hover { background: var(--bg-muted); }

  .topbar { padding: 0 12px; gap: 8px; }
  .brand { min-width: 0; }
  .brand-tag { display: none; }
  .search { max-width: none; }
  .search .kbd { display: none; }
  .topbar-nav .nav-text { display: none; }
  .audience-toggle { padding: 2px; gap: 0; }
  .audience-link { height: 26px; padding: 0 10px; font-size: 12px; }
  .chooser-grid { grid-template-columns: 1fr; }

  .main { padding: 28px 18px 56px; }
  .main h1 { font-size: 28px; }
  .main h2 { font-size: 20px; margin-top: 32px; }

  .cards-grid { grid-template-columns: 1fr; }
  .page-footer { grid-template-columns: 1fr; }
  .page-footer .next { text-align: left; }
}

/* Backdrop when mobile menu is open */
.menu-backdrop {
  position: fixed; inset: var(--topbar-h) 0 0 0;
  background: rgba(15, 23, 42, 0.4);
  opacity: 0; pointer-events: none;
  transition: opacity .2s; z-index: 20;
}
.menu-backdrop.open { opacity: 1; pointer-events: auto; }

/* ===== Audience chooser (root /documentation/ page) ===== */
.audience-chooser {
  max-width: 900px;
  margin: 0 auto;
  padding: 80px 32px 96px;
}
.audience-chooser .eyebrow { margin-bottom: 12px; }
.audience-chooser h1 {
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text);
}
.audience-chooser .chooser-lead {
  font-size: 17px;
  color: var(--text-soft);
  margin: 0 0 40px;
  max-width: 640px;
}
.chooser-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.chooser-card {
  display: block;
  padding: 28px 28px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.chooser-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.chooser-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}
.chooser-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.chooser-body {
  font-size: 14.5px;
  color: var(--text-soft);
  margin: 0 0 18px;
  line-height: 1.55;
}
.chooser-cta {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--accent);
  margin: 0;
}

/* Print */
@media print {
  .sidebar, .toc, .topbar, .menu-toggle { display: none; }
  .layout { grid-template-columns: 1fr; }
  .main { padding: 0; }
}
