:root {
  color-scheme: dark;
  --bg: #030712;
  --text: #f8fafc;
  --muted: #94a3b8;
  --cyan: #22d3ee;
  --purple: #8b5cf6;
  --pink: #ec4899;
  
  --card-bg: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.12);
  --border-hover: rgba(255, 255, 255, 0.22);
  --glow-cyan: rgba(34, 211, 238, 0.15);
  --glow-purple: rgba(139, 92, 246, 0.15);
  --glow-pink: rgba(236, 72, 153, 0.15);
  
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-code: 'JetBrains Mono', monospace;
}

/* --- Preloader --- */
#preloader {
  position: fixed;
  inset: 0;
  background-color: var(--bg);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loader-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.loader-logo svg {
  animation: logoPulse 1.2s ease-in-out infinite;
}

.loader-text {
  font-family: var(--font-code);
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  white-space: nowrap;
  animation: loadingFade 1.2s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.15));
  }
  50% {
    transform: scale(1.12);
    filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.45));
  }
}

@keyframes loadingFade {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

/* --- Custom Cursor --- */
@media (hover: hover) and (pointer: fine) {
  html, body, a, button, input, select, textarea {
    cursor: none !important;
  }

  .custom-cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    background-color: var(--cyan);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    mix-blend-mode: screen;
  }

  .custom-cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    border: 1.5px solid rgba(34, 211, 238, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    mix-blend-mode: screen;
    will-change: width, height, border-color, background-color;
  }

  .custom-cursor-ring.hovered {
    width: 38px;
    height: 38px;
    border-color: rgba(236, 72, 153, 0.6);
    background-color: rgba(236, 72, 153, 0.08);
  }

  .custom-cursor-ring.clicked {
    width: 14px;
    height: 14px;
    border-color: var(--purple);
    background-color: rgba(139, 92, 246, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
  width: 100%;
  height: 100%;
}

/* --- Background overlays --- */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.045;
  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.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 85%);
}

/* Parallax 2D Dust Layer */
#dustCanvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* Spotlight Reveal Overlay */
.reveal-mask {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(circle 220px at var(--mouse-x, -1000px) var(--mouse-y, -1000px), transparent 0%, rgba(3, 7, 18, 0.4) 75%, rgba(3, 7, 18, 0.85) 100%);
  mix-blend-mode: multiply;
  transition: opacity 1.2s ease;
  opacity: 0;
}

.ambient-glow {
  position: fixed;
  width: 65vw;
  height: 65vw;
  border-radius: 50%;
  filter: url(#liquid-blur) blur(90px); /* Premium Organic Liquid Warp */
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
}

.bg-glow-1 {
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, var(--cyan), transparent 70%);
}

.bg-glow-2 {
  bottom: -10%;
  right: -10%;
  background: radial-gradient(circle, var(--purple), transparent 70%);
}

/* --- Heart Container (Fixed) --- */
#heart-container {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

#heartCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* --- Cursor Light --- */
.cursor-light {
  position: fixed;
  z-index: 3;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(103, 247, 255, 0.14), transparent 66%);
  opacity: 0;
  translate: -50% -50%;
  transition: opacity 250ms ease;
  mix-blend-mode: screen;
}

/* --- Single-Page Intro Layout --- */
.intro-page {
  position: relative;
  width: 100%;
  height: 100vh;
  z-index: 2;
}

.panel {
  width: 100%;
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px clamp(20px, 5vw, 60px);
}

/* --- Intro Content --- */
#intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 3;
}

.intro-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-top: 8vh; /* Lower the text block slightly to sit better with the 3D heart */
}

.cinematic-title {
  font-family: var(--font-heading);
  font-size: clamp(3.2rem, 8vw, 7rem);
  font-weight: 700;
  line-height: 1.0;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  color: transparent;
  background: linear-gradient(110deg, #ffffff 0%, var(--cyan) 25%, var(--pink) 50%, var(--purple) 75%, #ffffff 100%);
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  filter: drop-shadow(0 0 35px rgba(34, 211, 238, 0.25));
  animation: textShine 6s linear infinite;
}

@keyframes textShine {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* --- Role Rotator --- */
.role-rotator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  min-height: 48px;
  flex-wrap: nowrap; /* Prevent wrapping on mobile */
  width: 100%;
}

.role-prefix {
  font-family: var(--font-code);
  font-size: clamp(0.85rem, 3.6vw, 1.4rem);
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.role-carousel {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 1.4em;
  overflow: hidden;
}

.role-text {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  font-family: var(--font-heading);
  font-size: clamp(0.85rem, 3.6vw, 1.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: transparent;
  background: linear-gradient(90deg, var(--cyan), var(--purple), var(--pink));
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  animation: roleGradientShift 4s ease-in-out infinite;
}

@keyframes roleGradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Blinking cursor */
.role-cursor {
  font-family: var(--font-code);
  font-size: clamp(0.85rem, 3.6vw, 1.4rem);
  color: var(--cyan);
  animation: cursorBlink 1s step-end infinite;
  text-shadow: 0 0 12px var(--glow-cyan);
  user-select: none;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* --- Intro Subtext --- */
.intro-subtext {
  font-family: var(--font-code);
  font-size: clamp(0.85rem, 1.6vw, 1.15rem);
  color: var(--muted);
  letter-spacing: 0.12em;
  margin: 0 0 40px;
  text-transform: uppercase;
  opacity: 0.8;
}

/* --- Intro Action Buttons --- */
.intro-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.primary-action,
.secondary-action,
.cta-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 280ms cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-body);
}

.primary-action {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  backdrop-filter: blur(14px);
}

.primary-action:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3), 0 0 20px var(--glow-cyan);
}

.secondary-action {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  backdrop-filter: blur(14px);
}

.secondary-action:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3), 0 0 20px var(--glow-purple);
}

.cta-action {
  border: 1px solid rgba(34, 211, 238, 0.5);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(139, 92, 246, 0.14));
  color: var(--cyan);
  backdrop-filter: blur(14px);
}

.cta-action:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.3), rgba(139, 92, 246, 0.22));
  border-color: var(--cyan);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3), 0 0 24px var(--glow-cyan);
  color: var(--text);
}

/* SVG icons in buttons */
.primary-action svg,
.secondary-action svg,
.cta-action svg {
  flex-shrink: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .intro-content {
    margin-top: 14vh; /* Lower the text block on mobile screens to sit better with the 3D heart model */
  }

  .cinematic-title {
    font-size: clamp(2.4rem, 9vw, 3.8rem);
    margin-bottom: 18px;
  }

  .role-rotator {
    gap: 6px;
    margin-bottom: 16px;
  }

  .intro-subtext {
    max-width: min(100%, 320px);
    margin-inline: auto;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    margin-bottom: 24px;
  }

  .intro-actions {
    gap: 12px;
  }

  .primary-action,
  .secondary-action,
  .cta-action {
    min-height: 42px;
    padding: 0 18px;
    font-size: 0.82rem;
  }
}

/* Mobile: hide action text and show compact circle icon-only buttons */
@media (max-width: 600px) {
  .btn-text {
    display: none;
  }

  .intro-actions {
    flex-direction: row !important; /* Keep icons side-by-side */
    justify-content: center;
    gap: 16px;
    width: auto;
    max-width: none;
  }

  .primary-action,
  .secondary-action,
  .cta-action {
    width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center;
    align-items: center;
  }

  .primary-action svg,
  .secondary-action svg,
  .cta-action svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 480px) {
  .intro-content {
    margin-top: 16vh;
  }

  .cinematic-title {
    font-size: clamp(2.0rem, 8.5vw, 2.6rem);
  }
}

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