:root {
  --bg: #0a0e27;
  --bg-alt: #0d1230;
  --fg: #f5f5f5;
  --fg-dim: #a3a9c2;
  --accent: #00d4ff;
  --accent-dim: #0891b2;
  --accent2: #a78bfa;
  --accent2-dim: #7c5cf0;
  --border: #1c2244;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --prose: 760px;
  --wide: 1100px;
  --card-bg: rgba(11, 15, 40, 0.88);
  --card-blur: blur(14px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Static CSS gradient fallback — always present. The 3D particle field
     (#bg3d canvas) renders on top of this when WebGL/motion/viewport allow;
     when it doesn't, this gradient alone is the backdrop. */
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(167, 139, 250, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 45% at 88% 20%, rgba(0, 212, 255, 0.09), transparent 60%),
    radial-gradient(ellipse 65% 55% at 50% 100%, rgba(139, 92, 246, 0.07), transparent 60%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
}

/* Persistent full-page 3D backdrop. Fixed so it never scrolls with content;
   sits behind everything via negative z-index. Left untouched by bg3d.js
   (transparent) when WebGL/reduced-motion/mobile checks fail, so the body
   gradient above shows through unobstructed. */
#bg3d {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  display: block;
  /* keep the field well behind text contrast-wise — restrained, not busy */
  opacity: 0.55;
}

.wrap {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 24px;
}

/* narrower column for prose-only sections/elements */
.wrap-prose {
  max-width: var(--prose);
  margin: 0 auto;
  padding: 0 24px;
}

header.hero {
  position: relative;
  overflow: hidden;
  padding: 96px 0 64px;
  border-bottom: 1px solid var(--border);
}

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

.kicker {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

h1 {
  font-size: clamp(2.75rem, 7.5vw, 5.25rem);
  line-height: 1.02;
  margin: 0 0 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.lede {
  font-size: 1.15rem;
  color: var(--fg-dim);
  max-width: var(--prose);
  margin: 0 0 32px;
}

.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, color 0.15s ease;
}

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

.btn.primary:hover {
  background: #33ddff;
}

.btn.ghost {
  color: var(--fg);
}

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

section {
  padding: 64px 0;
  border-bottom: 1px solid var(--border);
}

section:last-of-type {
  border-bottom: none;
}

h2 {
  font-size: 1.6rem;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.section-label {
  font-family: var(--mono);
  color: var(--accent-dim);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

p {
  color: var(--fg-dim);
  max-width: var(--prose);
}

.problem-box {
  background: var(--card-bg);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 24px 28px;
  max-width: var(--prose);
}

.problem-box p {
  margin: 0;
  color: var(--fg);
}

.layers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.layer-card {
  position: relative;
  background: var(--card-bg);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
  transition: border-color 0.3s ease, box-shadow 0.6s ease;
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.05), 0 0 18px rgba(139, 92, 246, 0.05);
}

/* subtle animated glow once a layer-card is scrolled into view */
.layer-card.lc-glow {
  animation: lcPulse 4.5s ease-in-out infinite;
}

@keyframes lcPulse {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.12), 0 0 20px rgba(139, 92, 246, 0.1);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.2), 0 0 30px rgba(0, 212, 255, 0.16);
  }
}

.layer-card:hover {
  border-color: var(--accent2);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.3), 0 0 36px rgba(0, 212, 255, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  .layer-card.lc-glow {
    animation: none;
  }
}

.layer-card .num {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.85rem;
}

.layer-card h3 {
  margin: 8px 0 8px;
  font-size: 1.05rem;
}

.layer-card p {
  margin: 0;
  font-size: 0.92rem;
}

/* ---------- scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- flow diagram ---------- */

.flow-diagram {
  margin-top: 40px;
}

.flow-chain {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: 620px;
}

.flow-step {
  background: var(--card-bg);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
}

.flow-step-final {
  border-color: var(--accent-dim);
}

.flow-step-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.flow-step-sub {
  color: var(--fg-dim);
  font-size: 0.82rem;
  margin-top: 4px;
}

.flow-arrow {
  align-self: center;
  width: 2px;
  height: 22px;
  background: var(--border);
  position: relative;
}

.flow-arrow::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--border);
}

.flow-branch {
  margin: 14px 0 0 24px;
  padding: 2px 0 2px 18px;
  border-left: 2px dashed rgba(255, 180, 84, 0.45);
}

.flow-branch-line {
  display: none;
}

.flow-branch-box {
  display: inline-block;
  background: rgba(255, 180, 84, 0.08);
  border: 1px solid rgba(255, 180, 84, 0.35);
  border-radius: 6px;
  padding: 10px 16px;
}

.flow-branch-title {
  color: #ffb454;
  font-weight: 600;
  font-size: 0.85rem;
}

.flow-branch-sub {
  color: rgba(255, 180, 84, 0.8);
  font-size: 0.78rem;
  margin-top: 2px;
}

/* ---------- private -> proven interaction ---------- */

.reveal-demo {
  margin-top: 48px;
  background: var(--card-bg);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 32px;
}

.rd-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
}

.rd-data {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-dim);
  filter: blur(3px);
  opacity: 0.55;
  transition: filter 0.7s ease, opacity 0.7s ease;
  user-select: none;
}

.rd-row {
  letter-spacing: 0.02em;
}

.rd-badge {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.6s ease 0.1s, transform 0.6s ease 0.1s;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 18px 26px;
  box-shadow: 0 0 32px rgba(0, 212, 255, 0.1), 0 0 56px rgba(167, 139, 250, 0.08);
}

.reveal-demo.is-active .rd-data,
.reveal-demo:hover .rd-data {
  filter: blur(1px);
  opacity: 0.2;
}

.reveal-demo.is-active .rd-badge,
.reveal-demo:hover .rd-badge {
  opacity: 1;
  transform: scale(1);
}

.rd-check-circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  transition: stroke-dashoffset 0.5s ease 0.2s;
}

.rd-check-mark {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  transition: stroke-dashoffset 0.4s ease 0.5s;
}

.reveal-demo.is-active .rd-check-circle,
.reveal-demo:hover .rd-check-circle {
  stroke-dashoffset: 0;
}

.reveal-demo.is-active .rd-check-mark,
.reveal-demo:hover .rd-check-mark {
  stroke-dashoffset: 0;
}

.rd-badge-title {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 0.9rem;
  white-space: nowrap;
}

.rd-badge-sub {
  color: var(--fg-dim);
  font-size: 0.8rem;
  margin-top: 4px;
}

.rd-caption {
  margin: 24px auto 0;
  font-size: 0.82rem;
  color: var(--fg-dim);
  text-align: center;
  max-width: 460px;
}

@media (prefers-reduced-motion: reduce) {
  .rd-data,
  .rd-badge,
  .rd-check-circle,
  .rd-check-mark {
    transition: none;
  }
}

/* ---------- comparison table ---------- */

.compare-table {
  margin-top: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.compare-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.3fr;
}

.compare-row + .compare-row {
  border-top: 1px solid var(--border);
}

.compare-head {
  background: var(--card-bg);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  font-family: var(--mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
}

.compare-cell {
  padding: 14px 18px;
  font-size: 0.88rem;
  color: var(--fg);
}

.compare-approach {
  font-weight: 600;
}

.compare-tag {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--fg-dim);
  font-weight: 400;
  margin-top: 3px;
}

.compare-yes {
  color: #a3f7bf;
}

.compare-no {
  color: var(--fg-dim);
}

.gap-callout {
  margin-top: 32px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 28px 32px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.07), rgba(139, 92, 246, 0.05));
  max-width: var(--prose);
}

.gap-callout p {
  margin: 0;
  color: var(--fg);
  font-size: 1.15rem;
  line-height: 1.5;
  max-width: none;
}

.gap-callout em {
  color: var(--accent);
  font-style: normal;
  font-weight: 600;
}

@media (max-width: 700px) {
  .compare-head {
    display: none;
  }
  .compare-row {
    grid-template-columns: 1fr;
    padding: 16px 18px;
    row-gap: 4px;
  }
  .compare-cell {
    padding: 3px 0;
  }
  .compare-cell.compare-yes::before {
    content: '✓ Proves: ';
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.7rem;
  }
  .compare-cell.compare-no::before {
    content: '✗ Can\'t answer: ';
    color: #ff8a8a;
    font-family: var(--mono);
    font-size: 0.7rem;
  }
}

/* ---------- roadmap timeline ---------- */

.timeline {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  max-width: 620px;
}

.timeline-item {
  display: flex;
  gap: 20px;
  position: relative;
  padding-bottom: 28px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item.done:not(:last-child)::before {
  background: var(--accent-dim);
}

.timeline-node {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--fg-dim);
  background: var(--bg);
  position: relative;
  z-index: 1;
}

.timeline-item.done .timeline-node {
  border-color: var(--accent);
  background: var(--accent);
  color: #001018;
  font-weight: 700;
}

.timeline-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fg-dim);
}

.timeline-item.done .timeline-title {
  color: var(--fg);
}

.timeline-sub {
  font-size: 0.8rem;
  color: var(--fg-dim);
  margin-top: 2px;
}

pre {
  background: #060814;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 22px;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.6;
  max-width: var(--prose);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

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

.tok-kw { color: #ff79c6; }
.tok-str { color: #a3f7bf; }
.tok-fn { color: var(--accent); }
.tok-com { color: #6b7394; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #ffb454;
  background: rgba(255, 180, 84, 0.08);
  border: 1px solid rgba(255, 180, 84, 0.35);
  border-radius: 20px;
  padding: 6px 14px;
  margin-bottom: 20px;
}

ul.status-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: var(--prose);
}

ul.status-list li {
  color: var(--fg-dim);
  padding: 10px 0 10px 24px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

ul.status-list li:last-child {
  border-bottom: none;
}

ul.status-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.link-card {
  display: block;
  text-decoration: none;
  background: var(--card-bg);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  color: var(--fg);
  transition: border-color 0.15s ease;
}

.link-card:hover {
  border-color: var(--accent);
}

.link-card .link-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.link-card .link-sub {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--fg-dim);
}

footer {
  padding: 40px 0 60px;
  text-align: center;
}

footer p {
  margin: 0 auto;
  font-size: 0.85rem;
  color: var(--fg-dim);
}

footer a {
  color: var(--accent);
}

a {
  color: var(--accent);
}

/* ---------- scrambled -> proven stat hover ---------- */

.scramble {
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: default;
  display: inline-block;
}

@media (prefers-reduced-motion: reduce) {
  .scramble {
    cursor: text;
  }
}

@media (max-width: 600px) {
  header.hero {
    padding: 64px 0 48px;
  }
  section {
    padding: 48px 0;
  }
  pre {
    font-size: 0.76rem;
    padding: 16px;
  }
  .reveal-demo {
    padding: 28px 20px;
  }
  .rd-badge {
    flex-direction: column;
    text-align: center;
    gap: 10px;
    padding: 20px;
  }
  .rd-badge-title {
    white-space: normal;
  }
}
