/* ===========================================================
   EcoPulse — Cinematic Scroll Experience
   =========================================================== */

:root {
  --bg-deep: #050706;
  --bg-forest: #0b1a13;
  --fg: #eef3ef;
  --fg-dim: rgba(238, 243, 239, 0.55);
  --fg-quiet: rgba(238, 243, 239, 0.32);
  --accent: oklch(0.82 0.16 150);
  --accent-soft: oklch(0.82 0.16 150 / 0.35);
  --line: rgba(238, 243, 239, 0.12);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Space Grotesk", -apple-system, system-ui, sans-serif;
}

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

html, body {
  background: var(--bg-deep);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body {
  cursor: none;
  overflow-x: hidden;
}

a, button { cursor: none; }

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

/* ----- Fixed canvas backdrop ----- */
#three-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
}

/* ----- Mouse-tracked volumetric glow ----- */
#mouse-glow {
  position: fixed;
  pointer-events: none;
  z-index: 2;
  width: 720px;
  height: 720px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle at center,
    oklch(0.82 0.16 150 / 0.18) 0%,
    oklch(0.82 0.16 150 / 0.06) 30%,
    transparent 65%
  );
  mix-blend-mode: screen;
  filter: blur(40px);
  opacity: 0;
  transition: opacity 1.4s ease;
  will-change: transform, opacity;
}
#mouse-glow.visible { opacity: 1; }

/* ----- Top navigation ----- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 40px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  mix-blend-mode: difference;
  color: #fff;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}
.nav__brand::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.6); opacity: 0.5; }
}
.nav__links {
  display: flex;
  gap: 36px;
  list-style: none;
}
.nav__links a {
  color: inherit;
  text-decoration: none;
  position: relative;
  transition: opacity 0.3s;
}
.nav__links a:hover { opacity: 0.6; }

/* ----- Scroll progress indicator (right side) ----- */
.progress {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--fg-quiet);
  writing-mode: vertical-rl;
}
.progress__rail {
  position: relative;
  width: 1px;
  height: 160px;
  background: var(--line);
}
.progress__fill {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 0%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.progress__num {
  font-variant-numeric: tabular-nums;
  writing-mode: horizontal-tb;
}

/* ----- Scene container ----- */
.timeline {
  position: relative;
  z-index: 10;
  width: 100%;
}
.scene {
  position: relative;
  width: 100%;
  pointer-events: none;
}
.scene > * { pointer-events: auto; }

.scene--1 { height: 220vh; }
.scene--2 { height: 220vh; }
.scene--3 { height: 220vh; }
.scene--4 { height: 220vh; }
.scene--5 { height: 200vh; }

/* Scene 1 — intro */
.scene--1 .sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 12;
}
.scene--1 .prompt {
  position: absolute;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--fg-quiet);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.scene--1 .prompt::after {
  content: "";
  width: 1px;
  height: 36px;
  background: linear-gradient(to bottom, var(--fg-quiet), transparent);
  animation: drop 2s ease-in-out infinite;
}
@keyframes drop {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

.intro-title {
  font-family: var(--sans);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 0.92;
  font-size: clamp(64px, 11vw, 180px);
  opacity: 0;
  transform: translateY(40px);
}
.intro-title em {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}
.intro-sub {
  margin-top: 28px;
  max-width: 560px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--fg-dim);
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(20px);
}
.intro-meta {
  position: absolute;
  bottom: 56px;
  right: 40px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-quiet);
  text-align: right;
  line-height: 1.7;
}

/* Scene 2 — processor reveal */
.scene--2 .sticky,
.scene--3 .sticky,
.scene--4 .sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  z-index: 12;
}

.s2-label {
  position: absolute;
  top: 50%;
  left: 64px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-dim);
  max-width: 280px;
  line-height: 1.7;
}
.s2-label__num {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.32em;
}
.s2-title {
  position: absolute;
  bottom: 80px;
  left: 64px;
  font-family: var(--sans);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 0.95;
  font-size: clamp(40px, 6vw, 88px);
  max-width: 740px;
}
.s2-title em {
  color: var(--accent);
  font-style: italic;
  font-weight: 300;
}
.s2-readout {
  position: absolute;
  top: 96px;
  right: 64px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-dim);
  text-align: right;
  line-height: 1.9;
}
.s2-readout span {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Scene 3 — exploded view annotations */
.s3-left, .s3-right {
  position: absolute;
  top: 50%;
  width: 240px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.55;
  color: var(--fg);
  text-transform: none;
}
.s3-left { left: 64px; }
.s3-right { right: 64px; text-align: right; }
.s3-tag {
  display: block;
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.s3-annot {
  margin-bottom: 28px;
  opacity: 0;
  transform: translateY(20px);
}

/* Scene 4 — context */
.s4-quote {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  max-width: 900px;
  padding: 0 32px;
  font-family: var(--sans);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-size: clamp(28px, 4.4vw, 64px);
  opacity: 0;
}
.s4-quote em {
  color: var(--accent);
  font-style: italic;
}
.s4-caption {
  position: absolute;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fg-dim);
  text-align: center;
}

/* Scene 5 — CTA + video slot */
.scene--5 {
  background: transparent;
}
.scene--5 .sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 56px;
  z-index: 20;
}
.video-slot {
  position: relative;
  width: min(960px, 78vw);
  aspect-ratio: 16/9;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(238,243,239,0.025) 0 2px,
      transparent 2px 16px
    ),
    #0c1411;
  border: 1px solid var(--line);
  overflow: hidden;
}
.video-slot__chrome {
  position: absolute;
  inset: 14px;
  border: 1px dashed rgba(238,243,239,0.18);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-quiet);
}
.video-slot__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.video-slot__icon::before {
  content: "";
  width: 0; height: 0;
  border-left: 12px solid var(--accent);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  margin-left: 4px;
}
.video-slot__meta {
  position: absolute;
  bottom: 18px;
  left: 22px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--fg-quiet);
}
.video-slot__meta span { color: var(--accent); }

.cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.cta__eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
}
.cta__button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 22px;
  padding: 28px 52px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(238, 243, 239, 0.02);
  backdrop-filter: blur(8px);
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(20px, 2.4vw, 32px);
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
  transition: background 0.5s ease, border-color 0.5s ease;
  will-change: transform;
}
.cta__button:hover {
  background: oklch(0.82 0.16 150 / 0.12);
  border-color: var(--accent-soft);
}
.cta__button .arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cta__button:hover .arrow { transform: translateX(6px); }

.scene--5 footer {
  position: absolute;
  bottom: 32px;
  left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 40px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-quiet);
}

/* ----- Custom cursor ----- */
#cursor-ring {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--fg);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  transition: width 0.25s ease, height 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  will-change: transform;
}
#cursor-dot {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  width: 4px;
  height: 4px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  will-change: transform;
}
#cursor-label {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg);
  background: transparent;
  white-space: nowrap;
  transform: translate(-50%, calc(-50% + 36px));
  opacity: 0;
  mix-blend-mode: difference;
  transition: opacity 0.3s ease;
  will-change: transform, opacity;
}
#cursor-label.visible { opacity: 1; }
body.is-hovering #cursor-ring {
  width: 72px;
  height: 72px;
  background: rgba(255,255,255,0.04);
}

/* ----- Audio toggle ----- */
.audio-toggle {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fg-dim);
  background: transparent;
  border: none;
  padding: 8px 0;
}
.audio-toggle__bars {
  display: flex;
  gap: 2px;
  align-items: end;
  height: 14px;
}
.audio-toggle__bars span {
  width: 2px;
  height: 4px;
  background: var(--fg-dim);
  transition: height 0.3s ease;
}
.audio-toggle.on .audio-toggle__bars span {
  background: var(--accent);
  animation: eq 0.9s ease-in-out infinite;
}
.audio-toggle.on .audio-toggle__bars span:nth-child(2) { animation-delay: 0.15s; }
.audio-toggle.on .audio-toggle__bars span:nth-child(3) { animation-delay: 0.3s; }
.audio-toggle.on .audio-toggle__bars span:nth-child(4) { animation-delay: 0.45s; }
@keyframes eq {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

/* ----- Loader ----- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  transition: opacity 1.2s ease 0.3s, visibility 0s linear 1.5s;
}
.loader.hidden { opacity: 0; visibility: hidden; }
.loader__logo {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.loader__bar {
  width: 240px;
  height: 1px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.loader__bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform-origin: left;
  animation: load 2.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes load {
  0% { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}
.loader__pct {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--fg-quiet);
  font-variant-numeric: tabular-nums;
}

/* ----- Reduce when mobile ----- */
@media (max-width: 768px) {
  .nav { padding: 18px 20px; }
  .nav__links { gap: 18px; }
  .s2-label, .s2-title, .s2-readout,
  .s3-left, .s3-right, .intro-meta { display: none; }
  .progress { display: none; }
}
