/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; background: #000000; }

/* ── VARIABLES ── */
:root {
  --bg:           #000000;
  --bg-raised:    #0a0a0a;
  --bg-card:      #111111;
  --bg-mid:       #080808;
  --border:       rgba(0, 255, 102, 0.08);
  --border-hover: rgba(0, 255, 102, 0.2);

  --green:        #00ff66;
  --green-dim:    #00cc52;
  --green-glow:   rgba(0, 255, 102, 0.15);
  --green-subtle: rgba(0, 255, 102, 0.06);

  --text:         #b0e8b0;
  --text-bright:  #f5f5f5;
  --text-muted:   #88bb88;

  --font-brand:   'JetBrains Mono', monospace;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --max-width:    1040px;
  --nav-height:   4rem;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--green); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

em { font-style: italic; color: var(--green); }

code {
  font-family: var(--font-brand);
  font-size: 0.82em;
  color: var(--green-dim);
  background: rgba(0, 255, 102, 0.05);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── NAV ── */
#site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid #1a1a1a;
  background: #000000;
  position: relative;
  z-index: 100;
}

#site-nav .nav-brand {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: #ffffff;
}
#site-nav .nav-brand:hover { color: #cc2222; }
#site-nav .nav-brand--green { color: var(--green); }
#site-nav .nav-brand--green:hover { color: var(--green); opacity: 0.8; }

#site-nav .nav-links {
  display: flex;
  gap: 1.5rem;
}

#site-nav .nav-links a {
  font-family: var(--font-brand);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #888888;
  transition: color 0.15s;
}
#site-nav .nav-links a:hover { color: #ffffff; }

/* ── BUTTONS ── */
.btn {
  display: inline-block;
  font-family: var(--font-brand);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 0.7rem 1.8rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-transform: uppercase;
}

.btn-primary {
  background: var(--green);
  color: var(--bg);
  border: 1px solid var(--green);
}
.btn-primary:hover {
  background: var(--green-dim);
  border-color: var(--green-dim);
  box-shadow: 0 0 20px var(--green-glow);
  opacity: 1;
}

.btn-ghost {
  background: rgba(0, 0, 0, 0.5);
  color: var(--text);
  border: 1px solid var(--border-hover);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
.btn-ghost:hover {
  border-color: var(--green);
  color: var(--green);
  opacity: 1;
}

.btn-lg {
  padding: 0.9rem 2.5rem;
  font-size: 0.85rem;
}

/* ── HERO ── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 34%, rgba(0, 255, 102, 0.22), transparent 0 16%),
    radial-gradient(circle at 78% 42%, rgba(70, 255, 255, 0.14), transparent 0 11%),
    radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.07), transparent 0 8%),
    linear-gradient(135deg, #010301 0%, #000000 45%, #031108 100%);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.hero::before {
  background:
    repeating-linear-gradient(
      120deg,
      transparent 0 18px,
      rgba(0, 255, 102, 0.035) 18px 19px,
      transparent 19px 38px
    );
  opacity: 0.45;
  mask-image: radial-gradient(circle at 75% 38%, rgba(0, 0, 0, 0.95), transparent 55%);
}

.hero::after {
  inset: 14% -10% auto 42%;
  height: 72%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.18), transparent 0 11%),
    radial-gradient(circle at 50% 50%, rgba(0, 255, 102, 0.24), transparent 0 28%),
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7) 72%);
  filter: blur(14px);
  opacity: 0.9;
  transform: perspective(1200px) rotateY(-22deg) rotateX(10deg);
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.hero-webgl-ready #hero-canvas {
  opacity: 1;
}

.hero-webgl-disabled #hero-canvas {
  display: none;
}

.hero-webgl-ready .hero::before {
  opacity: 0.18;
}

.hero-webgl-ready .hero::after {
  opacity: 0.3;
}

.hero-content {
  position: relative;
  z-index: 1;
  margin: 12vh max(2rem, 8vw) 0 max(2rem, 8vw);
  /* 376px target: 15px + 344px row + 15px padding + 2px border (horizontal) */
  box-sizing: border-box;
  width: min(376px, calc(100vw - 2 * max(2rem, 8vw)));
  padding: 16px 15px;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  pointer-events: none;
  background: rgba(30, 30, 30, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  box-shadow: inset 0 0 0 1px #111;
}

.hero-content a,
.hero-content button {
  pointer-events: auto;
}

.hero-copy {
  min-width: 0;
  width: 100%;
  container-type: inline-size;
  container-name: hero-copy;
}

.hero-label {
  font-family: var(--font-brand);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--green-dim);
  margin-bottom: 0.75rem;
  opacity: 0.7;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.hero-title {
  font-family: var(--font-brand);
  /* Fallback when container query length units are unavailable */
  font-size: clamp(1.475rem, 5.5vw, 2.975rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-bright);
  margin-bottom: 0.75rem;
  line-height: 1.2;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 0, 0, 0.5);
}

@supports (font-size: 1cqi) {
  .hero-title {
    /* Scales with hero card inner width (.hero-copy is the container) */
    font-size: clamp(1.325rem, calc(0.6rem + 11.5cqi), 3.05rem);
  }
}

.hero-sub {
  font-size: clamp(0.9rem, 1.8vw, 1rem);
  color: var(--text-muted);
  margin-bottom: 0.625rem;
  line-height: 1.75;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-actions .btn {
  width: 164px;
  box-sizing: border-box;
  padding: 0.45rem 0.2rem;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── SECTIONS ── */
.section-title {
  font-family: var(--font-brand);
  font-size: clamp(1.3rem, 3.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-bright);
  margin-bottom: 0.75rem;
}

.section-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 520px;
  margin-bottom: 3rem;
  line-height: 1.7;
}

.section-kicker {
  font-family: var(--font-brand);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green-dim);
  opacity: 0.75;
  margin-bottom: 0.9rem;
}

.section-dark {
  padding: 7rem 0;
  background: var(--bg);
}

.section-mid {
  padding: 7rem 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.context-stage-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.95fr) minmax(0, 1.05fr);
  column-gap: 4rem;
  align-items: start;
}

.context-stage-copy .section-sub {
  max-width: 34rem;
  margin-bottom: 0;
}

.context-ops {
  display: grid;
  gap: 0.85rem;
}

.context-op {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  column-gap: 1.4rem;
  align-items: start;
  padding: 1.1rem 0;
  border-top: 1px solid var(--border-hover);
}

.context-op:last-child {
  border-bottom: 1px solid rgba(0, 255, 102, 0.08);
}

.context-op-label {
  font-family: var(--font-brand);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-bright);
  padding-top: 0.15rem;
}

.context-op p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.72;
}

/* ── PROBLEM ── */
.problem-grid {
  counter-reset: problem;
  display: block;
  max-width: 980px;
  margin-bottom: 3.5rem;
}

.problem-card {
  display: grid;
  grid-template-columns: 72px minmax(180px, 220px) minmax(0, 1fr);
  column-gap: 2rem;
  align-items: start;
  padding: 1.4rem 0;
  border-top: 1px solid var(--border-hover);
  background: transparent;
}

.problem-card:last-child {
  border-bottom: 1px solid rgba(0, 255, 102, 0.08);
}

.problem-card::before {
  counter-increment: problem;
  content: "0" counter(problem);
  display: block;
  font-family: var(--font-brand);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--green-dim);
  opacity: 0.8;
  padding-top: 0.25rem;
}

.problem-card h3 {
  font-family: var(--font-brand);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
  letter-spacing: 0.03em;
  line-height: 1.35;
}

.problem-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.72;
  margin: 0;
}

.problem-punch {
  font-family: var(--font-brand);
  font-size: 1rem;
  color: var(--text);
  max-width: 520px;
  margin: 2.5rem 0 0 auto;
  text-align: left;
  line-height: 1.8;
  letter-spacing: 0.02em;
}

.problem-punch em {
  font-style: italic;
  color: var(--green);
}

/* ── ARCHITECTURE ── */
.arch-grid {
  display: block;
}

.arch-block {
  padding: 2rem 0;
  border-top: 1px solid var(--border-hover);
  background: transparent;
}

.arch-block:last-child {
  border-bottom: 1px solid rgba(0, 255, 102, 0.08);
}

.arch-block-wide {
  grid-column: auto;
}

.arch-label {
  font-family: var(--font-brand);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--green-dim);
  opacity: 0.6;
}

.arch-block h3 {
  font-family: var(--font-brand);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
  letter-spacing: 0.03em;
  line-height: 1.35;
}

.arch-block p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.72;
  margin: 0;
}

#how .arch-block {
  display: grid;
  grid-template-columns: 110px minmax(200px, 250px) minmax(0, 1fr);
  column-gap: 2rem;
  align-items: start;
}

#how .arch-block:nth-child(even) {
  padding-left: min(5vw, 3rem);
}

#how .arch-label {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  padding-top: 0.25rem;
}

#how .arch-block h3 {
  grid-column: 2;
}

#how .arch-block p {
  grid-column: 3;
}

#architecture .arch-block {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.15fr);
  column-gap: 2.5rem;
  align-items: start;
}

#architecture .arch-label {
  grid-column: 1;
  grid-row: 1;
  margin-bottom: 0.5rem;
}

#architecture .arch-block h3 {
  grid-column: 1;
  grid-row: 2;
}

#architecture .arch-block p {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.compiled-stage {
  display: grid;
  grid-template-columns: minmax(260px, 0.88fr) minmax(0, 1.12fr);
  column-gap: 3.5rem;
  align-items: start;
}

.compiled-copy {
  padding-top: 0.4rem;
}

.compiled-copy .section-sub {
  max-width: 32rem;
  margin-bottom: 2rem;
}

.compiled-notes {
  display: grid;
  gap: 0.8rem;
}

.compiled-note {
  padding-top: 0.95rem;
  border-top: 1px solid var(--border-hover);
}

.compiled-note span {
  display: inline-block;
  margin-bottom: 0.55rem;
  font-family: var(--font-brand);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-dim);
}

.compiled-note p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.68;
}

#compiled .ctx-compile {
  margin-top: 0.15rem;
}

/* ── CODE BLOCK ── */
.code-block {
  background: #080e08;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 3rem;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: rgba(0, 255, 102, 0.03);
  border-bottom: 1px solid var(--border);
}

.code-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.3;
}

.code-filename {
  font-family: var(--font-brand);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-left: 0.5rem;
}

.code-body {
  font-family: var(--font-brand);
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--text);
  padding: 1.5rem;
  overflow-x: auto;
  white-space: pre;
}

.code-comment {
  color: var(--text-muted);
  opacity: 0.6;
}

/* ── INTEGRATION DETAILS ── */
.integration-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.int-detail {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
}

.int-detail h4 {
  font-family: var(--font-brand);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 0.5rem;
  letter-spacing: 0.03em;
}

.int-detail p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ── CONTEXT COMPILATION VISUAL ── */
.ctx-compile {
  background: #060a06;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.ctx-layers {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ctx-layer {
  background: rgba(0, 255, 102, 0.02);
  border-left: 2px solid rgba(0, 255, 102, 0.15);
  padding: 1rem 1.25rem;
  position: relative;
  transition: border-color 0.3s, background 0.3s;
}

.ctx-layer:hover {
  border-left-color: var(--green-dim);
  background: rgba(0, 255, 102, 0.04);
}

.ctx-layer-input {
  border-left-color: var(--green);
  background: rgba(0, 255, 102, 0.05);
}

.ctx-layer-label {
  font-family: var(--font-brand);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ctx-layer-tag {
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--green-dim);
  background: rgba(0, 255, 102, 0.08);
  padding: 0.15em 0.5em;
  border-radius: 2px;
}

.ctx-layer-content {
  font-family: var(--font-brand);
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--text);
  opacity: 0.7;
}

.ctx-layer[data-tokens]::after {
  content: attr(data-tokens) " tok";
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  font-family: var(--font-brand);
  font-size: 0.6rem;
  color: var(--text-muted);
  opacity: 0.5;
  letter-spacing: 0.05em;
}

.ctx-budget {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 255, 102, 0.02);
}

.ctx-budget-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}

.ctx-budget-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-dim), var(--green));
  border-radius: 2px;
  box-shadow: 0 0 8px var(--green-glow);
}

.ctx-budget-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-brand);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.ctx-budget-status {
  color: var(--green-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
}

/* ── CTA ── */
.cta {
  padding: 8rem 0;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.cta-title {
  font-family: var(--font-brand);
  font-size: clamp(1.3rem, 3.5vw, 2rem);
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 1rem;
  letter-spacing: 0.04em;
}

.cta-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 460px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

/* ── WAITLIST FORM ── */
.waitlist-form {
  display: flex;
  gap: 0.75rem;
  max-width: 460px;
  margin: 0 auto;
}

.waitlist-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-bright);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

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

.waitlist-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.waitlist-msg {
  font-size: 0.8rem;
  margin-top: 1rem;
  color: var(--green);
  min-height: 1.2em;
}

.waitlist-form .btn-primary:hover {
  box-shadow: none;
}

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

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.footer-brand {
  font-family: var(--font-brand);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

.footer-sep { color: var(--text-muted); opacity: 0.3; }

.footer-link {
  font-family: var(--font-brand);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.footer-link:hover { color: var(--green); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  #site-nav {
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.8rem 1.25rem;
  }

  #site-nav .nav-links {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero-content {
    margin: 12vh 1.25rem 0 1.25rem;
    width: min(376px, calc(100vw - 2.5rem));
  }

  .hero::after {
    inset: 18% -30% auto 48%;
    height: 56%;
    transform: perspective(900px) rotateY(-18deg) rotateX(8deg);
    opacity: 0.75;
  }

  .problem-card {
    grid-template-columns: 1fr;
    row-gap: 0.6rem;
  }
  .problem-punch {
    max-width: none;
    margin: 2rem 0 0;
  }
  .context-stage-grid,
  .compiled-stage,
  #how .arch-block,
  #architecture .arch-block {
    grid-template-columns: 1fr;
    row-gap: 0.7rem;
    padding-left: 0;
  }
  .context-op {
    grid-template-columns: 1fr;
    row-gap: 0.45rem;
  }
  #how .arch-label,
  #how .arch-block h3,
  #how .arch-block p,
  #architecture .arch-label,
  #architecture .arch-block h3,
  #architecture .arch-block p {
    grid-column: 1;
    grid-row: auto;
  }
  .arch-label { margin-bottom: 0.8rem; }
  .integration-details { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .container { padding: 0 1.25rem; }
  .hero-content { padding: 16px 15px; }
  .section-dark, .section-mid { padding: 5rem 0; }
  .waitlist-form { flex-direction: column; }
}

/* Two 164px buttons + gap need ~344px inner; below that, stack so the card still fits */
@media (max-width: 400px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .hero-actions .btn {
    width: 100%;
    max-width: none;
  }
}
