/* ============================================================
   Documentation Template — us.github.io Design System
   Sans-serif body, monospace labels/code, green accent
   ============================================================ */

/* ========== Design Tokens ========== */
:root {
  /* Paper (light) */
  --paper: #FFFFFF;
  --paper-warm: #F9FAFB;
  --paper-cool: #F3F4F6;
  --paper-deep: #F9FAFB;

  /* Ink (light text) */
  --ink: #111827;
  --ink-2: rgba(17, 24, 39, .72);
  --ink-3: #6B7280;
  --ink-4: rgba(8, 8, 8, .22);
  --ink-5: rgba(8, 8, 8, .10);

  /* Borders (light) */
  --border: rgba(8, 8, 8, .08);
  --border-mid: rgba(8, 8, 8, .14);
  --border-strong: rgba(8, 8, 8, .22);

  /* UI surfaces (dark components) */
  --ui-base: #0A0A0A;
  --ui-surface: #111111;
  --ui-card: #161616;
  --ui-card-2: #1e1e1e;
  --ui-card-3: #252525;
  --ui-border: rgba(255, 255, 255, .07);
  --ui-border-mid: rgba(255, 255, 255, .13);
  --ui-border-strong: rgba(255, 255, 255, .26);
  --ui-border-focus: rgba(255, 255, 255, .54);
  --ui-text: rgba(255, 255, 255, 1);
  --ui-text-2: rgba(255, 255, 255, .84);
  --ui-text-3: rgba(255, 255, 255, .54);
  --ui-text-4: rgba(255, 255, 255, .28);
  --ui-text-5: rgba(255, 255, 255, .12);

  /* Semantic colors */
  --green: #4ade80;
  --green-bg: rgba(74, 222, 128, .10);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, .10);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, .10);
  --blue: #60a5fa;
  --blue-bg: rgba(96, 165, 250, .10);
  --purple: #a78bfa;
  --purple-bg: rgba(167, 139, 250, .10);

  /* Accent */
  --accent-primary: #16A34A;
  --accent-primary-dim: rgba(22, 163, 74, .10);
  --accent-primary-hover: rgba(22, 163, 74, .15);
  --accent-gold: #16A34A;
  --accent-gold-dim: rgba(22, 163, 74, .10);
  --accent-blue: #7db8f0;
  --accent-green: #4ade80;

  /* Layout */
  --nav-h: 96px;
  --sidebar-w: 18rem;

  /* Typography */
  --font-primary: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --sans: var(--font-primary);
  --mono: var(--font-mono);

  /* Transitions */
  --t-micro: 80ms ease;
  --t-fast: 120ms ease;
  --t-base: 180ms ease;
  --t-slow: 280ms ease-in-out;

  /* Theme-dependent */
  --nav-bg: rgba(255, 255, 255, .80);
  --code-bg: #0A0A0A;
  --code-text: rgba(255, 255, 255, .68);
  --code-border: rgba(255, 255, 255, .08);
  --callout-bg: #F9FAFB;
  --callout-border: #111827;
  --highlight: rgba(8, 8, 8, .06);
}

[data-theme="dark"] {
  --paper: #0A0A0A;
  --paper-warm: #161616;
  --paper-cool: #1C1C1C;
  --paper-deep: #111111;
  --ink: #F5F3F0;
  --ink-2: #E8E4DF;
  --ink-3: #9B9590;
  --ink-4: rgba(255, 255, 255, .28);
  --ink-5: rgba(255, 255, 255, .12);
  --border: rgba(255, 255, 255, .08);
  --border-mid: rgba(255, 255, 255, .12);
  --border-strong: rgba(255, 255, 255, .24);
  --nav-bg: rgba(10, 10, 10, .80);
  --code-bg: #161616;
  --code-text: rgba(255, 255, 255, .72);
  --code-border: rgba(255, 255, 255, .08);
  --callout-bg: #161616;
  --callout-border: rgba(255, 255, 255, .24);
  --highlight: rgba(255, 255, 255, .06);
}

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; font-size: 15px; }

body {
  font-family: var(--font-primary);
  background: var(--paper);
  color: var(--ink);
  font-weight: 400;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--t-base), color var(--t-base);
  overflow-x: hidden;
}

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

::selection {
  background: rgba(22, 163, 74, 0.85);
  color: #ffffff;
}

pre::selection, pre *::selection,
code::selection, code *::selection {
  background: rgba(22, 163, 74, 0.85);
  color: #ffffff;
}

/* ========== Reading Progress Bar ========== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-green));
  z-index: 201;
  width: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

/* ========== Navbar (2-row Mintlify style) ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: background var(--t-base), border-color var(--t-base);
}

/* Top row: logo + search + actions */
.navbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 20px;
  gap: 20px;
}

.navbar-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.logo { font-size: 14px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); white-space: nowrap; display: flex; align-items: center; gap: 6px; text-decoration: none; }
.logo-img { height: 28px; width: auto; display: block; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }
.logo-text { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 16px; letter-spacing: -0.5px; }

.navbar-center { flex: 1; max-width: 480px; margin: 0 auto; }

.navbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* GitHub link in navbar */
.navbar-github {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-3);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
}
.navbar-github:hover { color: var(--ink); border-color: var(--border-strong); }
.navbar-github svg { flex-shrink: 0; }
.navbar-github span { font-weight: 500; }

.navbar-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  text-decoration: none;
  padding: 5px 8px;
  transition: color var(--t-fast);
  white-space: nowrap;
}
.navbar-link:hover { color: var(--ink); }

.navbar-signup {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent-primary);
  text-decoration: none;
  padding: 6px 16px;
  border-radius: 8px;
  transition: opacity var(--t-fast);
  white-space: nowrap;
}
.navbar-signup:hover { opacity: 0.9; }

/* Bottom row: tab navigation */
.navbar-tabs {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 20px;
  padding-left: calc(var(--sidebar-w) + 12px);
  border-top: 1px solid var(--border);
  gap: 0;
}

.navbar-tab {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
}
.navbar-tab:hover { color: var(--ink); }
.navbar-tab.active {
  color: var(--ink);
  font-weight: 500;
  border-bottom-color: var(--accent-primary);
}

/* ========== Hamburger ========== */
.hamburger { display: none; flex-direction: column; justify-content: center; gap: 4px; background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 18px; height: 1.5px; background: var(--ink); transition: transform var(--t-fast), opacity var(--t-fast); }
.hamburger.active span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* ========== Theme Toggle ========== */
.theme-toggle { background: none; border: 1px solid var(--border-mid); cursor: pointer; padding: 6px; color: var(--ink-3); display: flex; align-items: center; justify-content: center; transition: color var(--t-fast), border-color var(--t-fast); border-radius: 6px; }
.theme-toggle:hover { border-color: var(--border-strong); color: var(--ink); }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* ========== Search Trigger ========== */
.search-trigger { display: flex; align-items: center; gap: 8px; width: 100%; background: var(--highlight); border: 1px solid var(--border); padding: 8px 16px; color: var(--ink-4); cursor: pointer; font-family: var(--font-primary); font-size: 13px; transition: color var(--t-fast), border-color var(--t-fast); border-radius: 9999px; }
.search-trigger:hover { border-color: var(--border-mid); color: var(--ink-2); }
.search-placeholder { flex: 1; text-align: left; }
.search-shortcut { font-size: 10px; font-family: var(--font-mono); background: var(--paper-cool); padding: 2px 6px; border-radius: 4px; color: var(--ink-4); margin-left: auto; }

/* ========== Layout ========== */
.layout { display: flex; padding-top: var(--nav-h); flex: 1; }
.overlay { display: none; position: fixed; inset: 0; background: rgba(8, 8, 8, .4); z-index: 80; }
.overlay.active { display: block; }

/* ========== Sidebar ========== */
.sidebar {
  position: sticky;
  top: var(--nav-h);
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: calc(100vh - var(--nav-h));
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-5) transparent;
  flex-shrink: 0;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--ink-5); border-radius: 3px; }
.sidebar-section { margin-bottom: 0; padding-bottom: 0; }
.sidebar-section + .sidebar-section { padding-top: 4px; border-top: 1px solid var(--border); margin-top: 12px; }
.sidebar-section-title { font-family: var(--font-primary); font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink-2); padding: 12px 16px 6px; margin-bottom: 0; }

/* Sidebar quick links */
.sidebar-quick-links { display: flex; flex-direction: column; gap: 0; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.sidebar-quick-link { display: flex; align-items: center; gap: 14px; padding: 8px 16px; font-size: 14px; color: var(--ink-3); border-radius: 10px; transition: color var(--t-fast), background var(--t-fast); text-decoration: none; margin: 2px 0; }
.sidebar-quick-link:hover { color: var(--ink-2); background: rgba(128, 128, 128, .06); }
.sidebar-quick-icon { width: 16px; height: 16px; opacity: 0.5; flex-shrink: 0; }
.sidebar-quick-link:hover .sidebar-quick-icon { opacity: 0.7; }

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 7px 16px;
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  transition: color var(--t-fast), background var(--t-fast);
  cursor: pointer;
  border-radius: 10px;
  margin: 1px 0;
}

.sidebar-link:hover { color: var(--ink-2); background: rgba(128, 128, 128, .06); }

.sidebar-link.active {
  color: var(--accent-primary);
  font-weight: 500;
  background: rgba(22, 163, 74, .08);
  text-shadow: -0.2px 0 0 currentColor, 0.2px 0 0 currentColor;
}

[data-theme="dark"] .sidebar-link.active {
  color: var(--accent-primary);
  background: rgba(22, 163, 74, .10);
}

[data-theme="light"] .sidebar-link.active {
  color: #15803d;
  background: rgba(22, 163, 74, .08);
}

.sidebar-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  cursor: pointer;
  margin-bottom: 2px;
  transition: color var(--t-fast);
}

.sidebar-group-toggle:hover { color: var(--ink-2); }
.sidebar-group-toggle .chevron { font-size: 8px; transition: transform var(--t-fast); color: var(--ink-4); }
.sidebar-group-toggle.open .chevron { transform: rotate(90deg); }
.sidebar-group-children { overflow: hidden; max-height: 0; transition: max-height .28s ease-in-out; }
.sidebar-group-children.open { max-height: 800px; }

/* ========== Content ========== */
.content { flex: 1; min-width: 0; padding: 0; }

/* ========== Article Prose ========== */
#article { padding: 40px 48px 68px 40px; max-width: 860px; }
#article .eyebrow { font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .18em; color: var(--ink-3); margin-bottom: 12px; }
#article h1 { font-size: clamp(28px, 4vw, 34px); font-weight: 600; line-height: 1.2; letter-spacing: -.02em; margin-bottom: 16px; color: var(--ink); }
#article h2 { font-size: clamp(20px, 3vw, 24px); font-weight: 600; line-height: 1.25; letter-spacing: -.01em; margin-top: 40px; margin-bottom: 16px; color: var(--ink); }
#article h3 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin-top: 32px; margin-bottom: 10px; color: var(--ink); }
#article h4 { font-family: var(--font-mono); font-size: 10px; font-weight: 400; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-3); margin-top: 32px; margin-bottom: 8px; }
#article p { font-size: 15px; font-weight: 400; line-height: 1.7; color: var(--ink-2); max-width: 720px; margin-bottom: 14px; }
#article ul, #article ol { margin-bottom: 18px; padding-left: 22px; color: var(--ink-2); font-size: 16px; font-weight: 400; line-height: 1.75; max-width: 720px; }
#article li { margin-bottom: 6px; }
#article strong { font-weight: 600; color: var(--ink); }
#article em { font-style: italic; }
#article a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink-4); text-underline-offset: 3px; transition: text-decoration-color var(--t-fast); }
#article a:hover { text-decoration-color: var(--accent-primary); }

/* Inline code */
#article code {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--paper-warm);
  color: var(--ink-2);
  padding: 2px 6px;
}

/* Code blocks */
#article pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 22px;
  overflow-x: auto;
  line-height: 1.78;
  position: relative;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

#article pre code {
  background: none;
  color: var(--code-text);
  padding: 0;
  font-size: 14px;
}

/* Language label on code blocks */
#article pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  right: 0;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid var(--code-border);
  border-left: 1px solid var(--code-border);
  border-radius: 0 6px 0 4px;
}

#article blockquote { font-size: clamp(16px, 2.1vw, 22px); font-weight: 500; line-height: 1.52; border-left: 3px solid var(--accent-primary); padding-left: 22px; margin: 36px 0; max-width: 640px; color: var(--ink); }
#article table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 13px; }
#article th { font-family: var(--font-mono); font-size: 9px; font-weight: 400; text-transform: uppercase; letter-spacing: .16em; color: var(--ink-3); text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border-strong); }
#article td { padding: 10px 12px; color: var(--ink-2); border-bottom: 1px solid var(--border); line-height: 1.55; }
#article hr { border: none; border-top: 1px solid var(--border); margin: 52px 0; }
#article img { max-width: 100%; border-radius: 4px; }

/* ========== Code Copy Button ========== */
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
  z-index: 2;
}

pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.6); }

.code-copy-btn.copied {
  background: var(--accent-primary-dim);
  border-color: rgba(22, 163, 74, 0.3);
  color: var(--accent-primary);
}

/* ========== Skeleton Loading ========== */
.skeleton {
  background: var(--paper-cool);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.03) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.8s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  to { transform: translateX(200%); }
}

/* ========== Scroll Reveal ========== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ========== Breadcrumb ========== */
.page-breadcrumb { font-size: 13px; font-weight: 500; color: var(--accent-primary); margin-bottom: 4px; }

/* ========== Sidebar Item Icons ========== */
.sidebar-item-icon { display: inline-flex; width: 16px; height: 16px; opacity: 0.4; flex-shrink: 0; margin-right: 12px; vertical-align: middle; }
.sidebar-item-icon svg { width: 16px; height: 16px; }
.sidebar-link:hover .sidebar-item-icon { opacity: 0.6; }
.sidebar-link.active .sidebar-item-icon { opacity: 0.7; }

/* ========== Card Grid ========== */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 24px 0; }
.doc-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  text-decoration: none;
  display: block;
}
.doc-card:hover { border-color: var(--border-mid); box-shadow: 0 2px 8px rgba(0,0,0,.04); }
[data-theme="dark"] .doc-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.2); }
.doc-card-icon { width: 28px; height: 28px; margin-bottom: 8px; color: var(--ink-3); }
.doc-card-icon svg { width: 20px; height: 20px; }
.doc-card-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.doc-card-desc { font-size: 13px; color: var(--ink-3); line-height: 1.4; }

/* ========== Feature Grid ========== */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
.feature-card { text-align: center; padding: 18px 12px; border: 1px solid var(--border); border-radius: 10px; }
.feature-card-icon { width: 32px; height: 32px; margin: 0 auto 8px; color: var(--accent-primary); }
.feature-card-icon svg { width: 24px; height: 24px; }
.feature-card-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.feature-card-desc { font-size: 12px; color: var(--ink-3); line-height: 1.4; }

/* ========== Code Tabs ========== */
.code-tabs { margin: 18px 0; border: 1px solid var(--code-border); border-radius: 8px; overflow: hidden; }
.code-tabs-header { display: flex; background: var(--code-bg); border-bottom: 1px solid var(--code-border); padding: 0 4px; }
.code-tab { padding: 8px 16px; font-size: 13px; font-weight: 500; color: rgba(255,255,255,.4); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; font-family: var(--font-primary); transition: color var(--t-fast), border-color var(--t-fast); }
.code-tab:hover { color: rgba(255,255,255,.7); }
.code-tab.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }
.code-tab-panel { display: none; }
.code-tab-panel.active { display: block; }
.code-tab-panel pre { border: none; border-radius: 0; margin: 0; box-shadow: none; }

/* ========== Callouts (Mintlify style) ========== */
.callout { display: flex; gap: 12px; padding: 16px 20px; border-radius: 8px; margin: 18px 0; font-size: 14px; line-height: 1.6; }
.callout-icon { flex-shrink: 0; width: 20px; height: 20px; }
.callout-icon svg { width: 20px; height: 20px; }
.callout-content { flex: 1; }
.callout-note { background: var(--blue-bg); border: 1px solid rgba(96, 165, 250, .2); color: var(--ink-2); }
.callout-note .callout-icon { color: var(--blue); }
.callout-info { background: var(--blue-bg); border: 1px solid rgba(96, 165, 250, .2); color: var(--ink-2); }
.callout-info .callout-icon { color: var(--blue); }
.callout-warning { background: var(--amber-bg); border: 1px solid rgba(251, 191, 36, .2); color: var(--ink-2); }
.callout-warning .callout-icon { color: var(--amber); }
.callout-tip { background: var(--green-bg); border: 1px solid rgba(74, 222, 128, .2); color: var(--ink-2); }
.callout-tip .callout-icon { color: var(--green); }

/* ========== Details / Collapsible ========== */
.details-block { border: 1px solid var(--border); border-radius: 8px; margin: 18px 0; overflow: hidden; }
.details-summary { padding: 12px 16px; cursor: pointer; font-weight: 500; font-size: 14px; display: flex; justify-content: space-between; align-items: center; color: var(--ink); transition: background var(--t-fast); }
.details-summary:hover { background: var(--highlight); }
.details-chevron { font-size: 10px; color: var(--ink-4); transition: transform var(--t-fast); }
.details-block.open .details-chevron { transform: rotate(90deg); }
.details-content { display: none; padding: 0 16px 16px; border-top: 1px solid var(--border); }
.details-block.open .details-content { display: block; }

/* ========== Footer (Mintlify style) ========== */
.footer-inner { max-width: 1280px; margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 48px; margin-bottom: 48px; }
.footer-brand { display: flex; flex-direction: column; gap: 16px; }
.footer-brand-logo { display: flex; align-items: center; gap: 8px; }
.footer-brand-logo img { height: 20px; }
.footer-brand-logo span { font-weight: 700; font-size: 16px; color: var(--ink); }
.footer-tagline { font-size: 15px; font-weight: 300; color: var(--ink-3); line-height: 1.5; max-width: 280px; }
.footer-col-title { font-family: var(--font-mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); margin-bottom: 12px; }
.footer-col-links { display: flex; flex-direction: column; gap: 8px; }
.footer-col-links a { font-size: 13px; color: var(--ink-3); text-decoration: none; transition: color var(--t-fast); }
.footer-col-links a:hover { color: var(--ink); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; padding-top: 24px; border-top: 1px solid var(--border); }
.footer-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-4); }
.footer-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #22C55E; }
.footer-copyright { font-size: 12px; color: var(--ink-4); }
.footer-socials { display: flex; gap: 16px; }
.footer-social { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; color: var(--ink-4); transition: color var(--t-fast); }
.footer-social:hover { color: var(--ink-2); }
.footer-social svg { width: 18px; height: 18px; }

/* ========== Old Callout (article override) ========== */
#article .callout { border-left: none; }

/* ========== Search Modal ========== */
.search-modal { display: none; position: fixed; inset: 0; z-index: 300; background: rgba(8, 8, 8, .4); align-items: flex-start; justify-content: center; padding-top: 15vh; }
.search-modal.active { display: flex; }
.search-modal-content { background: var(--paper); border: 1px solid var(--border-mid); width: 90%; max-width: 560px; overflow: hidden; border-radius: 12px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); }
.search-input-wrapper { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--ink-3); }
.search-input-wrapper input { flex: 1; background: none; border: none; outline: none; font-size: 15px; font-family: var(--font-primary); font-weight: 400; color: var(--ink); }
.search-input-wrapper input::placeholder { color: var(--ink-4); }
.search-input-wrapper kbd { font-family: var(--font-mono); font-size: 9px; background: var(--paper-warm); padding: 2px 8px; color: var(--ink-4); border: 1px solid var(--border); letter-spacing: .04em; }
.search-results { max-height: 400px; overflow-y: auto; padding: 4px; }
.search-result-item { padding: 10px 12px; cursor: pointer; transition: background var(--t-micro); border-radius: 8px; }
.search-result-item:hover, .search-result-item.selected { background: var(--highlight); }
.search-result-title { font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 2px; }
.search-result-snippet { font-size: 12px; color: var(--ink-3); line-height: 1.5; font-weight: 300; }
.search-result-snippet mark { background: var(--accent-primary-dim); color: var(--ink); padding: 0 2px; border-radius: 2px; }
[data-theme="dark"] .search-result-snippet mark { background: var(--accent-primary-dim); }
.search-empty { padding: 32px 16px; text-align: center; color: var(--ink-4); font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; }

/* ========== Table of Contents (right sidebar) ========== */
.toc {
  position: sticky;
  top: var(--nav-h);
  width: 220px;
  min-width: 220px;
  height: calc(100vh - var(--nav-h));
  padding: 24px 16px;
  overflow-y: auto;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--ink-5) transparent;
}

.toc-header {
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  margin-bottom: 12px;
  padding-left: 12px;
}

.toc-link {
  display: block;
  padding: 4px 0 4px 12px;
  font-size: 13px;
  color: var(--ink-4);
  line-height: 1.5;
  transition: color var(--t-fast), border-color var(--t-fast);
  border-left: 2px solid transparent;
  text-decoration: none;
}

.toc-link:hover { color: var(--ink-2); }

.toc-link.active {
  color: var(--accent-primary);
  border-left-color: var(--accent-primary);
}

.toc-link.toc-h3 { padding-left: 24px; font-size: 12px; }

/* TOC CTA Widget */
.toc-cta {
  margin-top: 24px;
  padding: 20px 16px;
  background: var(--paper-warm);
  border: 1px solid var(--border);
  border-radius: 10px;
}

[data-theme="dark"] .toc-cta {
  background: var(--paper-cool);
}

.toc-cta-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.toc-cta-brand img { height: 18px; width: auto; }

.toc-cta-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.toc-cta-desc {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
  margin-bottom: 14px;
}

.toc-cta-btn {
  display: block;
  text-align: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--t-fast), background var(--t-fast), border-color var(--t-fast);
  margin-bottom: 8px;
}

.toc-cta-btn:last-child { margin-bottom: 0; }

.toc-cta-btn.primary {
  background: var(--accent-primary);
  color: #fff;
}

.toc-cta-btn.primary:hover { opacity: 0.9; }

.toc-cta-btn.outline {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--border-mid);
}

.toc-cta-btn.outline:hover { border-color: var(--border-strong); }

@media (max-width: 1100px) {
  .toc { display: none; }
}

/* ========== Prev/Next Navigation ========== */
.prev-next-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.prev-next {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color var(--t-fast);
  flex: 1;
  max-width: 50%;
  text-decoration: none;
}

.prev-next:hover { border-color: var(--accent-primary); }
.prev-next.next { align-items: flex-end; text-align: right; }

.prev-next-label {
  font-size: 12px;
  color: var(--ink-4);
  font-weight: 400;
}

.prev-next-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

/* ========== Footer ========== */
.footer {
  background: var(--paper);
  border-top: 1px solid var(--border);
  padding: 64px 40px 32px;
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--ink-3);
}

[data-theme="dark"] .footer {
  background: #0A0A0A;
  border-top-color: rgba(255, 255, 255, .08);
}

.footer a { color: var(--ink-3); transition: color var(--t-fast); }
.footer a:hover { color: var(--accent-primary); }


/* ═══════════════════════════════════════════════════════════ */
/*           TMLS MASTERCLASS COMPONENTS                      */
/* ═══════════════════════════════════════════════════════════ */

/* HERO */
.hero { min-height: 96vh; background: var(--ink); color: white; display: grid; grid-template-columns: 1fr 1fr; position: relative; overflow: hidden; }
.hero-bg { position: absolute; font-family: var(--font-primary); font-size: clamp(160px, 26vw, 360px); font-weight: 700; color: rgba(255, 255, 255, .025); letter-spacing: -.06em; bottom: -30px; right: -10px; line-height: 1; user-select: none; pointer-events: none; }
.hero-l { padding: 80px 48px 80px 60px; display: flex; flex-direction: column; justify-content: flex-end; border-right: 1px solid rgba(255, 255, 255, .07); position: relative; z-index: 1; }
.hero-r { padding: 80px 60px 80px 48px; display: flex; flex-direction: column; justify-content: flex-end; position: relative; z-index: 1; }
.hero-eyebrow { font-family: var(--font-mono); font-size: 10px; letter-spacing: .20em; text-transform: uppercase; color: rgba(255, 255, 255, .28); margin-bottom: 22px; }
.hero-title { font-family: var(--font-primary); font-size: clamp(36px, 5.2vw, 66px); font-weight: 700; line-height: 1.06; letter-spacing: -.025em; color: white; margin-bottom: 22px; }
.hero-sub { font-family: var(--font-primary); font-size: 16px; line-height: 1.74; color: rgba(255, 255, 255, .46); max-width: 440px; margin-bottom: 48px; font-weight: 300; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 28px; }
.h-sv { font-family: var(--font-mono); font-size: 30px; font-weight: 500; color: white; display: block; line-height: 1; }
.h-sl { font-family: var(--font-mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .28); margin-top: 5px; display: block; }
.hi-item { display: flex; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.hi-num { font-family: var(--font-mono); font-size: 10px; color: rgba(255, 255, 255, .22); width: 24px; flex-shrink: 0; }
.hi-title { font-family: var(--font-primary); font-size: 13px; color: rgba(255, 255, 255, .50); font-weight: 400; }
.hi-vol { font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .18); margin-left: auto; flex-shrink: 0; }

/* CHAPTER */
.chapter { background: var(--ink); color: white; padding: 68px 60px; position: relative; overflow: hidden; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.chapter-wm { position: absolute; font-family: var(--font-primary); font-size: clamp(100px, 18vw, 260px); font-weight: 700; color: rgba(255, 255, 255, .028); right: -8px; bottom: -18px; line-height: 1; user-select: none; }
.ch-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: .20em; text-transform: uppercase; color: rgba(255, 255, 255, .26); margin-bottom: 18px; display: flex; align-items: center; gap: 14px; }
.ch-label::after { content: ''; display: inline-block; width: 32px; height: 1px; background: rgba(255, 255, 255, .16); }
.ch-title { font-family: var(--font-primary); font-size: clamp(28px, 4.2vw, 50px); font-weight: 700; letter-spacing: -.02em; line-height: 1.12; color: white; max-width: 580px; }
.ch-desc { font-family: var(--font-primary); font-size: 15px; line-height: 1.74; color: rgba(255, 255, 255, .42); max-width: 500px; margin-top: 16px; font-weight: 300; }

/* SECTION */
.section { display: grid; grid-template-columns: 60px 1fr; border-bottom: 1px solid var(--border); }
.sec-num { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; color: var(--ink-4); writing-mode: vertical-rl; transform: rotate(180deg); padding: 44px 18px; border-right: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; align-self: flex-start; position: sticky; top: var(--nav-h); }
.sec-body { padding: 52px 52px 68px 44px; }

/* PROSE */
.eyebrow { font-family: var(--font-mono); font-size: 9px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.prose-h2 { font-family: var(--font-primary); font-size: clamp(22px, 3.6vw, 36px); font-weight: 700; letter-spacing: -.02em; line-height: 1.14; color: var(--ink); margin-bottom: 22px; }
.prose-h3 { font-family: var(--font-primary); font-size: 19px; font-weight: 600; letter-spacing: -.012em; color: var(--ink); margin-bottom: 10px; margin-top: 42px; }
.prose-h4 { font-family: var(--font-mono); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; margin-top: 26px; }
.prose p { font-family: var(--font-primary); font-size: 15px; line-height: 1.82; color: var(--ink-2); font-weight: 300; max-width: 700px; margin-bottom: 16px; }
.prose p strong { font-weight: 600; color: var(--ink); }
.prose p em { font-style: italic; }
.blockquote { font-family: var(--font-primary); font-size: clamp(16px, 2.1vw, 22px); font-weight: 500; line-height: 1.52; color: var(--ink); border-left: 3px solid var(--accent-primary); padding-left: 22px; margin: 36px 0; max-width: 640px; letter-spacing: -.01em; }
.callout { background: var(--paper-warm); border-left: 3px solid var(--ink); padding: 16px 20px; margin: 22px 0; max-width: 700px; }
.callout.warn { border-left-color: #b45309; background: #fffbeb; }
.callout.good { border-left-color: #166534; background: #f0fdf4; }
.callout.danger { border-left-color: #991b1b; background: #fef2f2; }
.callout-lbl { font-family: var(--font-mono); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 7px; }
.callout p { margin: 0; font-size: 14px; line-height: 1.72; max-width: none; }

/* DEMO */
.demo { border: 1px solid var(--border-mid); margin: 26px 0; overflow: hidden; }
.demo-hdr { background: var(--paper-warm); padding: 9px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); gap: 10px; }
.demo-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.demo-tags { display: flex; gap: 5px; }
.demo-tag { font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em; color: var(--ink-4); border: 1px solid var(--border); padding: 2px 7px; }
.dc { padding: 30px; }
.dc-dark { background: var(--ui-base); }
.dc-white { background: #fff; }
.dc-warm { background: var(--paper); }
.dc-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dc-col { display: flex; flex-direction: column; gap: 10px; }
.dc-g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dc-g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dc-g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dc-center { display: flex; justify-content: center; align-items: center; }

/* VERDICT */
.vgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border-mid); border: 1px solid var(--border-mid); margin: 26px 0; }
.vi { background: var(--paper); padding: 20px; }
.vi-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; margin-bottom: 12px; font-weight: 500; }
.vi-label.do { color: #16a34a; }
.vi-label.dont { color: #dc2626; }
.vi-desc { font-family: var(--font-primary); font-size: 12px; color: var(--ink-3); margin-top: 10px; line-height: 1.6; font-weight: 400; }

/* TABLES */
.t { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 13px; }
.t th { font-family: var(--font-mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); text-align: left; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--border-strong); font-weight: 400; }
.t td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--border); color: var(--ink-2); vertical-align: top; font-weight: 300; line-height: 1.55; }
.t td code, .t td .c { font-family: var(--font-mono); font-size: 11px; color: var(--ink); }
.swatch { display: inline-block; width: 18px; height: 18px; border: 1px solid var(--border-mid); vertical-align: middle; margin-right: 6px; flex-shrink: 0; }

/* UI BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .05em; font-weight: 400; padding: 0 16px; height: 32px; border: none; cursor: pointer; transition: all .10s; white-space: nowrap; text-decoration: none; }
.btn-xs { height: 24px; font-size: 10px; padding: 0 10px; }
.btn-sm { height: 28px; padding: 0 12px; }
.btn-lg { height: 40px; font-size: 12px; padding: 0 20px; }
.btn-xl { height: 48px; font-size: 13px; padding: 0 24px; }
.btn-2xl { height: 56px; font-size: 14px; padding: 0 28px; }
.btn-primary { background: white; color: black; }
.btn-primary:hover { opacity: .87; }
.btn-secondary { background: var(--ui-card-2); color: var(--ui-text-2); }
.btn-secondary:hover { background: #282828; }
.btn-ghost { background: transparent; color: var(--ui-text-3); }
.btn-ghost:hover { color: var(--ui-text); background: rgba(255, 255, 255, .05); }
.btn-outline { background: transparent; color: var(--ui-text-2); border: 1px solid var(--ui-border-mid); }
.btn-outline:hover { border-color: var(--ui-border-strong); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(248, 113, 113, .28); }
.btn-danger:hover { background: var(--red-bg); }
.btn-success { background: var(--green); color: black; }
.btn-success:hover { opacity: .87; }
.btn-destructive { background: var(--red); color: white; }
.btn-destructive:hover { opacity: .87; }
.btn-icon { width: 32px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 28px; height: 28px; }
.btn:disabled { opacity: .34; cursor: not-allowed; }

/* BADGES */
.badge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10px; font-weight: 400; padding: 2px 8px; height: 20px; letter-spacing: .04em; }
.badge-sm { height: 16px; font-size: 9px; padding: 0 6px; }
.badge-lg { height: 24px; font-size: 11px; padding: 2px 10px; }
.badge-neutral { background: rgba(255, 255, 255, .09); color: var(--ui-text-2); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-outline { background: transparent; border: 1px solid var(--ui-border-mid); color: var(--ui-text-3); }
.bdot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* INPUTS */
.inp { width: 100%; background: var(--ui-card); border: 1px solid var(--ui-border-mid); color: var(--ui-text-2); font-family: var(--font-mono); font-size: 12px; padding: 0 12px; height: 36px; outline: none; transition: border-color .10s; }
.inp:focus { border-color: var(--ui-border-focus); }
.inp::placeholder { color: var(--ui-text-4); }
.inp-sm { height: 30px; font-size: 11px; }
.inp-lg { height: 44px; font-size: 13px; }
.inp-error { border-color: rgba(248, 113, 113, .50) !important; }
.inp-success { border-color: rgba(74, 222, 128, .40) !important; }
.inp:disabled { opacity: .36; cursor: not-allowed; }
.lbl { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .10em; text-transform: uppercase; color: var(--ui-text-3); margin-bottom: 6px; }
.hint { font-family: var(--font-mono); font-size: 10px; color: var(--ui-text-4); margin-top: 5px; }
.hint-err { color: var(--red); }
.hint-ok { color: var(--green); }
.inp-group { display: flex; }
.addon { display: flex; align-items: center; padding: 0 12px; background: var(--ui-card-2); border: 1px solid var(--ui-border-mid); font-family: var(--font-mono); font-size: 11px; color: var(--ui-text-3); flex-shrink: 0; }
.addon-l { border-right: none; }
.addon-r { border-left: none; }
.inp-group .inp { flex: 1; }
.inp-field { position: relative; }
.inp-icon-l { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ui-text-4); pointer-events: none; }
.inp-icon-r { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--ui-text-4); pointer-events: none; }
.inp-field .inp { padding-left: 32px; }
.sel { width: 100%; background: var(--ui-card); border: 1px solid var(--ui-border-mid); color: var(--ui-text-2); font-family: var(--font-mono); font-size: 12px; padding: 0 12px; height: 36px; outline: none; cursor: pointer; appearance: none; }
.sel:focus { border-color: var(--ui-border-focus); }
.textarea { width: 100%; background: var(--ui-card); border: 1px solid var(--ui-border-mid); color: var(--ui-text-2); font-family: var(--font-mono); font-size: 12px; padding: 10px 12px; outline: none; transition: border-color .10s; resize: vertical; min-height: 80px; line-height: 1.65; }
.textarea:focus { border-color: var(--ui-border-focus); }

/* CHECKBOXES RADIOS TOGGLES */
.chk-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.chk-box { width: 16px; height: 16px; background: var(--ui-card); border: 1px solid var(--ui-border-mid); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .10s; }
.chk-box.on { background: white; border-color: white; }
.chk-box.indet { border-color: rgba(255, 255, 255, .30); }
.chk-mark { width: 8px; height: 5px; border-left: 1.5px solid black; border-bottom: 1.5px solid black; transform: rotate(-45deg) translateY(-1px); display: none; }
.chk-box.on .chk-mark { display: block; }
.chk-dash { width: 8px; height: 1.5px; background: var(--ui-text-3); display: none; }
.chk-box.indet .chk-dash { display: block; }
.chk-lbl { font-family: var(--font-mono); font-size: 12px; color: var(--ui-text-2); }
.radio-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.radio-circle { width: 16px; height: 16px; border-radius: 50%; background: var(--ui-card); border: 1px solid var(--ui-border-mid); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.radio-circle.on { border-color: white; }
.radio-dot { width: 6px; height: 6px; border-radius: 50%; background: white; display: none; }
.radio-circle.on .radio-dot { display: block; }
.toggle { position: relative; width: 36px; height: 20px; flex-shrink: 0; cursor: pointer; }
.toggle-track { position: absolute; inset: 0; background: var(--ui-card-2); border: 1px solid var(--ui-border-mid); border-radius: 9999px; transition: background .18s; }
.toggle.on .toggle-track { background: white; border-color: white; }
.toggle-thumb { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; background: var(--ui-text-3); border-radius: 50%; transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), background .18s; }
.toggle.on .toggle-thumb { transform: translateX(16px); background: black; }

/* TABS */
.tabs { border-bottom: 1px solid var(--ui-border); }
.tabs-list { display: flex; }
.tab { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; color: var(--ui-text-3); padding: 0 16px; height: 40px; display: flex; align-items: center; cursor: pointer; border-bottom: 2px solid transparent; transition: all .10s; user-select: none; gap: 7px; }
.tab:hover { color: var(--ui-text-2); }
.tab.active { color: white; border-bottom-color: var(--accent-gold); }
.seg { display: inline-flex; background: var(--ui-card); border: 1px solid var(--ui-border); padding: 3px; gap: 2px; }
.seg-btn { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--ui-text-3); padding: 5px 14px; cursor: pointer; transition: all .10s; user-select: none; display: flex; align-items: center; gap: 6px; }
.seg-btn:hover { color: var(--ui-text-2); }
.seg-btn.active { background: var(--ui-card-2); color: white; }

/* ACCORDION */
.acc { border: 1px solid var(--ui-border); }
.acc-item { border-bottom: 1px solid var(--ui-border); }
.acc-item:last-child { border-bottom: none; }
.acc-hdr { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; cursor: pointer; font-family: var(--font-mono); font-size: 12px; color: var(--ui-text-2); user-select: none; transition: background .10s; }
.acc-hdr:hover { background: rgba(255, 255, 255, .02); }
.acc-chev { width: 14px; height: 14px; color: var(--ui-text-4); flex-shrink: 0; transition: transform .18s; }
.acc-item.open .acc-chev { transform: rotate(180deg); }
.acc-body { max-height: 0; overflow: hidden; transition: max-height .22s ease; }
.acc-item.open .acc-body { max-height: 240px; }
.acc-content { padding: 4px 16px 16px; font-family: var(--font-primary); font-size: 13px; color: var(--ui-text-3); line-height: 1.72; font-weight: 300; }

/* CARDS */
.card { background: var(--ui-card); border: 1px solid var(--ui-border); padding: 18px; }
.card-lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ui-text-4); margin-bottom: 7px; }
.card-val { font-family: var(--font-mono); font-size: 28px; font-weight: 500; color: white; line-height: 1; margin-bottom: 5px; }
.card-trend { font-family: var(--font-mono); font-size: 11px; display: flex; align-items: center; gap: 4px; }
.c-up { color: var(--green); }
.c-dn { color: var(--red); }

/* LIST */
.list { border: 1px solid var(--ui-border); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--ui-border); transition: background .08s; cursor: pointer; }
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: rgba(255, 255, 255, .02); }
.list-icon { width: 30px; height: 30px; background: var(--ui-card-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.list-body { flex: 1; min-width: 0; }
.list-title { font-family: var(--font-mono); font-size: 12px; color: var(--ui-text-2); }
.list-sub { font-family: var(--font-mono); font-size: 10px; color: var(--ui-text-4); margin-top: 2px; }
.list-right { font-family: var(--font-mono); font-size: 10px; color: var(--ui-text-4); flex-shrink: 0; }

/* DROPDOWN */
.dropdown { background: var(--ui-card); border: 1px solid var(--ui-border-mid); width: 220px; padding: 4px; }
.dd-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; font-family: var(--font-mono); font-size: 12px; color: var(--ui-text-2); cursor: pointer; transition: background .08s; gap: 8px; }
.dd-item:hover { background: rgba(255, 255, 255, .04); }
.dd-item.danger { color: var(--red); }
.dd-item.danger:hover { background: var(--red-bg); }
.dd-item.disabled { opacity: .35; cursor: not-allowed; }
.dd-shortcut { color: var(--ui-text-4); font-size: 10px; flex-shrink: 0; }
.dd-icon { width: 14px; height: 14px; color: var(--ui-text-3); flex-shrink: 0; }
.dd-divider { height: 1px; background: var(--ui-border); margin: 4px 0; }
.dd-section-lbl { padding: 8px 12px 4px; font-family: var(--font-mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ui-text-4); }

/* MODAL */
.modal-backdrop { background: rgba(0, 0, 0, .88); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 24px; min-height: 260px; }
.modal { background: var(--ui-card); border: 1px solid var(--ui-border-mid); width: 100%; max-width: 420px; }
.modal-header { padding: 20px 20px 0; }
.modal-title { font-family: var(--font-primary); font-size: 18px; font-weight: 600; color: white; letter-spacing: -.01em; }
.modal-body { padding: 12px 20px 20px; font-family: var(--font-primary); font-size: 13px; color: var(--ui-text-3); line-height: 1.72; font-weight: 300; }
.modal-footer { padding: 0 20px 20px; display: flex; gap: 8px; justify-content: flex-end; }
.modal-danger-icon { width: 40px; height: 40px; background: var(--red-bg); border: 1px solid rgba(248, 113, 113, .20); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }

/* TOAST */
.toast { display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px; border: 1px solid; font-family: var(--font-mono); font-size: 12px; margin-bottom: 8px; }
.toast-success { background: var(--green-bg); border-color: rgba(74, 222, 128, .22); color: var(--green); }
.toast-error { background: var(--red-bg); border-color: rgba(248, 113, 113, .22); color: var(--red); }
.toast-warning { background: var(--amber-bg); border-color: rgba(251, 191, 36, .22); color: var(--amber); }
.toast-info { background: var(--blue-bg); border-color: rgba(96, 165, 250, .22); color: var(--blue); }
.toast-body { flex: 1; }
.toast-title { font-weight: 500; margin-bottom: 2px; }
.toast-msg { color: var(--ui-text-3); font-size: 11px; font-weight: 300; }
.toast-close { color: var(--ui-text-4); cursor: pointer; font-size: 14px; flex-shrink: 0; }

/* TOOLTIP / POPOVER */
.tip-wrap { position: relative; display: inline-block; }
.tip { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: #111; border: 1px solid var(--ui-border-mid); font-family: var(--font-mono); font-size: 11px; color: var(--ui-text-2); padding: 6px 10px; white-space: nowrap; pointer-events: none; z-index: 50; }
.tip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #111; }

/* PROGRESS / SPINNERS */
.prog-track { overflow: hidden; }
.prog-track.sm { height: 2px; background: rgba(255, 255, 255, .07); }
.prog-track.md { height: 4px; background: rgba(255, 255, 255, .07); }
.prog-track.lg { height: 6px; background: rgba(255, 255, 255, .07); }
.prog-bar { height: 100%; }
.pb-white { background: white; }
.pb-green { background: var(--green); }
.pb-red { background: var(--red); }
.pb-amber { background: var(--amber); }
.pb-blue { background: var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { transform: translateX(200%); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.spinner { border-radius: 50%; animation: spin .72s linear infinite; }
.sp-xs { width: 12px; height: 12px; border: 1.5px solid rgba(255, 255, 255, .12); border-top-color: white; }
.sp-sm { width: 16px; height: 16px; border: 1.5px solid rgba(255, 255, 255, .12); border-top-color: white; }
.sp-md { width: 20px; height: 20px; border: 2px solid rgba(255, 255, 255, .12); border-top-color: white; }
.sp-lg { width: 28px; height: 28px; border: 2px solid rgba(255, 255, 255, .12); border-top-color: white; }
.sp-xl { width: 40px; height: 40px; border: 3px solid rgba(255, 255, 255, .10); border-top-color: white; }
.skel { background: rgba(255, 255, 255, .06); overflow: hidden; position: relative; }
.skel::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, .04) 50%, transparent 100%); transform: translateX(-100%); animation: shimmer 2s infinite; }

/* DARK TABLE */
.ui-tbl { width: 100%; border-collapse: collapse; }
.ui-tbl th { font-family: var(--font-mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--ui-text-4); text-align: left; padding: 10px 16px 10px 0; border-bottom: 1px solid var(--ui-border-mid); font-weight: 400; }
.ui-tbl th.sort { cursor: pointer; }
.ui-tbl th.sort:hover { color: var(--ui-text-2); }
.ui-tbl td { font-family: var(--font-mono); font-size: 12px; color: var(--ui-text-3); padding: 11px 16px 11px 0; border-bottom: 1px solid var(--ui-border); }
.ui-tbl td.primary { color: var(--ui-text-2); }
.ui-tbl td.muted { color: var(--ui-text-4); }
.ui-tbl td.num { text-align: right; }
.ui-tbl tr:hover td { background: rgba(255, 255, 255, .015); }
.ui-tbl tr.sel td { background: rgba(255, 255, 255, .03); }
.tbl-chk { width: 14px; height: 14px; background: var(--ui-card); border: 1px solid var(--ui-border-mid); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.tbl-chk.on { background: white; border-color: white; }

/* CODE */
.code-block { background: #0b0b0b; border: 1px solid var(--ui-border); overflow: hidden; }
.code-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 9px 16px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.code-lang { font-family: var(--font-mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ui-text-4); }
.code-action { font-family: var(--font-mono); font-size: 10px; color: var(--ui-text-4); cursor: pointer; background: none; border: none; transition: color .10s; }
.code-action:hover { color: var(--ui-text-2); }
.code-body { padding: 20px; font-family: var(--font-mono); font-size: 12px; line-height: 1.78; overflow-x: auto; color: rgba(255, 255, 255, .68); }
.ct-kw { color: rgba(255, 255, 255, .46); }
.ct-fn { color: rgba(255, 255, 255, .80); }
.ct-str { color: rgba(255, 255, 255, .60); }
.ct-prop { color: rgba(255, 255, 255, .88); }
.ct-val { color: rgba(255, 255, 255, .56); }
.ct-cmt { color: rgba(255, 255, 255, .24); font-style: italic; }
.ct-num { color: rgba(255, 255, 255, .82); }
.ct-type { color: rgba(255, 255, 255, .70); }
.code-inline { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .10); font-family: var(--font-mono); font-size: 11px; color: var(--ui-text-2); padding: 2px 6px; display: inline; }

/* EMPTY STATE */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; gap: 10px; text-align: center; }
.empty-icon { width: 48px; height: 48px; background: var(--ui-card-2); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.empty-icon svg { width: 20px; height: 20px; color: var(--ui-text-4); }
.empty-title { font-family: var(--font-primary); font-size: 15px; font-weight: 500; color: var(--ui-text-2); }
.empty-desc { font-family: var(--font-primary); font-size: 13px; color: var(--ui-text-4); max-width: 260px; line-height: 1.65; font-weight: 300; }

/* PAGINATION */
.pagination { display: flex; align-items: center; gap: 2px; }
.pg-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 12px; color: var(--ui-text-3); cursor: pointer; border: 1px solid transparent; transition: all .10s; }
.pg-btn:hover { color: white; background: rgba(255, 255, 255, .05); }
.pg-btn.active { color: white; border-color: var(--ui-border-mid); }
.pg-btn.disabled { opacity: .28; cursor: not-allowed; }
.pg-ellipsis { color: var(--ui-text-4); padding: 0 5px; font-family: var(--font-mono); font-size: 12px; }

/* AVATAR */
.av { display: inline-flex; align-items: center; justify-content: center; background: var(--ui-card-2); color: var(--ui-text-3); font-family: var(--font-mono); font-weight: 500; flex-shrink: 0; }
.av-2xs { width: 16px; height: 16px; font-size: 7px; }
.av-xs { width: 20px; height: 20px; font-size: 8px; }
.av-sm { width: 28px; height: 28px; font-size: 10px; }
.av-md { width: 36px; height: 36px; font-size: 12px; }
.av-lg { width: 48px; height: 48px; font-size: 15px; }
.av-xl { width: 64px; height: 64px; font-size: 19px; }
.av-round { border-radius: 50%; }
.av-sq { border-radius: 4px; }
.av-group { display: flex; }
.av-group .av { margin-left: -8px; border: 2px solid var(--ui-base); }
.av-group .av:first-child { margin-left: 0; }

/* BREADCRUMB */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11px; }
.bc-item { color: var(--ui-text-3); transition: color .10s; cursor: pointer; }
.bc-item:hover { color: var(--ui-text-2); }
.bc-item.active { color: white; cursor: default; }
.bc-sep { color: var(--ui-text-5); }

/* VNAV */
.vnav { background: var(--ui-surface); border-right: 1px solid var(--ui-border); width: 210px; padding: 10px; }
.vnav-section { font-family: var(--font-mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--ui-text-4); padding: 8px 10px 4px; }
.vnav-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; font-family: var(--font-mono); font-size: 12px; color: var(--ui-text-3); cursor: pointer; transition: all .09s; }
.vnav-item:hover { color: var(--ui-text-2); background: rgba(255, 255, 255, .03); }
.vnav-item.active { color: white; background: rgba(255, 255, 255, .07); }
.vnav-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.vnav-badge { margin-left: auto; }

/* CMD PALETTE */
.cmd { background: var(--ui-card); border: 1px solid var(--ui-border-mid); overflow: hidden; }
.cmd-inp-wrap { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--ui-border); }
.cmd-inp { flex: 1; background: transparent; border: none; outline: none; font-family: var(--font-mono); font-size: 13px; color: var(--ui-text-2); height: 48px; }
.cmd-inp::placeholder { color: var(--ui-text-4); }
.cmd-results { padding: 6px; max-height: 280px; overflow-y: auto; }
.cmd-section { font-family: var(--font-mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--ui-text-4); padding: 8px 10px 4px; }
.cmd-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; font-family: var(--font-mono); font-size: 12px; color: var(--ui-text-2); cursor: pointer; transition: background .08s; }
.cmd-item:hover, .cmd-item.focused { background: rgba(255, 255, 255, .05); }
.cmd-item-icon { width: 28px; height: 28px; background: var(--ui-card-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cmd-item-text { flex: 1; }
.cmd-item-title { color: var(--ui-text-2); }
.cmd-item-sub { font-size: 10px; color: var(--ui-text-4); margin-top: 1px; }
.cmd-item-key { font-size: 10px; color: var(--ui-text-4); }
.cmd-footer { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; border-top: 1px solid var(--ui-border); }
.cmd-hint { font-family: var(--font-mono); font-size: 10px; color: var(--ui-text-4); display: flex; align-items: center; gap: 8px; }
.kbkey { background: var(--ui-card-2); border: 1px solid var(--ui-border-mid); padding: 2px 6px; font-family: var(--font-mono); font-size: 10px; color: var(--ui-text-3); }

/* SETTINGS */
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--ui-border); gap: 16px; }
.settings-row:last-child { border-bottom: none; }
.settings-title { font-family: var(--font-mono); font-size: 12px; color: var(--ui-text-2); }
.settings-desc { font-family: var(--font-primary); font-size: 12px; color: var(--ui-text-4); margin-top: 3px; line-height: 1.55; font-weight: 300; }

/* ICON GRID */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 3px; }
.icon-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 4px; border: 1px solid var(--ui-border); transition: background .08s; cursor: pointer; }
.icon-cell:hover { background: rgba(255, 255, 255, .04); }
.icon-cell svg { width: 16px; height: 16px; color: var(--ui-text-3); }
.icon-cell-name { font-family: var(--font-mono); font-size: 7.5px; color: var(--ui-text-4); text-align: center; letter-spacing: .03em; }

/* RULER */
.ruler { display: flex; flex-wrap: wrap; gap: 3px; margin: 16px 0; align-items: flex-end; }
.ruler-item { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.ruler-bar { background: var(--ink); }
.ruler-lbl { font-family: var(--font-mono); font-size: 8px; color: var(--ink-4); }

/* SLIDER */
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 3px; background: rgba(255, 255, 255, .12); outline: none; cursor: pointer; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: white; cursor: pointer; }

/* CHARTS */
canvas { display: block; }

/* HEATMAP */
.heatmap { display: grid; gap: 2px; }
.hm-cell { aspect-ratio: 1; border-radius: 2px; }

/* DRAWER */
.drawer-mock { display: flex; background: var(--ui-surface); min-height: 300px; }
.drawer-overlay { flex: 1; background: rgba(0, 0, 0, .60); }
.drawer { width: 320px; background: var(--ui-card); border-left: 1px solid var(--ui-border-mid); display: flex; flex-direction: column; }
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--ui-border); }
.drawer-title { font-family: var(--font-primary); font-size: 16px; font-weight: 600; color: white; }
.drawer-body { flex: 1; padding: 20px; font-family: var(--font-primary); font-size: 13px; color: var(--ui-text-3); line-height: 1.70; font-weight: 300; }
.drawer-footer { padding: 16px 20px; border-top: 1px solid var(--ui-border); display: flex; gap: 8px; justify-content: flex-end; }

/* ERR INLINE */
.err-inline { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--red-bg); border: 1px solid rgba(248, 113, 113, .22); }
.err-inline svg { width: 14px; height: 14px; color: var(--red); flex-shrink: 0; margin-top: 1px; }
.err-inline-body { font-family: var(--font-mono); font-size: 12px; color: var(--red); }
.err-inline-title { font-weight: 500; margin-bottom: 2px; }
.err-inline-msg { font-size: 11px; opacity: .80; }

/* LAYOUT DEMOS */
.layout-demo { background: var(--ui-base); border: 1px solid var(--ui-border); }
.ld-nav { height: 44px; background: var(--ui-surface); border-bottom: 1px solid var(--ui-border); display: flex; align-items: center; padding: 0 16px; gap: 12px; }
.ld-nav-brand { font-family: var(--font-mono); font-size: 11px; color: var(--ui-text-3); }
.ld-nav-spacer { flex: 1; }
.ld-body { display: flex; min-height: 240px; }
.ld-sidebar { width: 160px; background: var(--ui-surface); border-right: 1px solid var(--ui-border); padding: 8px; }
.ld-main { flex: 1; padding: 16px; display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; align-content: start; }
.ld-card { background: var(--ui-card); border: 1px solid var(--ui-border); padding: 12px; }
.ld-card-full { grid-column: 1 / -1; }
.ld-card-half { grid-column: span 2; }
.ld-nav-item { display: flex; align-items: center; gap: 7px; padding: 7px 8px; font-family: var(--font-mono); font-size: 10px; color: var(--ui-text-4); }
.ld-nav-item.active { color: white; background: rgba(255, 255, 255, .06); }

/* BENTO */
.bento { display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: auto; gap: 8px; padding: 16px; background: var(--ui-base); }
.bento-cell { background: var(--ui-card); border: 1px solid var(--ui-border); padding: 16px; }

/* FORM LAYOUT */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-field { margin-bottom: 16px; }
.form-section-title { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--ui-text-2); border-bottom: 1px solid var(--ui-border); padding-bottom: 10px; margin-bottom: 16px; letter-spacing: .04em; }
.form-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 20px; border-top: 1px solid var(--ui-border); margin-top: 8px; }

/* POPOVER */
.popover { background: var(--ui-card); border: 1px solid var(--ui-border-mid); padding: 16px; width: 240px; }
.popover-title { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--ui-text-2); margin-bottom: 8px; }
.popover-body { font-family: var(--font-primary); font-size: 12px; color: var(--ui-text-3); line-height: 1.65; font-weight: 300; }

/* FOOTER (TMLS override — disabled for docs) */


/* ========== Responsive ========== */
@media (max-width: 768px) {
  :root { --nav-h: 52px; }
  .hamburger { display: flex; }
  .navbar-tabs { display: none; }
  .navbar-github span { display: none; }
  .navbar-link { display: none; }
  .navbar-signup { font-size: 12px; padding: 5px 12px; }
  .search-shortcut { display: none; }
  .navbar-center { display: none; }
  .sidebar { position: fixed; top: var(--nav-h); left: 0; bottom: 0; z-index: 90; background: var(--paper); transform: translateX(-100%); transition: transform var(--t-slow); }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 0; }
  #article { padding: 28px 20px; }
  .card-grid { grid-template-columns: 1fr; }
  .footer { padding: 40px 20px 24px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
  .hero { grid-template-columns: 1fr !important; min-height: auto !important; }
  .hero-l, .hero-r { padding: 40px 20px !important; }
  .section { grid-template-columns: 1fr !important; }
  .sec-num { display: none !important; }
  .sec-body { padding: 32px 20px !important; }
  .chapter { padding: 40px 20px !important; }
}
