:root {
  /* Soft dark palette (reading pages default) */
  --bg: #1a1a1e;
  --bg-elevated: #222226;
  --bg-card: #28282d;
  --text: #d8d5d0;
  --text-dim: #9b9894;
  --text-muted: #7a7670;
  --accent: #f33;
  --accent-glow: rgb(255 51 51 / 15%);
  --green: #0f8;
  --green-dim: rgb(0 255 136 / 8%);
  --green-glow: rgb(0 255 136 / 25%);
  --amber: #fa0;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Space Grotesk', sans-serif;
  --serif: 'Crimson Pro', serif;

  /* RGB triplets for alpha compositing */
  --accent-rgb: 255 51 51;
  --green-rgb: 0 255 136;
  --amber-rgb: 255 170 0;

  /* Derived: borders, overlays, shadows (white-on-dark) */
  --border-subtle: rgb(255 255 255 / 4%);
  --border-light: rgb(255 255 255 / 8%);
  --border-medium: rgb(255 255 255 / 12%);
  --overlay-subtle: rgb(255 255 255 / 3%);
  --overlay-light: rgb(255 255 255 / 5%);
  --overlay-hover: rgb(255 255 255 / 10%);
  --shadow-color: rgb(0 0 0 / 30%);

  /* Nav background */
  --nav-bg: rgb(26 26 30 / 90%);

  /* Scanline effect */
  --scanline: rgb(0 0 0 / 3%);
}

/* Dramatic dark — true-black for hero/landing pages */
[data-theme="dark"][data-page-type="hero"] {
  --bg: #0a0a0b;
  --bg-elevated: #111113;
  --bg-card: #16161a;
  --text: #edebe8;
  --text-muted: #8a8680;
  --nav-bg: rgb(10 10 11 / 85%);
}

/* Light theme */
[data-theme="light"] {
  --bg: #f5f4f1;
  --bg-elevated: #eae8e4;
  --bg-card: #fff;
  --text: #1a1a1e;
  --text-dim: #555250;
  --text-muted: #7a7670;
  --accent: #c20;
  --accent-glow: rgb(204 34 0 / 10%);
  --green: #059960;
  --green-dim: rgb(5 153 96 / 8%);
  --green-glow: rgb(5 153 96 / 20%);
  --amber: #b87a00;
  --accent-rgb: 204 34 0;
  --green-rgb: 5 153 96;
  --amber-rgb: 184 122 0;

  /* Inverted borders/overlays: dark-on-light */
  --border-subtle: rgb(0 0 0 / 6%);
  --border-light: rgb(0 0 0 / 10%);
  --border-medium: rgb(0 0 0 / 15%);
  --overlay-subtle: rgb(0 0 0 / 3%);
  --overlay-light: rgb(0 0 0 / 4%);
  --overlay-hover: rgb(0 0 0 / 8%);
  --shadow-color: rgb(0 0 0 / 10%);
  --nav-bg: rgb(245 244 241 / 90%);
  --scanline: rgb(0 0 0 / 1.5%);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* Visited link color — override browser default blue on dark bg */
a:visited { color: inherit; }

/* Scanline effect */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    var(--scanline) 2px,
    var(--scanline) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ---- NAV ---- */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-logo {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.nav-logo .hex { color: var(--accent); }
.nav-logo .dot { color: var(--text-dim); }

.nav-primary {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: flex-end;
}

.nav-primary a,
.nav-secondary a {
  position: relative;
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  transition: color 0.2s;
}

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

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

.nav-primary a.active::before,
.nav-secondary a.active::before {
  content: "›";
  position: absolute;
  left: -0.9em;
  font-weight: 700;
}

.nav-right {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 2rem;
}

.nav-secondary {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0;
}

.nav-secondary a {
  font-size: 0.85rem;
  text-transform: uppercase;
}

nav::after {
  content: "";
  grid-column: 1 / -1;
  grid-row: 2;
  background: rgb(var(--accent-rgb) / 8%);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  z-index: -1;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--green);
  letter-spacing: 0.05em;
}

.nav-status .pulse {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--green-glow); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

/* ---- THEME TOGGLE ---- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.4rem;
  cursor: pointer;
  color: var(--text-dim);
  transition: color 0.2s, border-color 0.2s;
  line-height: 1;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-light);
}

/* Show sun in dark mode (click to go light), moon in light mode (click to go dark) */
[data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: none; }

/* ---- HERO ---- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10rem 2rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgb(var(--accent-rgb) / 6%) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 80% 20%, rgb(var(--green-rgb) / 3%) 0%, transparent 60%);
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Split hero: text left, mascot right */
.hero-split {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 3rem;
  align-items: center;
  max-width: 1100px;
}

.hero-text-col {
  /* inherits normal flow */
}

.hero-mascot-col {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  opacity: 0;
  animation: fade-up 0.6s 0.3s forwards;
}

.hero-mascot-col::before {
  content: '';
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(var(--accent-rgb) / 6%) 0%, rgb(var(--green-rgb) / 3%) 50%, transparent 70%);
  filter: blur(40px);
}

.hero-mascot-img {
  width: 280px;
  height: auto;
  position: relative;
  filter: drop-shadow(0 4px 30px rgb(var(--accent-rgb) / 12%)) drop-shadow(0 0 60px rgb(var(--green-rgb) / 6%));
  animation: parrot-float 6s ease-in-out infinite;
}

@keyframes parrot-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* Problem statement between headline and code */
.hero-problem {
  max-width: 900px;
  margin: 3rem auto 0;
  position: relative;
  z-index: 1;
}

/* Code block sits below the split, full width */
.hero-code {
  max-width: 1100px;
  margin: 0 auto;
  margin-top: 4rem;
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: fade-up 0.6s 1s forwards;
}

.hero-code-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.hero-code-split .code-window:first-child {
  border-radius: 8px 0 0 8px;
  border-right: none;
}

.hero-code-split .schema-window {
  border-radius: 0 8px 8px 0;
  border-left: 1px solid var(--overlay-subtle);
}

.schema-window .code-header {
  color: var(--text-muted);
}

@media (width <= 768px) {
  .hero-code-split {
    grid-template-columns: 1fr;
  }

  .hero-code-split .code-window:first-child {
    border-radius: 8px 8px 0 0;
    border-right: 1px solid var(--border-light);
  }

  .hero-code-split .schema-window {
    border-radius: 0 0 8px 8px;
    border-left: 1px solid var(--border-light);
    border-top: none;
  }
}

/* Mobile: stack vertically, mascot above text */
@media (width <= 768px) {
  .hero-split {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .hero-mascot-col {
    order: -1;
  }

  .hero-mascot-img {
    width: 90vw;
    max-width: none;
  }

  .hero-cta {
    justify-content: center;
  }

  .hero-sub {
    margin-left: auto;
    margin-right: auto;
  }
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 2rem;
  opacity: 0;
  animation: fade-up 0.6s 0.2s forwards;
}

.hero-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 2rem;
  opacity: 0;
  animation: fade-up 0.6s 0.4s forwards;
}

.hero-title .line2 {
  color: var(--text-dim);
}

.hero-title .highlight {
  color: var(--green);
  position: relative;
}

.hero-sub {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text-dim);
  max-width: 640px;
  line-height: 1.7;
  margin-bottom: 3rem;
  opacity: 0;
  animation: fade-up 0.6s 0.6s forwards;
}

.hero-sub strong {
  color: var(--text);
  font-weight: 300;
}

.hero-highlight {
  color: var(--text);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: fade-up 0.6s 0.8s forwards;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-decoration: none;
  border-radius: 2px;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: #dd2d2d;
  color: white;
}

.btn-primary:hover {
  background: #e44;
  box-shadow: 0 0 30px rgb(var(--accent-rgb) / 30%);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--overlay-hover);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--overlay-hover);
}

/* ---- CODE BLOCK (hero) ---- */
.code-window {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--overlay-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.code-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}

.code-dot.r { background: #ff5f57; }
.code-dot.y { background: #ffbd2e; }
.code-dot.g { background: #28c840; }

.code-header span {
  margin-left: 0.75rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.code-body {
  padding: 1.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.8;
  overflow-x: auto;
  white-space: pre;
}

/* ---- CONTENT LINKS (unified) ---- */

/* Inline links in prose: green, underline on hover */
.section-body a,
.faq-a a,
.research-content a,
.rfc-content a:not(.rfc-toc a) {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  text-decoration-color: rgb(var(--green-rgb) / 40%);
  transition: color 0.2s, text-decoration-color 0.2s;
}

.section-body a:hover,
.faq-a a:hover,
.research-content a:hover,
.rfc-content a:not(.rfc-toc a):hover {
  text-decoration: underline;
  text-decoration-color: var(--green);
}

/* External link indicator */
.section-body a[href^="http"]::after,
.faq-a a[href^="http"]::after,
.research-content a[href^="http"]::after,
.rfc-content a[href^="http"]::after {
  content: " ↗";
  font-size: 0.7em;
  vertical-align: super;
  opacity: 0.5;
}

/* ---- JARGON TOOLTIPS ---- */

/* Glossary term links: dotted underline, help cursor */
.glossary-link {
  text-decoration: none;
  color: inherit;
  border-bottom: 1px dotted var(--overlay-hover);
  cursor: help;
}

.glossary-link:hover {
  border-bottom-color: var(--text);
}

/* Mobile: highlight when tooltip is showing (tap-again-to-navigate) */
.glossary-link.active {
  border-bottom-style: solid;
  border-bottom-color: var(--text);
}

/* Schema field tooltips (hero JSON demo): same look, not a link */
.schema-tip {
  border-bottom: 1px dotted var(--overlay-hover);
  cursor: help;
}

.schema-tip:hover {
  border-bottom-color: var(--text);
}

/* Inside code blocks: subtle underline only */
.code-body .glossary-link {
  color: inherit;
  border-bottom-color: var(--overlay-hover);
}

.code-body .glossary-link:hover {
  border-bottom-color: var(--text-dim);
}

/* Shared tooltip element positioned by JS */
.schema-tooltip {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 0.7rem 0.9rem;
  border-radius: 4px;
  max-width: min(320px, calc(100vw - 2rem));
  white-space: normal;
  pointer-events: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 1001;
  box-shadow: 0 4px 12px var(--shadow-color);
}

/* Backdrop overlay for mobile tooltip — blurs background, catches taps to dismiss */
.tooltip-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgb(0 0 0 / 10%);
  backdrop-filter: blur(1px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.tooltip-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.code-body .comment { color: var(--text-muted); }
.code-body .keyword { color: var(--accent); }
.code-body .string { color: var(--green); }
.code-body .func { color: var(--amber); }
.code-body .dim { color: var(--text-dim); }
.code-body .num { color: #c8f; }

/* ---- SECTIONS ---- */
section {
  padding: 6rem 2rem;
}

.section-inner {
  max-width: 900px;
  margin: 0 auto;
  overflow-x: hidden;
}

.section-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.content-dates {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.suggest-edit {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  padding: 2rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

.suggest-edit a {
  color: var(--green);
  text-decoration: none;
}

.suggest-edit a:hover {
  text-decoration: underline;
}

.section-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.section-body {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.8;
  color: var(--text-dim);
  max-width: 720px;
}

.section-body strong {
  color: var(--text);
  font-weight: 400;
}

/* ---- PROBLEM ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border-subtle);
  margin: 3rem 0;
  border: 1px solid var(--border-subtle);
}

.stat {
  background: var(--bg);
  padding: 2rem;
}

.stat-number {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.5;
}

/* ---- HOW IT WORKS ---- */
.protocol-steps {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.step {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 1.5rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.step:last-child { border-bottom: none; }

.step-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  padding-top: 0.25rem;
}

.step-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.step-title .green { color: var(--green); }

.step-desc {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--text-dim);
  line-height: 1.65;
}

/* ---- API SECTION ---- */
.endpoint-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border-subtle);
  margin-top: 3rem;
  border: 1px solid var(--border-subtle);
}

.endpoint {
  display: grid;
  grid-template-columns: 100px 1fr;
  background: var(--bg);
  padding: 1.25rem 1.5rem;
  align-items: baseline;
  gap: 1.5rem;
}

.endpoint-method {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  text-align: center;
  letter-spacing: 0.05em;
}

.endpoint-method.post {
  background: rgb(var(--green-rgb) / 10%);
  color: var(--green);
}

.endpoint-method.get {
  background: rgb(var(--amber-rgb) / 10%);
  color: var(--amber);
}

.endpoint-method.delete {
  background: rgb(var(--accent-rgb) / 10%);
  color: var(--accent);
}

.endpoint-path {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.endpoint-path .param { color: var(--text-dim); }

.endpoint-desc {
  grid-column: 2;
  font-family: var(--serif);
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: -0.5rem;
}

/* ---- INTEGRATIONS ---- */
.integrations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 3rem;
}

.integration-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 1.75rem;
  transition: border-color 0.2s;
}

.integration-card:hover {
  border-color: var(--overlay-hover);
}

.integration-icon {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.integration-name {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.integration-status {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.integration-status.planned { color: var(--amber); }
.integration-status.concept { color: var(--text-muted); }
.integration-status.soon { color: var(--green); }

.integration-desc {
  font-family: var(--serif);
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ---- MANIFESTO ---- */
.manifesto {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.manifesto blockquote {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-style: italic;
  font-weight: 300;
  line-height: 1.7;
  color: var(--text-dim);
  border-left: 2px solid var(--accent);
  padding-left: 2rem;
  max-width: 700px;
}

.manifesto blockquote strong {
  color: var(--text);
  font-weight: 400;
}

/* ---- FAQ ---- */
.faq-list {
  margin-top: 3rem;
}

.faq-item {
  border-bottom: 1px solid var(--border-subtle);
  padding: 1.5rem 0;
}

.faq-q {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.faq-a {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--text-dim);
  line-height: 1.75;
  padding-left: 1rem;
  border-left: 1px solid var(--border-light);
}

/* ---- FOOTER ---- */
footer {
  padding: 4rem 2rem 2rem;
  border-top: 1px solid var(--border-subtle);
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.footer-logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.footer-logo .hex { color: var(--accent); }

.footer-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-right {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.8;
}

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

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

/* ---- TOMBSTONE ---- */
.tombstone {
  text-align: center;
  padding: 2rem 2rem 4rem;
}

.tombstone-bluesky {
  margin-bottom: 1.5rem;
}

.tombstone-bluesky-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--green);
  text-decoration: none;
  transition: color 0.2s;
}

.tombstone-bluesky-link:hover {
  color: var(--green);
}

.tombstone-bluesky-link:hover .tombstone-bluesky-handle {
  color: var(--text);
}

.tombstone-bluesky-icon {
  width: 1.5rem;
  height: auto;
  fill: currentcolor;
}

.tombstone-bluesky-handle {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 500;
}

.tombstone-bluesky-cta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.tombstone-text {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.tombstone-quote {
  display: block;
  margin-top: 1rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.tombstone-quote:hover {
  color: var(--text-dim);
}

/* ---- CTA BANNER ---- */
.cta-banner {
  background: linear-gradient(135deg, rgb(var(--accent-rgb) / 5%) 0%, rgb(var(--green-rgb) / 3%) 100%);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  padding: 5rem 2rem;
}

.cta-banner .section-title {
  max-width: 600px;
  margin: 0 auto 1rem;
}

.cta-banner .section-title a,
.cta-banner .section-title a:visited {
  color: var(--green);
  text-decoration: none;
}

.cta-banner .section-title a:hover {
  text-decoration: underline;
}

.cta-banner .section-body {
  max-width: 500px;
  margin: 0 auto 2rem;
}

/* ---- HAMBURDER ---- */
.nav-hamburder {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}

.nav-hamburder span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-dim);
  transition: all 0.3s;
}

.nav-hamburder.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-hamburder.open span:nth-child(2) {
  opacity: 0;
}

.nav-hamburder.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ---- RESPONSIVE ---- */
@media (width <= 768px) {
  nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 0;
  }

  nav::after {
    display: none;
  }

  .nav-logo {
    order: 1;
    padding: 1rem;
  }

  .nav-right {
    order: 2;
    margin-left: auto;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .nav-status {
    font-size: 0.7rem;
  }

  @media (width <= 420px) {
    .nav-status {
      font-size: 0.5rem;
      letter-spacing: 0;
    }

    .nav-right {
      gap: 0.5rem;
      padding: 1rem 0.75rem;
    }
  }

  .nav-hamburder {
    display: flex;
  }

  .nav-primary {
    order: 3;
    display: none;
    width: 100%;
  }

  .nav-secondary {
    order: 4;
    display: none;
    width: 100%;
  }

  nav.open .nav-primary {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-light);
  }

  nav.open .nav-secondary {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: rgb(var(--accent-rgb) / 8%);
    border-top: 1px solid var(--border-subtle);
  }

  nav.open .nav-primary a,
  nav.open .nav-secondary a {
    display: block;
    font-size: 0.85rem;
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    letter-spacing: 0.1em;
    width: 100%;
    text-align: right;
  }

  nav.open .nav-primary a:last-child {
    border-bottom: none;
  }

  nav.open .nav-secondary a:last-child {
    border-bottom: none;
  }

  nav.open .nav-primary a.active,
  nav.open .nav-secondary a.active {
    background: var(--overlay-subtle);
  }

  .hero { padding: 7rem 1.5rem 3rem; }
  section { padding: 4rem 1.5rem; }
}

@media (width <= 640px) {
  .step {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .endpoint {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .endpoint-desc {
    grid-column: 1;
  }
}

/* ---- BLINK CURSOR ---- */
.cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--green);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ---- PLAYGROUND ---- */
.playground-tool {
  margin-bottom: 4rem;
}

.search-input {
  width: 100%;
  padding: 0.85rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text);
  transition: border-color 0.2s;
  margin-bottom: 1.5rem;
}

.search-input:focus {
  border-color: var(--green);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.oracle-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
}

.oracle-result {
  padding: 1.5rem;
}

.oracle-status {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.75rem;
  border-radius: 2px;
  margin-bottom: 1rem;
}

.oracle-status.dead {
  background: rgb(var(--accent-rgb) / 15%);
  color: var(--accent);
}

.oracle-status.alive {
  background: var(--green-dim);
  color: var(--green);
}

.oracle-status.not-human {
  background: var(--overlay-light);
  color: var(--text-muted);
}

.oracle-entity {
  margin-bottom: 1.5rem;
}

.oracle-entity h3 {
  font-family: var(--mono);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.oracle-entity .qid {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.oracle-entity .description {
  font-family: var(--serif);
  color: var(--text-dim);
  font-style: italic;
  margin-top: 0.5rem;
}

.age-bar-track {
  position: relative;
  height: 3px;
  background: var(--border-light);
  border-radius: 2px;
  margin: 0.5rem 0 0.25rem;
  max-width: 200px;
}

.age-bar-x {
  position: absolute;
  top: -0.45em;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--accent);
  line-height: 1;
}

.age-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.6s ease;
}

.age-bar-fill.over {
  background: var(--accent);
}

.age-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin-bottom: 0.75rem;
}

.oracle-dates {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.oracle-toggle {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  text-decoration: underline;
}

.oracle-toggle:hover {
  color: var(--text-dim);
}

.oracle-json {
  display: none;
  margin-top: 1rem;
}

.oracle-json.visible {
  display: block;
}

/* Switch simulator */
.switch-status {
  text-align: center;
  margin-bottom: 2rem;
}

.switch-status-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.5rem 1.5rem;
  border-radius: 2px;
}

.switch-timeline {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.5rem 0;
}

.switch-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.3s;
  position: relative;
}

.switch-dot.active {
  transform: scale(1.3);
}

.switch-dot.past {
  opacity: 0.6;
}

.switch-dot[data-phase="nominal"] { --dot-color: var(--green); }
.switch-dot[data-phase="concerned"] { --dot-color: var(--green); }
.switch-dot[data-phase="worried"] { --dot-color: var(--amber); }
.switch-dot[data-phase="alarmed"] { --dot-color: var(--amber); }
.switch-dot[data-phase="urgent"] { --dot-color: var(--accent); }
.switch-dot[data-phase="critical"] { --dot-color: var(--accent); }
.switch-dot[data-phase="deceased"] { --dot-color: var(--accent); }

.switch-dot.active,
.switch-dot.past {
  background: var(--dot-color);
  box-shadow: 0 0 8px var(--dot-color);
}

.switch-email {
  margin-bottom: 2rem;
}

.switch-email .code-body {
  line-height: 2;
}

.switch-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.switch-buttons .btn {
  min-width: 160px;
  justify-content: center;
}

.btn-alive {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green);
}

.btn-alive:hover {
  background: var(--green-dim);
  box-shadow: 0 0 20px rgb(var(--green-rgb) / 15%);
}

.btn-alive:disabled,
.btn-ignore:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-ignore {
  background: #dd2d2d;
  color: white;
}

.btn-ignore:hover {
  background: #e44;
  box-shadow: 0 0 20px rgb(var(--accent-rgb) / 30%);
}

.switch-reset {
  text-align: center;
  margin-top: 1rem;
}

.switch-reset a {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: underline;
}

.switch-final {
  text-align: center;
  padding: 2rem;
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
}

/* ---- RFC PAGE ---- */
.rfc-content {
  max-width: 900px;
  margin: 0 auto;
  overflow-x: hidden;
}

.rfc-content h1,
.rfc-content h2,
.rfc-content h3,
.rfc-content h4 {
  font-family: var(--mono);
  font-weight: 600;
  margin-top: 3rem;
  margin-bottom: 1rem;
  scroll-margin-top: 6.5rem;
}

.heading-anchor {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 400;
  font-size: 0.85em;
  opacity: 0;
  transition: opacity 0.15s ease;
  margin-left: 0.25em;
}

.rfc-content h1:hover .heading-anchor,
.rfc-content h2:hover .heading-anchor,
.rfc-content h3:hover .heading-anchor,
.rfc-content h4:hover .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--accent);
}

.rfc-content h1 {
  font-size: 1.75rem;
}

.rfc-content h2 {
  font-size: 1.35rem;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
}

.rfc-content h3 {
  font-size: 1.1rem;
  color: var(--text-dim);
}

.rfc-content p {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.rfc-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.rfc-content code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--overlay-light);
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
}

.rfc-content pre code {
  background: none;
  padding: 0;
}

/* Pygments syntax highlighting (codehilite) — uses site theme variables */
.codehilite {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.codehilite pre {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}

/* comments */
.codehilite .c1,
.codehilite .cm {
  color: var(--text-muted);
  font-style: italic;
}
.codehilite .nv { color: var(--accent); }                                            /* keys (Name.Variable) */
.codehilite .s, .codehilite .s2, .codehilite .s1 { color: var(--green); }           /* string values */
.codehilite .mf, .codehilite .mi { color: var(--amber); }                           /* numbers */
.codehilite .o { color: var(--text-dim); }                                           /* operators */
.codehilite .p { color: var(--text); }                                               /* punctuation */
.codehilite .w { color: transparent; }                                               /* whitespace */
.codehilite .kd, .codehilite .k { color: var(--accent); }                           /* keywords */

.rfc-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.rfc-content th {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--overlay-hover);
  color: var(--text);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}

.rfc-content td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-dim);
}

.rfc-content ul, .rfc-content ol {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.rfc-content blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.5rem;
  font-style: italic;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.rfc-callout {
  border: 1px solid var(--accent);
  border-left: 3px solid var(--accent);
  background: rgb(var(--accent-rgb) / 6%);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 2px;
  font-style: normal;
  color: var(--text);
  line-height: 1.75;
}

.rfc-toc {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 3rem;
}

.rfc-toc-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 100%;
  text-align: left;
  transition: color 0.2s;
}

.rfc-toc-toggle:hover {
  color: var(--text-dim);
}

.rfc-toc-arrow {
  display: inline-block;
  transition: transform 0.2s;
}

.rfc-toc:not(.collapsed) .rfc-toc-arrow {
  transform: rotate(90deg);
}

.rfc-toc.collapsed .rfc-toc-body {
  display: none;
}

.rfc-toc-body {
  margin-top: 1rem;
}

.rfc-toc ul {
  list-style: none;
  padding-left: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.rfc-toc li {
  margin-bottom: 0.5rem;
}

.rfc-toc a {
  color: var(--text-dim);
  text-decoration: none;
}

.rfc-toc a:hover {
  color: var(--text);
}

/* ---- BLOG ---- */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
}

.blog-item {
  background: var(--bg);
  padding: 2rem;
  text-decoration: none;
  transition: background 0.2s;
  display: block;
}

.blog-item:hover {
  background: var(--bg-card);
}

.blog-item-date {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.blog-item-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.blog-item-excerpt {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.case-study-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.keyword-tag {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--border-subtle);
  border: 1px solid var(--border-light);
  border-radius: 2px;
  padding: 0.15rem 0.5rem;
}


/* ---- 404 ---- */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.error-code {
  font-family: var(--mono);
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.error-label {
  font-family: var(--mono);
  font-size: 1.5rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.error-message {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 400px;
}

.error-link {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--green);
  text-decoration: none;
}

.error-link:hover {
  text-decoration: underline;
}

/* === CONTENT REWORK: New Components === */

/* Protocol sketch (landing page) */
.protocol-sketch {
  margin-top: 2rem;
}

.sketch-body {
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text);
}

.sketch-body p {
  margin-bottom: 1.25rem;
}

.sketch-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* Research page content */
.case-studies-cta {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent);
  padding: 1.5rem 2rem;
  margin-bottom: 3rem;
}

.case-studies-cta-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.case-studies-cta-link {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1rem;
  color: var(--green);
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
}

.case-studies-cta-link:hover {
  text-decoration: underline;
}

.case-studies-cta-desc {
  font-family: var(--serif);
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.research-content {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--text);
}

.research-content h2 {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.research-content h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.1rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.research-content p {
  margin-bottom: 1.25rem;
}

.research-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-family: var(--sans);
  font-size: 0.9rem;
}

.research-content th {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--overlay-hover);
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}

.research-content td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.research-content tr.row-pulse td {
  animation: row-pulse 2s ease;
}

@keyframes row-pulse {
  0% { background: transparent; }
  15% { background: rgb(var(--accent-rgb) / 12%); }
  30% { background: rgb(var(--accent-rgb) / 4%); }
  45% { background: rgb(var(--accent-rgb) / 10%); }
  60% { background: rgb(var(--accent-rgb) / 3%); }
  100% { background: transparent; }
}

.research-content strong {
  color: var(--accent);
}

.research-content ul, .research-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.research-content li {
  margin-bottom: 0.5rem;
}

.research-content em {
  color: var(--text-dim);
}

/* Draft banner (RFC page) */
.draft-banner {
  font-family: var(--serif);
  font-style: italic;
  color: var(--amber);
  padding: 1.5rem;
  border-left: 3px solid var(--amber);
  background: rgb(var(--amber-rgb) / 5%);
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* 404 page enhancements */
.error-parrot {
  width: 160px;
  height: auto;
  margin: 2rem 0;
  filter: drop-shadow(0 0 20px rgb(var(--accent-rgb) / 30%));
}

.error-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2rem;
}

/* Coming soon / help CTA */
.coming-soon-help {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  max-width: 440px;
}

.coming-soon-help-heading {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--green);
  margin-bottom: 0.75rem;
}

.coming-soon-help-message {
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Footer additions */
.footer-disclaimer {
  font-family: var(--serif);
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 1rem;
  line-height: 1.5;
  max-width: 300px;
}

.footer-license {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  letter-spacing: 0.05em;
}

.footer-license a {
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

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

/* ---- ACCESSIBILITY ---- */

/* Skip-to-content link */
.back-link {
  display: block;
  text-decoration: none;
  background: rgb(255 68 68 / 12%);
  border-radius: 4px;
  padding: 0.5rem 1.25rem;
  margin: 0.75rem 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: #f44;
  transition: all 0.2s;
  scroll-margin-top: 8.5rem;
}

.back-link:hover {
  background: rgb(255 68 68 / 22%);
  color: #f55;
  box-shadow: 0 0 12px rgb(255 68 68 / 8%);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  z-index: 10000;
  padding: 0.75rem 1.5rem;
  background: var(--bg-card);
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.85rem;
  border: 1px solid var(--green);
  border-radius: 2px;
  text-decoration: none;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Global focus indicator */
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ---- LIGHT MODE OVERRIDES ---- */
[data-theme="light"] ::selection {
  color: #fff;
}

[data-theme="light"] .code-dot.r { background: #d9453e; }
[data-theme="light"] .code-dot.y { background: #d4a020; }
[data-theme="light"] .code-dot.g { background: #1fa834; }

[data-theme="light"] .code-body .num { color: #8a3daa; }

[data-theme="light"] .cta-primary {
  background: var(--accent);
  color: #fff;
}

[data-theme="light"] .cta-primary:hover {
  background: #a31a00;
  color: #fff;
}

[data-theme="light"] .cta-secondary {
  border-color: var(--border-light);
  color: var(--text);
}

[data-theme="light"] body::after {
  opacity: 0.5;
}

[data-theme="light"] .back-link {
  color: var(--accent);
}

/* ---- REDUCED MOTION ---- */
@media (prefers-reduced-motion: reduce) {
  /* stylelint-disable declaration-no-important -- !important required to override
     animation declarations with higher specificity than the universal selector */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* stylelint-enable declaration-no-important */

  html {
    scroll-behavior: auto;
  }
}

.footer-cta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 1rem;
}

.footer-right .footer-cta a,
.footer-right .footer-cta a:visited {
  color: var(--green);
  text-decoration: none;
}

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

/* ---- GLOSSARY ---- */
.glossary-list {
  max-width: 720px;
}

.glossary-entry {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
  scroll-margin-top: 6.5rem;
}

@media (width <= 768px) {
  .glossary-entry {
    scroll-margin-top: 4.5rem;
  }
}

.glossary-term {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.glossary-anchor {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 400;
  font-size: 0.85em;
  opacity: 0;
  transition: opacity 0.15s ease;
  margin-left: 0.25em;
}

.glossary-entry:hover .glossary-anchor,
.glossary-anchor:focus {
  opacity: 1;
}

.glossary-anchor:hover {
  color: var(--accent);
}

.glossary-aliases {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.glossary-definition {
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

/* Citation list */
.citation-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.75rem;
}

.citation-heading {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.citation-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.25rem 0;
}

.citation-item:hover {
  color: var(--green);
}

.citation-icon {
  flex-shrink: 0;
  font-size: 0.85rem;
}

.citation-label {
  flex-grow: 1;
}

.citation-arrow {
  flex-shrink: 0;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.citation-item:hover .citation-arrow {
  opacity: 1;
}
