/* ==========================================================================
   SARVX TECH — GLOBAL STYLES, CURSOR, LOADER & OVERLAYS
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@200;300;400;500;600;700;800;900&family=Space+Grotesk:wght@300;400;500;600;700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

html.lenis, html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  selection-background-color: #FFFFFF;
  selection-color: #000000;
}

::selection {
  background: #FFFFFF;
  color: #000000;
}

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

button {
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  outline: none;
}

ul, ol {
  list-style: none;
}

img, video, canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Film Grain & Background Ambient Canvas --- */
#ambientCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  opacity: 0.6;
}

.film-grain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 998;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* --- Custom Magnetic Cursor --- */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--cursor-size);
  height: var(--cursor-size);
  background-color: #FFFFFF;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease-cinematic), height 0.3s var(--ease-cinematic), background-color 0.3s ease, transform 0.1s ease-out;
  mix-blend-mode: difference;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-cursor-follower {
  position: fixed;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.4s var(--ease-cinematic), height 0.4s var(--ease-cinematic), border-color 0.3s ease, opacity 0.3s ease;
}

.custom-cursor .cursor-text {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #000000;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.custom-cursor.hovering {
  width: 60px;
  height: 60px;
  background-color: rgba(255, 255, 255, 1);
  mix-blend-mode: difference;
}

.custom-cursor.hovering-project {
  width: 84px;
  height: 84px;
  background-color: #FFFFFF;
  mix-blend-mode: normal;
}

.custom-cursor.hovering-project .cursor-text {
  opacity: 1;
}

@media (max-width: 1024px), (pointer: coarse) {
  .custom-cursor, .custom-cursor-follower {
    display: none !important;
  }
}



/* --- Elva Labs Kinetic Liquid Text Blur Tokens --- */
.elva-token {
  display: inline-block;
  white-space: pre-wrap;
  filter: blur(var(--elva-blur-initial));
  opacity: 0;
  transform: translateY(16px);
  will-change: transform, filter, opacity;
  transition: filter 0.75s var(--ease-cinematic), opacity 0.75s ease, transform 0.75s var(--ease-cinematic);
}

.elva-token.revealed {
  filter: blur(var(--elva-blur-clear));
  opacity: 1;
  transform: translateY(0);
}

/* --- Elva Labs 8-Dot Morphing Geometric Constellation --- */
.dots {
  position: relative;
  width: 20px;
  height: 20px;
  display: inline-block;
  flex-shrink: 0;
  transform: rotate(0deg);
}

.dots div {
  position: absolute;
  width: 3.5px;
  height: 3.5px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.dots div:nth-child(1) { top: 2px; left: 8px; }
.dots div:nth-child(2) { top: 4px; left: 13px; }
.dots div:nth-child(3) { top: 8px; left: 16px; }
.dots div:nth-child(4) { top: 8px; left: 8px; }
.dots div:nth-child(5) { top: 8px; left: 0px; }
.dots div:nth-child(6) { top: 12px; left: 3px; }
.dots div:nth-child(7) { top: 12px; left: 13px; }
.dots div:nth-child(8) { top: 15px; left: 8px; }

/* Constellation Morph Physics on Hover */
:hover > .dots div:nth-child(1), .btn-elva:hover .dots div:nth-child(1), .card-hover-trigger:hover .dots div:nth-child(1) { transform: translateY(-5px); background: #0989d8; }
:hover > .dots div:nth-child(2), .btn-elva:hover .dots div:nth-child(2), .card-hover-trigger:hover .dots div:nth-child(2) { transform: translate(4px, -4px); background: #3fa1e6; }
:hover > .dots div:nth-child(3), .btn-elva:hover .dots div:nth-child(3), .card-hover-trigger:hover .dots div:nth-child(3) { transform: translate(5px, 0); background: #850dee; }
:hover > .dots div:nth-child(4), .btn-elva:hover .dots div:nth-child(4), .card-hover-trigger:hover .dots div:nth-child(4) { transform: scale(1.4); }
:hover > .dots div:nth-child(5), .btn-elva:hover .dots div:nth-child(5), .card-hover-trigger:hover .dots div:nth-child(5) { transform: translate(-5px, 0); background: #0989d8; }
:hover > .dots div:nth-child(6), .btn-elva:hover .dots div:nth-child(6), .card-hover-trigger:hover .dots div:nth-child(6) { transform: translate(-4px, 4px); background: #850dee; }
:hover > .dots div:nth-child(7), .btn-elva:hover .dots div:nth-child(7), .card-hover-trigger:hover .dots div:nth-child(7) { transform: translate(4px, 4px); background: #3fa1e6; }
:hover > .dots div:nth-child(8), .btn-elva:hover .dots div:nth-child(8), .card-hover-trigger:hover .dots div:nth-child(8) { transform: translateY(5px); background: #850dee; }

/* --- Elva Labs Neon SVG Animated Border Draw Button --- */
.btn-elva {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 22px;
  background: var(--elva-glass-bg);
  backdrop-filter: var(--elva-glass-blur);
  -webkit-backdrop-filter: var(--elva-glass-blur);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.35s var(--ease-cinematic), border-color 0.3s ease, box-shadow 0.35s ease;
  white-space: nowrap;
}

.btn-elva svg.btn-elva-border {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: blur(1.5px);
}

.btn-elva svg.btn-elva-border rect {
  stroke-width: 3.5;
  stroke-dasharray: 0, 600;
  stroke-dashoffset: -300;
  opacity: 0;
  transition: opacity 0.4s ease;
}

@keyframes elvaBtnDraw {
  0% { stroke-dasharray: 0, 600; opacity: 1; }
  60% { stroke-dasharray: 600, 0; opacity: 1; }
  100% { stroke-dasharray: 600, 0; opacity: 0; }
}

.btn-elva:hover svg.btn-elva-border rect {
  animation: elvaBtnDraw 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.btn-elva:hover {
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(9, 137, 216, 0.2), 0 0 16px rgba(133, 13, 238, 0.2);
}

/* Three.js Background WebGL Container */
#threeWebglContainer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  opacity: 0.85;
}


/* --- Global Header & Navigation --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--container-padding);
  z-index: 990;
  transition: background-color 0.4s ease, backdrop-filter 0.4s ease, border-bottom 0.4s ease, transform 0.4s ease;
  background-color: transparent;
}

.site-header.scrolled {
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-logo-link,
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-transform: uppercase;
  z-index: 2;
  text-decoration: none;
  white-space: nowrap;
}

.brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #FFC700;
  box-shadow: 0 0 8px rgba(255, 199, 0, 0.8);
  animation: pulseDot 2.4s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 1.6vw, 2rem);
}

.nav-link {
  font-family: var(--font-mono);
  font-size: clamp(11px, 0.85vw, 12.5px);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  position: relative;
  padding: 6px 0;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0%;
  height: 1px;
  background-color: #FFFFFF;
  transition: width 0.3s var(--ease-cinematic);
}

.nav-link:hover {
  color: #FFFFFF;
}

.nav-link:hover::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.sound-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.sound-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border-color: var(--border-glass-hover);
}

.sound-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.sound-bar {
  width: 2px;
  background-color: currentColor;
  border-radius: 1px;
  height: 4px;
  transition: height 0.2s ease;
}

.sound-toggle-btn.playing .sound-bar:nth-child(1) { animation: soundBar1 0.8s infinite alternate ease-in-out; }
.sound-toggle-btn.playing .sound-bar:nth-child(2) { animation: soundBar2 0.6s infinite alternate ease-in-out 0.1s; }
.sound-toggle-btn.playing .sound-bar:nth-child(3) { animation: soundBar3 0.7s infinite alternate ease-in-out 0.2s; }
.sound-toggle-btn.playing .sound-bar:nth-child(4) { animation: soundBar4 0.9s infinite alternate ease-in-out 0.3s; }

@keyframes soundBar1 { from { height: 3px; } to { height: 12px; } }
@keyframes soundBar2 { from { height: 6px; } to { height: 11px; } }
@keyframes soundBar3 { from { height: 2px; } to { height: 10px; } }
@keyframes soundBar4 { from { height: 5px; } to { height: 12px; } }

.nav-cta-btn {
  padding: 10px 20px;
  background: #FFFFFF;
  color: #000000;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: transform 0.3s var(--ease-cinematic), background-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 18px rgba(255, 255, 255, 0.15);
}

.nav-cta-btn:hover {
  transform: scale(1.05);
  background: #F0F0F0;
  box-shadow: 0 6px 24px rgba(255, 255, 255, 0.3);
}

/* Mobile Menu Toggle */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  border-radius: 50%;
  cursor: pointer;
  z-index: 1002;
  transition: all 0.25s ease;
}

.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-glass-hover);
}

.mobile-menu-line {
  width: 18px;
  height: 1.5px;
  background-color: #FFFFFF;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-menu-btn.active .mobile-menu-line:nth-child(1) {
  transform: translateY(3.75px) rotate(45deg);
}

.mobile-menu-btn.active .mobile-menu-line:nth-child(2) {
  transform: translateY(-3.75px) rotate(-45deg);
}

@media (max-width: 1080px) {
  .nav-desktop {
    display: none;
  }
  .mobile-menu-btn {
    display: flex;
  }
}

@media (max-width: 768px) {
  .site-header {
    height: 64px;
    padding: 0 clamp(0.75rem, 3vw, 1.25rem);
  }
  .brand-logo-link {
    font-size: 1.05rem;
    gap: 0.45rem;
  }
  .header-actions .nav-cta-btn {
    display: none;
  }
}

@media (max-width: 480px) {
  .sound-toggle-btn {
    padding: 8px 10px;
  }
  .sound-toggle-btn .sound-label {
    display: none;
  }
}

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background-color: #000000;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5.5rem clamp(1.25rem, 4vw, 2.5rem) 2.5rem;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.6s cubic-bezier(0.85, 0, 0.15, 1);
  overflow-y: auto;
}

.mobile-nav-overlay.active {
  clip-path: inset(0 0 0 0);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mobile-nav-link {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6.5vw, 3rem);
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: -0.03em;
  transition: color 0.3s ease, transform 0.3s ease;
}

.mobile-nav-link:hover {
  color: var(--text-muted);
  transform: translateX(6px);
}
