/* ============================================================
   TERRA — cinematic scroll-driven 3D experience
   ============================================================ */

:root {
  --bg-deep:   #03040a;
  --bg-mid:    #070a18;
  --ink:       #eef1ff;
  --ink-dim:   rgba(238, 241, 255, 0.55);
  --ink-faint: rgba(238, 241, 255, 0.32);
  --accent:    #5fb2ff;
  --accent-2:  #9d7bff;
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { width: 100%; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(140% 90% at 70% -10%, #0b1330 0%, transparent 55%),
    radial-gradient(120% 80% at 10% 110%, #160d2e 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Lock scroll until the experience is ready */
body.is-loading { overflow: hidden; height: 100vh; }

/* ============ 3D CANVAS ============ */
.webgl {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  outline: none;
  display: block;
}

/* ============ PRELOADER ============ */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg-deep);
  transition: opacity 1s var(--ease), visibility 1s var(--ease);
}
.preloader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.preloader__inner { width: min(420px, 70vw); text-align: center; }

.preloader__label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 1.4rem;
  padding-left: 0.45em;
}

.preloader__bar {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  overflow: hidden;
}
.preloader__fill {
  position: absolute;
  inset: 0 100% 0 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px var(--accent);
  transition: right 0.4s var(--ease);
}

.preloader__count {
  margin-top: 1.2rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3.4rem;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.02em;
}
.preloader__pct { font-size: 1.2rem; color: var(--ink-dim); margin-left: 0.2em; }

/* ============ FIXED HEADER ============ */
.site-header {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1.2rem, 3vw, 2.2rem) clamp(1.4rem, 5vw, 4rem);
  mix-blend-mode: difference;
  pointer-events: none;
}
.brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.3em;
}
.brand span { color: var(--accent); }
.nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.nav__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ============ SCROLL LAYOUT ============ */
.scroll-container { position: relative; z-index: 1; }

.section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 0 clamp(1.6rem, 7vw, 9rem);
  position: relative;
}
.section--left   { justify-content: flex-start; }
.section--right  { justify-content: flex-end; }
/* Right-aligned section: anchor each block to the right edge so a wide (nowrap)
   heading overflows into the open centre instead of being clipped off-screen.
   (align-items handles the block boxes; text-align handles multi-line text.) */
.section--right .panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}
.section--center,
.section--cta,
.section--hero   { justify-content: center; text-align: center; }

/* ============ TYPOGRAPHY ============ */
.eyebrow {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.4rem;
  padding-left: 0.4em;
}

.title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.03em;
  font-size: clamp(2.8rem, 9vw, 8rem);
  text-shadow: 0 12px 60px rgba(0, 0, 0, 0.6);
}

/* Keep side-section headings to their <br>-defined 2 lines (no extra wrapping).
   Centre/CTA sections wrap naturally (3 lines). */
.section--left .title,
.section--right .title { white-space: nowrap; }
.title--hero { font-size: clamp(4rem, 18vw, 16rem); font-weight: 300; letter-spacing: 0.04em; }

/* Animated gradient accent — clipped to the glyphs, swept by GSAP.
   Start == end colour so the loop is seamless. */
.grad {
  background: linear-gradient(90deg, #5fb2ff, #9d7bff, #ff8fc7, #9d7bff, #5fb2ff);
  background-size: 200% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(95, 178, 255, 0.35));
}
.title--cta  { margin-bottom: 2.4rem; }

.lede {
  max-width: 30ch;
  margin: 2rem auto 0;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.6;
  color: var(--ink-dim);
  font-weight: 300;
}

.panel { max-width: 30rem; }
.panel--center { max-width: 38rem; margin: 0 auto; }

.copy {
  margin-top: 1.6rem;
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
  line-height: 1.7;
  color: var(--ink-dim);
  font-weight: 300;
}

/* ============ CTA ============ */
.cta { max-width: 40rem; }
.btn {
  display: inline-block;
  padding: 1rem 2.6rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 100px;
  color: var(--ink);
  text-decoration: none;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease), color 0.5s var(--ease);
}
.btn:hover {
  background: var(--ink);
  color: var(--bg-deep);
  border-color: var(--ink);
}
.fineprint {
  margin-top: 2.4rem;
  font-size: 0.66rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ============ SCROLL CUE ============ */
.scroll-cue {
  position: absolute;
  bottom: clamp(1.6rem, 5vh, 3rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.62rem;
  letter-spacing: 0.4em;
  color: var(--ink-dim);
}
.scroll-cue__line {
  width: 1px; height: 48px;
  background: linear-gradient(var(--ink-dim), transparent);
  animation: cue 2.2s var(--ease) infinite;
  transform-origin: top;
}
@keyframes cue { 0% { transform: scaleY(0); } 40% { transform: scaleY(1); } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  .nav__dot, .scroll-cue__line { animation: none; }
  * { scroll-behavior: auto !important; }
}
