/* === VARIABLES GLOBALES === */
:root {
  --verde-principal: #30DB8D;
  --verde-principal-alt: #30DB8E; /* usado en el gradiente de contact-item */
  --verde-secundario: #649E84;
  --gris-verde: #4E6159;
  --oscuro: #332E2D;
  --texto: #222;
  --fondo: #f9f9f9;
}

/* === RESETEO Y CONFIGURACIÓN GLOBAL === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
  color: var(--texto);
  background: var(--fondo);
}

/* === ACCESIBILIDAD: FOCO VISIBLE === */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--gris-verde);
  outline-offset: 3px;
}

/* === RESPETAR PREFERENCIA DE MOVIMIENTO REDUCIDO === */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .skill-bar::before,
  .btn,
  .cv-item,
  .project-card,
  .contact-item {
    transition: none !important;
    animation: none !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* === SECCIÓN HERO (CABECERA) === */
.hero {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  padding: 2rem;

  position: relative; /* Contexto para posicionar el vídeo y el overlay */
  overflow: hidden; /* Evita que el vídeo se desborde */

  /* Fallback por si el vídeo no carga o en móviles */
  background: linear-gradient(135deg, var(--verde-principal), var(--gris-verde));
}

/* --- CAPA 2 (EL VÍDEO) --- */
.hero-video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;

  z-index: 1; /* Detrás del overlay y el contenido */
}

/* --- CAPA 3 (EL OVERLAY) --- */
.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  background: linear-gradient(135deg,
      rgba(48, 219, 141, 0.8),
      rgba(78, 97, 89, 0.85)
  );

  z-index: 2; /* Encima del vídeo */
}

/* --- CAPA 4 (EL CONTENIDO) --- */
.hero-content {
  position: relative;
  z-index: 3;
  animation: fadeIn 1.5s ease;
}

.profile-pic {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 3px solid white;
  margin-bottom: 1rem;
  object-fit: cover;
}

.hero h1 {
  font-size: 2rem;
}

.hero h1 span {
  color: var(--oscuro);
}

/* Botón genérico (usado en Hero y CV) */
.btn {
  display: inline-block;
  background: white;
  color: var(--gris-verde);
  padding: 0.8rem 1.5rem;
  border-radius: 10px;
  text-decoration: none;
  margin-top: 1rem;
  margin-left: 0.5rem;
  margin-right: 0.5rem;
  font-weight: 600;
  transition: all 0.3s;
}

.btn:hover {
  background: var(--verde-secundario);
  color: var(--oscuro);
  transform: scale(1.05);
}

/* === SECCIONES GENÉRICAS === */
.section {
  padding: 4rem 1.5rem;
  max-width: 900px;
  margin: auto;
}

.section h2,
.section-title {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.8rem;
  color: var(--gris-verde);
}

.section-title {
  font-size: 2.2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* === SECCIÓN CV === */
.cv-section {
  padding: 4rem 2rem;
  background: linear-gradient(135deg, #f8f9fa, #eaf2ee);
  color: #333;
}

.cv-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 2rem;
  text-align: left;
  max-width: 1200px;
  margin: 0 auto;
}

.cv-column {
  flex: 1;
  min-width: 300px;
}

.cv-item {
  background: white;
  padding: 1.2rem;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  margin-bottom: 1.2rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cv-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.15);
}

/* Subtítulo de categoría dentro de Habilidades */
.skills-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gris-verde);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 1.2rem;
  margin-bottom: 0.3rem;
}

/* Lista de habilidades */
.skills-list {
  list-style: none;
  padding: 0;
  margin: 20px 0;
}

.skill-bar {
  position: relative;
  display: block;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  margin: 10px 0;
  font-weight: 600;
  padding: 10px;
  color: #fff;
  text-align: left;
  z-index: 1;
}

.skill-bar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--verde-principal), var(--gris-verde));
  transition: width 1.5s ease-in-out;
  border-radius: 10px;
  z-index: -1;
}

.skill-bar.filled::before {
  width: var(--level);
}

/* Botón Descargar CV */
.cv-download {
  text-align: center;
}
.cv-download .btn {
  background-color: white;
  color: #444;
  padding: 0.7rem 0.5rem;
  border-radius: 10px;
  font-weight: 500;
  font-size: 1rem;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  margin-top: 3rem;
}

.cv-download .btn:hover {
  background-color: var(--verde-principal);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* === SECCIÓN PROYECTOS === */
/* Anula el max-width del .section genérico solo para permitir que
   el split-container ocupe todo el ancho; el título vuelve a
   centrarse mediante .section-heading-wrap */
.section-full {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

.section-heading-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Contenedor de los dos paneles */
.split-container {
  display: flex;
  height: 65vh;
  min-height: 420px;
  margin-top: 2rem;
  overflow: hidden;
}

.split-panel {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem;
  color: white;
  text-decoration: none;
  transition: flex 0.5s ease;
  cursor: pointer;
}

/* --- VÍDEO DE FONDO --- */
/* Se coloca detrás de todo con object-fit: cover, igual que el hero
   pero usando la técnica moderna (más simple al no necesitar
   min-width/min-height con transform de centrado). */
.split-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* Oscurece la parte baja del panel para que el texto sea legible
   sobre el vídeo/gif o el gradiente de fondo */
.split-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0) 55%);
  z-index: 1;
}

.split-title,
.split-list {
  position: relative;
  z-index: 2;
}

.split-title {
  font-size: 1.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Placeholder de color, visible mientras no cargue el <video>
   (o si el navegador no lo soporta) — actúa como fallback real,
   no solo mientras decides las imágenes definitivas. */
.split-wetlab {
  background: linear-gradient(135deg, var(--verde-principal), var(--gris-verde));
}

.split-drylab {
  background:
    repeating-linear-gradient(
      100deg,
      rgba(255,255,255,0.04) 0px,
      rgba(255,255,255,0.04) 2px,
      transparent 2px,
      transparent 14px
    ),
    linear-gradient(135deg, var(--oscuro), var(--gris-verde));
}

/* Lista de contenido: oculta hasta expandir */
.split-list {
  list-style: none;
  padding: 0;
  margin: 0.8rem 0 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}

.split-list li {
  padding: 0.3rem 0;
  font-size: 0.95rem;
  border-top: 1px solid rgba(255,255,255,0.25);
}

.split-list li:first-child {
  border-top: none;
}

.split-list a,
.split-list button {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: none;
  border: none;
  font: inherit;
  text-align: left;
  width: 100%;
  padding: 0;
  cursor: pointer;
}

.split-list a:hover,
.split-list a:focus-visible,
.split-list button:hover,
.split-list button:focus-visible {
  text-decoration: underline;
}

/* Icono que indica el tipo de interacción: enlace real a otra
   página (↗) o contenido desplegable en la misma página (chevron) */
.split-icon {
  font-size: 0.8rem;
  opacity: 0.75;
  flex-shrink: 0;
}

.split-list a .split-icon {
  color: var(--verde-principal);
}

.split-list button .split-icon {
  color: rgba(255, 255, 255, 0.7);
  transition: transform 0.2s ease;
}

/* === PANEL INTEGRADO (ICM / Fitó) === */
/* A diferencia de un modal, este panel forma parte del flujo normal
   de la página: aparece justo debajo de los paneles Wet Lab/Dry Lab
   empujando el contenido de más abajo, sin oscurecer ni superponerse
   a nada. Se anima con max-height en vez de display, para permitir
   la transición de apertura/cierre. */
.lab-info-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  background: linear-gradient(135deg, #f8f9fa, #eaf2ee);
}

.lab-info-panel.open {
  max-height: 2500px; /* holgado a propósito: solo necesita ser mayor
                          que cualquier contenido real, no el alto exacto */
  overflow-y: auto;   /* red de seguridad: si algún día el contenido
                          fuera aún más largo, aparece scroll interno
                          en vez de recortarse */
}

.lab-info-panel[hidden] {
  display: none;
}

.lab-info-inner {
  position: relative;
  padding: 2.5rem 1.5rem 2rem;
}

.lab-info-content[hidden] {
  display: none;
}

.lab-info-header {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 150px;
  border-radius: 8px;
  overflow: hidden;
  padding: 1.2rem 1.5rem;
  margin: 0 0 1.5rem;

  background-color: var(--gris-verde); /* color de fondo si no hay imagen */
  background-size: cover;
  background-position: center;
}

/* Oscurece la parte baja de la imagen para que el título sea legible */
.lab-info-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.1) 75%);
}

.lab-info-content h3 {
  position: relative;
  z-index: 1;
  color: white;
  margin: 0;
}

.lab-info-content p {
  line-height: 1.6;
  margin-bottom: 0.8rem;
}

.lab-info-close {
  position: absolute;
  top: 0.8rem;
  right: 1.2rem;
  z-index: 5;
  background: rgba(0, 0, 0, 0.35);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: white;
  padding: 0.3rem;
}

.lab-info-close:hover {
  background: rgba(0, 0, 0, 0.55);
}

/* === BARRA DE NAVEGACIÓN FLOTANTE === */
/* Oculta mientras se está en el hero (que ya tiene sus propios
   botones); aparece con una transición suave al hacer scroll,
   gestionado por script.js mediante la clase .visible. */
.floating-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0.9rem 1.5rem;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  z-index: 900;

  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.floating-nav.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.floating-nav a {
  color: var(--gris-verde);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.3rem 0.2rem;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.floating-nav a:hover,
.floating-nav a:focus-visible {
  color: var(--verde-principal);
  border-bottom-color: var(--verde-principal);
}

@media (max-width: 600px) {
  .floating-nav {
    gap: 1.2rem;
    font-size: 0.85rem;
  }
}

/* Estado expandido: por hover en escritorio, por foco de teclado
   (al tabular hasta un enlace oculto de la lista), o por la clase
   .expanded que añade script.js al primer toque en táctil */
.split-panel:hover,
.split-panel:focus-within,
.split-panel.expanded {
  flex: 2.2;
}

.split-panel:hover .split-list,
.split-panel:focus-within .split-list,
.split-panel.expanded .split-list {
  max-height: 200px;
  opacity: 1;
}

@media (max-width: 768px) {
  .split-container {
    height: auto;
    flex-direction: column;
  }
  .split-panel {
    min-height: 180px;
  }
  /* Igual que con el vídeo del hero: se oculta en móvil por
     rendimiento y consumo de datos, dejando el gradiente de fondo */
  .split-video {
    display: none;
  }
}

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.project-card a {
  color: var(--gris-verde);
  text-decoration: none;
  font-weight: 600;
}

/* Estilo para tarjetas "Próximamente" (WIP) */
.project-card.is-wip {
  background: #f9f9f9;
  opacity: 0.7;
  pointer-events: none;
}

.project-card.is-wip > * {
  opacity: 0.8;
}

.project-card.is-wip:hover {
  transform: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Badge "Próximamente" */
.wip-badge {
  position: absolute;
  top: 10px;
  right: -30px;
  background: var(--verde-secundario);
  color: white;
  padding: 4px 30px;
  font-size: 0.8rem;
  font-weight: 700;
  transform: rotate(45deg);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* === SECCIÓN CONTACTO Y ENLACES === */
#contacto {
  text-align: center;
  padding: 3rem 1rem;
}

.contact p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  color: var(--oscuro);
}

.contact-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: linear-gradient(130deg, var(--verde-principal-alt), var(--gris-verde));
  color: white;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  margin: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.contact-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  background: linear-gradient(130deg, var(--gris-verde), var(--verde-principal-alt));
}

.contact-item i {
  font-size: 1.2rem;
}

#enlaces {
  padding-top: 2rem;
  padding-bottom: 1rem;
  text-align: center;
}

#enlaces h2 {
  margin-bottom: 1rem;
}

.center-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

/* Enlace GitHub */
.github-link {
  display: inline-flex;
  gap: 3px;
  color: #444;
  border: 1px solid #ccc;
  background: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.github-link:hover {
  color: var(--verde-principal);
  border-color: var(--verde-principal);
  box-shadow: 0 4px 10px rgba(48, 219, 141, 0.15);
}

/* === FOOTER === */
footer {
  text-align: center;
  padding: 2rem;
  background: #222;
  color: white;
  font-size: 0.9rem;
}

/* === ANIMACIONES === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === RESPONSIVE (MÓVIL) === */
@media (max-width: 768px) {
  .cv-container {
    flex-direction: column;
    align-items: center;
  }

  /* Ocultamos el vídeo en pantallas pequeñas: usa el fallback del .hero */
  .hero-video {
    display: none;
  }
}

@media (max-width: 600px) {
  .hero h1 {
    font-size: 1.6rem;
  }
  .section {
    padding: 2.5rem 1rem;
  }
  .hero .btn {
    display: block;
    margin: 1rem auto;
    width: 80%;
  }
}

/* Insignia para trabajos ya realizados pero aún no publicados
   (distinta del wip-badge: aquí no falta contenido, está en proceso
   editorial fuera de tu control) */
.pending-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #fff3cd;
  color: #8a6d00;
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
  margin-left: 0.5rem;
  vertical-align: middle;
  white-space: nowrap;
}
/* === SELECTOR DE IDIOMA === */
/* Fijo y siempre visible (a diferencia de .floating-nav, que solo
   aparece tras hacer scroll), para poder cambiar de idioma desde el
   primer segundo en cualquier página. */
.lang-switcher {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1100;
  display: flex;
  gap: 0.5rem;
}

.lang-switcher a {
  font-size: 1.5rem;
  line-height: 1;
  text-decoration: none;
  display: inline-block;
  opacity: 0.9;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.lang-switcher a.current-lang {
  opacity: 1;
  pointer-events: none;
  transform: scale(1.1);
}

.lang-switcher a:hover,
.lang-switcher a:focus-visible {
  opacity: 1;
  transform: scale(1.15);
}
