/* =============================================
   PREMIUM ANIMATIONS & MODERN ENHANCEMENTS
   Chintan Varma Portfolio — v3.0 Fullstack Wipe
   ============================================= */

/* ── Custom Cursor ── */
#cursor-dot,
#cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  transition: opacity 0.3s;
}

#cursor-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent-glow);
  transition: transform 0.1s, background 0.2s;
}

#cursor-ring {
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(129, 140, 248, 0.55);
  transition: width 0.3s var(--ease-out-cubic),
    height 0.3s var(--ease-out-cubic),
    border-color 0.3s;
}

body:has(a:hover) #cursor-ring,
body:has(button:hover) #cursor-ring {
  width: 52px;
  height: 52px;
  border-color: var(--accent);
  background: rgba(129, 140, 248, 0.07);
}

body:has(a:hover) #cursor-dot,
body:has(button:hover) #cursor-dot {
  transform: translate(-50%, -50%) scale(0.3);
}

@media (hover: none) {

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

/* ── Floating Particles Canvas ── */
#particles-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

@media (max-width: 768px) {
  #particles-canvas {
    display: none;
  }
}

/* ── Glitch Effect on Hero Name ── */
@keyframes glitch-clip-1 {
  0% {
    clip-path: inset(10% 0 80% 0);
    transform: translate(-4px, 0);
  }

  20% {
    clip-path: inset(60% 0 20% 0);
    transform: translate(4px, 0);
  }

  40% {
    clip-path: inset(30% 0 55% 0);
    transform: translate(-2px, 0);
  }

  60% {
    clip-path: inset(75% 0 5% 0);
    transform: translate(3px, 0);
  }

  80% {
    clip-path: inset(5% 0 75% 0);
    transform: translate(-3px, 0);
  }

  100% {
    clip-path: inset(10% 0 80% 0);
    transform: translate(0, 0);
  }
}

@keyframes glitch-clip-2 {
  0% {
    clip-path: inset(70% 0 5% 0);
    transform: translate(4px, 0);
  }

  20% {
    clip-path: inset(10% 0 65% 0);
    transform: translate(-4px, 0);
  }

  40% {
    clip-path: inset(50% 0 30% 0);
    transform: translate(2px, 0);
  }

  60% {
    clip-path: inset(20% 0 60% 0);
    transform: translate(-2px, 0);
  }

  80% {
    clip-path: inset(85% 0 2% 0);
    transform: translate(4px, 0);
  }

  100% {
    clip-path: inset(70% 0 5% 0);
    transform: translate(0, 0);
  }
}

.hero-name {
  position: relative;
}

.hero-name::before,
.hero-name::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 50%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  pointer-events: none;
  opacity: 0;
}

.hero-name:hover::before {
  opacity: 1;
  animation: glitch-clip-1 0.4s steps(1) 3;
  color: #f87171;
  -webkit-text-fill-color: #f87171;
  background: none;
}

.hero-name:hover::after {
  opacity: 1;
  animation: glitch-clip-2 0.4s steps(1) 3;
  color: #60a5fa;
  -webkit-text-fill-color: #60a5fa;
  background: none;
}

/* ── Typewriter blinking cursor on hero tagline ── */
.hero-tagline::after {
  content: '|';
  display: inline-block;
  color: var(--accent);
  animation: blink 1s step-end infinite;
  margin-left: 2px;
  font-weight: 300;
}

/* ── Scroll Progress Bar ── */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #38bdf8, #f472b6);
  z-index: 10001;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ── Magnetic Button Effect ── */
.btn-primary,
.btn-outline,
.prow-btn {
  will-change: transform;
}

/* ── Section Number Watermark ── */
.section-watermark {
  position: absolute;
  top: 50%;
  right: -20px;
  transform: translateY(-50%) rotate(90deg);
  font-family: var(--font-mono);
  font-size: clamp(5rem, 12vw, 14rem);
  font-weight: 900;
  color: transparent;
  -webkit-text-stroke: 1px rgba(129, 140, 248, 0.05);
  pointer-events: none;
  user-select: none;
  letter-spacing: -4px;
  white-space: nowrap;
  z-index: 0;
}

/* ── Floating Nav Indicator Dot ── */
.nav-link {
  position: relative;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
  animation: nav-dot-pulse 2s ease-in-out infinite;
}

@keyframes nav-dot-pulse {

  0%,
  100% {
    box-shadow: 0 0 6px var(--accent);
  }

  50% {
    box-shadow: 0 0 14px var(--accent), 0 0 24px var(--accent-glow);
  }
}

/* ── Tech Card — Tilt (JS-driven) ── */
.tech-card {
  transform-style: preserve-3d;
  perspective: 600px;
  transition: border-color 0.35s, box-shadow 0.35s, transform 0.18s var(--ease-out-cubic), background 0.35s;
}

/* ── Bento Cards — 3D Tilt Base ── */
.bento-card {
  transform-style: preserve-3d;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.18s var(--ease-out-cubic);
}

/* ── Project Row — Reveal glow on scroll ── */
.prow {
  transition: border-color 0.5s, box-shadow 0.5s, background 0.5s;
}

/* ── Neon Underline on Section Titles ── */
.section-title {
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
  border-radius: 2px;
  box-shadow: 0 0 10px var(--accent-glow);
  transition: width 0.7s var(--ease-out-cubic);
}

.section-header.in-view .section-title::after {
  width: 100%;
}

/* ── Pulsing Available Badge ── */
.status-dot {
  position: relative;
}

.status-dot::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--success);
  opacity: 0;
  animation: ripple-green 2s ease-out infinite;
}

@keyframes ripple-green {
  0% {
    transform: scale(0.8);
    opacity: 0.6;
  }

  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* ── Float animation for hero elements ── */
@keyframes float-y {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-8px);
  }
}

.hero-terminal .terminal-window {
  animation: float-y 5s ease-in-out infinite;
}

/* ── Preloader — Enhanced ── */
#preloader {
  overflow: hidden;
  cursor: none;
}

#preloader::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 50%,
      rgba(99, 102, 241, 0.12) 0%, transparent 70%);
  animation: preloader-pulse 2s ease-in-out infinite;
}

@keyframes preloader-pulse {

  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* ── Staggered fade-in helper ── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(28px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(28px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.88);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Shimmer on bento-bio card ── */
@keyframes shimmer {
  0% {
    background-position: -400px 0;
  }

  100% {
    background-position: 400px 0;
  }
}

.bento-bio::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg,
      transparent 30%, rgba(255, 255, 255, 0.03) 50%, transparent 70%);
  background-size: 400px 100%;
  animation: shimmer 4s infinite linear;
  pointer-events: none;
}

/* ── Cert card — rainbow border on hover ── */
.cert-card:hover {
  border-image: linear-gradient(135deg, #818cf8, #38bdf8, #f472b6) 1;
  border-width: 1.5px;
}

/* ── Contact form — glow ring on focus ── */
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.18),
    0 0 24px rgba(129, 140, 248, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ── Footer — animated gradient text ── */
.footer-copy {
  background: linear-gradient(90deg, var(--text-muted), var(--accent), var(--text-muted));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: text-shimmer 4s linear infinite;
}

@keyframes text-shimmer {
  0% {
    background-position: 0% center;
  }

  100% {
    background-position: 200% center;
  }
}

/* ── Social icon magnetic hover glow ── */
.social-icon-btn {
  position: relative;
  overflow: hidden;
}

.social-icon-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.social-icon-btn:hover::before {
  opacity: 1;
}

/* ── Hero eyebrow — scanline effect ── */
.hero-eyebrow {
  position: relative;
  overflow: hidden;
}

.hero-eyebrow::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.2), transparent);
  animation: scanline 3s ease-in-out infinite;
}

@keyframes scanline {
  0% {
    left: -60%;
  }

  100% {
    left: 160%;
  }
}

/* ── Stack section — animated dot grid ── */
.stack-section {
  overflow: hidden;
}

.stack-section::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, rgba(129, 140, 248, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  animation: grid-drift 20s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes grid-drift {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 28px 28px;
  }
}

/* ── Prow image — parallax on hover (JS) ── */
.prow-img-inner img {
  will-change: transform;
}

/* ── "Number" counters animate to value ── */
.stat-number {
  font-variant-numeric: tabular-nums;
}

/* ── Reveal classes for JS-triggered in-view ── */
.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
}

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
}

.in-view {
  opacity: 1 !important;
  transform: none !important;
  transition: opacity 0.8s var(--ease-out-cubic),
    transform 0.8s var(--ease-out-cubic);
}

/* ── Neon text glow on h2 section title ── */
.section-title {
  text-shadow: none;
  filter: none;
}

/* ── Projects — stagger cards appear with depth ── */
.prow {
  will-change: transform, opacity;
}

/* ── Gradient ring spinner in preloader ── */
@keyframes spin-ring {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.preloader-ring {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 48px;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-right-color: rgba(129, 140, 248, 0.3);
  border-radius: 50%;
  animation: spin-ring 1s linear infinite;
}

/* ── Noise texture on section-alt ── */
.section-alt::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
  opacity: 0.015;
  pointer-events: none;
  z-index: 0;
}

/* ── Cert grid — hover lift with glow color ── */
.cert-card:hover {
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow:
    0 16px 48px rgba(129, 140, 248, 0.2),
    0 0 0 1px rgba(129, 140, 248, 0.15),
    0 0 30px rgba(129, 140, 248, 0.08) inset;
  transform: translateY(-6px) scale(1.01);
}

/* ── Contact social link — slide with color ── */
.contact-social-link i {
  transition: color 0.3s, transform 0.3s var(--ease-out-cubic);
}

.contact-social-link:hover i {
  color: var(--accent);
  transform: scale(1.2) rotate(-5deg);
}

/* ── Scroll-down arrow on hero ── */
.hero-scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-subtle);
  z-index: 2;
  animation: hero-hint-fade 2.5s ease-in-out infinite;
}

.hero-scroll-hint i {
  font-size: 1.2rem;
  animation: bounce-down 1.6s ease-in-out infinite;
}

@keyframes bounce-down {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(7px);
  }
}

@keyframes hero-hint-fade {

  0%,
  100% {
    opacity: 0.4;
  }

  50% {
    opacity: 0.9;
  }
}

/* ── Back-to-top button ── */
#back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #818cf8, #6366f1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 6px 24px rgba(129, 140, 248, 0.4);
  z-index: 999;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s, transform 0.4s var(--ease-out-cubic),
    box-shadow 0.3s;
  cursor: pointer;
  border: none;
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

#back-to-top:hover {
  box-shadow: 0 12px 36px rgba(129, 140, 248, 0.6);
  transform: translateY(-3px);
}

/* ── Nav brand — animated angle brackets ── */
.brand-bracket {
  display: inline-block;
  transition: transform 0.3s var(--ease-out-cubic), color 0.3s;
}

.nav-brand:hover .brand-bracket:first-of-type {
  transform: translateX(-4px);
}

.nav-brand:hover .brand-bracket:last-of-type {
  transform: translateX(4px);
}

/* ── Hero section — subtle animated mesh lines ── */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(129, 140, 248, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(129, 140, 248, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 100%);
  pointer-events: none;
  z-index: 0;
  animation: mesh-drift 25s linear infinite;
}

@keyframes mesh-drift {
  0% {
    background-position: 0 0, 0 0;
  }

  100% {
    background-position: 48px 48px, 48px 48px;
  }
}