/* ==========================================================================
   KCP — Knowledge Context Protocol
   Design System: Scandinavian Minimalism
   ========================================================================== */

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

/* ---------- Custom Properties ---------- */
:root {
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', Consolas, monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.5rem;
  --fs-4xl: 3.25rem;
  --fs-5xl: 4rem;

  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --lh-tight: 1.15;
  --lh-snug: 1.3;
  --lh-normal: 1.6;
  --lh-relaxed: 1.75;

  --ls-tight: -0.025em;
  --ls-normal: 0;
  --ls-wide: 0.05em;
  --ls-wider: 0.1em;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Layout */
  --max-width: 72rem;
  --content-width: 52rem;
  --nav-height: 4rem;

  /* Borders */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.10);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Light theme (default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fb;
  --bg-tertiary: #f0f2f5;
  --bg-inverse: #0f1117;
  --bg-code: #f6f8fa;
  --bg-code-header: #edf0f4;

  --text-primary: #0f1117;
  --text-secondary: #4a5060;
  --text-tertiary: #6b7280;
  --text-inverse: #ffffff;
  --text-link: #2563eb;

  --border-primary: #e2e5ea;
  --border-secondary: #edf0f4;
  --border-focus: #2563eb;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-primary-subtle: #eff4ff;
  --accent-secondary: #7c3aed;
  --accent-success: #059669;
  --accent-success-subtle: #ecfdf5;
  --accent-warning: #d97706;
  --accent-warning-subtle: #fffbeb;

  /* Code block specific */
  --code-bg: #f6f8fa;
  --code-text: #24292e;
  --code-border: #e2e5ea;

  /* Card */
  --card-bg: #ffffff;
  --card-border: #e2e5ea;
  --card-shadow: var(--shadow-sm);
  --card-shadow-hover: var(--shadow-md);
}

/* ---------- Dark Theme ---------- */
[data-theme="dark"] {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-inverse: #ffffff;
  --bg-code: #161b22;
  --bg-code-header: #1c2128;

  --text-primary: #e6edf3;
  --text-secondary: #9aa5b4;
  --text-tertiary: #6e7a8a;
  --text-inverse: #0f1117;
  --text-link: #58a6ff;

  --border-primary: #2d333b;
  --border-secondary: #21262d;
  --border-focus: #58a6ff;

  --accent-primary: #58a6ff;
  --accent-primary-hover: #79b8ff;
  --accent-primary-subtle: #0d2240;
  --accent-secondary: #a371f7;
  --accent-success: #3fb950;
  --accent-success-subtle: #0d2818;
  --accent-warning: #d29922;
  --accent-warning-subtle: #2d1f00;

  --code-bg: #161b22;
  --code-text: #e6edf3;
  --code-border: #2d333b;

  --card-bg: #161b22;
  --card-border: #2d333b;
  --card-shadow: 0 1px 2px rgba(0,0,0,0.2);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.3);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.4);
}

/* ---------- Base Elements ---------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + var(--space-4));
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--duration-normal) var(--ease-out),
              color var(--duration-normal) var(--ease-out);
}

::selection {
  background-color: var(--accent-primary);
  color: white;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--duration-fast);
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }

p {
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.15em 0.4em;
  background: var(--bg-code);
  border-radius: var(--radius-sm);
  border: 1px solid var(--code-border);
  color: var(--accent-primary);
}

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

/* ---------- Layout ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--narrow {
  max-width: var(--content-width);
}

section {
  padding: var(--space-24) 0;
}

.section--alt {
  background-color: var(--bg-secondary);
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-secondary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: rgba(255,255,255,0.85);
  transition: background-color var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out);
}

[data-theme="dark"] .nav {
  background-color: rgba(13,17,23,0.85);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: var(--ls-tight);
}

.nav__brand:hover {
  text-decoration: none;
  color: var(--accent-primary);
}

.nav__logo {
  width: 28px;
  height: 28px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  list-style: none;
}

.nav__links a {
  font-size: 0.8rem;
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  white-space: nowrap;
  text-decoration: none;
  transition: color var(--duration-fast);
}

.nav__links a:hover,
.nav__links a.is-active {
  color: var(--text-primary);
  text-decoration: none;
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.theme-toggle:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Mobile menu */
.nav__mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--text-primary);
  cursor: pointer;
}

.nav__mobile-toggle svg {
  width: 24px;
  height: 24px;
}

/* ---------- Hero ---------- */
.hero {
  padding: calc(var(--nav-height) + var(--space-20)) 0 var(--space-24);
  text-align: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(
    ellipse at center,
    rgba(37, 99, 235, 0.06) 0%,
    transparent 70%
  );
  pointer-events: none;
}

[data-theme="dark"] .hero::before {
  background: radial-gradient(
    ellipse at center,
    rgba(88, 166, 255, 0.06) 0%,
    transparent 70%
  );
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-8);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--accent-primary);
  background: var(--accent-primary-subtle);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-full);
  letter-spacing: var(--ls-wide);
  opacity: 0.9;
}

.hero__title {
  font-size: var(--fs-5xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.03em;
  max-width: 48rem;
  margin: 0 auto var(--space-6);
}

.hero__title span {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  font-size: var(--fs-xl);
  color: var(--text-secondary);
  max-width: 38rem;
  margin: 0 auto var(--space-10);
  line-height: var(--lh-relaxed);
}

.hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.hero__code-preview {
  margin-top: var(--space-16);
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn--primary {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.btn--primary:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

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

.btn--secondary:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn--ghost:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- Section Headers ---------- */
.section-header {
  text-align: center;
  max-width: 40rem;
  margin: 0 auto var(--space-16);
}

.section-label {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: var(--space-4);
}

.section-header h2 {
  margin-bottom: var(--space-4);
}

.section-header p {
  font-size: var(--fs-lg);
}

/* ---------- Problem Cards ---------- */
.problem-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
}

.problem-card {
  padding: var(--space-8);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  transition: all var(--duration-normal) var(--ease-out);
}

.problem-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

.problem-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  margin-bottom: var(--space-5);
}

.problem-card__icon svg {
  width: 24px;
  height: 24px;
}

.problem-card h3 {
  font-size: var(--fs-lg);
  margin-bottom: var(--space-3);
}

.problem-card p {
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}

/* ---------- What is KCP ---------- */
.what-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  align-items: center;
}

.what-content h2 {
  margin-bottom: var(--space-6);
}

.what-content p {
  margin-bottom: var(--space-4);
  font-size: var(--fs-md);
}

.what-content .feature-list {
  list-style: none;
  margin-top: var(--space-6);
}

.what-content .feature-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

.what-content .feature-list li::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent-primary);
  flex-shrink: 0;
}

.what-code {
  position: relative;
}

/* ---------- Code Blocks ---------- */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  font-family: var(--font-mono);
  transition: all var(--duration-normal) var(--ease-out);
}

/* code-block hover shadow removed — suggests clickability where none exists */

.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-code-header);
  border-bottom: 1px solid var(--code-border);
}

.code-block__filename {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.code-block__dots {
  display: flex;
  gap: 6px;
}

.code-block__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-primary);
}

.code-block__dot:nth-child(1) { background: #ff5f57; }
.code-block__dot:nth-child(2) { background: #febc2e; }
.code-block__dot:nth-child(3) { background: #28c840; }

[data-theme="dark"] .code-block__dot:nth-child(1) { background: #ff5f57; opacity: 0.7; }
[data-theme="dark"] .code-block__dot:nth-child(2) { background: #febc2e; opacity: 0.7; }
[data-theme="dark"] .code-block__dot:nth-child(3) { background: #28c840; opacity: 0.7; }

.code-block__body {
  padding: var(--space-5);
  overflow-x: auto;
}

.code-block__body pre {
  margin: 0;
}

.code-block__body code {
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  tab-size: 2;
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.copy-btn:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.copy-btn.copied {
  color: var(--accent-success);
  border-color: var(--accent-success);
}

.copy-btn svg {
  width: 14px;
  height: 14px;
}

/* ---------- How It Works ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
  position: relative;
}

.steps::before {
  content: '';
  position: absolute;
  top: 40px;
  left: calc(33.333% - var(--space-4));
  right: calc(33.333% - var(--space-4));
  height: 2px;
  background: var(--border-primary);
}

.step {
  text-align: center;
  position: relative;
}

.step__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-primary-subtle);
  border: 2px solid var(--accent-primary);
  margin-bottom: var(--space-6);
  position: relative;
  z-index: 1;
}

.step__number svg {
  width: 32px;
  height: 32px;
  color: var(--accent-primary);
}

.step__label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: var(--space-2);
}

.step h3 {
  font-size: var(--fs-xl);
  margin-bottom: var(--space-3);
}

.step p {
  font-size: var(--fs-sm);
  max-width: 20rem;
  margin: 0 auto;
}

/* ---------- Spec Cards ---------- */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

.spec-card {
  padding: var(--space-6);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  transition: all var(--duration-normal) var(--ease-out);
}

.spec-card--required {
  border-left: 3px solid var(--color-primary);
}

.spec-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent-primary);
}

.spec-card__field {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--accent-primary);
  padding: var(--space-1) var(--space-3);
  background: var(--accent-primary-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
}

.spec-card__required {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  margin-left: var(--space-2);
  color: var(--accent-success);
}

.spec-card__required.optional {
  color: var(--text-tertiary);
}

.spec-card p {
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}

.spec-card code {
  font-size: var(--fs-xs);
}

/* ---------- Examples Tabs ---------- */
.tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-1);
  background: var(--bg-code-header);
  border: 1px solid var(--code-border);
  border-bottom: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-2) var(--space-2) 0;
  overflow-x: auto;
}

.tab-btn {
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.tab-btn.active {
  color: var(--text-primary);
  background: var(--code-bg);
  font-weight: var(--fw-semibold);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel .code-block {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.tab-panel .code-block__header {
  display: none;
}

/* ---------- Parsers ---------- */
.parsers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
}

.parser-block h3 {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.parser-block h3 svg {
  width: 28px;
  height: 28px;
}

.parser-block p {
  font-size: var(--fs-sm);
  margin-bottom: var(--space-4);
}

.parser-block .code-block {
  margin-bottom: var(--space-4);
}

/* ---------- Adoption Guide ---------- */
.adoption-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}

.adoption-step {
  padding: var(--space-6);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  text-align: center;
  transition: all var(--duration-normal) var(--ease-out);
}

.adoption-step:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

.adoption-step__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-4);
}

.adoption-step h4 {
  font-size: var(--fs-base);
  margin-bottom: var(--space-3);
}

.adoption-step p {
  font-size: var(--fs-sm);
}

.adoption-step code {
  font-size: var(--fs-xs);
}

/* ---------- FAQ ---------- */
.faq-list {
  max-width: var(--content-width);
  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid var(--border-primary);
}

.faq-item:first-child {
  border-top: 1px solid var(--border-primary);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) 0;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: color var(--duration-fast);
}

.faq-question:hover {
  color: var(--accent-primary);
}

.faq-question svg {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  transition: transform var(--duration-normal) var(--ease-out);
  flex-shrink: 0;
  margin-left: var(--space-4);
}

.faq-item.open .faq-question svg {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-slow) var(--ease-out),
              padding var(--duration-slow) var(--ease-out);
}

.faq-item.open .faq-answer {
  max-height: 400px;
  padding-bottom: var(--space-6);
}

.faq-answer p {
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}

.faq-answer p + p {
  margin-top: var(--space-3);
}

/* ---------- Footer ---------- */
.footer {
  padding: var(--space-12) 0;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-primary);
}

.footer__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-8);
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.footer__brand svg {
  width: 24px;
  height: 24px;
}

.footer__cols {
  display: flex;
  gap: var(--space-10);
  flex-wrap: wrap;
}

.footer__col {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 140px;
}

.footer__col-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
}

.footer__col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer__col a {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

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

.footer__meta {
  width: 100%;
  text-align: center;
  padding-top: var(--space-8);
  margin-top: var(--space-6);
  border-top: 1px solid var(--border-primary);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

/* ---------- Scroll Animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

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

.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }
.reveal-delay-3 { transition-delay: 300ms; }
.reveal-delay-4 { transition-delay: 400ms; }

/* ---------- Typing Animation for Hero Code ---------- */
.typing-line {
  opacity: 0;
  transform: translateX(-8px);
  animation: typeLine 0.4s var(--ease-out) forwards;
}

@keyframes typeLine {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Stagger each line */
.typing-line:nth-child(1) { animation-delay: 0.3s; }
.typing-line:nth-child(2) { animation-delay: 0.5s; }
.typing-line:nth-child(3) { animation-delay: 0.7s; }
.typing-line:nth-child(4) { animation-delay: 0.9s; }
.typing-line:nth-child(5) { animation-delay: 1.1s; }
.typing-line:nth-child(6) { animation-delay: 1.3s; }
.typing-line:nth-child(7) { animation-delay: 1.5s; }
.typing-line:nth-child(8) { animation-delay: 1.7s; }
.typing-line:nth-child(9) { animation-delay: 1.9s; }
.typing-line:nth-child(10) { animation-delay: 2.1s; }

/* ---------- Ecosystem Diagram ---------- */
.ecosystem {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  margin-top: var(--space-8);
  flex-wrap: wrap;
}

.ecosystem__node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  text-align: center;
  min-width: 140px;
}

.ecosystem__node--highlight {
  border-color: var(--accent-primary);
  background: var(--accent-primary-subtle);
}

.ecosystem__node span:first-child {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.ecosystem__node--highlight span:first-child {
  color: var(--accent-primary);
}

.ecosystem__node span:last-child {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.ecosystem__arrow {
  color: var(--text-tertiary);
  font-size: var(--fs-2xl);
  line-height: 1;
}

/* ---------- Conformance Levels ---------- */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  margin-top: var(--space-10);
}

.level-card {
  padding: var(--space-6);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  border-top: 3px solid var(--accent-primary);
  transition: all var(--duration-normal) var(--ease-out);
}

.level-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

.level-card h4 {
  font-size: var(--fs-base);
  margin-bottom: var(--space-2);
}

.level-card p {
  font-size: var(--fs-sm);
}

.level-card code {
  font-size: var(--fs-xs);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .problem-grid,
  .steps,
  .levels-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .steps::before {
    display: none;
  }

  .what-grid {
    grid-template-columns: 1fr;
    gap: var(--space-10);
  }

  .parsers-grid {
    grid-template-columns: 1fr;
  }

  .adoption-steps {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero__title {
    font-size: var(--fs-3xl);
  }
}

@media (max-width: 768px) {
  section {
    padding: var(--space-16) 0;
  }

  .container {
    padding: 0 var(--space-4);
  }

  h1 { font-size: var(--fs-3xl); }
  h2 { font-size: var(--fs-2xl); }
  h3 { font-size: var(--fs-xl); }

  .hero {
    padding: calc(var(--nav-height) + var(--space-12)) 0 var(--space-16);
  }

  .hero__title {
    font-size: var(--fs-2xl);
  }

  .hero__subtitle {
    font-size: var(--fs-base);
  }

  .problem-grid,
  .steps,
  .adoption-steps,
  .levels-grid {
    grid-template-columns: 1fr;
  }

  .nav__links {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-primary);
    padding: var(--space-4);
    gap: var(--space-2);
  }

  .nav__links.open {
    display: flex;
  }

  .nav__links a {
    display: block;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
  }

  .nav__links a:hover {
    background: var(--bg-tertiary);
  }

  .nav__mobile-toggle {
    display: flex;
  }

  .ecosystem {
    flex-direction: column;
  }

  .ecosystem__arrow {
    transform: rotate(90deg);
  }

  .footer__inner {
    flex-direction: column;
  }

  .footer__cols {
    gap: var(--space-6);
  }
}

@media (max-width: 480px) {
  .hero__title {
    font-size: var(--fs-xl);
  }

  .hero__actions {
    flex-direction: column;
    width: 100%;
  }

  .hero__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .spec-grid {
    grid-template-columns: 1fr;
  }

  .usecase-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Highlight.js Overrides ---------- */
.hljs {
  background: transparent !important;
  padding: 0 !important;
  color: var(--code-text) !important;
}

/* Light theme highlights */
.hljs-keyword { color: #cf222e; }
.hljs-string { color: #0a3069; }
.hljs-comment { color: #6e7781; }
.hljs-attr { color: #0550ae; }
.hljs-number { color: #0550ae; }
.hljs-literal { color: #0550ae; }
.hljs-type { color: #953800; }
.hljs-built_in { color: #8250df; }

[data-theme="dark"] .hljs-keyword { color: #ff7b72; }
[data-theme="dark"] .hljs-string { color: #a5d6ff; }
[data-theme="dark"] .hljs-comment { color: #8b949e; }
[data-theme="dark"] .hljs-attr { color: #79c0ff; }
[data-theme="dark"] .hljs-number { color: #79c0ff; }
[data-theme="dark"] .hljs-literal { color: #79c0ff; }
[data-theme="dark"] .hljs-type { color: #ffa657; }
[data-theme="dark"] .hljs-built_in { color: #d2a8ff; }

/* ---------- Comparison Table ---------- */
.compare-wrapper {
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  position: relative;
}

.compare-wrapper::after {
  content: '';
  position: sticky;
  display: block;
  right: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  height: 100%;
  margin-top: -100%;
  pointer-events: none;
  background: linear-gradient(to right, transparent, var(--bg-primary) 90%);
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
}

@media (min-width: 768px) {
  .compare-wrapper::after { display: none; }
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.compare-table th,
.compare-table td {
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--card-border);
  text-align: center;
  white-space: nowrap;
}

.compare-table th:first-child,
.compare-table td:first-child {
  text-align: left;
  font-weight: var(--fw-medium);
  white-space: normal;
  min-width: 200px;
  color: var(--text-secondary);
}

.compare-table thead th {
  background: var(--code-bg);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  color: var(--text-tertiary);
  position: sticky;
  top: 0;
}

.compare-table thead th:first-child {
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
}

.compare-table thead .kcp-col {
  color: var(--accent-primary);
  background: var(--accent-primary-subtle);
}

.compare-table tbody tr:last-child td { border-bottom: none; }

.compare-table tbody tr:hover td { background: var(--bg-secondary); }

.cmp-yes  { color: var(--accent-success); font-weight: var(--fw-semibold); }
.cmp-no   { color: var(--text-tertiary); }
.cmp-rfc  {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--accent-warning);
  background: var(--accent-warning-subtle);
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
}

.compare-note {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-top: var(--space-4);
  text-align: center;
  line-height: var(--lh-relaxed);
}

.compare-note a { color: var(--text-link); }

/* ---------- RFC Roadmap ---------- */
.roadmap-core {
  background: var(--accent-primary-subtle);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-8);
  margin-bottom: var(--space-8);
  display: flex;
  gap: var(--space-8);
  align-items: flex-start;
}

.roadmap-core__info { flex: 0 0 auto; }

.roadmap-core__badge {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--accent-primary);
  background: var(--bg-primary);
  border: 1px solid var(--accent-primary);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-3);
}

.roadmap-core__info h3 {
  font-size: var(--fs-lg);
  margin-bottom: var(--space-1);
}

.roadmap-core__info p {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  max-width: 18rem;
}

.roadmap-core__fields {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-content: flex-start;
}

.roadmap-field-pill {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--accent-primary);
  background: var(--bg-primary);
  border: 1px solid var(--accent-primary);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
}

.roadmap-rfcs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
}

.rfc-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all var(--duration-normal) var(--ease-out);
}

.rfc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent-primary);
}

.rfc-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.rfc-card__num {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--text-tertiary);
}

.rfc-card__theme {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--accent-secondary);
  background: color-mix(in srgb, var(--accent-secondary) 10%, transparent);
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
}

.rfc-card h4 {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  margin: 0;
}

.rfc-card__blocks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.rfc-card__block {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  background: var(--code-bg);
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
}

.rfc-card p {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  flex: 1;
}

.rfc-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-1);
}

.rfc-card__status {
  font-size: var(--fs-xs);
  color: var(--accent-warning);
  font-weight: var(--fw-medium);
}

.rfc-card__link {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--accent-primary);
  text-decoration: none;
}

.rfc-card__link:hover { text-decoration: underline; }

/* ---------- Playground ---------- */
.playground {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
}

.playground__editor {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--code-bg);
}

.playground__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-code-header);
  border-bottom: 1px solid var(--card-border);
  gap: var(--space-3);
}

.playground__toolbar span {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.playground__controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.playground__controls select {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-2);
  cursor: pointer;
}

#yaml-input {
  display: block;
  width: 100%;
  min-height: 300px;
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.7;
  color: var(--code-text);
  background: var(--code-bg);
  border: none;
  resize: vertical;
  outline: none;
}

.playground__output {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  min-height: 200px;
  background: var(--card-bg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.pg-note {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  line-height: var(--lh-relaxed);
}

.pg-note code { font-size: var(--fs-xs); }
.pg-note kbd {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  background: var(--code-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 1px var(--space-2);
}

.pg-result {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.pg-result__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-result--ok .pg-result__icon {
  background: var(--accent-success-subtle);
  color: var(--accent-success);
}

.pg-result--error .pg-result__icon {
  background: color-mix(in srgb, #ef4444 10%, transparent);
  color: #ef4444;
}

[data-theme="dark"] .pg-result--error .pg-result__icon {
  background: rgba(239,68,68,0.15);
}

.pg-result__title {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-base);
  margin-bottom: var(--space-1);
}

.pg-result--ok .pg-result__title { color: var(--accent-success); }
.pg-result--error .pg-result__title { color: #ef4444; }

.pg-result__project {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.pg-result__meta {
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
}

.pg-result__errors {
  list-style: none;
  font-size: var(--fs-sm);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pg-result__errors li::before {
  content: '↳ ';
  color: var(--text-tertiary);
}

@media (max-width: 768px) {
  .roadmap-core { flex-direction: column; gap: var(--space-4); }
  .playground   { grid-template-columns: 1fr; }
}

/* ---------- Use Cases ---------- */
.usecase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: var(--space-6);
}

.usecase-card {
  padding: var(--space-6);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  transition: all var(--duration-normal) var(--ease-out);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.usecase-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent-primary);
}

.usecase-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.usecase-card__icon {
  width: 36px;
  height: 36px;
  padding: var(--space-2);
  background: var(--accent-primary-subtle);
  border-radius: var(--radius-md);
  color: var(--accent-primary);
  flex-shrink: 0;
}

.usecase-card__persona {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}

.usecase-card h4 {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  margin: 0;
}

.usecase-card p {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  flex: 1;
}

.usecase-card__fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.usecase-card__field-tag {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--accent-primary);
  padding: 2px var(--space-2);
  background: var(--accent-primary-subtle);
  border-radius: var(--radius-sm);
}

.usecase-snippet {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.usecase-snippet summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  background: var(--code-bg);
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
  list-style: none;
  border-radius: var(--radius-lg);
}

.usecase-snippet[open] summary {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.usecase-snippet summary::-webkit-details-marker { display: none; }

.usecase-snippet summary span { pointer-events: none; }

.usecase-snippet summary::after {
  content: '\25B8 show';
  font-size: var(--fs-xs);
  color: var(--accent-primary);
}

.usecase-snippet[open] summary::after {
  content: '\25BE hide';
}

.usecase-snippet pre {
  margin: 0;
  padding: var(--space-4);
  background: var(--code-bg);
  overflow-x: auto;
  font-size: var(--fs-xs);
  line-height: 1.6;
}

/* ---------- Quickstart ---------- */
.qs-note {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-3);
  line-height: var(--lh-relaxed);
}

/* ---------- Adopters ---------- */
.adopters-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.adopters-cta-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.75rem;
  text-align: center;
  max-width: 38rem;
  margin: 0 auto 2.5rem;
}

.adopters-cta-box h3 {
  font-size: var(--fs-md);
  margin-bottom: 0.5rem;
}

.adopters-cta-box p {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  margin-bottom: 1.25rem;
}

.adopter-snippet {
  background: var(--code-bg);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.25rem;
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  text-align: left;
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
  border: 1px solid var(--card-border);
}

/* ---------- Community ---------- */
.community-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

@media (max-width: 768px) {
  .community-grid { grid-template-columns: 1fr; }
}

.community-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

.community-card__icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.community-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.community-card p {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: var(--lh-relaxed);
}

.rfc-lifecycle {
  display: flex;
  align-items: stretch;
}

.rfc-step {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-right: none;
  padding: 1.25rem 0.875rem;
  text-align: center;
  position: relative;
}

.rfc-step:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.rfc-step:last-child {
  border-right: 1px solid var(--card-border);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.rfc-step::after {
  content: '›';
  position: absolute;
  right: -0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 1.1rem;
  z-index: 1;
  background: var(--bg-primary);
  line-height: 1;
}

.rfc-step:last-child::after { display: none; }

.rfc-step__num {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 0.3rem;
}

.rfc-step__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.rfc-step__desc {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

@media (max-width: 640px) {
  .rfc-lifecycle { flex-wrap: wrap; }
  .rfc-step { min-width: 45%; flex: 1 1 45%; border-right: 1px solid var(--card-border); border-bottom: none; border-radius: 0; }
  .rfc-step:first-child { border-radius: var(--radius-md) 0 0 0; }
  .rfc-step:last-child { border-radius: 0 0 var(--radius-md) 0; }
  .rfc-step::after { display: none; }
  .rfc-step__desc { display: none; }
}

/* ---------- Back to Top ---------- */
.back-to-top {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--accent-primary-hover);
}

/* ---------- Use Cases RFC Divider ---------- */
.usecase-rfc-divider {
  margin: var(--space-16) 0 var(--space-8);
  text-align: center;
}

.usecase-rfc-divider p {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  max-width: 540px;
  margin: var(--space-2) auto 0;
}

/* ---------- RFC Badge (use-case cards) ---------- */
.rfc-badge {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  letter-spacing: var(--ls-wide);
  margin-left: auto;
}

/* ---------- Utility ---------- */
.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-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }

/* ---------- Simulator Player ---------- */
.sim-tabs {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.sim-tab {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease-out);
}

.sim-tab:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.sim-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-inverse);
}

.sim-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: var(--space-6);
}

@media (max-width: 768px) {
  .sim-layout {
    grid-template-columns: 1fr;
  }
}

.sim-terminal-wrap {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #0d1117;
}

.sim-terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.sim-title {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: #e6edf3;
}

.sim-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sim-btn {
  padding: var(--space-1) var(--space-3);
  border: 1px solid #30363d;
  border-radius: var(--radius-sm);
  background: #21262d;
  color: #e6edf3;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  transition: background var(--duration-fast);
}

.sim-btn:hover {
  background: #30363d;
}

#sim-speed,
#sim-jump {
  padding: var(--space-1) var(--space-2);
  border: 1px solid #30363d;
  border-radius: var(--radius-sm);
  background: #21262d;
  color: #e6edf3;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
}

.sim-terminal {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: var(--lh-normal);
  padding: var(--space-4);
  height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.sim-progress {
  height: 3px;
  background: #30363d;
}

.sim-progress-bar {
  height: 100%;
  background: var(--accent-primary);
  width: 0;
  transition: width 0.1s;
}

/* Terminal line colors (always dark background) */
.sim-line-kcp      { color: #58a6ff; }
.sim-line-a2a      { color: #bc8cff; }
.sim-line-audit    { color: #d29922; }
.sim-line-hitl     { color: #3fb950; }
.sim-line-success  { color: #3fb950; }
.sim-line-blocked  { color: #f85149; font-weight: var(--fw-bold); }
.sim-line-violation { color: #f85149; }
.sim-line-advisory { color: #d18616; }
.sim-line-phase    { color: #8b949e; }
.sim-line-info     { color: #c9d1d9; }

/* Stats panel */
.sim-stats {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.sim-stat-header {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
}

.sim-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-secondary);
  font-size: var(--fs-sm);
}

.sim-stat:last-of-type {
  border-bottom: none;
}

.sim-stat-label {
  color: var(--text-secondary);
}

.sim-stat-value {
  font-family: var(--font-mono);
  font-weight: var(--fw-semibold);
}

.sim-stat--red    { color: #ef4444; }
.sim-stat--orange { color: #f97316; }
.sim-stat--green  { color: #22c55e; }
.sim-stat--amber  { color: #f59e0b; }

.sim-stat-footer {
  margin-top: var(--space-4);
}

.sim-gh-link {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  text-decoration: none;
}

.sim-gh-link:hover {
  color: var(--accent-primary);
}

/* ---------- Interactive Simulator (Phase 2) ---------- */
.sim-interactive { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--border-primary, #e2e8f0); }
.sim-interactive-header { margin-bottom: 1.5rem; }
.sim-interactive-header h3 { font-size: var(--fs-lg); margin-bottom: var(--space-2); }
.sim-interactive-header p { color: var(--text-secondary); font-size: var(--fs-sm); }

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

.sim-editor-wrap { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border-primary, #e2e8f0); border-radius: var(--radius-lg, 8px); overflow: hidden; }
.sim-editor-header { display: flex; justify-content: space-between; align-items: center; padding: var(--space-2) var(--space-3); background: #161b22; color: #e6edf3; font-family: var(--font-mono); font-size: var(--fs-xs); border-bottom: 1px solid #30363d; }
.sim-editor { font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.6; padding: var(--space-3); height: 320px; border: none; outline: none; background: #0d1117; color: #c9d1d9; resize: none; tab-size: 2; }
.sim-editor-footer { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2) var(--space-3); background: #161b22; border-top: 1px solid #30363d; gap: var(--space-2); flex-wrap: wrap; }
.sim-editor-footer label { font-size: var(--fs-xs); color: #8b949e; display: flex; align-items: center; gap: 0.4rem; }
.sim-btn--primary { background: var(--accent-primary, #3b82f6); border-color: var(--accent-primary, #3b82f6); color: white; font-weight: var(--fw-semibold); }
.sim-btn--primary:hover { opacity: 0.9; }

.sim-agents-wrap { display: flex; flex-direction: column; }
.sim-agent-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; flex: 1; }
@media (max-width: 600px) { .sim-agent-panels { grid-template-columns: 1fr; } }
.sim-agent-panel { display: flex; flex-direction: column; border: 1px solid var(--border-primary, #e2e8f0); border-radius: var(--radius-lg, 8px); overflow: hidden; }
.sim-agent-header { padding: 0.4rem 0.75rem; font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-align: center; }
.sim-agent-header--polite { background: #0d2c1a; color: #3fb950; border-bottom: 1px solid #1a4a2a; }
.sim-agent-header--greedy { background: #2c0d0d; color: #f85149; border-bottom: 1px solid #4a1a1a; }
.sim-terminal--sm { font-family: var(--font-mono); font-size: 0.72rem; line-height: 1.5; padding: 0.6rem; height: 280px; overflow-y: auto; background: #0d1117; color: #c9d1d9; }
.sim-agent-summary { padding: 0.4rem 0.75rem; font-size: 0.78rem; font-family: var(--font-mono); background: #161b22; color: #8b949e; border-top: 1px solid #30363d; min-height: 2rem; }

/* Interactive log line colors */
.sim-line { padding: 1px 0; }
.sim-line--request  { color: #c9d1d9; }
.sim-line--throttle { color: #d29922; }
.sim-line--violation { color: #f85149; font-weight: var(--fw-semibold); }
.sim-line--summary  { color: #8b949e; margin-top: 0.25rem; border-top: 1px solid #21262d; padding-top: 0.25rem; }

/* ==========================================================================
   Simulator dedicated page (simulator.html)
   ========================================================================== */

/* Page hero */
.sim-page-hero { padding: var(--space-16) 0 var(--space-12); background: var(--bg-secondary); text-align: center; }
.sim-page-hero h1 { font-size: var(--fs-4xl); font-weight: var(--fw-bold); margin-bottom: var(--space-4); }
.sim-page-hero p { font-size: var(--fs-lg); color: var(--text-secondary); max-width: 56rem; margin: 0 auto var(--space-8); }
.sim-page-hero .sim-hero-actions { display: flex; gap: var(--space-4); justify-content: center; flex-wrap: wrap; }

/* Scenario cards overview */
.sim-scenarios-overview { padding: var(--space-12) 0; }
.sim-scenario-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); margin-top: var(--space-8); }
.sim-scenario-card { border: 1px solid var(--border-primary); border-radius: var(--radius-xl); padding: var(--space-5); cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; }
.sim-scenario-card:hover, .sim-scenario-card.active { border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
.sim-scenario-badge { font-size: var(--fs-xs); font-weight: var(--fw-semibold); font-family: var(--font-mono); color: var(--accent-primary); margin-bottom: var(--space-2); }
.sim-scenario-card h3 { font-size: var(--fs-base); font-weight: var(--fw-semibold); margin-bottom: var(--space-1); }
.sim-scenario-card .sim-card-tag { font-size: var(--fs-xs); color: var(--text-secondary); margin-bottom: var(--space-3); }
.sim-scenario-card p { font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.5; margin-bottom: var(--space-3); }
.sim-scenario-card ul { list-style: none; padding: 0; margin: 0; }
.sim-scenario-card ul li { font-size: var(--fs-xs); color: var(--text-secondary); padding: 2px 0; }
.sim-scenario-card ul li::before { content: "\2192 "; color: var(--accent-primary); }

/* Player section */
.sim-player-section { padding: var(--space-12) 0; background: var(--bg-secondary); }

/* Interactive section */
.sim-interactive-section { padding: var(--space-12) 0; }

/* Color legend */
.sim-color-legend { display: flex; gap: var(--space-5); flex-wrap: wrap; margin-bottom: var(--space-4); font-size: var(--fs-xs); color: var(--text-secondary); align-items: center; }
.sim-legend-item { display: flex; align-items: center; gap: 0.35rem; }
.sim-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sim-legend-dot--normal   { background: #c9d1d9; }
.sim-legend-dot--throttle { background: #d29922; }
.sim-legend-dot--blocked  { background: #f85149; }
.sim-legend-dot--hitl     { background: #3fb950; }
.sim-legend-dot--audit    { background: #d29922; }

/* Simulator page — context strip and agent explainer */
.sim-context-desc { font-size: var(--fs-sm); color: var(--text-secondary); padding: var(--space-3) var(--space-4); background: var(--bg-secondary); border-left: 3px solid var(--accent-primary); border-radius: 0 var(--radius-lg) var(--radius-lg) 0; margin-bottom: var(--space-4); line-height: 1.6; min-height: 2.5rem; }
.sim-context-desc:empty { display: none; }

.sim-concept-explainer { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin: var(--space-6) 0; }
@media (max-width: 640px) { .sim-concept-explainer { grid-template-columns: 1fr; } }
.sim-concept { padding: var(--space-4); border-radius: var(--radius-xl); border: 1px solid var(--border-primary); }
.sim-concept--polite { border-color: #1a4a2a; background: rgba(13,44,26,0.3); }
.sim-concept--greedy { border-color: #4a1a1a; background: rgba(44,13,13,0.3); }
.sim-concept strong { display: block; margin-bottom: var(--space-2); font-size: var(--fs-base); }
.sim-concept p { font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.5; margin: 0; }
