/* ============================================================
   seLe4n Website — Pure CSS, No Dependencies
   v2 — Expanded with tables, code examples, syntax highlighting
   ============================================================ */

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

:root {
  /* Colors */
  --bg:          #080c15;
  --bg-alt:      #0d1320;
  --surface:     #141c2d;
  --surface-2:   #192338;
  --border:      #2a3550;
  --text:        #d8deea;
  --text-muted:  #99a4bf;
  --text-bright: #e8ecf4;
  --heading:     #f0f2f8;
  --accent:      #5ba0f5;
  --accent-dim:  #3d7dd4;
  --accent-glow: rgba(91, 160, 245, 0.15);
  --on-accent:   #fff;
  --green:       #4ec989;
  --green-dim:   rgba(78, 201, 137, 0.12);
  --yellow:      #e5c07b;
  --yellow-dim:  rgba(229, 192, 123, 0.12);
  --red:         #e06c75;
  --red-dim:     rgba(224, 108, 117, 0.12);
  --purple:      #c678dd;
  --purple-dim:  rgba(198, 120, 221, 0.12);
  --bg-pattern:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(91, 160, 245, 0.11), transparent 72%),
    radial-gradient(ellipse 60% 40% at 30% 72%, rgba(78, 201, 137, 0.08), transparent 65%),
    linear-gradient(180deg, rgba(8, 12, 21, 0.55), rgba(8, 12, 21, 0.3));

  /* Assurance colors (map proof-pair indicators) */
  --assurance-linked:  #22b573;
  --assurance-partial: #c47adb;
  --assurance-local:   #5ba8d4;
  --assurance-none:    #8e8e9a;

  /* Typography */
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:  "SFMono-Regular", "Cascadia Code", "Fira Code", Consolas, "Liberation Mono", Menlo, monospace;

  /* Layout */
  --section-bg:     rgba(8, 12, 21, 0.94);
  --section-alt-bg: rgba(13, 19, 32, 0.95);
  --footer-bg:      rgba(13, 19, 32, 0.96);

  /* Spacing */
  --section-pad: 5rem 0;
  --container-w: 72rem;
  --radius:      0.5rem;
  --radius-lg:   0.75rem;
  --nav-height: 3.75rem;
  --nav-scroll-offset: 4.5rem;
}

/* --- Light Theme --- */
[data-theme="light"] {
  --bg:          #f8f9fc;
  --bg-alt:      #f0f2f7;
  --surface:     #ffffff;
  --surface-2:   #eef0f5;
  --border:      #d4d8e1;
  --text:        #3a3f4b;
  --text-muted:  #6b7280;
  --text-bright: #1a1d24;
  --heading:     #111318;
  --accent:      #2b6fd0;
  --accent-dim:  #1a5bb8;
  --accent-glow: rgba(43, 111, 208, 0.1);
  --on-accent:   #fff;
  --green:       #16804b;
  --green-dim:   rgba(22, 128, 75, 0.08);
  --yellow:      #946b1a;
  --yellow-dim:  rgba(148, 107, 26, 0.08);
  --red:         #c53030;
  --red-dim:     rgba(197, 48, 48, 0.08);
  --purple:      #7c3aed;
  --purple-dim:  rgba(124, 58, 237, 0.08);
  --bg-pattern:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(43, 111, 208, 0.14), transparent 72%),
    radial-gradient(ellipse 60% 40% at 30% 72%, rgba(22, 128, 75, 0.1), transparent 65%),
    linear-gradient(180deg, rgba(248, 249, 252, 0.2), rgba(240, 242, 247, 0.15));

  --assurance-linked:  #0d8c5b;
  --assurance-partial: #9b4eb8;
  --assurance-local:   #2b7fb0;
  --assurance-none:    #6b6b78;

  --section-bg:     rgba(248, 249, 252, 0.88);
  --section-alt-bg: rgba(240, 242, 247, 0.92);
  --footer-bg:      rgba(240, 242, 247, 0.92);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  scroll-padding-top: var(--nav-scroll-offset);
}

@supports not (scroll-behavior: smooth) {
  html {
    scroll-padding-top: 0;
  }
}

section[id],
header[id] {
  scroll-margin-top: var(--nav-scroll-offset);
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  overflow-x: clip;
}

@supports not (overflow: clip) {
  body {
    overflow-x: hidden;
  }
}

body.nav-open {
  overflow: hidden;
}
[data-theme="light"] body {
  text-shadow: none;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--text-bright);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  color: var(--accent);
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.65;
  tab-size: 2;
}
pre code {
  background: none;
  padding: 0;
  color: var(--text-bright);
  font-size: inherit;
}

ul {
  list-style: none;
  padding: 0;
}

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

strong {
  color: var(--text-bright);
  font-weight: 600;
}

em {
  font-style: italic;
}

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

/* --- Skip Link (Accessibility) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 1001;
  background: var(--accent);
  color: var(--bg);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0.75rem;
  color: var(--bg);
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 1.5rem);
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition: background 0.3s, box-shadow 0.3s;
  background: transparent;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.nav.scrolled {
  background: rgba(8, 12, 21, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--border);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .nav.scrolled {
    background: rgba(8, 12, 21, 0.985);
  }

  [data-theme="light"] .nav.scrolled {
    background: rgba(248, 249, 252, 0.985);
  }
}
[data-theme="light"] .nav.scrolled {
  background: rgba(248, 249, 252, 0.92);
}

.nav-inner {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 1.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--nav-height);
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  border-radius: var(--radius);
  -webkit-tap-highlight-color: transparent;
}
.nav-logo:hover {
  color: var(--accent);
}

.logo-se { color: var(--text-muted); }
.logo-le4n { color: var(--accent); }

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

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
}

@media (min-width: 48.0625rem) {
  .nav-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: 0.75rem;
  }

  .nav-links {
    justify-self: center;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-controls {
    margin-left: 0;
    justify-self: end;
  }
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.6rem 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
  touch-action: manipulation;
}
.nav-links a:hover {
  color: var(--text-bright);
  background: var(--accent-glow);
}
.nav-links a[aria-current="page"],
.nav-links a[aria-current="true"] {
  color: var(--accent);
  background: var(--accent-glow);
}

.nav-links a.nav-cta {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  padding: 0.4rem 1rem;
}
.nav-links a.nav-cta:hover {
  background: var(--accent-dim);
  color: var(--on-accent);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
  line-height: 0;
  touch-action: manipulation;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.nav-toggle.open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* --- Theme Toggle --- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  flex-shrink: 0;
  touch-action: manipulation;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}
.theme-toggle svg {
  width: 1.125rem;
  height: 1.125rem;
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.bg-animation-toggle .icon-play { display: none; }
.bg-animation-toggle.is-paused .icon-pause { display: none; }
.bg-animation-toggle.is-paused .icon-play { display: block; }

/* --- Logo Image --- */
.logo-img {
  height: 4rem;
  width: auto;
  display: block;
}
.nav-logo .logo-img {
  height: clamp(2.2rem, 6vw, 2.8rem);
}
.logo-img-dark { display: block; }
.logo-img-light { display: none; }
[data-theme="light"] .logo-img-dark { display: none; }
[data-theme="light"] .logo-img-light { display: block; }
@media (prefers-color-scheme: light) {
  html:not([data-theme]) .logo-img-dark { display: none; }
  html:not([data-theme]) .logo-img-light { display: block; }
}

.hero-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
  filter: drop-shadow(0 6px 24px rgba(0, 0, 0, 0.65));
}

html:not([data-theme="light"]) .hero-logo {
  filter: drop-shadow(0 8px 32px rgba(0, 0, 0, 0.75));
}
.hero-logo .logo-img {
  height: clamp(13rem, 58vw, 39rem);
}

.footer-logo .logo-img {
  height: 4rem;
}

/* --- Code Links (interactive references) --- */
a.code-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-dim);
  transition: color 0.2s, border-color 0.2s;
}
a.code-link:hover {
  color: var(--text-bright);
  border-bottom-color: var(--text-bright);
}
a.code-link code {
  color: inherit;
}

/* Architecture blocks as links */
a.arch-block {
  text-decoration: none;
  color: var(--text-bright);
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
}
a.arch-block:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(91, 160, 245, 0.15);
  color: var(--accent);
}

/* Light theme overrides for backgrounds */
[data-theme="light"] .hero-bg {
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(43, 111, 208, 0.12), transparent),
    radial-gradient(ellipse 40% 30% at 70% 60%, rgba(22, 128, 75, 0.08), transparent);
}
[data-theme="light"] .timeline-marker {
  background: var(--surface);
}
[data-theme="light"] .tier-script {
  background: var(--surface-2);
}

/* --- Hero --- */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding: calc(var(--nav-height) + 2.25rem) 0 4rem;
}

.hero-bg {
  opacity: 1;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(91, 160, 245, 0.16), transparent),
    radial-gradient(ellipse 40% 30% at 70% 60%, rgba(78, 201, 137, 0.08), transparent);
  pointer-events: none;
}

/* Animated background canvas wrapper — fixed behind all content */
#bg-canvas-wrap {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Container for WebGL canvas — sized/positioned by background-pattern.js */
#bg-canvas-mover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-pattern);
}

/* WebGL canvas — JS sets opacity/transition inline; these are
   safe defaults if JS hasn't loaded yet. */
.math-bg-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.math-bg-layer.active {
  opacity: 0.5;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

html:not([data-theme="light"]) .hero-label {
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
}


.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text);
  max-width: 38rem;
  margin: 0 auto 1rem;
  line-height: 1.8;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

html:not([data-theme="light"]) .hero-subtitle {
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
}

.hero-tagline {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 3rem;
}
.hero-tagline code {
  background: var(--green-dim);
  color: var(--green);
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 6rem;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-version {
  margin-top: 2rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius);
  transition: transform 0.2s, background 0.2s, color 0.2s, border-color 0.2s;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover {
  background: var(--accent-dim);
  color: var(--on-accent);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* --- Sections --- */
.section {
  position: relative;
  z-index: 1;
  padding: var(--section-pad);
  background: var(--section-bg);
  content-visibility: auto;
  contain-intrinsic-size: auto 800px;
}
.section-alt {
  background: var(--section-alt-bg);
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  text-align: center;
}

.section-lead {
  font-size: 1.0625rem;
  color: var(--text);
  max-width: 42rem;
  margin: 0 auto 3rem;
  text-align: center;
  line-height: 1.8;
}

/* --- Grid --- */
.grid {
  display: grid;
  gap: 1.5rem;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.75rem;
}
.card h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.5rem;
}
.card-compact h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.card p {
  color: var(--text);
  line-height: 1.7;
}
.card ul {
  margin-top: 0.75rem;
}
.card ul li {
  padding: 0.25rem 0 0.25rem 1.25rem;
  position: relative;
  line-height: 1.6;
}
.card ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.card-compact {
  padding: 1.5rem;
}

.card-note {
  margin-top: 1rem;
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--text-muted);
}

/* --- Callout Box --- */
.callout {
  background: var(--surface);
  border: 1px solid var(--accent-dim);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  margin: 2rem 0;
}
.callout h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1rem;
}
.callout p {
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 0.75rem;
}
.callout p:last-child {
  margin-bottom: 0;
}

/* --- Architecture Diagram --- */
.arch-diagram {
  margin: 3rem auto;
  max-width: 48rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.arch-layer {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  position: relative;
}

.arch-layer-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.arch-blocks {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.arch-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-bright);
  text-align: center;
  flex: 1 1 auto;
  min-width: 6rem;
  overflow: hidden;
}

.arch-blocks .arch-block {
  max-width: calc(33.333% - 0.5rem);
}

/* File path hints inside architecture blocks */
.arch-hint {
  display: block;
  font-size: 0.625rem;
  font-weight: 400;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.25rem;
  letter-spacing: 0;
}

/* Theorem/file count annotations on arch blocks */
.arch-stat {
  display: block;
  font-size: 0.5625rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.1875rem;
  letter-spacing: 0;
  line-height: 1.3;
}

/* Layer-level stat annotation next to label */
.arch-layer-stat {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 0.5rem;
  opacity: 0.8;
}

.arch-api { background: rgba(91, 160, 245, 0.06); }
.arch-api .arch-block { border-color: rgba(91, 160, 245, 0.25); }

.arch-core { background: rgba(78, 201, 137, 0.04); }
.arch-core .arch-block { border-color: rgba(78, 201, 137, 0.2); }
.arch-core .arch-blocks .arch-block {
  max-width: calc(25% - 0.375rem);
  min-width: 0;
}

.arch-security { background: rgba(229, 192, 123, 0.04); }
.arch-security .arch-block { border-color: rgba(229, 192, 123, 0.2); }

.arch-hw { background: rgba(224, 108, 117, 0.04); }
.arch-hw .arch-block { border-color: rgba(224, 108, 117, 0.2); }
.arch-hw .arch-blocks .arch-block {
  min-width: 0;
}

.arch-model { background: rgba(91, 160, 245, 0.03); }
.arch-model .arch-block { border-color: rgba(91, 160, 245, 0.15); }
.arch-model .arch-blocks .arch-block {
  max-width: calc(25% - 0.375rem);
  min-width: 0;
}

.arch-platform { background: rgba(198, 120, 221, 0.04); }
.arch-platform .arch-block { border-color: rgba(198, 120, 221, 0.2); }

.arch-rust { background: rgba(222, 120, 60, 0.05); }
.arch-rust .arch-block { border-color: rgba(222, 120, 60, 0.25); }

/* --- Features Grid --- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: border-color 0.2s, transform 0.2s;
}
.feature-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}

.feature-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 1rem;
  color: var(--accent);
}
.feature-icon svg {
  width: 100%;
  height: 100%;
}

.feature-card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.5rem;
}
.feature-card p {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.7;
}

/* --- Comparison & Data Tables --- */
.table-wrap {
  overflow-x: auto;
  margin: 0 -0.5rem;
  padding: 0 0.5rem;
}

.comparison-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 0.9375rem;
}

.comparison-table thead,
.data-table thead {
  background: var(--surface-2);
}

.comparison-table th,
.data-table th {
  padding: 0.875rem 1.25rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.comparison-table td,
.data-table td {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  line-height: 1.6;
  vertical-align: top;
}

.comparison-table tbody tr:last-child td,
.data-table tbody tr:last-child td {
  border-bottom: none;
}

.comparison-table tbody tr:hover,
.data-table tbody tr:hover {
  background: rgba(91, 160, 245, 0.03);
}

/* First column in comparison table is a label */
.comparison-table td:first-child {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.comparison-table td:first-child strong {
  color: var(--text-bright);
}

/* Third column (seLe4n) gets accent highlight */
.comparison-table td:nth-child(3) {
  color: var(--text-bright);
}

/* API table specific */
.api-table td:first-child {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  white-space: nowrap;
}
.api-table td:first-child code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* Badges */
.badge-stable {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 1rem;
  white-space: nowrap;
}
.badge-stable {
  background: var(--green-dim);
  color: var(--green);
}

/* Lean 4 Syntax Highlighting */
.kw {
  color: var(--purple);
  font-weight: 600;
}
.ty {
  color: var(--accent);
}
.fn {
  color: var(--green);
}
.cm {
  color: var(--text-muted);
  font-style: italic;
}
.tac {
  color: var(--yellow);
}

/* --- Shortcut Table Section --- */
.shortcut-table {
  margin-top: 3rem;
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}
.shortcut-table > h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 1.5rem;
  text-align: center;
}

/* --- Threat Model --- */
.threat-model {
  margin-top: 3rem;
}
.threat-model > h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 1.5rem;
  text-align: center;
}

.threat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
}
.threat-card h4 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.75rem;
}
.threat-card ul li {
  padding: 0.3rem 0 0.3rem 1.25rem;
  position: relative;
  font-size: 0.9375rem;
  line-height: 1.6;
}
.threat-card ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
}

/* --- Verification Tiers --- */
.tiers {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 48rem;
  margin: 0 auto 3rem;
}

.tier {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
}

.tier-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.tier-badge {
  background: var(--accent);
  color: var(--bg);
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.625rem;
  border-radius: 1rem;
  white-space: nowrap;
}

.tier-header h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--heading);
}

.tier p {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.tier-script {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  color: var(--green);
}

/* --- Proof Quality --- */
.proof-quality {
  margin-top: 3rem;
}
.proof-quality > h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading);
  text-align: center;
  margin-bottom: 1.5rem;
}

.quality-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
}
.quality-card h4 {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.quality-card ul li {
  font-size: 0.875rem;
  padding: 0.2rem 0 0.2rem 1.25rem;
  position: relative;
  line-height: 1.6;
}
.quality-card ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.quality-high {
  border: 1px solid rgba(78, 201, 137, 0.3);
  background: var(--green-dim);
}
.quality-high h4 { color: var(--green); }
.quality-high ul li::before { background: var(--green); }

.quality-low {
  border: 1px solid rgba(229, 192, 123, 0.3);
  background: var(--yellow-dim);
}
.quality-low h4 { color: var(--yellow); }
.quality-low ul li::before { background: var(--yellow); }

.quality-resolved {
  border: 1px solid rgba(91, 160, 245, 0.3);
  background: var(--accent-glow);
}
.quality-resolved h4 { color: var(--accent); }
.quality-resolved ul li::before { background: var(--accent); }

/* --- File Tree --- */
.file-tree {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  max-width: 48rem;
  margin: 0 auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 2;
}

.tree-root {
  font-weight: 800;
  color: var(--heading);
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
}

.tree-group {
  margin-left: 1.5rem;
  margin-top: 0.5rem;
}

.tree-dir {
  color: var(--accent);
  font-weight: 600;
}

.tree-file {
  color: var(--text);
}

.tree-children {
  margin-left: 1.5rem;
  border-left: 1px solid var(--border);
  padding-left: 1rem;
}

.tree-desc {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.75rem;
}

/* --- Getting Started Steps --- */
.steps {
  max-width: 48rem;
  margin: 0 auto 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.step {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--accent);
  color: var(--bg);
  font-weight: 800;
  font-size: 1.125rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.25rem;
}

.step-content {
  flex: 1;
  min-width: 0;
}
.step-content h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.5rem;
}
.step-content p {
  font-size: 0.9375rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

/* --- Timeline / Roadmap --- */
.timeline {
  max-width: 48rem;
  margin: 0 auto;
  position: relative;
  padding-left: 2rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 0.5625rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 2rem;
  padding-left: 1.5rem;
}
.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -1.625rem;
  top: 0.4rem;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
}

.timeline-item.done .timeline-marker {
  background: var(--green);
  border-color: var(--green);
}
.timeline-item.active .timeline-marker {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.timeline-item.future .timeline-marker {
  border-color: var(--text-muted);
}

.timeline-content h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.5rem;
}
.timeline-content p {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.7;
}

.timeline-tag {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  vertical-align: middle;
  margin-left: 0.5rem;
  background: var(--green-dim);
  color: var(--green);
}
.tag-active {
  background: var(--accent-glow);
  color: var(--accent);
}
.tag-future {
  background: rgba(122, 130, 153, 0.12);
  color: var(--text-muted);
}

/* --- Footer --- */
.footer {
  position: relative;
  z-index: 1;
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 4rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.footer-brand {
  font-size: 0.9375rem;
}
.footer-brand .logo-se,
.footer-brand .logo-le4n {
  font-size: 1.25rem;
  font-weight: 700;
}
.footer-brand p {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.footer-logo-link {
  text-decoration: none;
}
.footer-logo-link:hover .logo-le4n {
  color: var(--text-bright);
}

.footer-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.footer-license {
  margin-top: 0.5rem;
}

.footer-links h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.footer-links ul li {
  margin-bottom: 0.5rem;
}
.footer-links ul li a {
  color: var(--text);
  font-size: 0.875rem;
  transition: color 0.2s;
}
.footer-links ul li a:hover {
  color: var(--accent);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-compact {
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.footer-compact a {
  color: var(--text);
  transition: color 0.2s;
}
.footer-compact a:hover {
  color: var(--accent);
}

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

@media (max-width: 64rem) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

@media (max-width: 48rem) {
  :root {
    --nav-height: 3.5rem;
    --section-pad: 3.5rem 0;
  }


  .nav {
    background: color-mix(in oklab, var(--bg) 84%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .nav-inner {
    gap: 0.5rem;
  }

  /* Nav mobile */
  .nav-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .nav-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.45rem;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: calc(var(--nav-height) + env(safe-area-inset-top));
    left: 0;
    right: 0;
    margin-left: 0;
    background: rgba(10, 14, 23, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 0;
    max-height: calc(100vh - var(--nav-height));
    max-height: calc(100svh - var(--nav-height));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    box-shadow: 0 0.8rem 2rem rgba(0, 0, 0, 0.32);
  }
  [data-theme="light"] .nav-links {
    background: rgba(248, 249, 252, 0.97);
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links a {
    padding: 0.85rem 0.2rem;
    min-height: 2.75rem;
    width: 100%;
    font-size: 1rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
  .nav-links li {
    width: 100%;
  }
  .nav-links a.nav-cta {
    margin-top: 0.5rem;
    text-align: center;
  }

  .nav-logo .logo-img {
    height: clamp(2rem, 8vw, 2.35rem);
  }

  .theme-toggle,
  .nav-toggle {
    width: 2.5rem;
    height: 2.5rem;
    touch-action: manipulation;
  }

  /* Grids */
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }

  /* Hero */
  .hero {
    min-height: auto;
    padding: calc(var(--nav-height) + 1.75rem) 0 3rem;
  }
  .hero-logo {
    margin-bottom: 1.5rem;
  }
  .hero-stats {
    gap: 1.25rem;
  }
  .stat-value {
    font-size: 1.625rem;
  }

  /* Callout */
  .callout {
    padding: 1.5rem;
  }

  /* Cards */
  .card {
    padding: 1.5rem;
  }
  .card-compact {
    padding: 1.25rem;
  }
  .card-compact p {
    font-size: 0.875rem;
  }
  .feature-card {
    padding: 1.5rem;
  }
  .feature-card p {
    font-size: 0.875rem;
  }

  /* Architecture */
  .arch-diagram {
    max-width: 100%;
  }
  .arch-layer {
    padding: 0.75rem 0.875rem;
  }
  .arch-blocks {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
  }
  .arch-blocks .arch-block {
    max-width: none;
  }
  .arch-block {
    min-width: 0;
    padding: 0.4375rem 0.625rem;
    font-size: 0.75rem;
    word-break: break-word;
  }
  .arch-stat {
    font-size: 0.5rem;
  }
  .arch-layer-stat {
    display: block;
    margin-left: 0;
    font-size: 0.5625rem;
  }
  .arch-hint {
    font-size: 0.5625rem;
  }

  /* Threat and tier cards */
  .threat-card {
    padding: 1.25rem 1.5rem;
  }
  .threat-card ul li {
    font-size: 0.875rem;
  }
  .tier {
    padding: 1.25rem 1.5rem;
  }
  .tier p {
    font-size: 0.875rem;
  }

  /* Tables */
  .comparison-table,
  .data-table {
    font-size: 0.8125rem;
  }
  .comparison-table th,
  .comparison-table td,
  .data-table th,
  .data-table td {
    padding: 0.625rem 0.75rem;
  }
  .comparison-table td:first-child {
    font-size: 0.8125rem;
  }

  /* File tree */
  .file-tree {
    padding: 1.5rem;
    font-size: 0.75rem;
    overflow-x: auto;
  }
  .tree-group {
    margin-left: 1rem;
  }
  .tree-children {
    margin-left: 1rem;
    padding-left: 0.75rem;
  }

  /* Steps */
  .step {
    gap: 1rem;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@supports not (content-visibility: auto) {
  .section,
  .card {
    content-visibility: visible;
    contain-intrinsic-size: auto;
  }
}

@media (max-width: 30rem) {
  .hero-stats {
    flex-direction: column;
    gap: 1rem;
  }
  .stat {
    flex-direction: row;
    gap: 0.75rem;
    min-width: auto;
  }
  .stat-value {
    font-size: 1.5rem;
    min-width: 5rem;
    text-align: right;
  }
  .stat-label {
    margin-top: 0;
    text-align: left;
  }

  /* Architecture: single column on very small screens */
  .arch-blocks {
    grid-template-columns: 1fr;
  }
  .arch-layer {
    padding: 0.625rem 0.75rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
  .btn {
    width: 100%;
    justify-content: center;
    max-width: 16rem;
  }

  .timeline {
    padding-left: 1.5rem;
  }
  .timeline-item {
    padding-left: 1rem;
  }

  /* Comparison table: stack vertically on very small screens */
  .comparison-table th:nth-child(2),
  .comparison-table td:nth-child(2) {
    display: none;
  }

}

/* --- Accessibility --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
  .math-bg-layer {
    transition: none !important;
  }
}

@media (prefers-reduced-data: reduce) {
  .math-bg-layer {
    display: none;
  }
}

/* Focus styles */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: rgba(91, 160, 245, 0.3);
  color: var(--heading);
}
[data-theme="light"] ::selection {
  background: rgba(43, 111, 208, 0.22);
  color: var(--heading);
}

/* --- Live Data Transitions --- */
[data-live] {
  transition: opacity 0.3s;
}

/* Tier scripts as links */
a.tier-script {
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}
a.tier-script:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* --- Print --- */
@media print {
  --print-bg: #fff;
  --print-fg: #222;
  --print-muted: #333;
  --print-border: #ccc;
  --print-surface: #f5f5f5;

  .nav, .hero-bg, .skip-link, #bg-canvas-wrap {
    display: none;
  }
  body {
    background: var(--print-bg, #fff);
    color: var(--print-fg, #222);
  }
  .hero {
    min-height: auto;
    padding: 2rem 0;
  }
  .section, .section-alt {
    background: var(--print-bg, #fff);
    padding: 1.5rem 0;
  }
  a { color: var(--print-fg, #222); }
  code { background: var(--print-surface, #f5f5f5); color: var(--print-muted, #333); }
  pre { border-color: var(--print-border, #ccc); background: #f9f9f9; }
  .card, .feature-card, .tier, .threat-card, .quality-card {
    border-color: var(--print-border, #ccc);
    background: var(--print-bg, #fff);
  }
  .comparison-table, .data-table {
    background: var(--print-bg, #fff);
    border-color: var(--print-border, #ccc);
  }
  .comparison-table th, .data-table th {
    background: var(--print-surface, #f5f5f5);
  }
  .lang-switcher-menu {
    background: var(--print-bg, #fff);
    border-color: var(--print-border, #ccc);
  }
  .lang-switcher-menu li.active {
    color: var(--accent);
  }
}

/* ── Language Switcher ───────────────────────────────────── */

.lang-switcher {
  position: relative;
  display: flex;
  align-items: center;
}

.lang-switcher-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  height: 2.25rem;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  flex-shrink: 0;
  touch-action: manipulation;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.lang-switcher-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

.lang-switcher-btn .icon-globe {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

.lang-switcher-label {
  line-height: 1;
}

.lang-switcher-menu {
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  min-width: 9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0;
  list-style: none;
  margin: 0;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.lang-switcher-menu li {
  padding: 0.5rem 0.875rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.lang-switcher-menu li:hover,
.lang-switcher-menu li:focus {
  background: var(--accent-glow);
}
.lang-switcher-menu li:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.lang-switcher-menu li.active {
  color: var(--accent);
  font-weight: 600;
}

.lang-switcher-menu li[aria-selected="true"]::before {
  content: "\2713\00a0";
}
