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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--deep);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  user-select: none;
  cursor: none;
}

#gl-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  touch-action: none;
}

.webgl-fallback #gl-canvas { display: none; }
.webgl-fallback .caustics-layer { opacity: 1; }
.webgl-fallback .ui-layer {
  background:
    radial-gradient(circle at 72% 28%, rgba(0,245,212,0.10), transparent 28%),
    radial-gradient(circle at 25% 65%, rgba(192,132,252,0.12), transparent 34%),
    linear-gradient(135deg, rgba(4,12,24,0.92), rgba(2,5,14,0.96));
}

.caustics-layer,
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.caustics-layer {
  z-index: 2;
  opacity: 0;
  mix-blend-mode: screen;
  animation: causticDrift var(--caustic-speed, 24s) linear infinite, fadeIn 2s 0.5s forwards;
}

.vignette { z-index: 3; }

#cursor,
#cursor-dot {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

#cursor {
  z-index: 999;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--cursor-color, var(--accent));
  transition: width 0.22s, height 0.22s, opacity 0.22s;
  mix-blend-mode: screen;
}

#cursor.hovering,
#cursor.dragging {
  width: 32px;
  height: 32px;
  opacity: 0.62;
}

#cursor-dot {
  z-index: 1000;
  width: 4px;
  height: 4px;
  background: var(--cursor-dot, var(--accent));
}

.cursor-ripple {
  position: fixed;
  z-index: 998;
  width: 12px;
  height: 12px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: cursorRipple 0.7s ease-out forwards;
}

.ui-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.brand-nav {
  position: absolute;
  top: 5vh;
  left: 5vw;
  pointer-events: all;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  opacity: 0;
  animation: slideDown 1s 0.3s cubic-bezier(.22,.61,.36,1) forwards;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--brand-border, color-mix(in srgb, var(--accent), transparent 50%));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: var(--brand-color, var(--accent));
  font-size: 11px;
  font-weight: 600;
}

.brand-name {
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.brand-name span {
  color: var(--brand-color, var(--accent));
  font-weight: 400;
}

.nav-links {
  display: flex;
  gap: 20px;
  opacity: 0;
  animation: slideDown 1s 0.5s cubic-bezier(.22,.61,.36,1) forwards;
}

.nav-link {
  color: var(--faint);
  cursor: pointer;
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active { color: var(--nav-active, var(--accent)); }

.hero {
  position: absolute;
  top: 50%;
  left: 5vw;
  transform: translateY(-50%);
  max-width: min(var(--hero-width, 580px), var(--hero-vw, 52vw));
}

.hero-eyebrow {
  margin-bottom: 18px;
  color: var(--eyebrow-color, var(--accent));
  font-size: 0.6rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  opacity: 0;
  animation: slideUp 1s 0.7s cubic-bezier(.22,.61,.36,1) forwards;
}

.hero-title {
  margin-bottom: 24px;
  color: var(--ink);
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.6rem, 5.5vw, 5rem);
  font-weight: 300;
  line-height: 0.92;
}

.hero-title .word { display: block; overflow: hidden; }
.hero-title .word span { display: block; opacity: 0; transform: translateY(100%); }
.hero-title .word:nth-child(1) span { animation: wordRise 1s 0.9s cubic-bezier(.22,.61,.36,1) forwards; }
.hero-title .word:nth-child(2) span { animation: wordRise 1s 1.05s cubic-bezier(.22,.61,.36,1) forwards; }
.hero-title .word:nth-child(3) span { animation: wordRise 1s 1.2s cubic-bezier(.22,.61,.36,1) forwards; }
.hero-title .word:nth-child(4) span { animation: wordRise 1s 1.35s cubic-bezier(.22,.61,.36,1) forwards; }
.hero-title em { color: var(--title-accent, var(--accent)); font-style: italic; }

.hero-body {
  max-width: var(--copy-width, 370px);
  margin-bottom: 32px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.85;
  opacity: 0;
  animation: slideUp 1s 1.4s cubic-bezier(.22,.61,.36,1) forwards;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  opacity: 0;
  animation: slideUp 1s 1.6s cubic-bezier(.22,.61,.36,1) forwards;
}

.cta-primary {
  padding: 12px 28px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  pointer-events: all;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 0.3s, box-shadow 0.3s, transform 0.3s;
}

.cta-primary:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 24px var(--accent-dim);
  transform: translateY(-1px);
}

.cta-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  cursor: pointer;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  pointer-events: all;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.3s;
}

.cta-secondary:hover { color: var(--ink); }
.cta-secondary::after { content: '→'; transition: transform 0.3s; }
.cta-secondary:hover::after { transform: translateX(4px); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1px solid var(--accent, #00f5d4);
  outline-offset: 4px;
}

.bottom-quote {
  position: absolute;
  bottom: 7vh;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  opacity: 0;
  animation: slideUp 1s 2s cubic-bezier(.22,.61,.36,1) forwards;
}

.bottom-quote blockquote {
  max-width: 480px;
  color: var(--muted);
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.8rem, 1.3vw, 1rem);
  font-style: italic;
  font-weight: 300;
  letter-spacing: 0.04em;
  line-height: 1.7;
}

.hud {
  position: absolute;
  bottom: 7vh;
  left: 5vw;
  opacity: 0;
  animation: slideUp 1s 2s cubic-bezier(.22,.61,.36,1) forwards;
}

.hud-label {
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 0.57rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.hud-metrics { display: flex; gap: 20px; }
.hud-metric { display: flex; flex-direction: column; gap: 3px; }
.hud-value {
  min-width: 50px;
  color: var(--accent);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  line-height: 1;
}
.hud-name {
  color: var(--faint);
  font-size: 0.5rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.scroll-hint {
  position: absolute;
  right: 5vw;
  bottom: 7vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: slideUp 1s 2.2s ease forwards;
}

.scroll-line {
  width: 1px;
  height: 44px;
  background: linear-gradient(180deg, var(--scroll-color, var(--accent)), transparent);
  animation: scrollPulse 2.5s ease-in-out infinite;
}

.scroll-text {
  color: var(--faint);
  font-size: 0.55rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
}

.page-indicator {
  position: absolute;
  top: 50%;
  right: 2.2vw;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  animation: slideDown 1s 2.5s ease forwards;
}

.page-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--faint);
  transition: all 0.3s;
}

.page-dot.active {
  height: 16px;
  border-radius: 2px;
  background: var(--dot-active, var(--accent));
  box-shadow: 0 0 8px var(--dot-glow, var(--accent-dim));
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: var(--deep);
  transition: opacity 1.2s, visibility 1.2s;
}

#loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#loading-screen.hidden > * { display: none; }
.loading-logo {
  color: var(--loading-color, var(--accent));
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.35em;
  text-transform: uppercase;
}
.loading-bar-track { width: 160px; height: 1px; background: var(--loading-track, rgba(255,255,255,0.15)); }
.loading-bar { height: 100%; width: 0%; background: var(--loading-color, var(--accent)); transition: width 0.3s ease; }
.loading-sub { color: var(--faint); font-size: 0.45rem; letter-spacing: 0.35em; text-transform: uppercase; }

@keyframes cursorRipple { to { width: 54px; height: 54px; opacity: 0; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes wordRise { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: translateY(0); } }
@keyframes scrollPulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

/* ─── WEB AUDIO EQUALIZER WAVE ICON ─── */
#audio-toggle {
  position: absolute;
  top: 5vh;
  right: 5vw;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
  cursor: pointer;
  pointer-events: all;
  z-index: 100;
  opacity: 0.65;
  transition: opacity 0.3s, transform 0.3s;
}
#audio-toggle:hover {
  opacity: 1;
  transform: scale(1.05);
}
#audio-toggle span {
  display: inline-block;
  width: 2px;
  height: 3px;
  background: var(--accent);
  border-radius: 1px;
  transition: height 0.2s, background 0.3s;
  transform-origin: bottom;
}
#audio-toggle.playing span {
  animation: bounce 0.8s ease-in-out infinite alternate;
}
#audio-toggle.playing span:nth-child(1) { animation-delay: 0.1s; animation-duration: 0.7s; }
#audio-toggle.playing span:nth-child(2) { animation-delay: 0.3s; animation-duration: 0.9s; }
#audio-toggle.playing span:nth-child(3) { animation-delay: 0.2s; animation-duration: 0.6s; }
#audio-toggle.playing span:nth-child(4) { animation-delay: 0.4s; animation-duration: 0.8s; }

@keyframes bounce {
  from { transform: scaleY(1); }
  to { transform: scaleY(5); }
}

/* ─── BIOLUMINESCENT CURSOR TRAIL CANVAS ─── */
#trail-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  pointer-events: none;
}

/* ─── AWWWARDS PANEL GLOWS ─── */
.method-step,
.track-row,
.proof-signal,
.proof-artifacts,
.form-panel {
  backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45), inset 0 0 12px rgba(255, 255, 255, 0.02) !important;
  transition: border-color 0.4s, box-shadow 0.4s, transform 0.4s;
}
.method-step:hover,
.track-row:hover,
.proof-signal:hover,
.proof-artifacts:hover,
.form-panel:hover {
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 16px 48px 0 rgba(0, 0, 0, 0.55), 0 0 24px var(--accent-dim, rgba(255,255,255,0.05)) !important;
}

@media (max-width: 760px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    cursor: auto;
  }

  #cursor,
  #cursor-dot { display: none; }

  .ui-layer {
    position: relative;
    min-height: 100vh;
    padding: 28px 20px 58px;
    overflow: visible;
    pointer-events: none;
  }

  .brand-nav,
  .hero,
  .method-panel,
  .tracks-panel,
  .proof-panel,
  .form-panel,
  .bottom-quote,
  .hud,
  .stats-column {
    pointer-events: auto;
  }

  .brand-nav { position: relative; top: auto; left: auto; }
  .brand-logo { opacity: 1; animation: none; }
  .nav-links { flex-wrap: wrap; gap: 12px 15px; opacity: 1; animation: none; }
  .nav-link { color: rgba(190,210,230,0.62); font-size: 0.56rem; letter-spacing: 0.18em; }

  .hero {
    position: relative;
    top: auto;
    left: auto;
    max-width: 100%;
    margin-top: 82px;
    transform: none;
  }

  .hero-eyebrow {
    color: color-mix(in srgb, var(--eyebrow-color, var(--accent)) 90%, white 10%);
    font-size: 0.55rem;
    letter-spacing: 0.24em;
    text-shadow: 0 1px 18px rgba(0,0,0,0.82);
  }
  .hero-title {
    max-width: 11ch;
    font-size: clamp(2.35rem, 13vw, 3.35rem);
    line-height: 0.94;
    text-shadow: 0 2px 24px rgba(0,0,0,0.72);
  }
  .hero-body {
    max-width: 92vw;
    color: rgba(222,232,244,0.82);
    font-size: 0.78rem;
    line-height: 1.78;
    text-shadow: 0 1px 18px rgba(0,0,0,0.78);
  }
  .hero-ctas { gap: 12px; }
  .cta-primary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 12px 18px;
    letter-spacing: 0.16em;
  }
  .cta-secondary {
    color: rgba(222,232,244,0.58);
    letter-spacing: 0.12em;
  }

  .bottom-quote,
  .hud,
  .scroll-hint,
  .page-indicator { display: none; }

  #audio-toggle {
    position: absolute;
    top: 3.5vh;
    right: 6vw;
    height: 15px;
  }

}

/* ── Audio Toggle States ─────────────────────────────────────── */
#audio-toggle:hover {
  border-color: rgba(0, 245, 212, 0.55);
  box-shadow: 0 0 16px rgba(0, 245, 212, 0.22);
}

#audio-toggle.playing {
  border-color: rgba(0, 245, 212, 0.7);
  box-shadow: 0 0 24px rgba(0, 245, 212, 0.28);
}

#audio-toggle.playing span {
  animation: eqBar 0.8s ease-in-out infinite alternate;
}
#audio-toggle.playing span:nth-child(1) { animation-delay: 0s; }
#audio-toggle.playing span:nth-child(2) { animation-delay: 0.15s; }
#audio-toggle.playing span:nth-child(3) { animation-delay: 0.3s; }
#audio-toggle.playing span:nth-child(4) { animation-delay: 0.45s; }

@keyframes eqBar {
  from { transform: scaleY(0.4); }
  to   { transform: scaleY(1.5); }
}

/* ── View Transitions: ocean cross-fade ─────────────────────── */
::view-transition-old(root) {
  animation: vtFadeOut 0.45s cubic-bezier(0.4, 0, 1, 1) both;
}
::view-transition-new(root) {
  animation: vtFadeIn  0.55s cubic-bezier(0, 0, 0.2, 1) both;
}

@keyframes vtFadeOut {
  from { opacity: 1; filter: blur(0px); }
  to   { opacity: 0; filter: blur(6px); }
}
@keyframes vtFadeIn {
  from { opacity: 0; filter: blur(6px); transform: translateY(8px); }
  to   { opacity: 1; filter: blur(0px); transform: translateY(0); }
}

/* ── Trail canvas hidden on mobile ──────────────────────────── */
@media (max-width: 760px) {
  #trail-canvas { display: none; }
  #audio-toggle { display: none; }
}
