/* ============================================================
   EFFECTS — Aprimoramentos Visuais Premium
   Contém: progress bar, grain overlay, orbs, cursor, tilt,
           divisores de seção, canvas de partículas e canvas de seções.
   ============================================================ */

/* ============================================================
   BARRA DE PROGRESSO DE SCROLL
   Fica fixada no topo com z-index acima da navbar.
   A largura é animada pelo GSAP ScrollTrigger em effects.js.
   ============================================================ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-light));
  z-index: 1001;
  pointer-events: none;
  box-shadow: 0 0 8px var(--color-accent-glow);
}

/* ============================================================
   OVERLAY DE RUÍDO / GRAIN
   SVG com feTurbulence posicionado fixo sobre toda a página.
   Opacidade baixa (0.04) para ser sutil — apenas textura, não distração.
   A animação grainShift desloca o SVG em pequenos incrementos
   para simular o efeito de película (film grain).
   ============================================================ */
.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.04;
  animation: grainShift 0.5s steps(4) infinite;
}

@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2px, 2px); }
  50%  { transform: translate(2px, -2px); }
  75%  { transform: translate(-1px, -1px); }
  100% { transform: translate(1px, 1px); }
}

/* ============================================================
   ORBS GRADIENTE FLUTUANTES (Fundo do Hero)
   Três círculos com blur extremo criam profundidade atmosférica.
   Cada orb tem duração de animação diferente para dessincronizar
   o movimento e evitar padrão repetitivo visível.
   ============================================================ */
.hero-orbs {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}

/* Orb 1 — canto superior esquerdo, roxo intenso, 15s */
.hero-orb--1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.6), transparent 70%);
  top: -10%;
  left: -5%;
  animation: floatOrb1 15s ease-in-out infinite;
}

/* Orb 2 — canto inferior direito, índigo, 20s */
.hero-orb--2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.5), transparent 70%);
  bottom: -5%;
  right: -5%;
  animation: floatOrb2 20s ease-in-out infinite;
}

/* Orb 3 — centro-direita, lilás claro, 25s */
.hero-orb--3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(157, 95, 255, 0.4), transparent 70%);
  top: 40%;
  left: 50%;
  animation: floatOrb3 25s ease-in-out infinite;
}

@keyframes floatOrb1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40px, 30px) scale(1.05); }
  66%      { transform: translate(-20px, -15px) scale(0.95); }
}

@keyframes floatOrb2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(-35px, -25px) scale(1.08); }
  66%      { transform: translate(25px, 20px) scale(0.92); }
}

@keyframes floatOrb3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(30px, -35px) scale(1.03); }
  66%      { transform: translate(-25px, 20px) scale(0.97); }
}

/* ============================================================
   CURSOR PERSONALIZADO
   Dot: ponto sólido que segue o mouse imediatamente.
   Circle: anel translúcido com atraso (trailing) via GSAP ticker.
   A classe .has-custom-cursor no body esconde o cursor nativo.
   ============================================================ */
.custom-cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease, opacity 0.3s ease;
}

.custom-cursor-circle {
  position: fixed;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--color-accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.2);
  transition: transform 0.15s ease, opacity 0.3s ease, width 0.2s ease, height 0.2s ease;
}

/* Estado hover: cursor cresce e muda de cor ao passar em elementos interativos */
.cursor-hover .custom-cursor-dot {
  transform: translate(-50%, -50%) scale(1.5);
}

.cursor-hover .custom-cursor-circle {
  width: 50px;
  height: 50px;
  border-color: var(--color-accent-light);
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.35);
}

/* Esconde o cursor nativo no desktop quando o cursor custom está ativo */
.has-custom-cursor,
.has-custom-cursor a,
.has-custom-cursor button,
.has-custom-cursor input,
.has-custom-cursor textarea,
.has-custom-cursor [role="button"] {
  cursor: none !important;
}

/* Top-layer (dialog showModal) esconde o cursor custom — restaura o nativo */
.project-dialog,
.project-dialog a,
.project-dialog button {
  cursor: auto !important;
}

.project-dialog .project-dialog-close,
.project-dialog .project-dialog-btn {
  cursor: pointer !important;
}

/* ============================================================
   TILT 3D — Perspectiva nos Glass Cards
   transform-style: preserve-3d permite que o rotateX/Y do GSAP
   funcione corretamente em 3D.
   O .tilt-glare é injetado via JS e segue o mouse como reflexo.
   ============================================================ */
.tilt-container {
  perspective: 800px;
}

.glass-card {
  transform-style: preserve-3d;
}

.glass-card .tilt-glare {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03), transparent 35%);
  transition: opacity 0.3s ease;
  z-index: 1;
}

.glass-card:hover .tilt-glare {
  opacity: 1;
}

/* ============================================================
   DIVISOR DE SEÇÃO — Linha Gradiente com Glow
   Separa visualmente as seções com uma linha neon sutil.
   O ::after cria o brilho difuso abaixo da linha.
   ============================================================ */
.section-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--color-accent) 30%,
    var(--color-accent-light) 50%,
    var(--color-accent) 70%,
    transparent 100%
  );
  position: relative;
  overflow: visible;
}

.section-divider::after {
  content: '';
  position: absolute;
  top: -2px;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(124, 58, 237, 0.3) 30%,
    rgba(157, 95, 255, 0.4) 50%,
    rgba(124, 58, 237, 0.3) 70%,
    transparent 100%
  );
  filter: blur(4px);
}

/* ============================================================
   CANVAS DE PARTÍCULAS (Hero)
   Posicionado absolutamente dentro do #hero, abaixo do conteúdo.
   pointer-events: none garante que o canvas não intercepte cliques.
   ============================================================ */
#particleCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Garante que o conteúdo do hero fique acima do canvas e dos orbs */
#hero {
  position: relative;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

/* ============================================================
   CANVAS DE FUNDO DAS SEÇÕES
   Cada seção (about, skills, projects, contact) tem um canvas
   posicionado absolutamente como fundo animado.
   O .section-container fica acima via z-index: 1.
   ============================================================ */
.section {
  position: relative;
  overflow: hidden; /* evita que os canvas vazem para fora da seção */
}

.section-bg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Conteúdo das seções sempre acima do canvas de fundo */
.section .section-container {
  position: relative;
  z-index: 1;
}

/* ============================================================
   ACESSIBILIDADE — Movimento Reduzido (prefers-reduced-motion)
   Desativa todas as animações decorativas para usuários que
   configuraram o sistema para reduzir movimento.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .noise-overlay {
    animation: none;
  }

  .hero-orb {
    animation: none !important;
  }

  .custom-cursor-dot,
  .custom-cursor-circle {
    display: none !important;
  }

  .scroll-progress {
    transition: none;
  }

  .section-divider::after {
    filter: none;
  }

  /* Remove todos os canvas animados */
  #particleCanvas,
  .section-bg-canvas {
    display: none !important;
  }
}

/* ============================================================
   RESPONSIVO — Ajustes Mobile (≤768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Orbs menores e mais transparentes para não sobrecarregar a tela */
  .hero-orb {
    opacity: 0.2;
  }

  .hero-orb--1 {
    width: 250px;
    height: 250px;
  }

  .hero-orb--2 {
    width: 200px;
    height: 200px;
  }

  /* Terceiro orb removido no mobile — economiza processamento */
  .hero-orb--3 {
    display: none;
  }

  /* Cursor custom nunca aparece em touch */
  .custom-cursor-dot,
  .custom-cursor-circle {
    display: none !important;
  }

  /* Glow do divisor desativado no mobile */
  .section-divider::after {
    display: none;
  }
}
