/* =====================================================
   Cenosis — Main Styles
   ===================================================== */

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

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

body {
  font-family: var(--font-sans);
  background-color: var(--clr-bg);
  color: var(--clr-text);
  line-height: var(--leading-normal);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
ul, ol { list-style: none; }

/* --- Utility --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}
.container--wide {
  max-width: var(--max-width-wide);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity var(--duration-xslow) var(--ease-out),
              transform var(--duration-xslow) var(--ease-out);
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }
.reveal-delay-3 { transition-delay: 300ms; }
.reveal-delay-4 { transition-delay: 400ms; }
.reveal-delay-5 { transition-delay: 500ms; }
.reveal-delay-6 { transition-delay: 600ms; }

/* =====================================================
   Navigation
   ===================================================== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out);
}
.nav.scrolled {
  background: hsla(225, 22%, 6%, 0.92);
  backdrop-filter: blur(20px);
  border-color: var(--clr-border-soft);
}

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

.nav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.nav__logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: var(--radius-full);
}
.nav__logo-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--clr-green-bright), var(--clr-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}
.nav__link {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--clr-text-muted);
  letter-spacing: 0.01em;
  transition: color var(--duration-fast);
}
.nav__link:hover { color: var(--clr-text); }

.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* Hamburger */
.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: var(--space-2);
}
.nav__toggle span {
  display: block;
  height: 2px;
  background: var(--clr-text);
  border-radius: 2px;
  transition: transform var(--duration-base), opacity var(--duration-base);
}

/* Mobile nav */
.nav__mobile {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0; right: 0;
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  padding: var(--space-6);
  flex-direction: column;
  gap: var(--space-4);
  z-index: 99;
}
.nav__mobile.open { display: flex; }
.nav__mobile .nav__link {
  font-size: var(--text-base);
  color: var(--clr-text);
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
  transition: all var(--duration-base) var(--ease-out);
  white-space: nowrap;
}

.btn--primary {
  background: linear-gradient(135deg, var(--clr-green), var(--clr-green-bright));
  color: hsl(225, 22%, 6%);
  box-shadow: var(--shadow-green-sm);
}
.btn--primary:hover {
  background: linear-gradient(135deg, var(--clr-green-bright), var(--clr-green-glow));
  box-shadow: var(--shadow-green-glow);
  transform: translateY(-2px);
}

.btn--primary-lg {
  padding: var(--space-4) var(--space-10);
  font-size: var(--text-base);
}

.btn--ghost {
  background: transparent;
  color: var(--clr-text-muted);
  border: 1px solid var(--clr-border);
}
.btn--ghost:hover {
  background: var(--clr-surface);
  border-color: var(--clr-border-soft);
  color: var(--clr-text);
}

.btn--outline-green {
  background: transparent;
  color: var(--clr-green-bright);
  border: 1px solid var(--clr-green);
}
.btn--outline-green:hover {
  background: var(--clr-accent-dim);
  box-shadow: var(--shadow-green-sm);
}

/* =====================================================
   Hero
   ===================================================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: var(--nav-height);
}

/* Animated background canvas */
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Radial glow behind logo */
.hero__glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    hsla(138, 60%, 42%, 0.12) 0%,
    hsla(38, 80%, 50%, 0.06) 35%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

.hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: var(--space-16);
  padding: var(--space-24) 0;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4) var(--space-1) var(--space-2);
  background: var(--clr-accent-dim);
  border: 1px solid var(--clr-green-dim);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--clr-green-bright);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-6);
}
.hero__badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--clr-green-bright);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

.hero__title {
  font-size: clamp(2.5rem, 5vw, var(--text-7xl));
  font-weight: var(--weight-black);
  line-height: var(--leading-tight);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-6);
}

.hero__title-line {
  display: block;
}
.hero__title-accent {
  background: linear-gradient(135deg, var(--clr-green-bright) 0%, var(--clr-amber) 60%, var(--clr-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  font-size: var(--text-xl);
  color: var(--clr-text-muted);
  line-height: var(--leading-relaxed);
  max-width: 520px;
  margin-bottom: var(--space-10);
}

.hero__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.hero__visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}

.hero__logo-wrap {
  position: relative;
  width: 440px;
  height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero__logo-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid;
  animation: spin-ring linear infinite;
}
.hero__logo-ring--1 {
  inset: -20px;
  border-color: hsla(138, 60%, 42%, 0.2);
  animation-duration: 20s;
}
.hero__logo-ring--2 {
  inset: -44px;
  border-color: hsla(38, 80%, 50%, 0.12);
  animation-duration: 32s;
  animation-direction: reverse;
  border-style: dashed;
}
.hero__logo-ring--3 {
  inset: -68px;
  border-color: hsla(185, 70%, 50%, 0.08);
  animation-duration: 48s;
}
@keyframes spin-ring {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.hero__logo-img {
  width: 360px;
  height: 360px;
  object-fit: contain;
  filter: drop-shadow(0 0 40px hsla(138, 70%, 45%, 0.4))
          drop-shadow(0 0 80px hsla(38, 90%, 55%, 0.2));
  animation: float 6s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

.hero__logo-caption {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--clr-green-bright), var(--clr-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__stats {
  display: flex;
  gap: var(--space-8);
  margin-top: var(--space-12);
  padding-top: var(--space-10);
  border-top: 1px solid var(--clr-border-soft);
}
.hero__stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--clr-green-bright);
  display: block;
}
.hero__stat-label {
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: var(--space-1);
}

/* =====================================================
   Section Styles
   ===================================================== */
section {
  padding: var(--space-32) 0;
}

.section-label {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--clr-green-bright);
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  font-weight: var(--weight-extrabold);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-6);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--clr-text-muted);
  line-height: var(--leading-relaxed);
  max-width: var(--max-width-text);
}

.section-header {
  margin-bottom: var(--space-16);
}
.section-header--center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* =====================================================
   Problem Section
   ===================================================== */
.problem {
  background: var(--clr-bg-alt);
  border-top: 1px solid var(--clr-border-soft);
  border-bottom: 1px solid var(--clr-border-soft);
}

.problem__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  margin-top: var(--space-12);
}

.problem-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  position: relative;
  overflow: hidden;
  transition: border-color var(--duration-base), box-shadow var(--duration-base);
}
.problem-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, hsla(0, 70%, 50%, 0.05) 0%, transparent 60%);
  pointer-events: none;
}
.problem-card:hover {
  border-color: hsl(0, 60%, 40%);
  box-shadow: 0 0 20px hsla(0, 60%, 40%, 0.1);
}

.problem-card__title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-3);
  color: hsl(0, 70%, 72%);
}
.problem-card__body {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  line-height: var(--leading-relaxed);
}

/* =====================================================
   How It Works
   ===================================================== */
.how {
  position: relative;
}

.lod-diagram {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  margin: var(--space-16) 0;
  position: relative;
}

.lod-diagram::before {
  content: '';
  position: absolute;
  top: 50%;
  left: calc(33.33% - 20px);
  right: calc(33.33% - 20px);
  height: 2px;
  background: linear-gradient(90deg, var(--clr-green-dim), var(--clr-amber-dim), var(--clr-cyan-dim));
  transform: translateY(-50%);
  z-index: 0;
}

.lod-card {
  position: relative;
  z-index: 1;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base);
}
.lod-card:hover {
  transform: translateY(-6px);
}

.lod-card--fs {
  border-color: var(--clr-green-dim);
  background: linear-gradient(160deg, var(--clr-surface) 60%, hsla(138, 50%, 30%, 0.15));
}
.lod-card--fs:hover { box-shadow: var(--shadow-green-glow); }

.lod-card--ss {
  border-color: var(--clr-amber-dim);
  background: linear-gradient(160deg, var(--clr-surface) 60%, hsla(38, 60%, 35%, 0.12));
}
.lod-card--ss:hover { box-shadow: 0 0 32px hsla(38, 80%, 50%, 0.2); }

.lod-card--macro {
  border-color: var(--clr-cyan-dim);
  background: linear-gradient(160deg, var(--clr-surface) 60%, hsla(185, 60%, 40%, 0.12));
}
.lod-card--macro:hover { box-shadow: 0 0 32px hsla(185, 80%, 50%, 0.15); }

.lod-card__tier {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
}
.lod-card--fs .lod-card__tier  { background: var(--clr-accent-dim); color: var(--clr-green-bright); }
.lod-card--ss .lod-card__tier  { background: var(--clr-amber-dim); color: var(--clr-amber); }
.lod-card--macro .lod-card__tier { background: var(--clr-cyan-dim); color: var(--clr-cyan); }

.lod-card__title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-2);
}
.lod-card__cost {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--clr-text-muted);
  margin-bottom: var(--space-4);
}
.lod-card__body {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  line-height: var(--leading-relaxed);
}

/* =====================================================
   Features
   ===================================================== */
.features {
  background: var(--clr-bg-alt);
}

.features__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.feature-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  transition: all var(--duration-base) var(--ease-out);
  cursor: default;
}
.feature-card:hover {
  border-color: var(--clr-green-dim);
  transform: translateY(-4px);
  box-shadow: var(--shadow-green-sm), var(--shadow-md);
}

.feature-card__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-3);
}
.feature-card__body {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  line-height: var(--leading-relaxed);
}

/* =====================================================
   Stats Counter Section
   ===================================================== */
.stats {
  background: var(--clr-bg);
  text-align: center;
  border-top: 1px solid var(--clr-border-soft);
  border-bottom: 1px solid var(--clr-border-soft);
}

.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-8);
  margin-top: var(--space-16);
}

.stat-item {
  padding: var(--space-8);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
  transition: border-color var(--duration-base), box-shadow var(--duration-base);
}
.stat-item:hover {
  border-color: var(--clr-green-dim);
  box-shadow: var(--shadow-green-sm);
}

.stat-item__value {
  font-size: var(--text-4xl);
  font-weight: var(--weight-black);
  background: linear-gradient(135deg, var(--clr-green-bright), var(--clr-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
  line-height: 1;
  margin-bottom: var(--space-3);
}
.stat-item__label {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  font-weight: var(--weight-medium);
}

/* =====================================================
   Architecture Diagram
   ===================================================== */
.architecture {
  background: var(--clr-bg-alt);
}

.arch-diagram {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  line-height: 1.8;
  overflow-x: auto;
  margin-top: var(--space-8);
}

.arch-layers {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-8);
}

.arch-layer {
  display: flex;
  align-items: stretch;
  gap: var(--space-3);
}

.arch-layer__label {
  width: 120px;
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--clr-text-faint);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: var(--space-4);
}

.arch-layer__boxes {
  flex: 1;
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.arch-box {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: var(--weight-medium);
  border: 1px solid;
  white-space: nowrap;
}

.arch-box--host   { background: hsla(220,60%,50%,0.1); border-color: hsla(220,60%,50%,0.3); color: hsl(220,80%,75%); }
.arch-box--ffi    { background: hsla(280,60%,50%,0.1); border-color: hsla(280,60%,50%,0.3); color: hsl(280,80%,80%); }
.arch-box--runtime{ background: hsla(138,60%,40%,0.1); border-color: hsla(138,60%,40%,0.3); color: var(--clr-green-bright); }
.arch-box--social { background: hsla(200,60%,50%,0.1); border-color: hsla(200,60%,50%,0.3); color: hsl(200,80%,75%); }
.arch-box--cog    { background: hsla(38,70%,50%,0.1); border-color: hsla(38,70%,50%,0.3); color: var(--clr-amber); }
.arch-box--store  { background: hsla(260,60%,50%,0.1); border-color: hsla(260,60%,50%,0.3); color: hsl(260,80%,80%); }
.arch-box--common { background: var(--clr-surface-2); border-color: var(--clr-border); color: var(--clr-text-muted); }

/* =====================================================
   Code Tabs
   ===================================================== */
.code-section {
  background: var(--clr-bg);
}

.code-tabs {
  margin-top: var(--space-10);
}

.code-tabs__nav {
  display: flex;
  gap: var(--space-2);
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}

.code-tab-btn {
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--clr-text-muted);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-bottom: none;
  transition: all var(--duration-fast);
}
.code-tab-btn.active {
  background: var(--clr-surface-2);
  color: var(--clr-green-bright);
  border-color: var(--clr-green-dim);
}
.code-tab-btn:hover:not(.active) {
  color: var(--clr-text);
  background: var(--clr-surface-2);
}

.code-tabs__panel {
  display: none;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: var(--space-8);
  overflow-x: auto;
}
.code-tabs__panel.active { display: block; }

.code-tabs__panel pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--clr-text);
}

/* Syntax-ish coloring */
.token-keyword  { color: var(--clr-green-bright); }
.token-type     { color: var(--clr-cyan); }
.token-string   { color: var(--clr-amber); }
.token-comment  { color: var(--clr-text-faint); font-style: italic; }
.token-fn       { color: hsl(200, 80%, 75%); }
.token-num      { color: hsl(280, 80%, 80%); }

/* =====================================================
   Roadmap / Timeline
   ===================================================== */
.roadmap {
  background: var(--clr-bg-alt);
}

.timeline {
  position: relative;
  margin-top: var(--space-16);
  padding: var(--space-4) 0;
}

.timeline__track {
  position: absolute;
  left: 20px;
  top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--clr-green-dim), var(--clr-amber-dim), var(--clr-cyan-dim));
}

.timeline__items {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding-left: 60px;
}

.timeline-item {
  position: relative;
  display: flex;
  gap: var(--space-6);
  align-items: flex-start;
}

.timeline-item__dot {
  position: absolute;
  left: -48px;
  top: 8px;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid;
  background: var(--clr-bg);
  flex-shrink: 0;
}
.timeline-item.reached .timeline-item__dot {
  background: var(--clr-green-bright);
  border-color: var(--clr-green-bright);
  box-shadow: 0 0 10px var(--clr-green-bright);
}
.timeline-item.current .timeline-item__dot {
  background: var(--clr-amber);
  border-color: var(--clr-amber);
  box-shadow: var(--shadow-amber-glow);
  animation: pulse-dot 2s ease-in-out infinite;
}
.timeline-item.future .timeline-item__dot {
  border-color: var(--clr-border);
}

.timeline-item__version {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  color: var(--clr-text-faint);
  min-width: 44px;
  padding-top: 6px;
}
.timeline-item.reached .timeline-item__version { color: var(--clr-green); }
.timeline-item.current .timeline-item__version { color: var(--clr-amber); }

.timeline-item__content {}
.timeline-item__name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
}
.timeline-item__desc {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
}

/* =====================================================
   Docs CTA Strip
   ===================================================== */
.docs-cta {
  background: linear-gradient(135deg,
    hsla(138, 40%, 18%, 0.8) 0%,
    hsla(225, 22%, 8%, 1) 50%,
    hsla(185, 40%, 15%, 0.8) 100%);
  border-top: 1px solid var(--clr-green-dim);
  border-bottom: 1px solid var(--clr-green-dim);
}

.docs-cta__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.docs-cta__text {}
.docs-cta__title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  margin-bottom: var(--space-3);
}
.docs-cta__body {
  font-size: var(--text-lg);
  color: var(--clr-text-muted);
  max-width: 500px;
}

.docs-cta__actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* =====================================================
   Waitlist Modal
   ===================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--clr-surface);
  border: 1px solid var(--clr-green-dim);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-green-glow), var(--shadow-xl);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--duration-slow) var(--ease-out);
}
.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--clr-surface-2);
  color: var(--clr-text-muted);
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}
.modal { position: relative; }
.modal__close:hover { background: var(--clr-border); color: var(--clr-text); }

.modal__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.modal__logo img {
  width: 48px; height: 48px;
  object-fit: contain;
  border-radius: var(--radius-full);
}
.modal__logo-name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  background: linear-gradient(135deg, var(--clr-green-bright), var(--clr-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal__title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  margin-bottom: var(--space-2);
}
.modal__subtitle {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  margin-bottom: var(--space-8);
  line-height: var(--leading-relaxed);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.form-group label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--clr-text-muted);
}
.form-group input, .form-group select {
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--clr-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  transition: border-color var(--duration-fast);
  width: 100%;
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--clr-green);
  box-shadow: 0 0 0 3px hsla(138,60%,42%,0.15);
}
.form-group select option { background: var(--clr-surface); }

.form__submit {
  width: 100%;
  margin-top: var(--space-2);
  padding: var(--space-4);
  font-size: var(--text-base);
}

/* Submit button loading state */
.form__submit { position: relative; }
.form__spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid hsla(225, 22%, 6%, 0.35);
  border-top-color: hsl(225, 22%, 6%);
  border-radius: 50%;
  animation: form-spin 0.7s linear infinite;
}
.form__submit.is-loading .form__submit-label { opacity: 0.5; }
.form__submit.is-loading .form__spinner { display: inline-block; }
.form__submit:disabled { cursor: progress; }
@keyframes form-spin { to { transform: rotate(360deg); } }

.form__error {
  display: none;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: hsl(0, 70%, 72%);
  background: hsla(0, 60%, 50%, 0.08);
  border: 1px solid hsla(0, 60%, 50%, 0.3);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  line-height: var(--leading-snug);
}
.form__error.visible { display: block; }

.form__success {
  display: none;
  text-align: center;
  padding: var(--space-8) 0;
}
.form__success.visible { display: block; }
.form__success-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}
.form__success-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-2);
  color: var(--clr-green-bright);
}
.form__success-body {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
}

/* =====================================================
   Footer
   ===================================================== */
.footer {
  background: var(--clr-bg-alt);
  border-top: 1px solid var(--clr-border-soft);
  padding: var(--space-16) 0 var(--space-10);
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-12);
  margin-bottom: var(--space-16);
}

.footer__brand {}
.footer__brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.footer__brand-logo img {
  width: 36px; height: 36px;
  object-fit: contain;
  border-radius: var(--radius-full);
}
.footer__brand-name {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  background: linear-gradient(135deg, var(--clr-green-bright), var(--clr-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.footer__brand-desc {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  line-height: var(--leading-relaxed);
}

.footer__col-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--clr-text);
  margin-bottom: var(--space-4);
  letter-spacing: 0.03em;
}
.footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.footer__link {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  transition: color var(--duration-fast);
}
.footer__link:hover { color: var(--clr-green-bright); }

.footer__bottom {
  padding-top: var(--space-8);
  border-top: 1px solid var(--clr-border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.footer__copy {
  font-size: var(--text-xs);
  color: var(--clr-text-faint);
}
.footer__legal {
  display: flex;
  gap: var(--space-6);
}
.footer__legal a {
  font-size: var(--text-xs);
  color: var(--clr-text-faint);
  transition: color var(--duration-fast);
}
.footer__legal a:hover { color: var(--clr-text-muted); }

/* =====================================================
   Live Demo
   ===================================================== */
.demo {
  background: var(--clr-bg);
  border-top: 1px solid var(--clr-border-soft);
  border-bottom: 1px solid var(--clr-border-soft);
}

.demo-stage {
  position: relative;
  margin-top: var(--space-12);
  height: 480px;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 50% 50%, hsla(138, 50%, 30%, 0.10), transparent 70%),
    var(--clr-bg-alt);
  box-shadow: var(--shadow-lg);
  cursor: crosshair;
}

.demo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.demo-hud {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  background: hsla(225, 22%, 6%, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--clr-border-soft);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  pointer-events: none;
}
.demo-hud__row { display: flex; justify-content: space-between; gap: var(--space-6); }
.demo-hud__k { color: var(--clr-text-faint); letter-spacing: 0.04em; }
.demo-hud__k--fs     { color: var(--clr-green-bright); }
.demo-hud__k--ss     { color: var(--clr-text-muted); }
.demo-hud__k--gossip { color: var(--clr-amber); }
.demo-hud__v { color: var(--clr-text); font-weight: var(--weight-semibold); }

.demo-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4) var(--space-8);
  margin-top: var(--space-8);
}
.demo-legend__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
}
.demo-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.demo-dot--ss     { background: var(--clr-green); }
.demo-dot--fs     { background: var(--clr-amber); box-shadow: 0 0 8px var(--clr-amber); }
.demo-dot--gossip { background: transparent; border: 2px solid var(--clr-amber); }
.demo-dot--player { background: hsla(185, 85%, 50%, 0.25); border: 2px solid var(--clr-cyan); }

.demo-caption {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--text-xs);
  color: var(--clr-text-faint);
  font-style: italic;
}
.demo-caption a { color: var(--clr-text-muted); text-decoration: underline; }
.demo-caption a:hover { color: var(--clr-green-bright); }

/* =====================================================
   Cognition Flywheel
   ===================================================== */
.flywheel {
  background: var(--clr-bg);
}

.flywheel__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-12);
}

.flywheel-step {
  position: relative;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-top: 2px solid var(--clr-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6) var(--space-6);
  overflow: hidden;
  transition: transform var(--duration-base) var(--ease-out), box-shadow var(--duration-base);
}
.flywheel-step:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.flywheel-step--1 { border-top-color: var(--clr-green); }
.flywheel-step--2 { border-top-color: var(--clr-amber); }
.flywheel-step--3 { border-top-color: var(--clr-cyan); }
.flywheel-step--4 { border-top-color: var(--clr-green-bright); }

.flywheel-step__idx {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--clr-text-faint);
  opacity: 0.5;
}
.flywheel-step--1 .flywheel-step__idx { color: var(--clr-green); }
.flywheel-step--2 .flywheel-step__idx { color: var(--clr-amber); }
.flywheel-step--3 .flywheel-step__idx { color: var(--clr-cyan); }
.flywheel-step--4 .flywheel-step__idx { color: var(--clr-green-bright); }

.flywheel-step__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  margin: var(--space-2) 0 var(--space-3);
}
.flywheel-step__body {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-5);
}
.flywheel-step__meta {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--clr-text-faint);
  letter-spacing: 0.04em;
  padding-top: var(--space-3);
  border-top: 1px solid var(--clr-border-soft);
  width: 100%;
}

.flywheel__providers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-8);
}
.flywheel__provider {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-6);
  background: var(--clr-bg-alt);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
}
.flywheel__provider-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--clr-green-bright);
}
.flywheel__provider-val {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  line-height: var(--leading-snug);
}

/* =====================================================
   Founder
   ===================================================== */
.founder {
  background: var(--clr-bg-alt);
  border-top: 1px solid var(--clr-border-soft);
}

.founder-card {
  display: flex;
  gap: var(--space-8);
  align-items: center;
  max-width: 760px;
  margin: 0 auto;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
}
.founder-card__avatar {
  flex-shrink: 0;
}
.founder-card__avatar img {
  width: 132px; height: 132px;
  object-fit: cover;
  border-radius: var(--radius-xl);
  border: 1px solid var(--clr-green-dim);
  background: var(--clr-bg);
}
.founder-card__name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  margin-bottom: var(--space-1);
}
.founder-card__role {
  font-size: var(--text-sm);
  color: var(--clr-green-bright);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-4);
}
.founder-card__bio {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-5);
}
.founder-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
}
.founder-card__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--clr-text-muted);
  transition: color var(--duration-fast);
}
.founder-card__link:hover { color: var(--clr-text); }
.founder-card__link[aria-disabled="true"] { color: var(--clr-text-faint); cursor: default; pointer-events: none; }
.founder-card__link--cta { color: var(--clr-green-bright); }
.founder-card__link--cta:hover { color: var(--clr-green-glow); }

.founder-proof {
  max-width: var(--max-width-text);
  margin: var(--space-10) auto 0;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  line-height: var(--leading-relaxed);
}
.founder-proof strong { color: var(--clr-text); }

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 1024px) {
  .features__grid { grid-template-columns: repeat(2, 1fr); }
  .stats__grid    { grid-template-columns: repeat(2, 1fr); }
  .footer__grid   { grid-template-columns: 1fr 1fr; }
  .hero__logo-wrap { width: 340px; height: 340px; }
  .hero__logo-img  { width: 280px; height: 280px; }
  .flywheel__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --nav-height: 60px; }

  .nav__links, .nav__actions .btn--ghost { display: none; }
  .nav__toggle { display: flex; }

  .hero {
    min-height: auto;
    display: block;
    padding-top: calc(var(--nav-height) + var(--space-16));
    padding-bottom: var(--space-16);
  }

  .hero__inner { grid-template-columns: 1fr; text-align: center; gap: var(--space-12); }
  .hero__subtitle { max-width: 100%; }
  .hero__actions  { justify-content: center; }
  .hero__visual   { order: -1; margin-top: var(--space-6); }
  .hero__logo-wrap { width: 240px; height: 240px; }
  .hero__logo-img  { width: 200px; height: 200px; }
  .hero__stats     { justify-content: center; gap: var(--space-6); flex-wrap: wrap; }

  .problem__grid   { grid-template-columns: 1fr; }
  .lod-diagram     { grid-template-columns: 1fr; }
  .lod-diagram::before { display: none; }
  .features__grid  { grid-template-columns: 1fr; }
  .stats__grid     { grid-template-columns: 1fr 1fr; }
  .docs-cta__inner { flex-direction: column; text-align: center; align-items: center; }
  .docs-cta__actions { justify-content: center; }
  .footer__grid    { grid-template-columns: 1fr; }

  .demo-stage      { height: 380px; }
  .demo-hud        { font-size: 0.6875rem; padding: var(--space-2) var(--space-3); }
  .flywheel__grid      { grid-template-columns: 1fr; }
  .flywheel__providers { grid-template-columns: 1fr; }
  .founder-card    { flex-direction: column; text-align: center; padding: var(--space-6); }
  .founder-card__links { justify-content: center; }
}

@media (max-width: 480px) {
  .stats__grid { grid-template-columns: 1fr; }
  .code-tabs__nav { flex-wrap: wrap; }
}

/* =====================================================
   Back-to-top button
   ===================================================== */
.back-to-top {
  position: fixed;
  bottom: var(--space-8);
  right: var(--space-8);
  z-index: 90;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-muted);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--duration-base), transform var(--duration-base), border-color var(--duration-base), color var(--duration-base);
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover {
  border-color: var(--clr-green-dim);
  color: var(--clr-green-bright);
}
