/* ==========================================================================
   Lean4Lean Proof Atlas — Editorial Verification Design System
   Warm archival paper aesthetic · Semantic dual-prover palette (Terracotta / Cobalt)
   ========================================================================== */

:root {
  --bg: #faf8f4;
  --bg-subtle: #f3efe8;
  --surface: #ffffff;
  --surface-raised: #fdfcfa;
  --code-bg: #f6f3ed;

  --ink: #1a1916;
  --ink-secondary: #4e4a42;
  --ink-muted: #767065;

  --border: #e3dcd0;
  --border-strong: #cfc6b7;

  /* Semantic Prover & Verification Palette */
  --rocq: #b5422b;
  --rocq-soft: #fcf0ed;
  --rocq-border: #ebcabf;

  --hol: #1d4e89;
  --hol-soft: #edf4fb;
  --hol-border: #bfd4eb;

  --verified: #1f6b48;
  --verified-soft: #ebf6f0;
  --verified-border: #b8dcc8;

  --scope: #9a5b13;
  --scope-soft: #fdf5e9;
  --scope-border: #e9d0a8;

  --upstream: #475366;
  --upstream-soft: #f0f2f5;

  /* Syntax highlighting (light) */
  --syn-kw: #9b3520;
  --syn-type: #1d4e89;
  --syn-sym: #1f6b48;
  --syn-comment: #857e72;
  --syn-num: #9a5b13;

  --shadow-sm: 0 1px 2px rgba(26, 25, 22, 0.05);
  --shadow-md: 0 6px 22px rgba(26, 25, 22, 0.07);
  --shadow-lg: 0 20px 50px rgba(26, 25, 22, 0.14);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;

  --topbar-h: 62px;
  --max-w: 1280px;
}

[data-theme="dark"] {
  --bg: #141413;
  --bg-subtle: #1c1b19;
  --surface: #1e1d1a;
  --surface-raised: #24221f;
  --code-bg: #171614;

  --ink: #ebe6dd;
  --ink-secondary: #bdb5a7;
  --ink-muted: #8f8779;

  --border: #2f2c27;
  --border-strong: #433f38;

  --rocq: #e27c66;
  --rocq-soft: #2b1d1a;
  --rocq-border: #59332a;

  --hol: #76aee8;
  --hol-soft: #182331;
  --hol-border: #2c4563;

  --verified: #64bd8f;
  --verified-soft: #17271f;
  --verified-border: #2a523e;

  --scope: #e0a657;
  --scope-soft: #292116;
  --scope-border: #574325;

  --upstream: #9eabbd;
  --upstream-soft: #23262b;

  --syn-kw: #eb8a73;
  --syn-type: #7cb4ee;
  --syn-sym: #74ca9d;
  --syn-comment: #7d766a;
  --syn-num: #e4b169;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg);
  background-image: radial-gradient(ellipse 90% 50% at 50% -10%, rgba(181, 66, 43, 0.035), transparent 65%);
  color: var(--ink);
  line-height: 1.62;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] body {
  background-image: radial-gradient(ellipse 90% 50% at 50% -10%, rgba(118, 174, 232, 0.04), transparent 65%);
}

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

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--hol);
  outline-offset: 2px;
}

code, pre {
  font-family: var(--font-mono);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 999;
  background: var(--ink);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.skip-link:focus {
  left: 12px;
}

/* ==========================================================================
   Top Navigation Bar
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: var(--max-w);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  flex-shrink: 0;
}

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

.brand-mark {
  display: block;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: -0.015em;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.primary-nav::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink-secondary);
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.nav-tab:hover {
  color: var(--ink);
  background: var(--bg-subtle);
}

.nav-tab.is-active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lens-group {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.lens-btn {
  border: 0;
  background: transparent;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--ink-muted);
  transition: all 130ms ease;
}

.lens-btn:hover {
  color: var(--ink);
}

.lens-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.lens-btn[data-lens="rocq"].is-active {
  color: var(--rocq);
}

.lens-btn[data-lens="hol"].is-active {
  color: var(--hol);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  transition: border-color 130ms ease, color 130ms ease, background-color 130ms ease;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink);
  background: var(--surface-raised);
}

.kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--ink-muted);
}

.theme-btn .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-btn .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-btn .icon-moon {
  display: block;
}

.repo-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  transition: border-color 130ms ease, background-color 130ms ease;
}

.repo-link:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
  text-decoration: none;
}

/* ==========================================================================
   Main Container & Common Editorial Primitives
   ========================================================================== */

.main-container {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px 72px;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 96px 16px;
  gap: 14px;
  color: var(--ink-muted);
}

.loading-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--rocq);
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.view-section {
  animation: fadeIn 180ms ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  margin-bottom: 24px;
}

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 6px;
  display: block;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 2.5vw, 2.15rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 8px;
}

.section-lead {
  color: var(--ink-secondary);
  max-width: 78ch;
  margin: 0;
  font-size: 0.98rem;
}

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

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  white-space: nowrap;
}

.badge-rocq {
  color: var(--rocq);
  background: var(--rocq-soft);
  border-color: var(--rocq-border);
}

.badge-hol {
  color: var(--hol);
  background: var(--hol-soft);
  border-color: var(--hol-border);
}

.badge-verified {
  color: var(--verified);
  background: var(--verified-soft);
  border-color: var(--verified-border);
}

.badge-scope {
  color: var(--scope);
  background: var(--scope-soft);
  border-color: var(--scope-border);
}

.badge-upstream {
  color: var(--upstream);
  background: var(--upstream-soft);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  transition: background-color 140ms ease, border-color 140ms ease, transform 100ms ease;
}

.btn:hover {
  background: var(--bg-subtle);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn-primary:hover {
  background: color-mix(in srgb, var(--ink) 86%, var(--rocq));
  border-color: color-mix(in srgb, var(--ink) 86%, var(--rocq));
  color: var(--bg);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 0.78rem;
  font-weight: 500;
  transition: all 120ms ease;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.chip.is-active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* Inline code */
.inline-code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

/* Formal Code Block */
.code-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  overflow: hidden;
}

.code-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.76rem;
  flex-wrap: wrap;
}

.code-panel-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.code-panel-file {
  font-family: var(--font-mono);
  color: var(--ink-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gh-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--hol);
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--hol-soft);
  border: 1px solid var(--hol-border);
  white-space: nowrap;
}

.gh-link:hover {
  text-decoration: none;
  filter: brightness(0.96);
}

.gh-link-rocq {
  color: var(--rocq);
  background: var(--rocq-soft);
  border-color: var(--rocq-border);
}

.code-pre {
  margin: 0;
  padding: 12px 14px;
  font-size: 0.79rem;
  line-height: 1.55;
  overflow-x: auto;
  color: var(--ink);
  tab-size: 2;
}

.syn-kw { color: var(--syn-kw); font-weight: 600; }
.syn-type { color: var(--syn-type); }
.syn-sym { color: var(--syn-sym); }
.syn-comment { color: var(--syn-comment); font-style: italic; }

/* ==========================================================================
   View 1: Big Picture / Overview
   ========================================================================== */

.hero {
  padding: 18px 0 34px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  gap: 36px;
  align-items: start;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--verified);
  font-weight: 600;
  margin-bottom: 12px;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.15rem, 3.8vw, 3.1rem);
  font-weight: 500;
  letter-spacing: -0.028em;
  line-height: 1.1;
  margin: 0 0 16px;
  color: var(--ink);
}

.hero-thesis {
  font-size: 1.05rem;
  line-height: 1.66;
  color: var(--ink-secondary);
  max-width: 64ch;
  margin: 0 0 24px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Verification Ledger Panel beside hero */
.hero-ledger {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.hero-ledger-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.ledger-rows {
  display: flex;
  flex-direction: column;
}

.ledger-row {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.ledger-row:last-child {
  border-bottom: 0;
}

.ledger-label {
  font-size: 0.84rem;
  color: var(--ink-secondary);
}

.ledger-label small {
  display: block;
  font-size: 0.74rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

.ledger-value {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.ledger-value.rocq { color: var(--rocq); }
.ledger-value.hol { color: var(--hol); }
.ledger-value.verified { color: var(--verified); }

/* 4-Layer Architecture Stack */
.architecture-block {
  margin-top: 40px;
}

.layer-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.layer-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
  cursor: pointer;
}

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

.layer-num {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 500;
  line-height: 1;
  color: var(--ink-muted);
  padding-top: 2px;
}

.layer-body h3 {
  font-family: var(--font-serif);
  font-size: 1.24rem;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.015em;
}

.layer-subtitle {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.layer-plain {
  font-size: 0.92rem;
  color: var(--ink-secondary);
  margin: 0 0 12px;
  max-width: 78ch;
}

.layer-provers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.layer-prover-box {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.48;
}

.layer-prover-box.rocq {
  background: var(--rocq-soft);
  border: 1px solid var(--rocq-border);
}

.layer-prover-box.hol {
  background: var(--hol-soft);
  border: 1px solid var(--hol-border);
}

.layer-prover-box strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

.layer-prover-box.rocq strong { color: var(--rocq); }
.layer-prover-box.hol strong { color: var(--hol); }

.layer-cta {
  align-self: center;
  white-space: nowrap;
}

/* Flagship Journeys Grid */
.journeys-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.journey-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

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

.journey-card h3 {
  font-family: var(--font-serif);
  font-size: 1.12rem;
  font-weight: 600;
  margin: 8px 0 6px;
  line-height: 1.28;
  color: var(--ink);
}

.journey-card p {
  font-size: 0.86rem;
  color: var(--ink-secondary);
  margin: 0;
  line-height: 1.54;
}

.journey-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--hol);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Cross-verification Findings */
.findings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.finding-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.finding-card h3 {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  margin: 8px 0 8px;
  line-height: 1.3;
}

.finding-card p {
  margin: 0 0 12px;
  font-size: 0.87rem;
  color: var(--ink-secondary);
}

/* ==========================================================================
   View 2: Goal-Directed Proof Derivation Trees
   ========================================================================== */

.trees-layout {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.trees-sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tree-selector-btn {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all 130ms ease;
}

.tree-selector-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-raised);
}

.tree-selector-btn.is-active {
  border-color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.tree-selector-title {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.3;
  margin-top: 4px;
  color: var(--ink);
}

.tree-workspace {
  min-width: 0;
}

.tree-header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.tree-header-card h2 {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 500;
  margin: 8px 0 8px;
  letter-spacing: -0.02em;
}

.tree-question {
  font-size: 0.98rem;
  color: var(--ink);
  font-weight: 500;
  margin: 0 0 10px;
}

.tree-big-picture {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  margin: 0 0 14px;
}

.scope-callout {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--scope-soft);
  border: 1px solid var(--scope-border);
  color: var(--ink-secondary);
  font-size: 0.83rem;
  line-height: 1.5;
}

.scope-callout strong {
  color: var(--scope);
}

.tree-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.tree-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.mode-toggle {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.mode-toggle button {
  border: 0;
  background: transparent;
  padding: 5px 11px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.mode-toggle button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Collapsible Tree Node Styling */
.tree-branch {
  position: relative;
}

.tree-children {
  margin-left: 22px;
  padding-left: 20px;
  border-left: 1.5px solid var(--border-strong);
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tree-node-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.tree-children > .tree-branch > .tree-node-card::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 22px;
  width: 21px;
  height: 1.5px;
  background: var(--border-strong);
}

.tree-node-card.is-root {
  border-color: var(--border-strong);
}

.tree-node-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  background: var(--surface);
}

.tree-node-main {
  min-width: 0;
  flex: 1;
}

.tree-node-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.tree-node-title {
  font-family: var(--font-serif);
  font-size: 1.14rem;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.28;
}

.tree-node-plain {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  margin: 0;
}

.tree-node-why {
  margin: 8px 0 0;
  font-size: 0.83rem;
  color: var(--ink-muted);
}

.tree-node-why strong {
  color: var(--ink-secondary);
}

.tree-node-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tree-node-formal {
  padding: 0 18px 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tree-node-formal.single-col {
  grid-template-columns: minmax(0, 1fr);
}

.tree-node-foot {
  padding: 9px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
}

.tree-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.77rem;
  font-weight: 600;
}

.tree-toggle-btn:hover {
  border-color: var(--border-strong);
}

/* ==========================================================================
   View 3: Interactive Proof Dependency DAG
   ========================================================================== */

.dag-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dag-toolbar-left,
.dag-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dag-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  font-size: 0.78rem;
  color: var(--ink-secondary);
  margin-bottom: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.dag-stage {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  height: 620px;
  user-select: none;
  cursor: grab;
}

.dag-stage:active {
  cursor: grabbing;
}

.dag-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.dag-col-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  fill: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dag-edge {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.5;
  opacity: 0.7;
  transition: opacity 160ms ease, stroke 160ms ease, stroke-width 160ms ease;
}

.dag-stage.is-dense .dag-edge:not(.is-ancestor):not(.is-descendant) {
  opacity: 0.28;
  stroke-width: 1.15;
}

.dag-edge.is-dim {
  opacity: 0.14;
}

.dag-edge.is-ancestor {
  stroke: var(--verified);
  stroke-width: 2.4;
  opacity: 1;
}

.dag-edge.is-descendant {
  stroke: var(--hol);
  stroke-width: 2.4;
  opacity: 1;
}

.dag-node {
  cursor: pointer;
  transition: opacity 160ms ease;
}

.dag-node.is-dim {
  opacity: 0.24;
}

.dag-node-rect {
  rx: 8;
  ry: 8;
  stroke-width: 1.4;
  transition: stroke-width 140ms ease, filter 140ms ease;
}

.dag-node:hover .dag-node-rect,
.dag-node.is-selected .dag-node-rect {
  stroke-width: 2.4;
}

.dag-node-title {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  fill: var(--ink);
}

.dag-node-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--ink-muted);
}

.dag-hint {
  position: absolute;
  bottom: 12px;
  left: 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 0.75rem;
  color: var(--ink-muted);
  pointer-events: none;
}

/* ==========================================================================
   View 4: Source-Indexed Catalog & Theorem Search
   ========================================================================== */

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.text-input {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  min-width: 260px;
  flex: 1;
  max-width: 440px;
}

.select-input {
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.84rem;
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  background: var(--bg-subtle);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.file-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--ink);
}

.file-pill:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}

.file-pill.rocq {
  color: var(--rocq);
  background: var(--rocq-soft);
  border-color: var(--rocq-border);
}

.file-pill.hol {
  color: var(--hol);
  background: var(--hol-soft);
  border-color: var(--hol-border);
}

/* Module Accordion Cards */
.modules-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.module-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}

.module-row:hover {
  background: var(--bg-subtle);
}

.module-row-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.module-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
}

.module-row-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.module-expand {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-raised);
}

.symbol-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.symbol-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 10px 12px;
}

.symbol-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.symbol-item-name {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}

/* ==========================================================================
   View 5: Skeptic's Audit, Trust Boundaries & Live Arena
   ========================================================================== */

.trust-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.trust-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.trust-card h3 {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  margin: 8px 0 12px;
}

.trust-card ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.86rem;
  color: var(--ink-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.scope-card {
  background: var(--surface);
  border: 1px solid var(--scope-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.scope-card h3 {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  margin: 0 0 8px;
  color: var(--ink);
}

.scope-card p {
  font-size: 0.86rem;
  color: var(--ink-secondary);
  margin: 0 0 10px;
}

.cmd-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.cmd-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.cmd-card-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  font-weight: 600;
}

.cmd-card-body {
  padding: 12px 14px;
}

.cmd-expected {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--verified);
  font-family: var(--font-mono);
}

/* Arena Progress Bars */
.arena-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.arena-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.arena-panel h3 {
  font-family: var(--font-serif);
  font-size: 1.24rem;
  margin: 8px 0 6px;
}

.bar-row {
  margin: 12px 0;
}

.bar-row-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 4px;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--verified);
}

.bar-fill.partial {
  background: var(--hol);
}

.bugs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.bug-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.bug-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.bug-card p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-secondary);
}

/* Milestones Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}

.timeline-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--ink-muted);
  padding-top: 2px;
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.timeline-head h4 {
  margin: 0;
  font-size: 0.96rem;
}

.timeline-item p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-secondary);
}

/* ==========================================================================
   Slide-Over Inspector Drawer & Global Search Modal
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 19, 17, 0.42);
  backdrop-filter: blur(2px);
}

.inspector-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  width: min(620px, 95vw);
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.drawer-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.drawer-title {
  font-family: var(--font-serif);
  font-size: 1.38rem;
  font-weight: 600;
  margin: 4px 0 0;
  line-height: 1.2;
}

.drawer-body {
  padding: 20px 22px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.drawer-section h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin: 0 0 8px;
}

.dep-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dep-pill-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink);
}

.dep-pill-btn:hover {
  border-color: var(--hol);
  color: var(--hol);
}

/* Search Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(20, 19, 17, 0.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 16px 24px;
}

.search-modal {
  width: min(740px, 100%);
  max-height: 78vh;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-muted);
}

.search-modal-input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 0.96rem;
  color: var(--ink);
  font-family: var(--font-sans);
  outline: none;
}

.search-modal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.search-modal-results {
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-hit {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  width: 100%;
}

.search-hit:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.search-hit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.search-hit-name {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}

.search-hit-sub {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 24px;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

.footer-col p {
  margin: 3px 0 0;
  color: var(--ink-muted);
}

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

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

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

  .journeys-grid,
  .trust-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trees-layout {
    grid-template-columns: 1fr;
  }

  .trees-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .tree-node-formal {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .topbar {
    height: auto;
    padding: 8px 0;
  }

  .topbar-inner {
    flex-wrap: wrap;
    padding: 0 14px;
    gap: 8px;
  }

  .primary-nav {
    order: 3;
    width: 100%;
    padding-top: 6px;
    padding-right: 18px;
    border-top: 1px solid var(--border);
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent 100%);
    mask-image: linear-gradient(to right, #000 88%, transparent 100%);
  }

  .nav-tab {
    padding: 5px 9px;
    font-size: 0.81rem;
  }

  .search-trigger-label,
  .repo-link-label,
  .brand-sub {
    display: none;
  }

  .main-container {
    padding: 20px 14px 56px;
  }

  .layer-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .layer-provers,
  .journeys-grid,
  .findings-grid,
  .trust-grid,
  .scope-grid,
  .arena-split,
  .bugs-grid {
    grid-template-columns: 1fr;
  }

  .tree-children {
    margin-left: 10px;
    padding-left: 12px;
  }

  .tree-children > .tree-branch > .tree-node-card::before {
    left: -13px;
    width: 13px;
  }

  .dag-stage {
    height: 460px;
  }
}

[hidden] {
  display: none !important;
}
