/* ============================================================================
   GAP (Gossiping Agents Protocol) — Site Stylesheet
   Academic Research Paper Aesthetic
   ============================================================================
   Font: Computer Modern Serif / Georgia / Times New Roman (serif)
   Palette: cream backgrounds, charcoal text, minimal borders
   Aesthetic: RFC / academic paper / research publication
   ========================================================================= */


/* ---------------------------------------------------------------------------
   0. CSS Custom Properties
   --------------------------------------------------------------------------- */

:root {
  --bg: #fafaf8;
  --fg: #1a1a1a;
  --surface: #f5f5f0;
  --surface-raised: #ffffff;
  --surface-hover: #f0f0eb;
  --surface-active: #e8e8e3;
  --card-gradient: none;
  --card-gradient-hero: none;
  --card-bg: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 6px 24px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.18), 0 4px 14px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.22), 0 8px 20px rgba(0,0,0,0.12);
  --border-subtle: transparent;
  --border-divider: transparent;
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", monospace;
  --teal: #00ccbc;
}


/* ---------------------------------------------------------------------------
   1. Reset & Base
   --------------------------------------------------------------------------- */

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

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

::selection {
  background: rgba(0, 0, 0, 0.1);
  color: var(--text-primary);
}

::-moz-selection {
  background: rgba(0, 0, 0, 0.1);
  color: var(--text-primary);
}

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

a {
  color: var(--text-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul,
ol {
  list-style: none;
}


/* ---------------------------------------------------------------------------
   2. Scrollbar — Use browser defaults
   --------------------------------------------------------------------------- */

/* Browser default scrollbar — no customization */


/* ---------------------------------------------------------------------------
   3. Body
   --------------------------------------------------------------------------- */

body {
  background: var(--bg);
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}


/* ---------------------------------------------------------------------------
   4. Container
   --------------------------------------------------------------------------- */

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 32px;
  min-width: 0;
  overflow-x: hidden;
}

/* Wider container for spec page with TOC sidebar */
.container-wide {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 32px;
}


/* ---------------------------------------------------------------------------
   5. Header & Navigation
   --------------------------------------------------------------------------- */

.header {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-divider);
  display: flex;
  align-items: center;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.logo {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

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

.logo .logo-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  margin-left: 6px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav a {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

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

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  font-family: var(--font-mono);
}

.nav-toggle:hover {
  color: var(--text-primary);
}


/* ---------------------------------------------------------------------------
   6. Hero Section
   --------------------------------------------------------------------------- */

.hero {
  padding: 60px 0 48px;
}

.section-label {
  display: block;
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-variant: small-caps;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.hero .subtitle,
.hero .hero-subtitle {
  font-family: var(--font-serif);
  font-size: 18px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 640px;
  margin-bottom: 8px;
}

.hero .hero-desc {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 640px;
  margin-bottom: 32px;
}

.hero .actions {
  display: flex;
  gap: 12px;
  margin-bottom: 40px;
}

.hero-stats,
.stats-row {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-family: var(--font-serif);
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-top: 4px;
}


/* ---------------------------------------------------------------------------
   7. Sections
   --------------------------------------------------------------------------- */

.section {
  padding: 60px 0;
  border-top: 1px solid var(--border-divider);
}

.section h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

.section h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: #333333;
  margin-bottom: 8px;
}

.section p {
  margin-bottom: 16px;
  max-width: 720px;
}

.section p + p {
  margin-top: 0;
}

.section-subtext,
.secondary-text {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.cycle-note {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 16px;
}


/* ---------------------------------------------------------------------------
   8. Cards
   --------------------------------------------------------------------------- */

.card {
  background: var(--card-bg);
  border: none;
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-hero {
  background: var(--card-bg);
  border: none;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}

.card-hero:hover {
  box-shadow: var(--shadow-xl);
}

.card-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.card-description {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}


/* ---------------------------------------------------------------------------
   9. Code Blocks
   --------------------------------------------------------------------------- */

/* Stripe-style dark code blocks on light page */
pre {
  background: #0a0d14;
  border: none;
  padding: 20px 24px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  color: #e1e4e8;
  margin: 20px 0;
  -webkit-font-smoothing: antialiased;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: inherit;
  border: none;
}

/* Syntax token colors (manual — no Prism needed) */
pre .comment, pre code .comment { color: #6a737d; font-style: italic; }
pre .keyword, pre code .keyword { color: #f97583; }
pre .string, pre code .string { color: #9ecbff; }
pre .function, pre code .function { color: #b392f0; }
pre .number, pre code .number { color: #79b8ff; }

/* Inline code */
code {
  font-family: var(--font-mono);
  background: #f0ede8;
  border: none;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
  color: #1a1a1a;
}

/* Code block with language header (Stripe-style) */
.code-block {
  margin: 20px 0;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #161b22;
  padding: 10px 24px;
  border-radius: 8px 8px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-block pre {
  margin-top: 0;
  border-radius: 0 0 8px 8px;
}


/* ---------------------------------------------------------------------------
   10. ASCII Diagrams
   --------------------------------------------------------------------------- */

.ascii-diagram {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.4;
  color: #8b949e;
  white-space: pre;
  overflow-x: auto;
  padding: 24px;
  background: #0a0d14;
  border: none;
  border-radius: 8px;
  margin: 20px 0;
  -webkit-font-smoothing: antialiased;
}

.ascii-diagram pre {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-size: inherit;
  border-radius: 0;
}


/* ---------------------------------------------------------------------------
   11. Tables
   --------------------------------------------------------------------------- */

.table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-serif);
  font-size: 14px;
}

thead th {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 2px solid var(--text-primary);
  white-space: nowrap;
}

tbody td {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-divider);
  vertical-align: top;
}

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


/* ---------------------------------------------------------------------------
   12. Primitive Cards
   --------------------------------------------------------------------------- */

.primitives-grid,
.primitive-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.primitive-card {
  background: var(--card-bg);
  border: none;
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 0.2s ease;
}

.primitive-card:hover {
  box-shadow: var(--shadow-lg);
}

.primitive-id {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
}

.primitive-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.primitive-desc {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.primitive-card pre {
  margin: 4px 0 0;
}


/* ---------------------------------------------------------------------------
   13. Phase Flow
   --------------------------------------------------------------------------- */

.phase-flow {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 24px 0;
}

.phase-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0;
}

.phase-box {
  background: var(--card-bg);
  border: none;
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.phase-icon {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  color: var(--text-muted);
}

.phase-title {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.phase-subtitle {
  font-family: var(--font-serif);
  font-size: 12px;
  color: var(--text-muted);
}

.phase-arrow {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  padding: 0 10px;
  display: flex;
  align-items: center;
  user-select: none;
}


/* ---------------------------------------------------------------------------
   14. Comparison Table
   --------------------------------------------------------------------------- */

.comparison-table {
  overflow-x: auto;
  margin: 16px 0;
}

.comparison-table table {
  min-width: 640px;
}

.comparison-table thead th:first-child,
.comparison-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg);
}

.comparison-table .col-gap {
  background: var(--surface);
}

.comparison-table thead th.col-gap {
  background: var(--surface);
}

.comparison-table tbody td.col-gap {
  background: var(--surface);
}


/* ---------------------------------------------------------------------------
   15. Badge / Tag
   --------------------------------------------------------------------------- */

.badge {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 400;
  padding: 2px 6px;
  border-radius: 2px;
  background: transparent;
  border: 1px solid #cccccc;
  color: var(--text-secondary);
  white-space: nowrap;
}

.badge + .badge {
  margin-left: 4px;
}

/* Status dot — teal for connected/live */
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  margin-right: 6px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.status-dot--inactive {
  background: var(--text-muted);
}


/* ---------------------------------------------------------------------------
   16. Buttons
   --------------------------------------------------------------------------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  background: var(--text-primary);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}

.btn-primary:hover {
  opacity: 0.85;
  text-decoration: none;
}

.btn-primary:active {
  opacity: 0.75;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--text-primary);
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}

.btn-ghost:hover {
  background: var(--text-primary);
  color: #ffffff;
  text-decoration: none;
}

.btn-ghost:active {
  opacity: 0.85;
}


/* ---------------------------------------------------------------------------
   17. Footer
   --------------------------------------------------------------------------- */

.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-divider);
}

.footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer a {
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--text-muted);
}

.footer a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.footer-note {
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--text-muted);
}


/* ---------------------------------------------------------------------------
   18. Animations — No-ops (static academic aesthetic)
   --------------------------------------------------------------------------- */

.fade-in {
  opacity: 1;
}

.delay-1 { }
.delay-2 { }
.delay-3 { }
.delay-4 { }
.delay-5 { }

.pulse { }


/* ---------------------------------------------------------------------------
   19. Spec Page — TOC & Method Signatures
   --------------------------------------------------------------------------- */

.spec-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 48px;
  align-items: start;
}

/* Table of Contents — sticky sidebar */
.spec-toc {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 0;
}

.spec-toc-title {
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.spec-toc a {
  display: block;
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--text-muted);
  padding: 3px 0;
  line-height: 1.5;
}

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

.spec-toc a.toc-indent {
  padding-left: 12px;
  font-size: 12px;
}

/* Spec body — prevent grid blowout */
.spec-body {
  min-width: 0;
  overflow-x: hidden;
}

/* Spec sections */
.spec-section {
  padding: 32px 0;
  border-top: 1px solid var(--border-divider);
}

.spec-section:first-child {
  border-top: none;
  padding-top: 0;
}

.spec-section h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.spec-section h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: #333333;
  margin-top: 24px;
  margin-bottom: 8px;
}

.spec-section h4 {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 20px;
  margin-bottom: 8px;
}

/* Method signatures */
.method-signature {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  padding: 16px 20px;
  border-radius: 3px;
  margin: 12px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-x: auto;
}

.method-signature .method-name {
  color: var(--text-primary);
  font-weight: 600;
}

.method-signature .method-params {
  color: var(--text-muted);
}

.method-signature .method-return {
  color: var(--text-secondary);
}

/* Type definitions */
.type-def {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  padding: 16px 20px;
  border-radius: 3px;
  margin: 12px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  overflow-x: auto;
}

.type-def .type-name {
  color: var(--text-primary);
  font-weight: 600;
}

.type-def .type-keyword {
  color: var(--text-muted);
}

/* Spec lists */
.spec-section ul {
  padding-left: 16px;
  margin: 8px 0;
}

.spec-section ul li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 6px;
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.6;
}

.spec-section ul li::before {
  content: '\2014'; /* em dash */
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.spec-section ol {
  padding-left: 16px;
  counter-reset: spec-counter;
  margin: 8px 0;
}

.spec-section ol li {
  counter-increment: spec-counter;
  position: relative;
  padding-left: 24px;
  margin-bottom: 6px;
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.6;
}

.spec-section ol li::before {
  content: counter(spec-counter) ".";
  position: absolute;
  left: 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.spec-section p {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}


/* ---------------------------------------------------------------------------
   20. Blog Page
   --------------------------------------------------------------------------- */

.blog-hero {
  padding: 60px 0 32px;
}

.blog-article {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 32px;
}

.blog-meta {
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.blog-body {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.blog-body h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 40px;
  margin-bottom: 16px;
}

.blog-body h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: #333333;
  margin-top: 32px;
  margin-bottom: 12px;
}

.blog-body p {
  margin-bottom: 16px;
}

.blog-body .lead {
  font-size: 17px;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.7;
  border-left: 3px solid var(--text-primary);
  padding-left: 20px;
  background: var(--surface);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.blog-divider {
  border: none;
  border-top: 1px solid var(--border-divider);
  margin: 32px 0;
}

.blog-links {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.closing-text {
  font-family: var(--font-serif);
  font-size: 16px;
  font-style: italic;
  color: var(--text-primary);
}

/* Primitive list (blog variant) */
.primitive-list {
  margin: 16px 0;
}

.primitive-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-divider);
  align-items: baseline;
}

.primitive-item:last-child {
  border-bottom: none;
}

.primitive-item .num {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 24px;
}

.primitive-item .name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 110px;
}

.primitive-item .desc {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Paper list (blog variant) */
.paper-list {
  margin: 16px 0;
}

.paper-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-divider);
}

.paper-item:last-child {
  border-bottom: none;
}

.paper-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.paper-ref {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.paper-desc {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Code examples (index page) */
.code-examples {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.code-example-block {
  margin: 0;
}

/* Research cards (index page) */
.research-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.research-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 20px;
}

.research-card .arxiv {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 8px;
}

/* Bridge blocks (index page) */
.bridge-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.bridge-block {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 20px;
}

.bridge-block h4 {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.bridge-block p,
.bridge-block code {
  font-size: 13px;
}


/* ---------------------------------------------------------------------------
   21. Abstract / Callout Boxes
   --------------------------------------------------------------------------- */

blockquote,
.callout {
  border-left: 3px solid var(--text-primary);
  background: var(--surface);
  padding: 16px 20px;
  margin: 16px 0;
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}


/* ---------------------------------------------------------------------------
   22. Responsive — Tablet (640px - 1024px)
   --------------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .container {
    padding: 0 24px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .stats-row,
  .hero-stats {
    gap: 32px;
  }

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

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

  .research-cards {
    grid-template-columns: 1fr;
  }

  /* Spec layout: TOC collapses to top */
  .spec-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .spec-toc {
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--border-divider);
    padding-bottom: 16px;
    margin-bottom: 8px;
  }

  /* Collapsible TOC */
  .spec-toc.collapsed .spec-toc-links {
    display: none;
  }

  .spec-toc-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    font-family: var(--font-serif);
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 0;
    margin-bottom: 8px;
  }

  .spec-toc-toggle:hover {
    color: var(--text-primary);
  }

  .phase-arrow {
    padding: 0 6px;
    font-size: 18px;
  }

  .phase-box {
    padding: 16px 10px;
  }

  .phase-title {
    font-size: 12px;
  }
}


/* ---------------------------------------------------------------------------
   23. Responsive — Mobile (<640px)
   --------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  /* Header */
  .header {
    height: 48px;
  }

  .nav {
    display: none;
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border-divider);
    flex-direction: column;
    padding: 16px;
    gap: 12px;
  }

  .nav.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  /* Hero */
  .hero {
    padding: 40px 0 32px;
  }

  .hero h1 {
    font-size: 26px;
  }

  .hero .subtitle,
  .hero .hero-subtitle {
    font-size: 16px;
  }

  .hero .hero-desc {
    font-size: 14px;
  }

  .hero .actions {
    flex-direction: column;
  }

  .hero .actions .btn-primary,
  .hero .actions .btn-ghost {
    width: 100%;
    text-align: center;
  }

  .stats-row,
  .hero-stats {
    gap: 24px;
  }

  .stat-value {
    font-size: 18px;
  }

  /* Sections */
  .section {
    padding: 40px 0;
  }

  .section h2 {
    font-size: 20px;
  }

  /* Cards */
  .card-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 20px;
    border-radius: 4px;
  }

  /* Primitive grid */
  .primitives-grid,
  .primitive-grid {
    grid-template-columns: 1fr;
  }

  .primitive-card {
    padding: 20px;
    border-radius: 4px;
  }

  .primitive-id {
    font-size: 24px;
  }

  /* Research cards */
  .research-cards {
    grid-template-columns: 1fr;
  }

  /* Phase flow — vertical on mobile */
  .phase-flow {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

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

  .phase-box {
    width: 100%;
    border-radius: 4px;
  }

  .phase-arrow {
    transform: rotate(90deg);
    padding: 8px 0;
  }

  /* Code blocks */
  pre {
    padding: 14px;
    font-size: 12px;
    border-radius: 3px;
  }

  /* ASCII diagrams */
  .ascii-diagram {
    font-size: 11px;
    padding: 14px;
    border-radius: 3px;
  }

  /* Tables */
  thead th {
    font-size: 11px;
    padding: 6px 8px;
  }

  tbody td {
    font-size: 13px;
    padding: 8px;
  }

  /* Comparison table — allow horizontal scroll */
  .comparison-table {
    margin-left: -16px;
    margin-right: -16px;
    padding: 0 16px;
  }

  /* Spec page */
  .spec-toc-toggle {
    display: inline-flex;
  }

  .method-signature {
    font-size: 12px;
    padding: 12px 16px;
  }

  /* Blog */
  .blog-article {
    padding: 0 16px;
  }

  .blog-body .lead {
    font-size: 15px;
  }

  .primitive-item {
    flex-direction: column;
    gap: 4px;
  }

  .primitive-item .name {
    min-width: auto;
  }

  /* Footer */
  .footer .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 12px;
  }
}


/* ---------------------------------------------------------------------------
   24. Utility Classes
   --------------------------------------------------------------------------- */

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.font-bold      { font-weight: 700; }
.font-semibold  { font-weight: 600; }
.font-medium    { font-weight: 500; }

.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.hidden { display: none; }

/* Hide TOC toggle on desktop */
@media (min-width: 1025px) {
  .spec-toc-toggle {
    display: none;
  }
}


/* ---------------------------------------------------------------------------
   25. Print Styles
   --------------------------------------------------------------------------- */

@media print {
  .header,
  .footer,
  .spec-toc,
  .nav-toggle {
    display: none;
  }

  body {
    background: #fff;
    color: #111;
    font-size: 11pt;
  }

  .hero {
    padding-top: 0;
  }

  .hero h1 {
    color: #000;
  }

  .section {
    border-top-color: #ccc;
  }

  .card,
  .primitive-card,
  .phase-box {
    box-shadow: none;
    background: #f8f8f5;
    border: 1px solid #ddd;
  }

  pre,
  .ascii-diagram,
  .type-def,
  .method-signature {
    background: #f8f8f5;
    border: 1px solid #ddd;
  }
}
