/* ============================================================
   SA References — Main Stylesheet
   ============================================================ */

/* 1. Custom Properties & Theming
   ============================================================ */
:root {
  /* Light mode colors */
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-2: #cbd5e1;

  --text: #1e293b;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #eff6ff;
  --primary-subtle: #dbeafe;

  --accent: #8b5cf6;
  --accent-light: #f5f3ff;

  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -1px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 28px -3px rgba(15, 23, 42, 0.1), 0 4px 10px -2px rgba(15, 23, 42, 0.05);

  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  --nav-width: 260px;
  --content-max: 860px;
  --site-max: 1400px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;

  /* Category accent colors */
  --cat-foundations: #3b82f6;
  --cat-arch-styles: #8b5cf6;
  --cat-distributed: #6366f1;
  --cat-communication: #0ea5e9;
  --cat-reliability: #f59e0b;
  --cat-scalability: #06b6d4;
  --cat-api: #10b981;
  --cat-integration: #f97316;
  --cat-data: #f59e0b;
  --cat-search: #ec4899;
  --cat-security: #ef4444;
  --cat-observability: #8b5cf6;
  --cat-deployment: #84cc16;
  --cat-cloud: #0ea5e9;
  --cat-platform: #10b981;
  --cat-aiml: #f43f5e;
  --cat-antipatterns: #f97316;
  --cat-decisions: #64748b;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --bg-alt: #0f172a;
  --surface: #1e293b;
  --surface-2: #0f172a;
  --border: #334155;
  --border-2: #475569;

  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-light: #172033;
  --primary-subtle: #1e3a5f;

  --accent: #a78bfa;
  --accent-light: #1e1b4b;

  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px -1px rgba(0, 0, 0, 0.35), 0 2px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 28px -3px rgba(0, 0, 0, 0.4), 0 4px 10px -2px rgba(0, 0, 0, 0.25);
}

/* 2. Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  transition: background-color var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  padding-left: 1.5em;
}

li {
  margin-bottom: 0.35em;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { color: var(--text); }
p + p { margin-top: 1em; }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 0.125em 0.375em;
  border-radius: var(--radius-sm);
  color: var(--accent);
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  color: var(--text);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

blockquote {
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1.25rem;
  background: var(--primary-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: italic;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

th {
  background: var(--bg-alt);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-muted);
}

tr:last-child td { border-bottom: none; }

tr:hover td {
  background: var(--bg-alt);
  transition: background var(--transition-fast);
}

/* 3. Layout
   ============================================================ */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

.container--narrow {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* 4. Top Navigation
   ============================================================ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.9);
  transition: background var(--transition), border-color var(--transition);
}

[data-theme="dark"] .topnav {
  background: rgba(30, 41, 59, 0.92);
}

.topnav__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 60px;
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.topnav__logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.topnav__logo:hover { color: var(--primary); }

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
  font-weight: 800;
  flex-shrink: 0;
}

.topnav__search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.topnav__search input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.topnav__search input::placeholder { color: var(--text-faint); }

.topnav__search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-subtle);
  background: var(--surface);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.topnav__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.theme-toggle svg { width: 18px; height: 18px; }
.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

.hamburger {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--text-muted);
  transition: background var(--transition-fast);
}

.hamburger:hover { background: var(--bg-alt); }
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--transition);
}

/* 5. Sidebar Navigation
   ============================================================ */
.page-layout {
  display: flex;
  flex: 1;
  max-width: var(--site-max);
  margin: 0 auto;
  width: 100%;
}

.sidebar {
  width: var(--nav-width);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  height: calc(100vh - 60px);
  position: sticky;
  top: 60px;
  overflow-y: auto;
  padding: 1.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar__section {
  margin-bottom: 0.25rem;
}

.sidebar__heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  padding: 0.5rem 1.25rem;
  margin-top: 1rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.4rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-radius: 0;
  transition: color var(--transition-fast), background var(--transition-fast);
  text-decoration: none;
  position: relative;
}

.sidebar__link:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.sidebar__link.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

.sidebar__link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.sidebar__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* 6. Main Content Area
   ============================================================ */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 2.5rem 4rem;
}

/* 7. Hero / Landing Page
   ============================================================ */
.hero {
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  background: linear-gradient(180deg, var(--primary-light) 0%, transparent 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--primary-subtle) 0%, transparent 70%);
  pointer-events: none;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-subtle);
  color: var(--primary);
  padding: 0.375rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1.75rem;
  letter-spacing: 0.02em;
  border: 1px solid var(--primary);
  animation: fadeInUp 0.5s ease both;
}

.hero__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  animation: fadeInUp 0.6s ease 0.1s both;
  background: linear-gradient(135deg, var(--text) 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2.5rem;
  line-height: 1.6;
  animation: fadeInUp 0.6s ease 0.2s both;
}

.hero__search {
  max-width: 560px;
  margin: 0 auto 3rem;
  position: relative;
  animation: fadeInUp 0.6s ease 0.3s both;
}

.hero__search input {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.hero__search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-subtle), var(--shadow-md);
}

.hero__search input::placeholder { color: var(--text-faint); }

.hero__search .search-icon {
  left: 1rem;
  width: 20px;
  height: 20px;
}

.hero__stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
  animation: fadeInUp 0.6s ease 0.4s both;
}

.hero__stat {
  text-align: center;
}

.hero__stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -0.03em;
}

.hero__stat-label {
  font-size: 0.8rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  margin-top: 0.25rem;
}

/* 8. Category Grid
   ============================================================ */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.section-grid--dense {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--cat-color, var(--primary));
  opacity: 0;
  transition: opacity var(--transition);
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-2);
}

.category-card:hover::before {
  opacity: 1;
}

.category-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: color-mix(in srgb, var(--cat-color, var(--primary)) 12%, transparent);
  color: var(--cat-color, var(--primary));
  flex-shrink: 0;
}

.category-card__number {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.category-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}

.category-card__desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
}

.category-card__count {
  font-size: 0.8rem;
  color: var(--text-faint);
  font-weight: 500;
}

/* 9. Article Cards
   ============================================================ */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.article-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-2);
}

.article-card__title {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin: 0;
}

.article-card:hover .article-card__title {
  color: var(--primary);
}

.article-card__desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
}

.article-card__meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.article-card__arrow {
  margin-left: auto;
  color: var(--text-faint);
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.article-card:hover .article-card__arrow {
  transform: translateX(3px);
  color: var(--primary);
}

/* 10. Badges & Tags
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge--primary {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary);
  border-width: 0.5px;
}

.badge--accent {
  background: var(--accent-light);
  color: var(--accent);
}

.badge--muted {
  background: var(--bg-alt);
  color: var(--text-muted);
  border-color: var(--border);
  border-width: 0.5px;
}

.badge--success {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.badge--warning {
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  color: var(--warning);
}

.badge--danger {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

/* 11. Article Page Layout
   ============================================================ */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 3rem;
  align-items: start;
}

.article-body {
  min-width: 0;
}

.article-aside {
  position: sticky;
  top: 84px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--text-faint);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb a:hover { color: var(--primary); }
.breadcrumb__sep { opacity: 0.5; }
.breadcrumb__current { color: var(--text-muted); }

.article-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.article-header__tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.article-header__title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.article-header__desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.article-header__meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-faint);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* Article Content Typography */
.article-content h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 80px;
}

.article-content h3 {
  font-size: 1.15rem;
  margin: 2rem 0 0.75rem;
  color: var(--text);
  scroll-margin-top: 80px;
}

.article-content p {
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  line-height: 1.75;
}

.article-content ul, .article-content ol {
  margin-bottom: 1.25rem;
  color: var(--text-muted);
}

.article-content li {
  margin-bottom: 0.5em;
}

/* Callout boxes */
.callout {
  border-radius: var(--radius-lg);
  padding: 1.125rem 1.25rem;
  margin: 1.5rem 0;
  border: 1px solid transparent;
  display: flex;
  gap: 0.875rem;
}

.callout--info {
  background: var(--primary-light);
  border-color: var(--primary-subtle);
  color: var(--primary);
}

.callout--success {
  background: color-mix(in srgb, var(--success) 10%, transparent);
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
  color: var(--success);
}

.callout--warning {
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  border-color: color-mix(in srgb, var(--warning) 25%, transparent);
  color: var(--warning);
}

.callout--danger {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
  color: var(--danger);
}

.callout__icon { flex-shrink: 0; font-size: 1.1rem; margin-top: 0.1rem; }

.callout__body { flex: 1; }

.callout__body strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.callout__body p, .callout__body ul {
  font-size: 0.875rem;
  margin: 0;
  color: inherit;
  opacity: 0.85;
}

/* Pros/Cons table */
.pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.pros-cons__col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.pros-cons__col--pros {
  border-color: color-mix(in srgb, var(--success) 30%, var(--border));
}

.pros-cons__col--cons {
  border-color: color-mix(in srgb, var(--danger) 25%, var(--border));
}

.pros-cons__heading {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pros-cons__col--pros .pros-cons__heading { color: var(--success); }
.pros-cons__col--cons .pros-cons__heading { color: var(--danger); }

.pros-cons__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pros-cons__list li {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
}

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

.pros-cons__list li::before {
  flex-shrink: 0;
  font-size: 0.8rem;
  margin-top: 0.1rem;
}

.pros-cons__col--pros .pros-cons__list li::before { content: "✓"; color: var(--success); }
.pros-cons__col--cons .pros-cons__list li::before { content: "✗"; color: var(--danger); }

/* Checklist */
.checklist {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.checklist li {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
  align-items: flex-start;
}

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

.checklist li::before {
  content: "☐";
  color: var(--primary);
  flex-shrink: 0;
  font-size: 1rem;
  margin-top: -0.1rem;
}

/* 12. Table of Contents (aside)
   ============================================================ */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.125rem;
  margin-bottom: 1.5rem;
}

.toc__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.875rem;
}

.toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc__list li { margin: 0; }

.toc__list a {
  display: block;
  font-size: 0.825rem;
  color: var(--text-muted);
  padding: 0.3rem 0.625rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
  line-height: 1.4;
}

.toc__list a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.toc__list a.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

/* Related patterns aside */
.related-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.125rem;
}

.related-panel__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.875rem;
}

.related-panel__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-panel__list li { margin: 0; }

.related-panel__list a {
  display: block;
  font-size: 0.825rem;
  color: var(--text-muted);
  padding: 0.4rem 0.625rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.related-panel__list a::before {
  content: "→";
  font-size: 0.75rem;
  color: var(--text-faint);
  flex-shrink: 0;
}

.related-panel__list a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* 13. Section Header
   ============================================================ */
.section-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.section-header__kicker {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cat-color, var(--primary));
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-header__title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.section-header__desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 680px;
}

/* 14. Article Navigation (prev/next)
   ============================================================ */
.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.article-nav__link {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.article-nav__link--next {
  text-align: right;
}

.article-nav__link:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.article-nav__dir {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.article-nav__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

/* 15. Search Results
   ============================================================ */
.search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 400px;
  overflow-y: auto;
  display: none;
}

.search-results.visible { display: block; }

.search-result {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background var(--transition-fast);
}

.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg-alt); }

.search-result__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.search-result__path {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.search-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.875rem;
}

/* 16. Progress Bar
   ============================================================ */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: 200;
  width: 0%;
  transition: width 100ms linear;
}

/* 17. Section Index Info Box
   ============================================================ */
.info-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.info-box__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: var(--primary-subtle);
  color: var(--primary);
}

.info-box__content h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.info-box__content p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* 18. Footer
   ============================================================ */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.5rem;
  margin-top: auto;
}

.footer__inner {
  max-width: var(--site-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer__tagline {
  font-size: 0.875rem;
  color: var(--text-faint);
}

.footer__links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer__links a {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer__links a:hover { color: var(--primary); }

.footer__copy {
  font-size: 0.8rem;
  color: var(--text-faint);
  width: 100%;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* 19. Utilities
   ============================================================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* 20. Animations
   ============================================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to { background-position: 200% 0; }
}

.animate-in {
  animation: fadeInUp 0.5s ease both;
}

.animate-in-1 { animation-delay: 0.1s; }
.animate-in-2 { animation-delay: 0.2s; }
.animate-in-3 { animation-delay: 0.3s; }
.animate-in-4 { animation-delay: 0.4s; }

/* Card stagger animation */
.article-grid .article-card,
.section-grid .category-card {
  animation: fadeInUp 0.4s ease both;
}

.article-grid .article-card:nth-child(1),
.section-grid .category-card:nth-child(1) { animation-delay: 0.05s; }
.article-grid .article-card:nth-child(2),
.section-grid .category-card:nth-child(2) { animation-delay: 0.1s; }
.article-grid .article-card:nth-child(3),
.section-grid .category-card:nth-child(3) { animation-delay: 0.15s; }
.article-grid .article-card:nth-child(4),
.section-grid .category-card:nth-child(4) { animation-delay: 0.2s; }
.article-grid .article-card:nth-child(5),
.section-grid .category-card:nth-child(5) { animation-delay: 0.25s; }
.article-grid .article-card:nth-child(6),
.section-grid .category-card:nth-child(6) { animation-delay: 0.3s; }

/* 21. Responsive
   ============================================================ */
@media (max-width: 1100px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-aside {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 60px;
    height: calc(100vh - 60px);
    z-index: 90;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transition: left var(--transition-slow);
    width: 280px;
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 60px;
    background: rgba(0,0,0,0.4);
    z-index: 89;
    backdrop-filter: blur(2px);
  }

  .sidebar-overlay.visible { display: block; }

  .hamburger {
    display: flex;
  }

  .main-content {
    padding: 2rem 1.25rem 3rem;
  }
}

@media (max-width: 640px) {
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }

  .hero {
    padding: 3rem 1.25rem 2.5rem;
  }

  .hero__stats {
    gap: 1.5rem;
  }

  .pros-cons {
    grid-template-columns: 1fr;
  }

  .article-nav {
    grid-template-columns: 1fr;
  }

  .article-aside {
    grid-template-columns: 1fr;
  }

  .topnav__search {
    display: none;
  }

  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* 22. Print Styles
   ============================================================ */
@media print {
  .topnav, .sidebar, .article-aside, footer, .reading-progress { display: none; }
  .main-content { padding: 0; }
  .article-layout { grid-template-columns: 1fr; }
  body { background: white; color: black; }
}
