/* =====================================
   VARIABLES Y CONFIGURACIÓN GLOBAL (Estilo FadCam)
===================================== */
:root {
  /* Paleta Roja / Oscura */
  --primary-color: #e53935;      /* Rojo Intenso */
  --secondary-color: #0a0a0a;    /* Fondo Casi Negro */
  --accent-color: #b71c1c;       /* Rojo Oscuro */
  --light-color: #f3f4f6;        /* Texto Claro */
  --dark-color: #1a1a1a;
  --card-bg: rgba(10, 10, 10, 0.85); /* Fondo tarjetas */
  --gradient-primary: linear-gradient(135deg, #e53935, #f44336);
  --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Estilo base */
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--secondary-color);
  color: var(--light-color);
  /* El fondo se define en global.css con partículas */
}

/* =====================================
   SECCIÓN HERO (HOME)
===================================== */
.hero-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  min-height: calc(100vh - 80px);
  position: relative;
  overflow: hidden;
  background: transparent; /* Transparente para ver partículas */
}

/* Fade inferior */
.hero-section::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 150px;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 10, 0) 0%,
    var(--secondary-color) 100%
  );
}

@keyframes fadeInHero {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.hero-content {
  flex: 1 1 400px;
  max-width: 600px;
  margin: 1rem;
  animation: slideInLeft 1s ease-out forwards;
  z-index: 2;
}

@keyframes slideInLeft {
  0% { opacity: 0; transform: translateX(-30px); }
  100% { opacity: 1; transform: translateX(0); }
}

.small-intro {
  font-size: 1.2rem;       /* Un tamaño cómodo para leer */
  color: #cccccc;          /* Gris claro elegante */
  margin-bottom: 1rem;     /* Un poco más de espacio antes del nombre */
  font-weight: 300;        /* Letra más fina/ligera */
  font-style: italic;      /* Estilo cursiva para que parezca una frase */
  letter-spacing: 0.5px;   /* Espaciado sutil */
  font-family: 'Segoe UI', sans-serif; /* Aseguramos una fuente limpia */
}

/* Título Principal "David Platas" */
.hero-title {
  font-size: 4rem; /* Ajustado a tu diseño original */
  margin-bottom: 0.5rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff; /* Núcleo blanco para que parezca luz */
  text-shadow:
    0 0 4px #e53935,   /* Rojo Primario */
    0 0 8px #e53935,   /* Rojo Primario */
    0 0 16px #b71c1c,  /* Rojo Oscuro (Halo) */
    0 0 24px #b71c1c,  /* Rojo Oscuro (Halo) */
    0 0 40px #b71c1c;  /* Rojo Oscuro (Halo) */
  animation: neon-pulse-strong 1.6s ease-in-out infinite alternate;
}

/* Contenedor del texto tipeado */
.hero-typed {
  font-size: 1.5rem;
  /* Espaciado para que no se pegue al título ni a la descripción */
  margin-bottom: 1rem; 
  color: #aaa;
  
  /* === CORRECCIONES === */
  /* 1. Quitamos height fijo y usamos min-height para reservar espacio 
        (evita saltos cuando está vacío) */
  min-height: 2.5rem; 
  
  /* 2. Dejamos que crezca si el texto es largo en móvil */
  height: auto;       
  
  /* 3. Damos espacio vertical para letras como 'g', 'p', 'q' */
  line-height: 1.6;   
  
  /* 4. Importante: Visible para no cortar sombras neón ni letras */
  overflow: visible;  
  
  position: relative;
  
  /* Opcional: un poco de padding inferior para la sombra del neón */
  padding-bottom: 0.2rem; 
}

/* TEXTO TIPEADO: Neón más tenue */
.hero-typed #typed-text {
  color: #fff;
  text-shadow:
    0 0 2px #e53935,
    0 0 4px #e53935,
    0 0 8px #b71c1c;
  animation: neon-pulse-soft 1.6s ease-in-out infinite alternate;
  
  /* Asegura que el texto rompa línea de forma bonita en móviles si es necesario */
  word-wrap: break-word;
}

/* Cursor tipo terminal con glow rojo */
.hero-typed .cursor {
  display: inline-block;
  width: 3px;
  /* Ajustamos la altura del cursor para que se alinee mejor visualmente */
  height: 1.1em; 
  margin-left: 4px;
  /* Ajuste vertical para centrar el cursor con el texto */
  vertical-align: text-bottom; 
  
  background-color: var(--primary-color);
  box-shadow:
    0 0 6px #e53935,
    0 0 12px #b71c1c;
  animation: cursor-blink 0.8s steps(1) infinite;
}

/* Animación neón fuerte (título) - Respiración roja */
@keyframes neon-pulse-strong {
  0% {
    text-shadow:
      0 0 2px #e53935,
      0 0 6px #e53935,
      0 0 12px #b71c1c,
      0 0 20px #b71c1c;
  }
  100% {
    text-shadow:
      0 0 6px #e53935,
      0 0 14px #e53935,
      0 0 26px #b71c1c,
      0 0 40px #b71c1c;
  }
}

/* Animación neón suave (typed) */
@keyframes neon-pulse-soft {
  0% {
    text-shadow:
      0 0 1px #e53935,
      0 0 3px #e53935,
      0 0 5px #b71c1c;
  }
  100% {
    text-shadow:
      0 0 2px #e53935,
      0 0 5px #e53935,
      0 0 9px #b71c1c;
  }
}

/* Parpadeo del cursor */
@keyframes cursor-blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* Descripción */
.hero-description {
  font-size: 1.1rem;
  color: var(--light-color); /* Usando variable global o #aaaaaa */
  line-height: 1.7;
  max-width: 90%;
}

/* Redes Sociales */
.social-media {
  margin-top: 2rem;
  text-align: left;
}

.social-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  justify-content: flex-start; /* Alineado a la izquierda */
  padding: 0;
  margin: 0;
}

.social-links li a {
  display: inline-block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-radius: 50%;
}

.social-links li a img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  /* Aseguramos que no tenga filtros extraños */
  filter: none; 
}

/* Animación suave al pasar el mouse (Glow Rojo) */
.social-links li a:hover {
  transform: scale(1.2);
  /* Sombra roja al hacer hover */
  box-shadow: 0 0 15px rgba(229, 57, 53, 0.6); 
}

.social-links li a:hover img {
  /* Opcional: Si quieres un ligero brillo sin cambiar el color */
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
}

/* =====================================
   IMAGEN CON GLOW ROJO
===================================== */
.hero-image-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem;
  flex: 1 1 400px;
  max-width: 600px;
  animation: slideInRight 1s ease-out forwards;
  z-index: 2;
}

@keyframes slideInRight {
  0% { opacity: 0; transform: translateX(30px); }
  100% { opacity: 1; transform: translateX(0); }
}

.hero-image-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 130%;
  height: 130%;
  border-radius: 50%;
  /* Glow Rojo */
  background: radial-gradient(rgba(229, 57, 53, 0.4), transparent 65%);
  z-index: 1;
  filter: blur(20px);
  animation: pulseGlow 4s infinite alternate;
}

@keyframes pulseGlow {
  0% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

.hero-image {
  width: 85%;
  max-width: 720px;
  height: 520px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-color);
  position: relative;
  z-index: 2;
  transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
  box-shadow: 0 0 25px rgba(229, 57, 53, 0.4);
}

.hero-image-hover {
  opacity: 0;
  transform: scale(1.05);
  position: absolute;
  z-index: 3;
  transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.hero-image-container:hover .hero-image {
  opacity: 0;
}

.hero-image-container:hover .hero-image-hover {
  opacity: 1;
  transform: scale(1);
}

/* Cursor de tipeo */
.cursor {
  display: inline-block;
  width: 3px;
  background-color: var(--primary-color);
  box-shadow: 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
  margin-left: 3px;
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* =====================================
   SECCIÓN ABOUT (Estilo FadCam)
===================================== */
.about-section {
  background-color: transparent;
  text-align: center;
  margin: 4rem auto;
  max-width: 1200px;
  padding: 0 1rem;
  animation: fadeInSection 1s ease forwards;
}

@keyframes fadeInSection {
  0% { opacity: 0; transform: translateY(15px); }
  100% { opacity: 1; transform: translateY(0); }
}

.about-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(229, 57, 53, 0.2); /* Borde Rojo Sutil */
  border-radius: 20px;
  padding: 3rem;
  max-width: 1200px;
  margin: 0 auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.about-card:hover {
  border-color: rgba(229, 57, 53, 0.4);
  box-shadow: 0 15px 50px rgba(229, 57, 53, 0.15);
}

.about-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  justify-content: flex-start;
}

.about-card-header h2 {
  margin: 0;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 2.2rem;
  font-weight: 700;
}

.about-header-line {
  width: 100px;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: 2px;
}

.about-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.about-image-container {
  flex-shrink: 0;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--primary-color);
  box-shadow: 0 0 15px rgba(229, 57, 53, 0.3);
  transition: transform 0.4s ease;
}

.about-image-container:hover {
  transform: scale(1.05);
}

.about-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-text {
  text-align: left;
  flex: 1;
  line-height: 1.8;
  color: var(--light-color);
  font-size: 1.05rem;
}

.about-text strong {
  color: var(--primary-color);
}

.about-text p {
  margin-bottom: 1rem;
}

/* Switch Idioma */
.language-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
}

.language-toggle .toggle-label {
  margin-left: 0.8rem;
  font-size: 0.9rem;
  color: var(--primary-color);
  font-weight: 600;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #333;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px; width: 16px;
  left: 4px; bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(26px); }

/* Efecto 3D en la tarjeta About */
#about-card {
  transition: transform 0.6s ease, box-shadow 0.6s ease;
}

#about-card.lang-english {
  transform: perspective(1000px) rotateY(5deg);
  box-shadow: -10px 10px 30px rgba(0,0,0,0.5);
}

/* =====================================
   SKILLS (Estilo Grid Rojo)
===================================== */
.skills-section {
  margin-top: 4rem;
  text-align: center;
  background: transparent;
  animation: fadeInSection 1s ease forwards;
}

.skills-section h3 {
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
  text-align: center;
}

.skills-tabs {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 3rem;
}

.tab-button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0.8rem 2rem;
  cursor: pointer;
  border-radius: 30px;
  font-weight: 600;
  transition: all 0.3s ease;
}   

.tab-button:hover {
  border-color: var(--primary-color);
  /* Color Rojo sutil para hover */
  background: rgba(229, 57, 53, 0.1);
  color: var(--primary-color);
}

.tab-button.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
  /* Sombra Roja */
  box-shadow: 0 5px 15px rgba(229, 57, 53, 0.3);
}

.skills-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.skills-header-line {
  width: 60px;
  height: 3px;
  background-color: var(--primary-color);
}

.skills-header h3 {
  margin: 0;
  color: var(--light-color);
  font-size: 2rem;
  font-weight: 700;
}

.skills-grid {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  animation: fadeInSection 0.7s ease forwards;
}

.skills-grid.active {
  display: flex;
}

/* Efecto clip-path en hover (Estructura 1 + Color 2) */
.skill-card {
  position: relative;
  background: var(--card-bg);
  backdrop-filter: blur(5px);
  /* Borde Rojo sutil */
  border: 1px solid rgba(229, 57, 53, 0.1);
  border-radius: 12px;
  width: 220px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
  cursor: default;
  overflow: hidden;
}

.skill-card::before {
  content: "";
  position: absolute;
  inset: 0;
  /* Fondo Rojo Oscuro al hacer hover */
  background: rgba(117, 13, 13, 0.15);
  clip-path: polygon(0 0, 0 100%, 0 100%, 0 0);
  transition: clip-path 0.4s ease;
  pointer-events: none;
}

.skill-card:hover::before {
  clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 0);
}

.skill-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.skill-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  z-index: 1;
  /* Eliminamos el filtro para mostrar el color original */
  filter: none;
}

.skill-info {
  display: flex;
  flex-direction: column;
  text-align: left;
  z-index: 1;
}

.skill-name {
  font-size: 1rem; /* Estructura del bloque 1 */
  color: #fff;
  margin: 0;
}

.skill-level {
  display: none;
  margin-top: 0.3rem;
  font-size: 0.8rem; /* Estructura del bloque 1 */
  color: var(--primary-color);
}

.skill-card:hover .skill-level {
  display: block;
}

/* =====================================
   FLECHAS DE NAVEGACIÓN VERTICAL
===================================== */
.vertical-nav {
  position: fixed;
  top: 50%;
  right: 2rem;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 2000;
}

.vertical-nav button {
  /* Aseguramos que sean un círculo perfecto */
  width: 50px;  
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: 1px solid var(--primary-color);
  padding: 0;
  font-size: 1.5rem; 
  line-height: 1; /* Evita espacios extra verticales */
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.3s, transform 0.3s;
}

.vertical-nav button:hover {
  background: var(--primary-color);
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(229, 57, 53, 0.5);
}

/* =====================================
   RESPONSIVO MEJORADO
===================================== */
@media (max-width: 768px) {
  
  /* MEJORA 1: Usabilidad en botones */
  /* 35px es muy pequeño para el dedo. 40px es el mínimo seguro */
  .vertical-nav button {
    width: 40px; 
    height: 40px;
    font-size: 1.4rem; /* Un pelín más grande el icono */
  }

  /* Ajustes de texto Hero */
  .hero-title {
    font-size: 2.5rem; /* Un poco más pequeño para evitar saltos de línea feos */
    line-height: 1.2;
  }
  
  .hero-typed {
    font-size: 1.1rem;
    min-height: 3rem; /* Dar espacio para que no brinque si el texto es largo */
  }

  /* Ajuste de imagen Hero */
  .hero-image {
    width: 200px; /* Un poco más pequeña para dar prioridad al texto */
    height: 200px;
  }
  .hero-image-glow {
    width: 240px;
    height: 240px;
  }
  
  /* MEJORA 2: Aprovechar espacio en tarjeta */
  .about-card {
    padding: 1.5rem; /* 2rem es mucho en móvil, 1.5rem da más espacio al contenido */
    margin: 0 1rem;  /* Margen lateral para que no pegue a los bordes de la pantalla */
  }

  .about-content {
    flex-direction: column;
    text-align: center; /* Esto centra la imagen y contenedores */
  }

  /* MEJORA 3: Legibilidad */
  /* Los párrafos largos centrados cansan la vista. Mejor alineados a la izquierda */
  .about-text {
    text-align: left; 
    font-size: 0.95rem; /* Texto un poco más compacto */
  }
  
  /* Excepción: Centrar solo los títulos o frases cortas si quieres */
  .about-text h4 {
    text-align: center;
    margin-top: 1.5rem;
  }

  /* Skills Grid: Tu lógica de 2 columnas es perfecta */
  .skills-grid.active {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0; /* Quitamos padding extra para ganar ancho */
  }

  .skill-card {
    width: auto;
    height: 100%; /* Altura automática para adaptarse si el texto tiene 2 líneas */
    min-height: 90px; /* Altura mínima para uniformidad */
    padding: 1rem 0.5rem;
    flex-direction: column; 
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
  }

  .skill-info {
    text-align: center;
    align-items: center;
    width: 100%;
  }

  /* MEJORA 4: Evitar texto cortado "..." */
  .skill-name {
    font-size: 0.9rem;
    /* Cambio clave: Permitir que el texto baje a otra línea si es largo */
    white-space: normal; 
    line-height: 1.2;
    /* Quitamos el ellipsis para que se lea todo (ej: Visual Studio Code) */
    overflow: visible; 
    text-overflow: clip;
  }

  .skill-level {
    margin-top: 4px;
    font-size: 0.75rem;
  }
  
  .skill-icon {
    margin-bottom: 5px;
    width: 35px;
    height: 35px;
  }
}

/* Ajuste extra para móviles MUY pequeños (iPhone SE, Galaxy Fold cerrado) */
@media (max-width: 380px) {
  .hero-title { font-size: 2rem; }
  .skills-grid.active { 
    /* En pantallas enanas, volvemos a 1 columna o reducimos fuente */
    gap: 8px;
  }
  .skill-name { font-size: 0.8rem; }
}

#about {
  scroll-margin-top: 80px;
}
