/* =========================================================
   SD-Guide — Interactive Learning Site for OpenAI/Anthropic
   System Design Interview Preparation
   ========================================================= */

:root {
  /* Dark theme (default) */
  --bg: #0a0a0c;
  --bg-elevated: #14141a;
  --bg-card: #1a1a22;
  --bg-hover: #22222c;
  --border: #2a2a36;
  --border-light: #1f1f29;

  --text: #e6e6ec;
  --text-muted: #a0a0ac;
  --text-subtle: #6b6b78;

  /* OpenAI teal accent */
  --openai: #10a37f;
  --openai-glow: rgba(16, 163, 127, 0.15);

  /* Anthropic warm orange accent */
  --anthropic: #d97757;
  --anthropic-glow: rgba(217, 119, 87, 0.15);

  /* Google blue accent */
  --google: #4285f4;
  --google-glow: rgba(66, 133, 244, 0.15);

  /* xAI monochrome accent (subtle silver/cyan) */
  --xai: #9aa0a6;
  --xai-glow: rgba(154, 160, 166, 0.15);

  /* Generic accents */
  --accent: #8b8ef7;
  --accent-hover: #a0a3ff;
  --success: #4ade80;
  --warn: #fbbf24;
  --danger: #ef4444;

  /* Tags */
  --tag-bg: #242431;
  --tag-border: #34344a;
  --tag-text: #c4c4d4;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', 'Monaco', monospace;
  --font-serif: 'Georgia', 'Times New Roman', serif;

  /* Spacing */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);

  /* Layout */
  --max-width: 1180px;
  --nav-height: 64px;
}

/* Light theme overrides */
[data-theme="light"] {
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f0f0f4;
  --border: #e4e4eb;
  --border-light: #efeff5;
  --text: #1a1a22;
  --text-muted: #50505c;
  --text-subtle: #8b8b9a;
  --tag-bg: #f0f0f5;
  --tag-border: #e0e0ea;
  --tag-text: #3a3a46;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Subtle background effect */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, var(--openai-glow) 0%, transparent 40%),
    radial-gradient(circle at 80% 90%, var(--anthropic-glow) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* ---------- Layout primitives ---------- */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

.page-body {
  padding: calc(var(--nav-height) + 2rem) 0 4rem;
}

/* ---------- Navigation ---------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: saturate(1.8) blur(14px);
  -webkit-backdrop-filter: saturate(1.8) blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
}

[data-theme="light"] .nav {
  background: rgba(255, 255, 255, 0.88);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.nav-brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--openai) 0%, var(--anthropic) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.85rem;
  color: #fff;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  flex: 1;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-links a.active {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.icon-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent);
}

/* ---------- Hero ---------- */

.hero {
  text-align: center;
  padding: 5rem 0 4rem;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.hero-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}

.hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 1.2rem;
  background: linear-gradient(110deg, var(--text) 40%, var(--openai) 70%, var(--anthropic) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.12rem;
  color: var(--text-muted);
  max-width: 720px;
  margin: 0 auto 2rem;
}

.hero-ctas {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0c;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(139, 142, 247, 0.35);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

/* ---------- Stat cards ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 2.5rem 0 4rem;
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  transition: border-color 0.15s, transform 0.15s;
}

.stat:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  margin-bottom: 0.35rem;
}

.stat-value.openai { color: var(--openai); }
.stat-value.anthropic { color: var(--anthropic); }
.stat-value.accent { color: var(--accent); }

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---------- Section titles ---------- */

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  letter-spacing: -0.5px;
}

.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  font-size: 0.98rem;
}

.section {
  margin-bottom: 4rem;
}

/* ---------- Feature / topic grid ---------- */

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.18s;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.15s;
}

.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

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

.feature-card.openai::before { background: var(--openai); }
.feature-card.openai:hover { border-color: var(--openai); }
.feature-card.anthropic::before { background: var(--anthropic); }
.feature-card.anthropic:hover { border-color: var(--anthropic); }
.feature-card.google::before { background: var(--google); }
.feature-card.google:hover { border-color: var(--google); }
.feature-card.xai::before { background: var(--xai); }
.feature-card.xai:hover { border-color: var(--xai); }

/* ---------- Company carousel (landing "Know your target") ---------- */
/* 3D coverflow: center card in front, side cards rotated on Y-axis, auto-rotating. */

.company-stage {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 0.75rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

.company-stage-viewport {
  position: relative;
  height: 480px;
  perspective: 1600px;
  perspective-origin: 50% 50%;
  overflow: visible;
  /* radial glow behind the active card */
}

.company-stage-viewport::before {
  content: "";
  position: absolute;
  inset: 10% 20%;
  background: radial-gradient(ellipse at center,
    rgba(255, 255, 255, 0.05) 0%,
    transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.company-slide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(440px, 86%);
  margin: 0;                 /* override feature-card margin if any */
  transform-style: preserve-3d;
  backface-visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) translateZ(-600px) scale(0.72);
  transition:
    transform 0.8s cubic-bezier(.22, .61, .36, 1),
    opacity 0.8s ease,
    box-shadow 0.8s ease,
    filter 0.8s ease;
  will-change: transform, opacity;
}

/* Center / active card: fully forward, lit up */
.company-slide.is-active {
  transform: translate(-50%, -50%) translateZ(0) rotateY(0deg) scale(1);
  opacity: 1;
  pointer-events: auto;
  z-index: 10;
  box-shadow:
    0 40px 100px -20px rgba(0, 0, 0, 0.65),
    0 0 0 1px var(--border),
    0 0 60px -10px var(--accent-glow, rgba(255, 255, 255, 0.12));
}

/* Right neighbour: tilted in from the right */
.company-slide.is-next {
  transform:
    translate(-50%, -50%)
    translateX(260px)
    translateZ(-220px)
    rotateY(-42deg)
    scale(0.92);
  opacity: 0.55;
  pointer-events: auto;
  z-index: 5;
  filter: saturate(0.8) brightness(0.85);
}

/* Left neighbour: tilted in from the left */
.company-slide.is-prev {
  transform:
    translate(-50%, -50%)
    translateX(-260px)
    translateZ(-220px)
    rotateY(42deg)
    scale(0.92);
  opacity: 0.55;
  pointer-events: auto;
  z-index: 5;
  filter: saturate(0.8) brightness(0.85);
}

/* Far card (directly behind active): barely visible, tiny, flipped */
.company-slide.is-back {
  transform:
    translate(-50%, -50%)
    translateZ(-520px)
    rotateY(180deg)
    scale(0.68);
  opacity: 0.12;
  pointer-events: none;
  z-index: 1;
  filter: saturate(0.4) brightness(0.55);
}

/* Hover side cards → brighten and nudge forward */
.company-slide.is-next:hover,
.company-slide.is-prev:hover {
  opacity: 0.85;
  filter: saturate(1) brightness(1);
}

/* Nav buttons stay in the grid gutters */
.company-stage-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.company-stage-nav:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.08);
  box-shadow: 0 0 20px -5px var(--accent);
}

.company-stage-dots {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1rem;
}

.company-stage-dots button {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
}

.company-stage-dots button:hover { border-color: var(--accent); }

.company-stage-dots button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.35);
  box-shadow: 0 0 10px -2px var(--accent);
}

/* Mobile: shrink the stage, tighten side-card offsets so they still peek. */
@media (max-width: 900px) {
  .company-stage-viewport { height: 520px; }
  .company-slide.is-next {
    transform: translate(-50%, -50%) translateX(170px) translateZ(-240px) rotateY(-38deg) scale(0.88);
  }
  .company-slide.is-prev {
    transform: translate(-50%, -50%) translateX(-170px) translateZ(-240px) rotateY(38deg) scale(0.88);
  }
}

@media (max-width: 640px) {
  .company-stage { grid-template-columns: 1fr; }
  .company-stage-nav { display: none; }
  .company-stage-viewport { height: 560px; }
  .company-slide { width: 88%; }
  .company-slide.is-next,
  .company-slide.is-prev {
    opacity: 0.25;
  }
  .company-slide.is-next {
    transform: translate(-50%, -50%) translateX(90px) translateZ(-260px) rotateY(-35deg) scale(0.85);
  }
  .company-slide.is-prev {
    transform: translate(-50%, -50%) translateX(-90px) translateZ(-260px) rotateY(35deg) scale(0.85);
  }
}

/* Respect users who prefer no motion */
@media (prefers-reduced-motion: reduce) {
  .company-slide { transition-duration: 0.01ms; }
}

.feature-icon {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.feature-card .arrow {
  margin-top: auto;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

/* ---------- Tags ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--tag-text);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
}

.tag.company-openai {
  background: rgba(16, 163, 127, 0.12);
  border-color: rgba(16, 163, 127, 0.4);
  color: var(--openai);
}

.tag.company-anthropic {
  background: rgba(217, 119, 87, 0.12);
  border-color: rgba(217, 119, 87, 0.4);
  color: var(--anthropic);
}

.tag.company-google {
  background: rgba(66, 133, 244, 0.12);
  border-color: rgba(66, 133, 244, 0.4);
  color: var(--google);
}

.tag.company-xai {
  background: rgba(154, 160, 166, 0.12);
  border-color: rgba(154, 160, 166, 0.4);
  color: var(--xai);
}

.tag.freq-3, .tag.freq-4 {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.35);
  color: var(--warn);
}

.tag.difficulty-hard {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--danger);
}

.tag.difficulty-medium {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.35);
  color: var(--warn);
}

/* ---------- Arena filter bar ---------- */

.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.filter-bar input[type="search"] {
  flex: 1;
  min-width: 220px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.filter-bar input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-group {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.filter-chip {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.12s;
}

.filter-chip.active {
  background: var(--accent);
  color: #0a0a0c;
  border-color: var(--accent);
}

.filter-chip:hover:not(.active) {
  color: var(--text);
  border-color: var(--accent);
}

/* ---------- Question list ---------- */

.question-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.35rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.question-card:hover {
  border-color: var(--accent);
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}

.question-card.company-openai:hover { border-color: var(--openai); }
.question-card.company-anthropic:hover { border-color: var(--anthropic); }
.question-card.company-google:hover { border-color: var(--google); }
.question-card.company-xai:hover { border-color: var(--xai); }

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.question-title {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.2px;
  flex: 1;
  min-width: 0;
}

.question-id {
  font-family: var(--font-mono);
  color: var(--text-subtle);
  font-size: 0.78rem;
  font-weight: 600;
  margin-right: 0.5rem;
}

.question-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.question-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.question-footer {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
  align-items: center;
}

.question-source {
  color: var(--text-subtle);
  font-size: 0.78rem;
  margin-left: auto;
}

/* ---------- Prose / study guide content ---------- */

.prose {
  font-size: 1rem;
  line-height: 1.72;
  color: var(--text);
  max-width: 780px;
}

.prose.wide {
  max-width: 100%;
}

.prose h1 {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  margin: 0 0 0.8rem;
}

.prose h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 2.6rem 0 0.9rem;
  padding-top: 0.2rem;
  border-top: 1px solid var(--border-light);
  padding-top: 1.5rem;
}

.prose h2:first-of-type {
  margin-top: 2rem;
}

.prose h3 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin: 2rem 0 0.5rem;
}

.prose h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.4rem 0 0.4rem;
  color: var(--text);
}

.prose p {
  margin: 0.7rem 0;
  color: var(--text);
}

.prose ul,
.prose ol {
  margin: 0.6rem 0 0.6rem 1.4rem;
}

.prose li {
  margin: 0.3rem 0;
}

.prose strong {
  color: var(--text);
  font-weight: 700;
}

.prose em {
  color: var(--text);
}

.prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.prose a:hover {
  border-bottom-color: var(--accent);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  color: var(--text);
}

.prose pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.88rem;
  line-height: 1.55;
}

.prose pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-style: italic;
  background: var(--bg-card);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.93rem;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.8rem;
  text-align: left;
}

.prose th {
  background: var(--bg-card);
  font-weight: 700;
}

.prose tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .prose tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.02);
}

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

/* Callout / aside boxes */
.callout {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin: 1.2rem 0;
}

.callout.openai { border-left-color: var(--openai); }
.callout.anthropic { border-left-color: var(--anthropic); }
.callout.google { border-left-color: var(--google); }
.callout.xai { border-left-color: var(--xai); }
.callout.warn { border-left-color: var(--warn); }
.callout.tip { border-left-color: var(--success); }

.callout h4 {
  margin: 0 0 0.3rem !important;
  font-size: 0.92rem !important;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
}

.callout.openai h4 { color: var(--openai); }
.callout.anthropic h4 { color: var(--anthropic); }
.callout.google h4 { color: var(--google); }
.callout.xai h4 { color: var(--xai); }
.callout.warn h4 { color: var(--warn); }
.callout.tip h4 { color: var(--success); }

.callout p:last-child,
.callout ul:last-child,
.callout ol:last-child {
  margin-bottom: 0;
}

/* Mermaid diagrams */
.mermaid-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.2rem 0;
  overflow-x: auto;
  text-align: center;
}

.mermaid {
  max-width: 100%;
}

/* ---------- Sidebar / TOC layout ---------- */

.layout-with-sidebar {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 900px) {
  .layout-with-sidebar {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
  max-height: calc(100vh - var(--nav-height) - 2rem);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.sidebar h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-subtle);
  font-weight: 700;
  margin: 1.25rem 0 0.4rem;
}

.sidebar h4:first-child { margin-top: 0; }

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin: 0.15rem 0;
}

.sidebar a {
  display: block;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  transition: all 0.12s;
  border-left: 2px solid transparent;
}

.sidebar a:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.sidebar a.active {
  color: var(--accent);
  background: var(--bg-hover);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ---------- Breadcrumb ---------- */

.breadcrumb {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.2rem;
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.12s;
}

.breadcrumb a:hover { color: var(--accent); }

.breadcrumb span.sep { color: var(--text-subtle); }

/* ---------- Footer ---------- */

.footer {
  margin-top: 5rem;
  padding: 2.5rem 0 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: 0.86rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer a:hover { color: var(--accent); }

/* ---------- i18n visibility ---------- */

[data-lang="zh"] { display: none; }
html[lang="zh"] [data-lang="zh"] { display: inline; }
html[lang="zh"] [data-lang="en"] { display: none; }
html[lang="zh"] [data-lang="en"].block { display: none; }

[data-lang="en"].block, [data-lang="zh"].block { display: block; }
html[lang="zh"] [data-lang="zh"].block { display: block; }
html[lang="zh"] [data-lang="en"].block { display: none; }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .nav-links { gap: 0; }
  .nav-links a {
    padding: 0.4rem 0.55rem;
    font-size: 0.85rem;
  }
  .hero { padding: 3rem 0 2.5rem; }
  .hero h1 { letter-spacing: -1px; }
  .section { margin-bottom: 3rem; }
  .prose h1 { font-size: 1.7rem; }
  .prose h2 { font-size: 1.3rem; }
  .filter-bar { flex-direction: column; align-items: stretch; }
}

/* ---------- Study Guide ---------- */

.page-header {
  padding: 2rem 0 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  font-weight: 700;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 780px;
  line-height: 1.6;
  margin: 0;
}

.guide-section {
  margin: 2.5rem 0;
  padding-top: 1rem;
}
.guide-section-title {
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}
.guide-section-lead {
  color: var(--text-muted);
  max-width: 820px;
  margin: 0 0 1.3rem;
  line-height: 1.65;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.guide-card {
  position: relative;
  display: block;
  padding: 1.25rem 1.25rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.guide-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--bg-hover);
}
.guide-card-num {
  position: absolute;
  top: 0.9rem;
  right: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-subtle);
  letter-spacing: 0.05em;
}
.guide-card h3 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
  padding-right: 2.5rem;
  font-weight: 650;
  line-height: 1.3;
}
.guide-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0;
}

/* Prose for topic pages */
.topic-prose {
  max-width: 820px;
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text);
}
.topic-prose h2 {
  font-size: 1.55rem;
  margin: 2.3rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topic-prose h3 {
  font-size: 1.2rem;
  margin: 1.75rem 0 0.6rem;
  color: var(--text);
  font-weight: 650;
}
.topic-prose h4 {
  font-size: 1.02rem;
  margin: 1.1rem 0 0.4rem;
  color: var(--accent);
  font-weight: 600;
}
.topic-prose p { margin: 0 0 1rem; }
.topic-prose ul, .topic-prose ol { margin: 0 0 1.1rem 1.3rem; padding: 0; }
.topic-prose li { margin-bottom: 0.4rem; }
.topic-prose strong { color: var(--text); font-weight: 650; }
.topic-prose em { color: var(--text); }
.topic-prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.3rem 0 0.3rem 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-style: italic;
  background: var(--bg-elevated);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.topic-prose code {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  padding: 0.1rem 0.38rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.88em;
}
.topic-prose pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.55;
  margin: 0 0 1.2rem;
}
.topic-prose pre code { background: none; border: none; padding: 0; }
.topic-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.4rem;
  font-size: 0.94rem;
}
.topic-prose table th,
.topic-prose table td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.topic-prose table th {
  background: var(--bg-elevated);
  font-weight: 650;
  color: var(--text);
}

.topic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.8rem 0 1.2rem;
  align-items: center;
}
.topic-meta .tag {
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--tag-text);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
}

.topic-toc {
  float: right;
  width: 250px;
  margin: 0.4rem 0 1rem 1.5rem;
  padding: 1rem 1.1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
}
.topic-toc h4 {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  font-weight: 600;
}
.topic-toc ol {
  margin: 0;
  padding-left: 1.2rem;
}
.topic-toc li {
  margin-bottom: 0.25rem;
  line-height: 1.4;
}
.topic-toc a {
  color: var(--text-muted);
  text-decoration: none;
}
.topic-toc a:hover { color: var(--accent); }

@media (max-width: 900px) {
  .topic-toc { float: none; width: auto; margin: 1rem 0; }
}

/* cross-link footer on topic pages */
.topic-footer-links {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.8rem;
}
.topic-footer-links a {
  display: block;
  padding: 0.9rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease;
}
.topic-footer-links a:hover {
  border-color: var(--accent);
}
.topic-footer-links .label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-subtle);
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
}

/* ---------- Utilities ---------- */

.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.88rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

::selection {
  background: var(--accent);
  color: #0a0a0c;
}
