/* ============ RESET / BASE ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root{
  --bg: #05060a;
  --bg-deep: #020204;
  --white: #f4f6fb;
  --dim: rgba(244,246,251,0.55);
  --dimmer: rgba(244,246,251,0.3);
  --blue: #3b82f6;
  --cyan: #22d3ee;
  --violet: #a855f7;
  --emerald: #10b981;
  --amber: #f59e0b;
  --magenta: #ec4899;
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

html{
  background: var(--bg);
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
}

body{
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-sans);
  overflow-x: hidden;
  cursor: none;
}
@media (hover: none), (pointer: coarse){
  body{ cursor: auto; }
  #cursor-dot, #cursor-ring{ display: none; }
}

a{ color: inherit; text-decoration: none; }

::selection{ background: var(--blue); color: var(--bg); }

/* ============ CANVAS BACKGROUND ============ */
#net{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  transition: opacity 1.1s ease, filter 1.1s ease;
}
#net.dim{ opacity: 0.22; filter: blur(1.5px) saturate(0.7); }
#net.hidden-net{ opacity: 0.08; }

/* ============ CUSTOM CURSOR ============ */
#cursor-dot, #cursor-ring{
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  will-change: transform;
}
#cursor-dot{
  width: 6px; height: 6px;
  background: var(--white);
  box-shadow: 0 0 8px 2px rgba(244,246,251,0.8);
  transition: opacity .2s ease;
}
#cursor-ring{
  width: 34px; height: 34px;
  border: 1px solid rgba(244,246,251,0.35);
  transition: width .25s ease, height .25s ease, border-color .25s ease, opacity .2s ease, background .25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--white);
  white-space: nowrap;
}
#cursor-ring.expand{
  width: 84px; height: 84px;
  border-color: rgba(244,246,251,0.7);
  background: rgba(59,130,246,0.08);
}
#cursor-ring.label::after{
  content: attr(data-label);
}

/* ============ NAV ============ */
#nav{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 5vw;
  mix-blend-mode: difference;
  pointer-events: none;
}
#nav a{ pointer-events: auto; }
.nav-logo{
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 13px;
}
.nav-links{
  display: flex;
  gap: clamp(16px, 3vw, 34px);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.nav-links a{
  opacity: 0.55;
  transition: opacity .3s ease;
}
.nav-links a:hover{ opacity: 1; }
@media (max-width: 720px){
  .nav-links{ gap: 12px; font-size: 10px; }
}
@media (max-width: 480px){
  #nav{ padding: 20px 5vw; flex-wrap: wrap; row-gap: 10px; }
  .nav-links{ width: 100%; justify-content: flex-start; gap: 10px 14px; font-size: 9px; flex-wrap: wrap; }
}

/* ============ PROGRESS RAIL ============ */
#progress-rail{
  position: fixed;
  right: clamp(14px, 3vw, 34px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: none;
}
.rail-item{
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.35;
  transition: opacity .4s ease;
}
.rail-item.active{ opacity: 1; }
.rail-dot{
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0 0 rgba(244,246,251,0);
  transition: box-shadow .4s ease, background .4s ease, width .3s ease, height .3s ease;
}
.rail-item.active .rail-dot{
  width: 7px; height: 7px;
  box-shadow: 0 0 10px 2px rgba(244,246,251,0.6);
}
.rail-dot-hollow{
  background: transparent;
  border: 1px solid var(--white);
}
.rail-label{
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
  display: none;
}
.rail-item.active .rail-label{ display: block; }
@media (max-width: 900px){
  #progress-rail{ display: none; }
}

/* ============ LAYOUT ============ */
main{ position: relative; z-index: 1; }

.chapter{
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12vh 6vw;
  text-align: center;
}

.chapter-inner{
  max-width: 900px;
  width: 100%;
}

/* ============ HERO ============ */
#hero{ position: relative; }
.hero-sequence{
  position: relative;
  height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-line, .hero-word, .hero-headline{
  position: absolute;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: clamp(28px, 6vw, 64px);
  letter-spacing: 0.04em;
  color: var(--dim);
}
.hero-line.show, .hero-word.show, .hero-headline.show{
  opacity: 1;
  transform: translateY(0);
}
.hero-word h1{
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(48px, 12vw, 140px);
  letter-spacing: 0.02em;
  color: var(--white);
  line-height: 0.95;
}
.hero-sub{
  font-family: var(--font-mono);
  font-size: clamp(12px, 1.6vw, 16px);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-top: 14px;
}
.hero-headline h2{
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: clamp(26px, 5vw, 56px);
  color: var(--white);
  max-width: 16ch;
  line-height: 1.15;
}
.scroll-cue{
  position: absolute;
  bottom: 6vh;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dimmer);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: fadeIn 1.5s ease 3s both;
}
.scroll-cue span{
  width: 1px; height: 34px;
  background: linear-gradient(var(--white), transparent);
  animation: scrollLine 2s ease-in-out infinite;
}
@keyframes scrollLine{
  0%{ transform: scaleY(0); transform-origin: top; opacity: 0; }
  50%{ transform: scaleY(1); transform-origin: top; opacity: 1; }
  51%{ transform-origin: bottom; }
  100%{ transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}
@keyframes fadeIn{ from{ opacity: 0; } to{ opacity: 1; } }

/* ============ REVEAL-ON-SCROLL ============ */
.reveal{
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.9s cubic-bezier(.16,.8,.24,1), transform 0.9s cubic-bezier(.16,.8,.24,1);
}
.reveal.in-view{
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce){
  .reveal, .hero-line, .hero-word, .hero-headline{
    transition: opacity .4s ease;
    transform: none;
  }
}

/* ============ CHAPTER TYPOGRAPHY ============ */
.chapter-year{
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: clamp(72px, 16vw, 220px);
  line-height: 0.9;
  color: var(--dimmer);
  letter-spacing: -0.02em;
}
.chapter-title{
  font-size: clamp(34px, 7vw, 84px);
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: -0.01em;
}
.chapter-names{
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.8vw, 17px);
  letter-spacing: 0.1em;
  color: var(--dim);
  margin-top: 18px;
  text-transform: uppercase;
}
.chapter-copy{
  margin-top: 22px;
  font-size: clamp(17px, 2.4vw, 26px);
  font-weight: 300;
  color: var(--dim);
  max-width: 44ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.chapter-title.accent{ color: var(--white); }
#ch-apifixer .accent{ color: var(--cyan); text-shadow: 0 0 40px rgba(34,211,238,0.5); }
#ch-pluginsilo .accent{ color: var(--violet); text-shadow: 0 0 40px rgba(168,85,247,0.5); }
#ch-partsyncer .accent{ color: var(--emerald); text-shadow: 0 0 40px rgba(16,185,129,0.5); }
#ch-homeza .accent{ color: var(--amber); text-shadow: 0 0 40px rgba(245,158,11,0.5); }
#ch-addcron .accent{ color: var(--magenta); text-shadow: 0 0 40px rgba(236,72,153,0.5); }

.brand-link{
  display: inline-block;
  margin-top: 40px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(244,246,251,0.25);
  transition: border-color .3s ease, color .3s ease;
}
.brand-link:hover{ border-color: currentColor; }

/* packet words (ApiFixer) */
.packet-words{
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  justify-content: center;
  margin-top: 34px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
}
.packet-words span{
  padding: 6px 14px;
  border: 1px solid rgba(34,211,238,0.35);
  border-radius: 999px;
  color: var(--cyan);
  opacity: 0.85;
}

/* module flow */
.module-flow{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 34px;
  font-family: var(--font-mono);
  font-size: clamp(11px, 1.6vw, 14px);
  letter-spacing: 0.08em;
  color: var(--dim);
  text-transform: uppercase;
}
.module-flow i{ opacity: 0.4; font-style: normal; }

/* ============ REVEAL SECTION ============ */
.reveal-center{ position: relative; }
.reveal-caption{
  font-family: var(--font-mono);
  font-size: clamp(12px, 1.6vw, 15px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 18px;
}
.reveal-title{
  font-size: clamp(48px, 11vw, 130px);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.reveal-orbit{
  position: relative;
  margin-top: 60px;
  display: flex;
  flex-wrap: wrap;
  gap: 26px 40px;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.reveal-orbit span{ opacity: 0.75; }

/* ============ PHILOSOPHY ============ */
.philosophy-words{
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 0.6em;
  justify-content: center;
  margin-bottom: 60px;
}
.phi-word{
  font-size: clamp(30px, 7vw, 80px);
  font-weight: 700;
  color: var(--dimmer);
  opacity: 0.25;
  transition: opacity .6s ease, color .6s ease;
}
.phi-word.lit{
  opacity: 1;
  color: var(--white);
  text-shadow: 0 0 30px rgba(59,130,246,0.4);
}
.philosophy-lines p{
  font-size: clamp(16px, 2.2vw, 24px);
  font-weight: 300;
  color: var(--dim);
  margin-top: 12px;
}

/* ============ FOUNDERS ============ */
.founders-split{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 6vw, 90px);
  flex-wrap: wrap;
  width: 100%;
}
.founder{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.founder-initial{
  width: clamp(90px, 14vw, 160px);
  height: clamp(90px, 14vw, 160px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: 0.05em;
  border: 1px solid rgba(244,246,251,0.25);
  background: radial-gradient(circle at 30% 30%, rgba(59,130,246,0.18), transparent 70%);
}
.founder-right .founder-initial{
  background: radial-gradient(circle at 70% 30%, rgba(236,72,153,0.18), transparent 70%);
}
.founder h3{ font-size: clamp(20px, 2.6vw, 30px); font-weight: 500; }
.founders-center{
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: clamp(14px, 2vw, 20px);
  color: var(--dim);
  flex-direction: column;
}
.founders-center > span:first-child, .founders-center > i, .founders-center > span:nth-child(2){
  display: inline;
}
.founders-role{
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dimmer);
}
.founders-copy{
  margin-top: 50px;
  max-width: 60ch;
  font-size: clamp(15px, 2vw, 20px);
  font-weight: 300;
  color: var(--dim);
  line-height: 1.6;
}
@media (max-width: 700px){
  .founders-split{ flex-direction: column; gap: 40px; }
}

/* ============ FAQ ============ */
.faq-block{ text-align: left; max-width: 720px; }
.faq-block .chapter-names{ text-align: center; margin-bottom: 30px; }
.faq-item{
  border-top: 1px solid rgba(244,246,251,0.14);
  padding: 20px 0;
}
.faq-item:last-child{ border-bottom: 1px solid rgba(244,246,251,0.14); }
.faq-item summary{
  cursor: pointer;
  list-style: none;
  font-size: clamp(15px, 2vw, 19px);
  font-weight: 500;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.faq-item summary::-webkit-details-marker{ display: none; }
.faq-item summary::after{
  content: "+";
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--dim);
  flex-shrink: 0;
  transition: transform .3s ease;
}
.faq-item[open] summary::after{ transform: rotate(45deg); }
.faq-item p{
  margin-top: 14px;
  font-size: clamp(14px, 1.8vw, 17px);
  font-weight: 300;
  color: var(--dim);
  line-height: 1.6;
  max-width: 65ch;
}

/* ============ DNA ============ */
#dna{ overflow: hidden; }
#dna-canvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
#dna .chapter-inner{ position: relative; z-index: 1; pointer-events: none; }
#dna .chapter-title{ line-height: 1.15; }

/* ============ NEXT ============ */
.next-line{
  font-size: clamp(16px, 2.2vw, 24px);
  font-weight: 300;
  color: var(--dim);
  margin-top: 10px;
}
.next-final{
  margin-top: 40px;
  font-size: clamp(22px, 3.4vw, 40px);
  font-weight: 500;
  color: var(--white);
}

/* ============ FINAL ============ */
.final-message p, .final-message h2{ margin-top: 6px; }
.final-word{
  font-size: clamp(20px, 3vw, 32px);
  font-weight: 300;
  color: var(--dim);
}
.final-star{ color: var(--dimmer); font-size: 20px; }
.final-brand{
  font-size: clamp(44px, 9vw, 100px);
  font-weight: 700;
  margin-top: 18px;
}
.final-tag{
  margin-top: 26px;
  font-size: clamp(13px, 1.6vw, 16px);
  color: var(--dim);
  font-family: var(--font-mono);
}
.final-founders{
  margin-top: 30px;
  font-size: 13px;
  color: var(--dimmer);
  font-family: var(--font-mono);
  line-height: 1.7;
}
.final-founders span{ letter-spacing: 0.1em; text-transform: uppercase; }

/* ============ RESPONSIVE ============ */
@media (max-width: 640px){
  .chapter{ padding: 10vh 7vw; }
  .chapter-copy{ max-width: 32ch; }
}
