/* ================= RESET & BASE ================= */
* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
}

html, body { 
  height: 100%; 
  overflow-x: hidden;
}

body {
  font-family: 'Inter', sans-serif;
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  background-color: #111;
}

/* ================= OVERLAY Y RUIDO (AJUSTE DE VISIBILIDAD) ================= */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: 
    /* Reduje la opacidad del velo negro de 0.35 a 0.15 para que la textura "respire" */
    linear-gradient(rgba(0,0,0,0.15), rgba(0,0,0,0.15)),
    /* Se mantiene: una sola imagen (no-repeat), centrada y estirada (cover) */
    url('assets/noise.png') no-repeat center / cover;
    transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}

/* ================= HEADER ================= */
header {
  padding: 30px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 4000; /* Asegura estar por debajo de los iconos de menú pero sobre el contenido */
  background: linear-gradient(
    to bottom,
    rgba(17,17,17,0.8) 0%,
    rgba(17,17,17,0.6) 60%,
    rgba(17,17,17,0) 100%
  );
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transition: background 0.4s ease, backdrop-filter 0.4s ease;
}

header h1 {
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  text-align: center;
  text-shadow: 0 0 25px rgba(255,255,255,0.45);
  position: relative;
  z-index: 1;
}

/* ================= MENU LATERAL Y ICONO ================= */
.menu-icon {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 25px;
  height: 18px;
  cursor: pointer;
  position: absolute;
  left: 40px;
  z-index: 8000; /* Prioridad máxima de click */
}

.menu-icon div { height: 2px; background: #fff; border-radius: 2px; transition: 0.3s; }

.menu {
  position: fixed;
  top: 0;
  left: -280px; /* Oculto por defecto */
  width: 280px;
  height: 100%;
  background: #0d0d0d;
  padding: 80px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9000; /* Sobre el header y overlays */
  border-right: 1px solid #1a1a1a;
}

.menu.active { left: 0; }

.close-menu {
  font-size: 1.5rem;
  font-weight: 300;
  color: #444;
  cursor: pointer;
  position: absolute;
  top: 30px;
  left: 40px;
  transition: color 0.3s;
}

.close-menu:hover { color: #fff; }

.menu ul { list-style: none; }
.menu ul li { margin-bottom: 25px; }
.menu ul li a {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  transition: opacity 0.3s;
}

/* LINEA 87: Definimos la base para todos los links del menú */
.menu ul li {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  transition: opacity 0.3s ease;
}

/* LINEA 96: Agregamos !important para anular estilos del HTML */
.menu ul li a:hover, 
#shopModeBtn:hover, 
#requestsBtn:hover, 
#qualityBtn:hover { 
  opacity: 0.6 !important; 
}

.menu .instagram a {
  color: #555 !important;
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  transition: color 0.3s;
}

.menu .instagram a:hover { color: #fff !important; }

.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 8500;
}

.menu-overlay.active { display: block; }

/* ================= SHOP GRID (VUELTA A 5 COLUMNAS) ================= */
.shop {
  max-width: 1900px;
  margin: 0 auto;
  padding: 0 30px;
  position: relative;
  z-index: 1;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 5 columnas recuperadas */
  column-gap: 50px;
  row-gap: 40px;
  padding: 30px 0;
  justify-items: start;
  background-color: transparent;
  min-height: 100vh; /* Mantiene el espacio del catálogo antes de que carguen las botas */
}

/* ================= PRODUCT ================= */
.product {
  text-decoration: none;
  color: #fff;
  transition: transform 0.4s ease, opacity 0.4s ease;
  position: relative;
  display: block;
}

.product:hover { transform: translateY(-4px); }

.product .image {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: transparent;
  position: relative;
  display: flex;  
  align-items: center;
  justify-content: center;
}

.product .image .shadow-wrap {
  width: 80%; /* Proporción para que el grid respire */
  height: 80%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 16px 24px rgba(82, 82, 82, 0.65));
}

.product .image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity 0.35s ease, transform 0.4s ease;
}

.product .image img.second {
  position: absolute;
  inset: 0;
  margin: auto;
  opacity: 0;
}

.product:hover .image img.second { opacity: 1; transform: scale(1.05); }
.product:hover .image img.first { opacity: 0; transform: scale(1.05); }

.product h2 {
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  margin-top: 5px;
  background: linear-gradient(90deg, #fff, #aaa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.product p { font-size: 0.7rem; color: #777; margin-top: 2px; }

/* ================= STOCK ================= */
.stock {
  margin-top: 4px;
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.8;
  display: block;
}

.stock.in { color: #aaa; }
.stock.out { color: #555; }

/* ================= MODALES Y LABORATORIO GRANDE ================= */

@keyframes subtlePopUp {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
@keyframes subtleFadeDown {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.95) translateY(15px);
  }
}

.quality-container {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.quality-blur-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(80px);
}

.quality-modal { 
  position: relative; 
  background: linear-gradient(145deg, rgba(25, 25, 25, 0.9), rgba(15, 15, 15, 0.95)); 
  backdrop-filter: blur(25px); 
  border-radius: 4px; 
  border: 1px solid rgba(255, 255, 255, 0.03); 
  padding: 80px 50px; 
  max-width: 500px; 
  width: 100%; 
  text-align: center; 
  box-shadow: 0 20px 120px rgba(0, 0, 0, 0.9);
  animation: subtlePopUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.quality-modal.closing {
  animation: subtleFadeDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: none;
}

.quality-modal h2 { 
  font-size: 1.2rem; 
  letter-spacing: 0.6em; 
  text-indent: 0.6em; /* Centrado óptico */
  margin-bottom: 45px; 
  font-weight: 500;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 
    0 0 10px rgba(255, 255, 255, 0.8), 
    0 0 20px rgba(255, 255, 255, 0.4),
    0 0 30px rgba(255, 255, 255, 0.2);
  display: inline-block;
  width: 100%;
}

.quality-modal p { 
  font-size: 0.9rem; 
  line-height: 1.8; 
  color: #aaa; 
  margin-bottom: 50px; 
}

.quality-modal button { 
  background: #fff; 
  color: #000; 
  border: none; 
  padding: 18px 60px; 
  font-weight: 600; 
  font-size: 0.7rem; 
  letter-spacing: 0.4em; 
  cursor: pointer; 
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.quality-modal button:hover { 
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(255,255,255,0.2);
}
.quality-modal button:active {
  transform: scale(0.96);
  opacity: 0.8;
}

/* GALERÍA DE COMPARACIÓN (ESTILO LABORATORIO ARCHIVE) */

.quality-gallery {
  position: relative;
  width: 100%;
  max-width: 1500px; /* Tamaño recuperado */
  height: 95vh;
  overflow-y: auto;
  padding: 80px 20px 20px;
}

.quality-gallery::-webkit-scrollbar { width: 4px; }
.quality-gallery::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.02); }
.quality-gallery::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }

.gallery-scroll {
  width: 100%;
  max-width: 1000px; 
  margin: 0 auto;
  padding-bottom: 100px;
}

.comparison-item { margin-bottom: 60px; width: 100%; }

.comparison-header-info {
  text-align: left;
  margin-bottom: 20px;
}

.comparison-header-info span {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: #444;
  display: block;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.comparison-header-info h3 {
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: #eee;
  text-transform: uppercase;
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  width: 100%;
  margin-bottom: 20px;
}

.comparison-box { display: flex; flex-direction: column; align-items: center; }

.comparison-box span { 
  font-size: 0.8rem; 
  letter-spacing: 0.4em; 
  color: #666; 
  margin-bottom: 20px;
  font-weight: 600; 
}

.comparison-box img { 
  width: 100%; 
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid #1a1a1a; 
  box-shadow: 0 20px 30px rgba(39, 39, 39, 0.5);
  transition: opacity 0.4s ease;
}

/* Navegación Carrusel Laboratorio */
.comparison-nav {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 15px 0;
}

.nav-btn {
  background: transparent;
  border: 1px solid #222;
  color: #555;
  padding: 10px 25px;
  font-size: 1rem;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: all 0.3s;
}

.nav-btn:hover:not(:disabled) { border-color: #fff; color: #fff; }
.nav-btn:disabled { opacity: 0.1; cursor: default; }

.comparison-desc { 
  color: #555; 
  font-size: 0.8rem; 
  line-height: 1.8; 
  text-align: center; 
  max-width: 700px; 
  margin: 20px auto 0; 
  letter-spacing: 0.1em;
  box-shadow: 0 20px 30px rgba(100, 100, 100, 0,5);
}

.close-gallery { 
  position: fixed; 
  top: 40px; 
  right: 50px; 
  font-size: 2.2rem; 
  color: #444; 
  cursor: pointer; 
  z-index: 10000;
}

/* ================= RESPONSIVE ================= */

.hidden { display: none !important; }

@media (max-width: 1200px) {
  .grid { grid-template-columns: repeat(4, 1fr); column-gap: 30px; }
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); column-gap: 20px; padding: 0px; }
  .comparison-grid { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 768px) {
  .close-gallery { top: 25px; right: 30px; }
  .gallery-scroll { padding: 0 20px; }
}

@media (max-width: 500px) {
  .grid { 
    grid-template-columns: repeat(2, 1fr); 
    column-gap: 30px; 
    row-gap: 15px; 
  }
  .product .image { max-height: 300px; }
  
  /* Ajustes del Menú en Mobile */
  .menu { 
    width: 225px; 
    padding: 70px 30px 60px; /* Reducimos padding para ganar espacio */
  }
  
  .menu ul li { 
    margin-bottom: 18px; /* Menos espacio entre ítems para que quepa todo */
  }

  .menu ul li a, 
  .menu ul li { 
    font-size: 0.75rem !important; /* Letras más pequeñas */
    letter-spacing: 0.05em; 
  }

  /* Ajuste específico para el link de Instagram al final */
  .menu .instagram a {
    font-size: 0.65rem !important;
  }
}

footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 80px 0;
  text-align: center;
  color: #333;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
}
.title-3d {
    height: 35px; /* Altura de seguridad para el logo */
    display: flex;
    align-items: center;
    justify-content: center;
    contain: size layout; /* Aísla el elemento para que su animación no mueva el resto */
}
@media (hover: hover) {
  .product:hover { 
    transform: translateY(-4px); 
  }
  
  .product:hover .image img.second { 
    opacity: 1; 
    transform: scale(1.05); 
  }
  
  .product:hover .image img.first { 
    opacity: 0; 
    transform: scale(1.05); 
  }
}

/* ================= CARRITO ================= */
.cart-icon-wrap {
  position: absolute;
  right: 40px;
  cursor: pointer;
  z-index: 8000;
}
.cart-icon-wrap svg { width: 22px; color: #fff; }
#cartCount {
  position: absolute;
  top: -8px; right: -8px;
  background: #fff; color: #000;
  font-size: 0.6rem; font-weight: 900;
  padding: 2px 5px; border-radius: 50%;
}

.cart-drawer {
  position: fixed; top: 0; right: -400px;
  width: 400px; height: 100%;
  background: rgba(13, 13, 13, 0.95);
  backdrop-filter: blur(20px);
  z-index: 9500; padding: 40px;
  display: flex; flex-direction: column;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 1px solid rgba(255,255,255,0.05);
}
.cart-drawer.active { right: 0; }
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 9400; display: none;
}
.cart-overlay.active { display: block; }

.cart-header {
  display: flex; justify-content: space-between;
  letter-spacing: 0.3em; font-size: 0.8rem;
  border-bottom: 1px solid #222; padding-bottom: 20px;
}
.close-cart { cursor: pointer; font-size: 1.5rem; color: #444; }

.cart-items { flex: 1; overflow-y: auto; padding: 20px 0; }

.cart-item {
  display: flex; gap: 20px; margin-bottom: 25px; align-items: center;
}
.cart-item img { width: 60px; aspect-ratio: 1/1; object-fit: contain; background: #1a1a1a; }
.cart-item-info { flex: 1; }
.cart-item-info h4 { font-size: 0.7rem; letter-spacing: 0.1em; color: #eee; margin-bottom: 5px; }
.cart-item-info p { font-size: 0.7rem; color: #555; }

.remove-item { cursor: pointer; color: #ff4444; font-size: 0.6rem; letter-spacing: 0.1em; margin-top: 5px; display: block; }

.cart-footer { border-top: 1px solid #222; padding-top: 20px; }
.total-row { display: flex; justify-content: space-between; margin-bottom: 20px; font-size: 0.8rem; letter-spacing: 0.2em; }
#payButton {
  width: 100%; background: #fff; color: #000; border: none;
  padding: 18px; font-weight: 700; font-size: 0.7rem;
  letter-spacing: 0.3em; cursor: pointer;
}

@media (max-width: 500px) {
  .cart-drawer { width: 100%; right: -100%; }
}