/* ============================================
   DEVOUT — Main Stylesheet
   ============================================ */

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

html {
  scroll-behavior: auto; /* GSAP handles smooth scroll */
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Variables --- */
:root {
  --violet: #7B2FFF;
  --green: #ADFF2F;
  --bg: #0A0A0F;
  --text: #F0F0F5;
  --deep-blue: #1A1A3E;
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
}

/* --- Preloader --- */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preloader-text {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 8vw, 6rem);
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--text);
  opacity: 0;
}

/* --- Hero --- */
#hero {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  pointer-events: none;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 12vw, 10rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text);
  opacity: 0.85;
  mix-blend-mode: difference;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: clamp(0.875rem, 2vw, 1.25rem);
  letter-spacing: 0.15em;
  color: var(--text);
  opacity: 0.6;
  margin-top: 1rem;
}

.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
}

.scroll-indicator span {
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.5;
}

.scroll-arrow {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--violet), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* --- Narrative Sections --- */
.narrative-section {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.narrative-content {
  position: relative;
  z-index: 2;
  text-align: center;
}

.narrative-letters {
  display: flex;
  justify-content: center;
  gap: 0.05em;
  perspective: 1000px;
}

.narrative-letters .letter {
  font-family: var(--font-heading);
  font-size: clamp(5rem, 20vw, 15rem);
  font-weight: 700;
  color: var(--text);
  display: inline-block;
  will-change: transform, opacity;
}

.narrative-copy {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  color: var(--text);
  opacity: 0;
  margin-top: 2rem;
  letter-spacing: 0.05em;
}

.narrative-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

/* --- Section background progression --- */
#section-dev {
  background: linear-gradient(180deg, var(--bg) 0%, rgba(123, 47, 255, 0.05) 100%);
}

#section-out {
  background: linear-gradient(180deg, rgba(123, 47, 255, 0.05) 0%, var(--deep-blue) 100%);
}

#section-ai {
  background: linear-gradient(180deg, var(--deep-blue) 0%, var(--bg) 100%);
}

#dev-bg {
  background: radial-gradient(ellipse at center, rgba(123, 47, 255, 0.08) 0%, transparent 70%);
}

#ai-bg {
  background: radial-gradient(ellipse at center, rgba(173, 255, 47, 0.05) 0%, transparent 70%);
}

/* --- Out section: network SVG --- */
.network-svg {
  width: 100%;
  height: 100%;
  opacity: 0.3;
}

.network-svg circle {
  fill: var(--violet);
}

.network-svg line {
  stroke: var(--green);
  stroke-width: 1;
  opacity: 0;
}

/* --- Contact / Footer --- */
#contact {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  background: var(--bg);
  padding: 4rem 2rem;
}

.contact-heading {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 6vw, 5rem);
  font-weight: 700;
  color: var(--text);
  text-align: center;
  opacity: 0;
}

.contact-links {
  display: flex;
  gap: 2rem;
  opacity: 0;
}

.contact-link {
  color: var(--text);
  transition: color 0.3s ease, filter 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-link:hover {
  color: var(--violet);
  filter: drop-shadow(0 0 12px var(--violet));
}

.copyright {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text);
  opacity: 0.3;
  position: absolute;
  bottom: 2rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero-title {
    letter-spacing: 0.1em;
  }

  .narrative-letters .letter {
    font-size: clamp(3rem, 15vw, 8rem);
  }

  .contact-heading {
    font-size: clamp(1.5rem, 5vw, 3rem);
  }

  .scroll-indicator {
    bottom: 1.5rem;
  }

  /* --- Mobile: CSS fallback for Three.js hero --- */
  #hero {
    background:
      radial-gradient(ellipse at 50% 50%, rgba(123, 47, 255, 0.3) 0%, transparent 60%),
      radial-gradient(ellipse at 30% 70%, rgba(173, 255, 47, 0.1) 0%, transparent 50%),
      var(--bg);
    background-size: 100% 100%;
    animation: heroGlow 6s ease-in-out infinite alternate;
  }

  @keyframes heroGlow {
    0% { background-position: 50% 50%, 30% 70%; }
    100% { background-position: 60% 40%, 40% 60%; }
  }

  .narrative-section {
    height: auto;
    min-height: 100vh;
    padding: 4rem 1.5rem;
  }

  .narrative-letters {
    perspective: 500px;
  }

  .contact-links {
    gap: 1.5rem;
  }
}
