/* Estilos personalizados */
:root {
  /* Paleta principal de la página (puedes ajustar estos valores) */
  --brand-pink: #ff3399;
  /* Paleta púrpura con doble acento */
  --accent-purple-1: #4808AA; /* principal neon */
  --accent-purple-2: #8a2be2; /* secundario azulado */
  --accent-purple-1-rgb: 72, 8, 170;
  --accent-purple-2-rgb: 138, 43, 226;

  /* Variables faltantes para brand-purple */
  --brand-purple: #4808AA;
  --brand-purple-rgb: 72, 8, 170;

  /* Preloader usa el acento principal */
  --preloader-accent: var(--accent-purple-1);
  --preloader-fill: var(--accent-purple-1);
  --preloader-stroke: #0f1f3a; /* azul muy oscuro para líneas del preloader */
}

/* ============================================================================
   PROJECT CARDS - SIMPLE GRID LAYOUT
   ============================================================================ */

.project-card {
  transition: all 0.3s ease;
  cursor: default;
  user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: rgba(var(--accent-purple-1-rgb), 0.5);
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.1),
    0 0 20px rgba(var(--accent-purple-1-rgb), 0.1);
}
#proyectos {
  user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  overflow: visible;
}

#projects-grid {
  user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

body {
  background-image:
    radial-gradient(
      circle at 25% 10%,
      rgba(var(--brand-purple-rgb), 0.05) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 75% 90%,
      rgba(var(--brand-purple-rgb), 0.05) 0%,
      transparent 50%
    );
}

/* Animaciones personalizadas */
.animate-in {
  opacity: 1 !important;
  transform: none !important;
}

.animate-section {
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.8s ease-out,
    transform 0.8s ease-out;
}

.animate-element {
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.5s ease-out,
    transform 0.5s ease-out;
}

.neon-border {
  box-shadow:
    0 0 5px var(--accent-purple-1),
    0 0 10px rgba(var(--accent-purple-2-rgb), 0.3);
}

.neon-text {
  text-shadow:
    0 0 5px var(--accent-purple-1),
    0 0 10px rgba(var(--accent-purple-2-rgb), 0.5);
}

.cyberpunk-grid {
  background-image:
    linear-gradient(rgba(var(--brand-purple-rgb), 0.1) 1px, transparent 1px),
    linear-gradient(
      90deg,
      rgba(var(--brand-purple-rgb), 0.1) 1px,
      transparent 1px
    );
  background-size: 20px 20px;
}

.glow-effect {
  position: relative;
  overflow: hidden;
}

.glow-effect::after {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    rgba(var(--accent-purple-1-rgb), 0.55),
    rgba(var(--accent-purple-2-rgb), 0.35)
  );
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.glow-effect:hover::after {
  opacity: 1;
}

/* Estilos responsivos adicionales */
@media (max-width: 768px) {
  .neon-text {
    text-shadow:
      0 0 3px var(--accent-purple-1),
      0 0 6px rgba(var(--accent-purple-2-rgb), 0.5);
  }
}

/* Cursor styles moved to cursor.css */

/* Interacción reactiva basada en posición del cursor */
.reactive,
[data-reactive] {
  transform-style: preserve-3d;
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
  will-change: transform, filter;
}

/* Reset suave cuando el cursor sale de la ventana */
.reactive.is-reset,
[data-reactive].is-reset {
  transform: none !important;
  filter: none !important;
}

/* =========================
   Preloader Overlay
   ========================= */
.preloader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.3); /* Más translúcido */
  backdrop-filter: blur(6px);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.preloader--show {
  opacity: 1;
  pointer-events: auto;
}

.preloader--hide {
  opacity: 0;
  pointer-events: none;
}

.preloader-animation {
  width: 320px; /* Un poco más grande */
  height: 320px; /* Un poco más grande */
}

@media (prefers-reduced-motion: reduce) {
  .preloader {
    transition: none;
  }
}

/* Bloquear scroll mientras el preloader está activo */
html.preloading {
  overflow: hidden;
}
/* Spinner de fallback mientras carga Lottie */
.preloader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(15, 31, 58, 0.35); /* azul muy oscuro */
  border-top-color: rgba(15, 31, 58, 0.9); /* azul muy oscuro */
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.preloader-fallback {
  color: white;
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .preloader {
    transition: none;
  }
}
/* Forzar color del Lottie preloader vía CSS */
#preloader-animation svg * {
  fill: var(--preloader-fill, var(--preloader-accent)) !important;
  stroke: var(--preloader-stroke, var(--preloader-accent)) !important;
}

/* Color de fondo principal de la página */
body {
  background: var(--bg-primary) !important;
  /* Fondo oscuro garantizado */
  background-color: #10111a !important; /* más oscuro que #31475C */
}
.box-glow {
  box-shadow:
    0 0 5px var(--brand-purple),
    0 0 10px rgba(var(--brand-purple-rgb), 0.3);
}
.title-glow {
  text-shadow:
    0 0 5px var(--brand-purple),
    0 0 10px rgba(var(--brand-purple-rgb), 0.5);
}
.subtitle-glow {
  text-shadow:
    0 0 3px var(--brand-purple),
    0 0 6px rgba(var(--brand-purple-rgb), 0.5);
}
:root {
  --preloader-stroke: #0f1f3a; /* asegurar override final en azul muy oscuro */
}

/* Soporte mínimo para clases usadas en barras de skills cuando no hay Tailwind */
.h-2 {
  height: 8px;
} /* equivalente a 0.5rem */
.w-full {
  width: 100%;
}
.rounded-full {
  border-radius: 9999px;
}
.bg-muted {
  background-color: rgba(255, 255, 255, 0.08);
} /* fallback tenue */

/* Barras de habilidades: estado inicial y animación al entrar en vista */
.h-2 > div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.9s ease-out;
  background: linear-gradient(
    90deg,
    var(--accent-purple-1),
    var(--accent-purple-2)
  );
}

/* Animación suave de las barras de habilidades */
#habilidades .h-2 > div {
  display: block;
  height: 100%;
  transition: width 800ms ease-in-out;
  will-change: width;
}

/* Al entrar en vista (IntersectionObserver agrega .animate-in al card contenedor) */
.animate-in .h-2 > div.w-\[95\%\] {
  width: 95%;
}
.animate-in .h-2 > div.w-\[90\%\] {
  width: 90%;
}
.animate-in .h-2 > div.w-\[85\%\] {
  width: 85%;
}
.animate-in .h-2 > div.w-\[80\%\] {
  width: 80%;
}
.animate-in .h-2 > div.w-\[75\%\] {
  width: 75%;
}
.animate-in .h-2 > div.w-\[70\%\] {
  width: 70%;
}
.animate-in .h-2 > div.w-\[65\%\] {
  width: 65%;
}
.animate-in .h-2 > div.w-\[60\%\] {
  width: 60%;
}
.animate-in .h-2 > div.w-\[50\%\] {
  width: 50%;
}
.animate-in .h-2 > div.w-\[45\%\] {
  width: 45%;
}

/* Ocultar porcentajes visuales en habilidades */
#habilidades .flex.justify-between .text-mutedForeground {
  display: none;
}
/* ==== Projects UX Optimizations ==== */
#projects-grid {
  width: 100%;
  max-width: 100%;
  grid-auto-rows: 1fr; /* filas de altura uniforme */
}

.project-card {
  display: flex;
  flex-direction: column;
  min-height: 520px; /* aumentar tamaño general */
}

.project-card .aspect-video {
  aspect-ratio: 16 / 9; /* proporción consistente */
}

.project-card .object-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card .project-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-card .project-actions {
  margin-top: auto; /* empuja acciones al fondo para uniformidad */
}

/* Ajustes para el marcado actual (fallback sin cambios de JS) */
.project-card .p-6 {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.project-card .p-6 > h3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.project-card .p-6 > p.text-muted-foreground {
  line-height: 1.6;
  max-height: calc(1.6em * 3);
  overflow: hidden;
  transition: max-height 300ms ease;
}
.project-card .p-6 > .flex.gap-3 {
  margin-top: auto;
}
.project-card .p-6 > .flex.flex-wrap.gap-2.mb-4 {
  max-height: 60px;
  overflow: hidden;
}
.project-card .project-actions {
  margin-top: auto; /* empuja acciones al fondo para uniformidad */
}

/* Título: máximo 2 líneas */
.project-card .project-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Descripción: vista previa reducida + transición suave al expandir */
.project-card .project-desc {
  line-height: 1.6;
  max-height: calc(1.6em * 3); /* aprox. 3 líneas */
  overflow: hidden;
  transition: max-height 300ms ease;
}
.project-card .p-6 > p.text-muted-foreground.expanded {
  max-height: 600px;
}
.project-card .project-desc.expanded {
  max-height: 600px; /* suficiente para textos largos */
}

/* Botón de despliegue con indicador visual */
.project-card .desc-toggle {
  font-size: 0.875rem;
}
.project-card .desc-toggle .chevron {
  width: 16px;
  height: 16px;
  transition: transform 200ms ease;
}
.project-card .desc-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

/* Tecnologías: limitar altura para uniformidad y optimizar espacio vertical */
.project-card .project-tags {
  max-height: 60px; /* ~2 filas dependiendo del tamaño de chips */
  overflow: hidden;
}

/* Responsive: asegurar full width y buen espaciado */
@media (max-width: 768px) {
  #projects-grid {
    gap: 12px;
  }
  .project-card {
    min-height: 460px;
  }
}
.box-glow {
  box-shadow:
    0 0 5px var(--brand-purple),
    0 0 10px rgba(var(--brand-purple-rgb), 0.3);
}
.title-glow {
  text-shadow:
    0 0 5px var(--brand-purple),
    0 0 10px rgba(var(--brand-purple-rgb), 0.5);
}
.subtitle-glow {
  text-shadow:
    0 0 3px var(--brand-purple),
    0 0 6px rgba(var(--brand-purple-rgb), 0.5);
}
/* Fondo global de cuadrados (equivalente a Tailwind: fixed inset-0 z-0) */
#global-squares-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none; /* no bloquea interacciones */
  z-index: 0; /* detrás del contenido con z-index mayor */
}

/* Asegurar que el canvas interno ocupe todo el contenedor */
#global-squares-bg canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
}
