/* ===== CSS Custom Properties ===== */
:root {
  /* Light theme (default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-tertiary: #eef1f5;
  --bg-sidebar: #f9fafb;
  --bg-code: #f0f2f5;
  --bg-card: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.88);
  --bg-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-callout-note: #e8f0fe;
  --bg-callout-tip: #e6f4ea;
  --bg-callout-warning: #fef7e0;
  --bg-callout-important: #fce8e6;
  --bg-table-header: #f0f3f8;
  --bg-table-row-alt: #f9fafb;

  --text-primary: #1b1f24;
  --text-secondary: #57606a;
  --text-tertiary: #8b949e;
  --text-link: #0969da;
  --text-link-hover: #0550ae;
  --text-heading: #1b1f24;
  --text-code: #cf222e;
  --text-on-accent: #ffffff;

  --border-primary: #d0d7de;
  --border-secondary: #e1e7ed;
  --border-accent: #0969da;
  --border-callout-note: #4285f4;
  --border-callout-tip: #34a853;
  --border-callout-warning: #f9ab00;
  --border-callout-important: #ea4335;

  --accent-primary: #0969da;
  --accent-secondary: #8250df;
  --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 280px;
  --header-height: 60px;
  --content-max-width: 820px;
  --toc-width: 220px;
}

/* Dark theme */
[data-theme="dark"] {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-sidebar: #0d1117;
  --bg-code: #1c2128;
  --bg-card: #161b22;
  --bg-header: rgba(13, 17, 23, 0.88);
  --bg-hero: linear-gradient(135deg, #4a3f8a 0%, #5b3d7a 100%);
  --bg-callout-note: rgba(56, 132, 244, 0.12);
  --bg-callout-tip: rgba(52, 168, 83, 0.12);
  --bg-callout-warning: rgba(249, 171, 0, 0.12);
  --bg-callout-important: rgba(234, 67, 53, 0.12);
  --bg-table-header: #1c2128;
  --bg-table-row-alt: #161b22;

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-tertiary: #6e7681;
  --text-link: #58a6ff;
  --text-link-hover: #79c0ff;
  --text-heading: #f0f6fc;
  --text-code: #ff7b72;
  --text-on-accent: #ffffff;

  --border-primary: #30363d;
  --border-secondary: #21262d;
  --border-accent: #58a6ff;
  --border-callout-note: #58a6ff;
  --border-callout-tip: #3fb950;
  --border-callout-warning: #d29922;
  --border-callout-important: #f85149;

  --accent-primary: #58a6ff;
  --accent-secondary: #bc8cff;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--text-link-hover);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

::selection {
  background-color: var(--accent-primary);
  color: var(--text-on-accent);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ===== Header ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-secondary);
  z-index: 1000;
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.3px;
}

.header-logo:hover {
  text-decoration: none;
  color: var(--accent-primary);
}

.header-logo svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.header-breadcrumb a {
  color: var(--text-secondary);
}

.header-breadcrumb a:hover {
  color: var(--text-link);
}

.header-breadcrumb .separator {
  color: var(--text-tertiary);
  font-size: 11px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-search {
  position: relative;
  width: 260px;
}

.header-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: all var(--transition-fast);
}

.header-search input::placeholder {
  color: var(--text-tertiary);
}

.header-search input:focus {
  border-color: var(--accent-primary);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}

.header-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.btn-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-theme-toggle:hover {
  background: var(--bg-secondary);
  border-color: var(--border-primary);
  color: var(--text-primary);
}

.btn-github {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-github:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-primary);
  text-decoration: none;
  color: var(--text-primary);
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
}

/* ===== Layout ===== */
.page-layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-secondary);
  overflow-y: auto;
  padding: 20px 0;
  z-index: 100;
  transition: transform var(--transition-slow), background var(--transition-normal);
}

.sidebar-nav {
  padding: 0 16px;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.sidebar-section-title:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.sidebar-section-title .chevron {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-section.collapsed .chevron {
  transform: rotate(-90deg);
}

.sidebar-section.collapsed .sidebar-links {
  display: none;
}

.sidebar-links {
  list-style: none;
  padding: 2px 0;
}

.sidebar-links li {
  margin: 1px 0;
}

.sidebar-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 16px;
  font-size: 13.5px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition-fast);
  border-left: 2px solid transparent;
  line-height: 1.4;
}

.sidebar-links a:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-links a.active {
  background: rgba(9, 105, 218, 0.08);
  color: var(--accent-primary);
  border-left-color: var(--accent-primary);
  font-weight: 600;
}

[data-theme="dark"] .sidebar-links a.active {
  background: rgba(88, 166, 255, 0.1);
}

.sidebar-links a .nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

.sidebar-links a.active .nav-icon {
  opacity: 1;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  justify-content: center;
  min-width: 0;
}

.content-wrapper {
  width: 100%;
  max-width: calc(var(--content-max-width) + var(--toc-width) + 60px);
  display: flex;
  gap: 40px;
  padding: 0 32px;
}

.content-body {
  flex: 1;
  max-width: var(--content-max-width);
  padding: 40px 0 80px;
  min-width: 0;
}

/* ===== Table of Contents (Right sidebar) ===== */
.toc-sidebar {
  width: var(--toc-width);
  flex-shrink: 0;
  padding-top: 40px;
  position: sticky;
  top: calc(var(--header-height) + 20px);
  height: fit-content;
  max-height: calc(100vh - var(--header-height) - 40px);
  overflow-y: auto;
}

.toc-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  padding-left: 12px;
}

.toc-list {
  list-style: none;
  border-left: 1px solid var(--border-secondary);
}

.toc-list li {
  margin: 0;
}

.toc-list a {
  display: block;
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--text-tertiary);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: all var(--transition-fast);
  line-height: 1.5;
}

.toc-list a:hover {
  color: var(--text-secondary);
  text-decoration: none;
}

.toc-list a.active {
  color: var(--accent-primary);
  border-left-color: var(--accent-primary);
  font-weight: 500;
}

/* ===== Article Meta ===== */
.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-secondary);
  font-size: 12.5px;
  color: var(--text-tertiary);
  flex-wrap: wrap;
}

.article-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.article-meta svg {
  width: 14px;
  height: 14px;
}

/* ===== Hero Section ===== */
.hero-section {
  background: var(--accent-gradient);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  margin-bottom: 40px;
  color: var(--text-on-accent);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-section h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
}

.hero-section p {
  font-size: 16px;
  opacity: 0.92;
  max-width: 600px;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.hero-badges {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ===== Typography ===== */
.content-body h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-heading);
  margin: 40px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-secondary);
  letter-spacing: -0.3px;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.content-body h2:first-of-type {
  margin-top: 0;
}

.content-body h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-heading);
  margin: 28px 0 12px;
  letter-spacing: -0.2px;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.content-body h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-heading);
  margin: 20px 0 8px;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.content-body p {
  margin-bottom: 16px;
  color: var(--text-primary);
}

.content-body ul,
.content-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.content-body li {
  margin-bottom: 6px;
  color: var(--text-primary);
}

.content-body li::marker {
  color: var(--text-tertiary);
}

/* ===== Inline Code ===== */
.content-body code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 7px;
  background: var(--bg-code);
  border-radius: 4px;
  color: var(--text-code);
  font-weight: 500;
}

/* ===== Code Blocks ===== */
.code-block {
  position: relative;
  margin: 20px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-secondary);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-secondary);
  font-size: 12px;
  color: var(--text-tertiary);
}

.code-block-lang {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-copy {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-copy:hover {
  background: var(--bg-secondary);
  border-color: var(--border-primary);
}

.btn-copy.copied {
  color: var(--border-callout-tip);
  border-color: var(--border-callout-tip);
}

.code-block pre {
  padding: 16px;
  background: var(--bg-code);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-primary);
  tab-size: 2;
}

/* ===== Callout Boxes ===== */
.callout {
  padding: 16px 20px;
  margin: 20px 0;
  border-radius: var(--radius-md);
  border-left: 4px solid;
  display: flex;
  gap: 12px;
}

.callout-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.callout-content {
  flex: 1;
  min-width: 0;
}

.callout-title {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.callout-text {
  font-size: 14px;
  line-height: 1.6;
}

.callout-text p:last-child {
  margin-bottom: 0;
}

.callout.note {
  background: var(--bg-callout-note);
  border-left-color: var(--border-callout-note);
}

.callout.note .callout-icon,
.callout.note .callout-title {
  color: var(--border-callout-note);
}

.callout.tip {
  background: var(--bg-callout-tip);
  border-left-color: var(--border-callout-tip);
}

.callout.tip .callout-icon,
.callout.tip .callout-title {
  color: var(--border-callout-tip);
}

.callout.warning {
  background: var(--bg-callout-warning);
  border-left-color: var(--border-callout-warning);
}

.callout.warning .callout-icon,
.callout.warning .callout-title {
  color: var(--border-callout-warning);
}

.callout.important {
  background: var(--bg-callout-important);
  border-left-color: var(--border-callout-important);
}

.callout.important .callout-icon,
.callout.important .callout-title {
  color: var(--border-callout-important);
}

/* ===== Feature Cards ===== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.feature-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  margin-bottom: 16px;
  color: var(--accent-primary);
  transition: all var(--transition-normal);
}

.feature-card:hover .feature-card-icon {
  background: var(--accent-gradient);
  color: white;
}

.feature-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-heading);
}

.feature-card p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 0;
}

/* ===== Tables ===== */
.table-wrapper {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-secondary);
}

.content-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.content-body thead {
  background: var(--bg-table-header);
}

.content-body th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-heading);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 2px solid var(--border-secondary);
}

.content-body td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-secondary);
  color: var(--text-primary);
}

.content-body tbody tr:nth-child(even) {
  background: var(--bg-table-row-alt);
}

.content-body tbody tr:last-child td {
  border-bottom: none;
}

.content-body tbody tr:hover {
  background: var(--bg-callout-note);
}

/* ===== Steps / Timeline ===== */
.steps-list {
  list-style: none;
  padding: 0;
  margin: 24px 0;
  counter-reset: step-counter;
}

.steps-list li {
  position: relative;
  padding: 0 0 28px 52px;
  counter-increment: step-counter;
}

.steps-list li:last-child {
  padding-bottom: 0;
}

.steps-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 34px;
  height: 34px;
  background: var(--accent-gradient);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.steps-list li::after {
  content: '';
  position: absolute;
  left: 16px;
  top: 38px;
  bottom: 0;
  width: 2px;
  background: var(--border-secondary);
}

.steps-list li:last-child::after {
  display: none;
}

.steps-list li h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-heading);
}

.steps-list li p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 0;
}

/* ===== Architecture Diagram ===== */
.architecture-diagram {
  margin: 24px 0;
  padding: 32px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-secondary);
  text-align: center;
}

.arch-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 auto;
}

.arch-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  min-width: 120px;
  transition: all var(--transition-normal);
}

.arch-node:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.arch-node-icon {
  width: 36px;
  height: 36px;
  color: var(--accent-primary);
}

.arch-node-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
}

.arch-node-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}

.arch-arrow {
  color: var(--text-tertiary);
  font-size: 20px;
  flex-shrink: 0;
}

/* ===== Next Steps Cards ===== */
.next-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.next-step-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition-normal);
}

.next-step-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--text-primary);
}

.next-step-card .card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  flex-shrink: 0;
  transition: all var(--transition-normal);
}

.next-step-card:hover .card-icon {
  background: var(--accent-gradient);
  color: white;
}

.next-step-card .card-text h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.next-step-card .card-text p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

/* ===== Footer ===== */
.site-footer {
  margin-left: var(--sidebar-width);
  border-top: 1px solid var(--border-secondary);
  background: var(--bg-secondary);
  padding: 32px 0;
  transition: background var(--transition-normal);
}

.footer-inner {
  max-width: calc(var(--content-max-width) + var(--toc-width) + 60px);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 20px;
  list-style: none;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--text-link);
}

.footer-copy {
  font-size: 12.5px;
  color: var(--text-tertiary);
}

/* ===== Feedback Section ===== */
.feedback-section {
  margin: 48px 0 0;
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-secondary);
  text-align: center;
}

.feedback-section h3 {
  font-size: 16px;
  margin-bottom: 6px;
  border: none;
  color: var(--text-heading);
}

.feedback-section p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.feedback-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-feedback {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-feedback:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--bg-callout-note);
}

/* ===== Mobile Overlay ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  backdrop-filter: blur(4px);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }

/* Heading anchor link */
.heading-anchor {
  opacity: 0;
  margin-left: 6px;
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.8em;
  transition: opacity var(--transition-fast);
}

h2:hover .heading-anchor,
h3:hover .heading-anchor {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--accent-primary);
  text-decoration: none;
}

/* ===== Search Overlay ===== */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  justify-content: center;
  padding-top: 120px;
}

.search-overlay.active {
  display: flex;
}

.search-modal {
  width: 560px;
  max-height: 420px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-secondary);
  overflow: hidden;
}

.search-modal-input {
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-bottom: 1px solid var(--border-secondary);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  font-family: var(--font-sans);
  outline: none;
}

.search-results {
  max-height: 340px;
  overflow-y: auto;
  padding: 8px;
}

.search-result-item {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.search-result-item:hover,
.search-result-item.focused {
  background: var(--bg-secondary);
  text-decoration: none;
  color: var(--text-primary);
}

.search-result-item h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.search-result-item p {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0;
}

.search-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* ===== Back to Top Button ===== */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition-normal);
  z-index: 50;
}
p.comprehensive-text { color:white }

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .toc-sidebar {
    display: none;
  }

  .content-wrapper {
    padding: 0 24px;
  }
}

@media (max-width: 840px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .site-footer {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .header-breadcrumb {
    display: none;
  }

  .header-search {
    width: 180px;
  }

  .btn-github span {
    display: none;
  }

  .hero-section {
    padding: 32px 24px;
  }

  .hero-section h1 {
    font-size: 24px;
  }

  .content-wrapper {
    padding: 0 16px;
  }

  .content-body {
    padding: 24px 0 60px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .arch-flow {
    flex-direction: column;
  }

  .arch-arrow {
    transform: rotate(90deg);
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 520px) {
  .header-search {
    display: none;
  }

  .search-modal {
    width: calc(100% - 32px);
    margin: 0 16px;
  }

  .hero-badges {
    gap: 6px;
  }

  .hero-badge {
    font-size: 11px;
    padding: 4px 10px;
  }

  .next-steps-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Print ===== */
@media print {
  .site-header,
  .sidebar,
  .toc-sidebar,
  .site-footer,
  .back-to-top,
  .feedback-section,
  .btn-copy {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .content-body {
    max-width: 100%;
  }

  body {
    color: #000;
    background: #fff;
  }
}
