/* ==========================================================================
   Nexus Bot Manager — Official website
   Static site, vanilla HTML/CSS/JS, no framework.
   Design system aligned with the Nexus Bot Manager application.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* --- Design tokens -------------------------------------------------------- */
:root,
[data-theme="dark"] {
  --brand:        #2563eb;
  --brand-hover:  #1d4ed8;
  --brand-soft:   rgba(37, 99, 235, 0.12);
  --brand-border: rgba(37, 99, 235, 0.32);

  --bg-base:      #0d1117;
  --bg-surface:   #161b22;
  --bg-elevated:  #1c2128;
  --bg-card:      #161b22;
  --bg-code:      #0b1118;
  --bg-hover:     rgba(255, 255, 255, 0.04);

  --border:       #30363d;
  --border-soft:  rgba(255, 255, 255, 0.06);
  --border-2:     #3d444d;

  --tx-1:         #e6edf3;
  --tx-2:         #8b949e;
  --tx-3:         #6e7681;
  --tx-inv:       #0d1117;

  --green:        #3fb950;
  --green-bg:     rgba(63, 185, 80, 0.10);
  --red:          #f85149;
  --red-bg:       rgba(248, 81, 73, 0.10);
  --amber:        #d29922;
  --amber-bg:     rgba(210, 153, 34, 0.10);

  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:       0 3px 10px rgba(0, 0, 0, 0.45);
  --shadow-lg:    0 10px 30px rgba(0, 0, 0, 0.55);

  --header-h:     64px;

  --font:         'Inter', -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r-sm: 4px;
  --r:    6px;
  --r-lg: 10px;

  color-scheme: dark;
}

[data-theme="light"] {
  --brand:        #2563eb;
  --brand-hover:  #1d4ed8;
  --brand-soft:   rgba(37, 99, 235, 0.08);
  --brand-border: rgba(37, 99, 235, 0.30);

  --bg-base:      #f6f8fa;
  --bg-surface:   #ffffff;
  --bg-elevated:  #ffffff;
  --bg-card:      #ffffff;
  --bg-code:      #f1f4f8;
  --bg-hover:     rgba(0, 0, 0, 0.04);

  --border:       #d8dee4;
  --border-soft:  rgba(0, 0, 0, 0.04);
  --border-2:     #c2c8d0;

  --tx-1:         #1f2328;
  --tx-2:         #57606a;
  --tx-3:         #8c959f;
  --tx-inv:       #ffffff;

  --green:        #1a7f37;
  --green-bg:     rgba(26, 127, 55, 0.10);
  --red:          #cf222e;
  --red-bg:       rgba(207, 34, 46, 0.08);
  --amber:        #9a6700;
  --amber-bg:     rgba(154, 103, 0, 0.10);

  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow:       0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg:    0 10px 30px rgba(0, 0, 0, 0.10);

  color-scheme: light;
}

/* System theme: prefer light by default unless OS is dark */
@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --brand:        #2563eb;
    --brand-hover:  #1d4ed8;
    --brand-soft:   rgba(37, 99, 235, 0.08);
    --brand-border: rgba(37, 99, 235, 0.30);
    --bg-base:      #f6f8fa;
    --bg-surface:   #ffffff;
    --bg-elevated:  #ffffff;
    --bg-card:      #ffffff;
    --bg-code:      #f1f4f8;
    --bg-hover:     rgba(0, 0, 0, 0.04);
    --border:       #d8dee4;
    --border-soft:  rgba(0, 0, 0, 0.04);
    --border-2:     #c2c8d0;
    --tx-1:         #1f2328;
    --tx-2:         #57606a;
    --tx-3:         #8c959f;
    --tx-inv:       #ffffff;
    --green:        #1a7f37;
    --green-bg:     rgba(26, 127, 55, 0.10);
    --red:          #cf222e;
    --red-bg:       rgba(207, 34, 46, 0.08);
    --amber:        #9a6700;
    --amber-bg:     rgba(154, 103, 0, 0.10);
    --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow:       0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg:    0 10px 30px rgba(0, 0, 0, 0.10);
    color-scheme: light;
  }
}
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    color-scheme: dark;
  }
}

/* --- Base reset ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--tx-1);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;            /* safety net for any element that overflows horizontally */
}
/* Reserve a permanent gutter for the vertical scrollbar so toggling
   overflow:hidden on body (when the mobile menu opens) does NOT shift
   the header buttons horizontally. */
html {
  scrollbar-gutter: stable;
}

img, svg { max-width: 100%; height: auto; display: block; }

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--brand-hover); }

::selection {
  background: var(--brand-soft);
  color: var(--tx-1);
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
  border: 2px solid var(--bg-base);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* --- Layout --------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}
.container-narrow {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
}
main { flex: 1 0 auto; }

/* --- Header -------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-soft);
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--tx-1);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--tx-1); }
.brand img { height: 32px; width: auto; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  color: var(--tx-2);
  padding: 0 12px;
  min-height: 36px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--r);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.site-nav a:hover { color: var(--tx-1); background: var(--bg-hover); }
.site-nav a.active { color: var(--tx-1); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Match GitHub button height to nav links + theme button */
.header-actions .btn-github {
  padding: 0 14px;
  min-height: 36px;
  font-size: 14px;
}

/* --- Theme selector ------------------------------------------------------ */
.theme-select {
  position: relative;
}
.theme-select-btn,
.mobile-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--tx-1);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.theme-select-btn:hover {
  color: var(--tx-1);
  background: var(--bg-hover);
  border-color: var(--border-2);
}
.mobile-menu-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-2);
}
.theme-select-btn:focus-visible,
.mobile-menu-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.theme-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  display: none;
}
.theme-select.open .theme-select-menu { display: block; }
.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tx-1);
  border-radius: var(--r);
  cursor: pointer;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background-color 0.15s ease;
}
.theme-option:hover { background: var(--bg-hover); }
.theme-option.active { color: var(--brand); }
.theme-option svg { flex-shrink: 0; color: var(--tx-2); }
.theme-option.active svg { color: var(--brand); }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.2;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #fff;
}
.btn-secondary {
  background: var(--bg-surface);
  color: var(--tx-1);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-2);
  color: var(--tx-1);
}
.btn-ghost {
  background: transparent;
  color: var(--tx-1);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); }
.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
}
.btn svg { flex-shrink: 0; }

/* GitHub-style button (used in header/hero) */
.btn-github {
  background: var(--bg-surface);
  color: var(--tx-1);
  border-color: var(--border);
}
.btn-github:hover {
  background: var(--bg-hover);
  border-color: var(--border-2);
  color: var(--tx-1);
}

/* --- Mobile nav ---------------------------------------------------------- */
.mobile-menu-btn {
  display: none;
}

@media (max-width: 768px) {
  .site-nav,
  .header-actions .btn-github { display: none; }
  .mobile-menu-btn { display: inline-flex; }
}

.mobile-menu {
  display: none;
  position: fixed;
  top: var(--header-h);     /* explicit viewport-relative positioning */
  left: 0;
  right: 0;
  height: calc(100vh - var(--header-h));
  width: 100vw;
  background: var(--bg-base);
  border-top: 1px solid var(--border-soft);
  z-index: 49;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mobile-menu.open { display: block; }
.mobile-menu .mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-menu .mobile-nav a {
  color: var(--tx-1);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--r);
  border: 1px solid transparent;
}
.mobile-menu .mobile-nav a:hover { background: var(--bg-hover); }
.mobile-menu .mobile-nav a.active {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: var(--brand-border);
}
.mobile-menu .mobile-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mobile-menu .mobile-actions .btn { width: 100%; }

/* --- Sections ------------------------------------------------------------ */
section {
  padding: 80px 0;
}
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.section-title {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 14px;
  color: var(--tx-1);
}
.section-lead {
  font-size: 16px;
  color: var(--tx-2);
  max-width: 640px;
  line-height: 1.6;
}
.section-head {
  text-align: center;
  margin: 0 auto 56px;
  max-width: 720px;
}
.section-head .section-lead { margin: 0 auto; }

/* --- Hero ---------------------------------------------------------------- */
.hero {
  position: relative;
  padding: 96px 0 80px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, var(--brand-soft) 0%, transparent 55%),
    radial-gradient(circle at 80% 30%, rgba(37, 99, 235, 0.04) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}
.hero .container { position: relative; z-index: 1; }

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 64px;
  align-items: center;
}
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; gap: 48px; }
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tx-2);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 24px;
}
.hero-eyebrow .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-bg);
}
.hero-eyebrow .latest-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--tx-1);
}
.hero-eyebrow .latest-tag.loading { color: var(--tx-3); }

.hero h1 {
  font-size: clamp(36px, 5.5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 20px;
  color: var(--tx-1);
}
.hero h1 .accent {
  color: var(--brand);
}
.hero p.lead {
  font-size: 17px;
  color: var(--tx-2);
  margin-bottom: 32px;
  max-width: 540px;
  line-height: 1.6;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 32px;
  font-size: 13px;
  color: var(--tx-3);
}
.hero-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hero-meta-item strong {
  color: var(--tx-1);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 13px;
}
.hero-meta-item svg { color: var(--tx-2); }

/* --- Dashboard preview --------------------------------------------------- */
.dashboard-preview {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-size: 12px;
}
.dp-titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.dp-dots {
  display: flex; gap: 6px;
}
.dp-dots span {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--border);
}
.dp-titlebar .dp-title {
  font-size: 12px;
  color: var(--tx-2);
  font-family: var(--font-mono);
}

.dp-body {
  display: grid;
  grid-template-columns: 168px 1fr;
  min-height: 380px;
}
@media (max-width: 600px) {
  .dp-body { grid-template-columns: 1fr; min-height: 0; }
  .dp-sidebar { display: none; }
}

.dp-sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  font-size: 12px;
}
.dp-sidebar-brand {
  display: flex; align-items: center; gap: 8px;
  padding: 0 6px 14px;
  font-weight: 600;
  color: var(--tx-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.dp-sidebar-brand img {
  width: 22px; height: 22px;
}
.dp-sidebar-section {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tx-3);
  padding: 8px 8px 4px;
}
.dp-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  color: var(--tx-2);
}
.dp-nav-item.active {
  background: var(--brand-soft);
  color: var(--brand);
}
.dp-nav-item svg { flex-shrink: 0; }

.dp-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dp-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 600px) {
  .dp-stats { grid-template-columns: repeat(2, 1fr); }
}
.dp-stat {
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.dp-stat-label {
  font-size: 10px;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 6px;
}
.dp-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--tx-1);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.dp-stat-value.ok { color: var(--green); }
.dp-stat-value.warn { color: var(--amber); }

.dp-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tx-2);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dp-section-title .dp-link { color: var(--brand); font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 11px; }

.dp-bots { display: flex; flex-direction: column; gap: 8px; }
.dp-bot {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.dp-bot-name {
  font-weight: 600;
  color: var(--tx-1);
  font-size: 12px;
}
.dp-bot-meta {
  font-size: 11px;
  color: var(--tx-3);
  font-family: var(--font-mono);
}
.dp-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
}
.dp-status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}
.dp-status.online { color: var(--green); background: var(--green-bg); }
.dp-status.online .dot { background: var(--green); }
.dp-status.offline { color: var(--tx-3); background: var(--bg-hover); }
.dp-status.offline .dot { background: var(--tx-3); }
.dp-status.error { color: var(--red); background: var(--red-bg); }
.dp-status.error .dot { background: var(--red); }

/* --- Stats bar (homepage) ------------------------------------------------ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 56px;
  padding-top: 48px;
  border-top: 1px solid var(--border-soft);
}
@media (max-width: 720px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 8px;
}
.stat-card .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--tx-1);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}
.stat-card .stat-hint {
  font-size: 12px;
  color: var(--tx-3);
  margin-top: 6px;
}

/* --- Features grid ------------------------------------------------------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 980px) { .features-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .features-grid { grid-template-columns: 1fr; } }

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.feature-card:hover {
  border-color: var(--border-2);
}
.feature-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--r);
  margin-bottom: 14px;
}
.feature-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--tx-1);
  letter-spacing: -0.01em;
}
.feature-card p {
  color: var(--tx-2);
  font-size: 14px;
  line-height: 1.55;
}

/* --- Templates list ------------------------------------------------------ */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 980px) { .templates-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .templates-grid { grid-template-columns: 1fr; } }

.template-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.template-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.template-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--tx-1);
  letter-spacing: -0.005em;
}
.template-card p {
  font-size: 13px;
  color: var(--tx-2);
  line-height: 1.55;
  flex: 1;
}
.template-difficulty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--tx-2);
  background: var(--bg-elevated);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.template-difficulty.beginner { color: var(--green); background: var(--green-bg); border-color: transparent; }
.template-difficulty.intermediate { color: var(--amber); background: var(--amber-bg); border-color: transparent; }

/* --- Architecture diagram ------------------------------------------------ */
.architecture {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
}
.arch-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  font-size: 13px;
}
.arch-node {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 18px;
  text-align: center;
  font-weight: 600;
  color: var(--tx-1);
  min-width: 180px;
}
.arch-node.primary {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand);
}
.arch-node .arch-sub {
  display: block;
  font-weight: 400;
  color: var(--tx-2);
  font-size: 11px;
  margin-top: 2px;
  font-family: var(--font-mono);
}
.arch-arrow {
  width: 1px;
  height: 18px;
  background: var(--border);
  position: relative;
}
.arch-arrow::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--border);
}
.arch-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 540px;
}
@media (max-width: 540px) {
  .arch-row { grid-template-columns: 1fr; }
}
.arch-bots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 360px;
}
@media (max-width: 540px) {
  .arch-bots { grid-template-columns: 1fr; }
}
.arch-bot {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--tx-2);
}
.arch-bot .arch-bot-name {
  font-weight: 600;
  color: var(--tx-1);
  display: block;
  font-size: 12px;
  margin-bottom: 2px;
}
.arch-callout {
  margin-top: 16px;
  font-size: 13px;
  color: var(--tx-2);
  padding: 12px 16px;
  background: var(--bg-base);
  border: 1px dashed var(--border-2);
  border-radius: var(--r);
  line-height: 1.5;
}
.arch-callout strong { color: var(--tx-1); }

/* --- Security grid ------------------------------------------------------- */
.security-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 880px) { .security-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .security-grid { grid-template-columns: 1fr; } }
.security-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.security-item svg { color: var(--brand); flex-shrink: 0; margin-top: 2px; }
.security-item strong {
  font-size: 14px;
  color: var(--tx-1);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}
.security-item span {
  font-size: 13px;
  color: var(--tx-2);
  line-height: 1.5;
}
.security-note {
  margin-top: 20px;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 14px;
  color: var(--tx-2);
  line-height: 1.6;
}
.security-note strong { color: var(--tx-1); }

/* --- Tech table --------------------------------------------------------- */
.tech-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.tech-table th, .tech-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
.tech-table tbody tr:last-child td { border-bottom: 0; }
.tech-table th {
  font-weight: 600;
  color: var(--tx-1);
  background: var(--bg-elevated);
  font-size: 13px;
}
.tech-table td { color: var(--tx-2); }
.tech-table td:first-child { color: var(--tx-1); font-weight: 500; }
.tech-table td code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--tx-1);
  background: var(--bg-code);
  padding: 1px 6px;
  border-radius: 4px;
}

/* --- CTA strip ---------------------------------------------------------- */
.cta-strip {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 56px 0;
}
.cta-strip-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.cta-strip h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: var(--tx-1);
}
.cta-strip p {
  color: var(--tx-2);
  font-size: 14px;
  margin: 0;
  max-width: 540px;
}
.cta-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* --- Code blocks -------------------------------------------------------- */
.code-block {
  position: relative;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  min-width: 0;
  max-width: 100%;
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--tx-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font);
}
.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: transparent;
  color: var(--tx-1);
  white-space: pre;
  font-family: var(--font-mono);
  min-width: 0;
  max-width: 100%;
}
.code-block pre code { color: inherit; }
.code-block-copy {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--tx-2);
  cursor: pointer;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.code-block-copy:hover { color: var(--tx-1); border-color: var(--border-2); }
.code-block-copy:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.code-block-copy.copied {
  color: var(--green);
  border-color: var(--green-bg);
  background: var(--green-bg);
}

.code-inline {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  color: var(--tx-1);
  white-space: nowrap;
}

/* --- Install steps ------------------------------------------------------- */
.steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}
.step {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  align-items: flex-start;
}
.step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid var(--brand-border);
}
.step h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--tx-1);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.step p { color: var(--tx-2); font-size: 14px; line-height: 1.6; }

/* --- Two-column layout (update methods) --------------------------------- */
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }
.col-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  min-width: 0;            /* allow shrinking so inner code blocks can scroll instead of expanding the card */
  overflow: hidden;        /* belt + braces against any inner overflow */
}
.col-card h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--tx-1);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.col-card h3 .badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.col-card p { color: var(--tx-2); font-size: 14px; line-height: 1.6; margin-bottom: 14px; }
.col-card ol, .col-card ul { padding-left: 20px; color: var(--tx-2); font-size: 14px; line-height: 1.7; }
.col-card ol li, .col-card ul li { margin-bottom: 4px; }
.col-card ol li code, .col-card ul li code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-code);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.col-card .menu-path {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 12px 0;
}
.menu-path .crumb {
  font-size: 13px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--tx-1);
  font-family: var(--font-mono);
}
.menu-path .sep { color: var(--tx-3); font-size: 12px; }

/* --- Docs layout --------------------------------------------------------- */
.docs-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  align-items: flex-start;
  padding: 40px 0 80px;
}
@media (max-width: 900px) {
  .docs-shell { grid-template-columns: 1fr; gap: 0; padding-top: 16px; }
}

.docs-toc-toggle {
  display: none;
}
@media (max-width: 900px) {
  .docs-toc-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 18px;
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
    border-radius: var(--r);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin: 4px 0 20px;
    letter-spacing: -0.005em;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  }
  .docs-toc-toggle:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
  }
  .docs-toc-toggle:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
  }
}

.docs-backdrop {
  display: none;
}
@media (max-width: 900px) {
  .docs-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 48;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }
  .docs-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }
}

.docs-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  border-right: 1px solid var(--border-soft);
  padding-right: 24px;
}
@media (max-width: 900px) {
  .docs-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: min(86vw, 320px);
    z-index: 49;
    background: var(--bg-base);
    border-right: 1px solid var(--border);
    padding: 16px 20px 32px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    overscroll-behavior: contain;
  }
  .docs-sidebar.open { transform: translateX(0); }
  .docs-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--tx-1);
    cursor: pointer;
    margin-bottom: 12px;
  }
  .docs-sidebar-close:hover { background: var(--bg-hover); }
}
@media (min-width: 901px) {
  .docs-sidebar-close { display: none; }
}

.docs-sidebar h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tx-3);
  font-weight: 600;
  margin: 14px 0 6px;
  padding: 0 12px;
}
.docs-sidebar h4:first-child { margin-top: 0; }
.docs-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.docs-sidebar a {
  display: block;
  padding: 7px 12px;
  color: var(--tx-2);
  font-size: 13px;
  border-radius: var(--r-sm);
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.docs-sidebar a:hover { color: var(--tx-1); background: var(--bg-hover); }
.docs-sidebar a.active {
  color: var(--brand);
  background: var(--brand-soft);
  border-left-color: var(--brand);
  font-weight: 600;
  padding-left: 9px;     /* compensate for the 3px left border so text doesn't shift */
}

.docs-content {
  max-width: 760px;
  min-width: 0;
}
.docs-content section { padding: 0 0 48px; }
.docs-content section:last-child { padding-bottom: 0; }
.docs-content h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tx-1);
  margin-bottom: 12px;
  padding-top: 24px;
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.docs-content section[id] {
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.docs-content h2:first-child { padding-top: 0; }
.docs-content h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--tx-1);
  margin: 24px 0 10px;
}
.docs-content p {
  color: var(--tx-2);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 12px;
}
.docs-content ul, .docs-content ol {
  color: var(--tx-2);
  font-size: 15px;
  line-height: 1.7;
  padding-left: 22px;
  margin-bottom: 12px;
}
.docs-content li { margin-bottom: 6px; }
.docs-content li::marker { color: var(--tx-3); }
.docs-content strong { color: var(--tx-1); font-weight: 600; }
.docs-content code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--tx-1);
  white-space: nowrap;
}
.docs-content .code-block { margin: 14px 0 16px; }
.docs-content .callout {
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--r);
  font-size: 14px;
  color: var(--tx-2);
  margin: 12px 0;
}
.docs-content .callout strong { color: var(--tx-1); }

/* --- Changelog list ------------------------------------------------------ */
.changelog-page-head {
  padding: 64px 0 32px;
  text-align: center;
}
.changelog-meta {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--tx-2);
}
.changelog-meta a { color: var(--tx-2); }
.changelog-meta a:hover { color: var(--brand); }

.releases {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0 80px;
  max-width: 820px;
  margin: 0 auto;
}

.release-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}
.release-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}
.release-tag {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--tx-1);
  letter-spacing: -0.01em;
}
.release-tag .badge-latest {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}
.release-date {
  font-size: 13px;
  color: var(--tx-2);
  font-family: var(--font-mono);
}
.release-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--tx-1);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

/* Markdown body inside release */
.md-body { font-size: 14px; color: var(--tx-2); line-height: 1.7; }
.md-body p { margin-bottom: 10px; }
.md-body h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--tx-1);
  margin: 18px 0 8px;
  letter-spacing: -0.01em;
  padding-top: 0;
}
.md-body h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--tx-1);
  margin: 14px 0 6px;
}
.md-body ul, .md-body ol { padding-left: 22px; margin-bottom: 12px; }
.md-body li { margin-bottom: 4px; }
.md-body li::marker { color: var(--tx-3); }
.md-body strong { color: var(--tx-1); font-weight: 600; }
.md-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-code);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--tx-1);
}
.md-body pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 12px 0;
  font-family: var(--font-mono);
  font-size: 13px;
}
.md-body pre code { background: transparent; border: 0; padding: 0; }
.md-body a { color: var(--brand); }
.md-body a:hover { text-decoration: underline; }
.md-body img { max-width: 100%; border-radius: var(--r); margin: 12px 0; border: 1px solid var(--border); }
.md-body hr { border: 0; border-top: 1px solid var(--border-soft); margin: 16px 0; }
.md-body blockquote {
  border-left: 3px solid var(--border-2);
  padding-left: 14px;
  color: var(--tx-2);
  font-style: italic;
  margin: 12px 0;
}

.release-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.release-assets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.release-asset {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--tx-2);
  background: var(--bg-elevated);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.release-asset:hover { color: var(--tx-1); border-color: var(--border-2); }
.release-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.release-link:hover { text-decoration: underline; }

/* Loading / error states */
.state-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 48px 24px;
  text-align: center;
  color: var(--tx-2);
}
.state-box .state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--tx-1);
  margin-bottom: 4px;
}
.state-box .state-desc { font-size: 13px; }
.state-box .spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--brand);
  margin: 0 auto 14px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Footer -------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  background: var(--bg-base);
  padding: 56px 0 32px;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 32px;
}
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; gap: 32px; } }
.footer-brand p {
  color: var(--tx-2);
  font-size: 13px;
  margin-top: 12px;
  max-width: 320px;
  line-height: 1.6;
}
.footer-brand .brand img { height: 32px; }
.footer-col h5 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tx-3);
  font-weight: 600;
  margin-bottom: 12px;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col a {
  color: var(--tx-2);
  font-size: 13px;
  font-weight: 500;
}
.footer-col a:hover { color: var(--tx-1); }
.footer-bottom {
  border-top: 1px solid var(--border-soft);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--tx-3);
  font-size: 12px;
}
.footer-bottom .links { display: flex; gap: 18px; }
.footer-bottom .links a { color: var(--tx-3); }
.footer-bottom .links a:hover { color: var(--tx-1); }

/* --- Page-specific: docs callout ---------------------------------------- */
.kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--tx-1);
}

/* --- Misc utilities ----------------------------------------------------- */
.text-mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-12 { margin-bottom: 12px; }
.mb-24 { margin-bottom: 24px; }
.flex-wrap { flex-wrap: wrap; }

/* --- Accessibility helpers ---------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Focus outline (default) */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  background: var(--brand);
  color: white;
  padding: 8px 14px;
  border-radius: var(--r);
  z-index: 100;
  font-size: 13px;
  font-weight: 600;
}
.skip-link:focus { top: 8px; color: white; }