/* === VARIABLES NATIVAS === */
:root {
  --rojo: #ED3632;
  --fondo: #F9F6F0;
  --texto: #333;
  --gris: #555;
  --cristal: rgba(255, 255, 255, 0.65);
  --cristal-panel: rgba(249, 246, 240, 0.85);
  --borde-cristal: rgba(255, 255, 255, 0.8);
  --fondo-tarjeta: #EAE6DF;
  --nav-bg-fixed: rgba(255, 255, 255, 0.9);
  --sombra: 0 10px 30px rgba(0,0,0,0.05);
  --curva-apple: cubic-bezier(0.25, 1, 0.5, 1);
}

/* === MODO OSCURO AUTOMÁTICO === */
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #121212;
    --texto: #F9F6F0;
    --gris: #A0A0A0;
    --cristal: rgba(20, 20, 20, 0.75);
    --cristal-panel: rgba(30, 30, 30, 0.9);
    --borde-cristal: rgba(255, 255, 255, 0.05);
    --fondo-tarjeta: #1E1E1E;
    --nav-bg-fixed: rgba(18, 18, 18, 0.95);
    --sombra: 0 10px 30px rgba(0,0,0,0.5);
  }
}

/* === SCROLL MAGNÉTICO === */
html { scroll-snap-type: y mandatory; scroll-behavior: smooth; }
.snap-section { scroll-snap-align: start; scroll-snap-stop: always; min-height: 100svh; }

/* === BASE === */
body { 
  margin: 0; font-family: 'Exo 2', sans-serif; background: var(--fondo); color: var(--texto); overflow-x: hidden; 
  transition: background-color 0.5s ease, color 0.5s ease;
}

/* === HERO, TÍTULO Y LUPA LIGERA === */
.hero { position: relative; width: 100vw; height: 100svh; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #111; }
.plano, .real { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.plano { z-index: 1; opacity: 1; filter: brightness(0.7); } 
.real { 
  z-index: 2; --x: 50vw; --y: 50vh; --lens: clamp(125px, 17.5vw, 200px); 
  clip-path: circle(var(--lens) at var(--x) var(--y));
  -webkit-clip-path: circle(var(--lens) at var(--x) var(--y));
}

.hero-title-container {
  z-index: 10; 
  text-align: center;
  pointer-events: none; 
  padding: 0 5%;
}
.hero-title-container h2 {
  font-size: clamp(2.5rem, 5vw, 5.5rem);
  font-weight: 700;
  color: #FFFFFF;
  margin: 0;
  text-shadow: 0 4px 20px rgba(0,0,0,0.5);
  line-height: 1.1;
}
.hero-title-container p {
  font-size: clamp(1.1rem, 1.5vw, 1.5rem);
  color: #E0E0E0;
  margin-top: 15px;
  font-weight: 400;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}

/* === ENVOLTORIO NAVBAR (DOCK EN PC) === */
.navbar-wrapper {
  position: fixed; bottom: 30px; left: 0; width: 100%; 
  display: flex; justify-content: center; 
  height: 80px; z-index: 1000; pointer-events: none; 
  transition: all 0.8s var(--curva-apple);
}
.navbar-wrapper.fixed-top { bottom: auto; top: 0; }

.navbar-glass {
  pointer-events: auto; display: flex; align-items: center; justify-content: space-between; 
  height: 100%; padding: 0 10px 0 30px; gap: 30px;
  width: max-content; 
  background: var(--cristal); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--borde-cristal); border-radius: 40px; 
  box-shadow: var(--sombra); box-sizing: border-box;
  transition: all 0.7s var(--curva-apple), background-color 0.5s ease;
}

.fixed-top .navbar-glass {
  width: 100%; max-width: 100%; padding: 0 5%; border-radius: 0; 
  border: none; border-bottom: 2px solid var(--rojo); background: var(--nav-bg-fixed); 
}

/* === INTERNOS DEL MENÚ === */
.nav-brand { display: flex; align-items: center; gap: 15px; flex-shrink: 0; height: 100%; text-decoration: none; }
.nav-logo { height: clamp(35px, 3vw, 45px); width: auto; flex-shrink: 0; transition: height 0.7s var(--curva-apple); }
.fixed-top .nav-logo { height: 40px; }
.nav-title { font-size: clamp(1rem, 1.2vw, 1.3rem); font-weight: 700; line-height: 1.15; color: var(--rojo); margin: 0; transition: font-size 0.7s var(--curva-apple); }
.fixed-top .nav-title { font-size: 1.1rem; }

.nav-links { display: flex; gap: 20px; align-items: center; margin-left: 15px; }
.fixed-top .nav-links { margin-right: auto; margin-left: 3vw; } 
.nav-links a { color: var(--texto); text-decoration: none; font-weight: 700; font-size: 0.95rem; transition: color 0.3s; }
.nav-links a:hover { color: var(--rojo); }

.nav-actions { display: flex; align-items: center; flex-shrink: 0; }
.cta-btn { 
  background: var(--rojo); color: #FFF; padding: 12px 30px; font-size: 1.05rem; font-weight: 700; text-decoration: none; 
  border-radius: 30px; border: none; box-shadow: 0 6px 20px rgba(237, 54, 50, 0.4);
  transition: all 0.4s ease; cursor: pointer; white-space: nowrap; margin-left: 10px;
}
.fixed-top .cta-btn { padding: 10px 25px; border-radius: 8px; font-size: 1rem; }
.cta-btn:hover { background: #d12e2b; transform: translateY(-3px); }

.mobile-menu-btn { display: none; }

/* === INDICADORES VISUALES (Scroll) === */
.scroll-indicator {
  position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%); width: 26px; height: 44px; border: 3px solid #FFF; border-radius: 50px;
  z-index: 15; pointer-events: none; box-shadow: 0 4px 15px rgba(0,0,0,0.5); background: rgba(0,0,0,0.15); opacity: 0;
}
.scroll-indicator::before {
  content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 6px; height: 6px;
  background: #FFF; border-radius: 50%; box-shadow: 0 0 8px rgba(255,255,255,0.8); animation: scrollWheel 2s infinite;
}
@keyframes scrollWheel { 0% { top: 8px; opacity: 1; } 100% { top: 26px; opacity: 0; } }

.mobile-hint {
  display: none; position: absolute; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.65); color: #FFF; padding: 12px 25px; border-radius: 30px; font-weight: 700;
  z-index: 50; pointer-events: none; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2); box-shadow: 0 4px 15px rgba(0,0,0,0.3); animation: pulseHint 2s infinite ease-in-out;
}
@keyframes pulseHint { 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.05); } }

/* === BENTO BOX GRID === */
.servicios-bento { padding: 120px 5% 40px 5%; display: flex; flex-direction: column; }
.bento-header { text-align: center; margin-bottom: 50px; }
.bento-header h2 { font-size: clamp(2rem, 3vw, 3rem); color: var(--rojo); margin: 0 0 10px 0; }
.bento-header p { font-size: 1.1rem; color: var(--gris); margin: 0; transition: color 0.5s ease; }

.bento-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 250px; gap: 20px; grid-auto-flow: dense; width: 100%; max-width: 1400px; margin: 0 auto; }
.card-large { grid-column: span 2; grid-row: span 2; }
.card-wide  { grid-column: span 2; grid-row: span 1; }
.card-tall  { grid-column: span 1; grid-row: span 2; }
.card-regular { grid-column: span 1; grid-row: span 1; }
.bento-card { position: relative; background: var(--fondo-tarjeta); border-radius: 24px; overflow: hidden; cursor: pointer; box-shadow: var(--sombra); transition: box-shadow 0.4s ease, background-color 0.5s ease; }
.bento-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--curva-apple), filter 0.6s; filter: blur(8px) brightness(0.85); }
.bento-glass {
  position: absolute; inset: 15px; background: var(--cristal); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
  border-radius: 16px; border: 1px solid var(--borde-cristal); padding: 25px; display: flex; flex-direction: column; justify-content: space-between; transition: all 0.5s var(--curva-apple), background-color 0.5s ease;
}
.bento-text h3 { font-size: 1.25rem; color: var(--texto); margin: 0 0 8px 0; transition: color 0.4s; }
.bento-text p { font-size: 0.95rem; color: var(--gris); margin: 0; line-height: 1.4; transition: opacity 0.4s, transform 0.4s, color 0.5s ease; }
.bento-arrow { align-self: flex-end; font-size: 1.5rem; color: var(--texto); font-weight: 700; transition: all 0.4s; }

@media (hover: hover) {
  .bento-card:hover { box-shadow: 0 20px 40px rgba(237, 54, 50, 0.15); }
  .bento-card:hover .bento-img { filter: blur(0px) brightness(1); transform: scale(1.05); }
  .bento-card:hover .bento-glass { top: auto; height: max-content; background: var(--nav-bg-fixed); border-color: var(--rojo); }
  .bento-card:hover .bento-text h3, .bento-card:hover .bento-arrow { color: var(--rojo); }
  .bento-card:hover .bento-text p { opacity: 0; transform: translateY(10px); position: absolute; }
  .bento-card:hover .bento-arrow { transform: translateX(5px); }
}

/* === FOOTER Y LEGAL === */
.site-footer { margin-top: auto; padding-top: 80px; text-align: center; font-size: 0.95rem; color: var(--gris); padding-bottom: 20px; transition: color 0.5s ease; }
.footer-links { margin-bottom: 12px; display: flex; justify-content: center; gap: 20px; font-size: 0.9rem; }
.footer-links span { color: var(--gris); opacity: 0.5; }
.footer-links a { color: var(--rojo); text-decoration: none; font-weight: 700; transition: color 0.3s; }
.footer-links a:hover { color: #d12e2b; }

.icoremex-brand { font-family: 'Michroma', sans-serif; color: #FACC14; text-decoration: none; font-size: 1rem; transition: text-shadow 0.3s ease; }
.icoremex-brand .mex-color { color: #FA7416; }
.icoremex-brand:hover { text-shadow: 0 0 10px rgba(250, 204, 20, 0.5); }
.icoremex-brand:hover .mex-color { text-shadow: 0 0 10px rgba(250, 116, 22, 0.5); }

/* === PANELES Y MODALES === */
.panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 1500; opacity: 0; pointer-events: none; transition: background-color 0.5s ease; }
.offcanvas-panel {
  position: fixed; top: 0; right: 0; width: 450px; height: 100svh; background: var(--cristal-panel); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  z-index: 2000; box-shadow: -10px 0 40px rgba(0,0,0,0.1); display: flex; flex-direction: column; padding: 50px 40px; box-sizing: border-box; border-left: 1px solid var(--borde-cristal);
  transform: translateX(100%); will-change: transform; transition: background-color 0.5s ease, border-color 0.5s ease;
}
.contact-icon { width: 35px; height: 35px; object-fit: contain; }
.close-btn { position: absolute; top: 25px; right: 30px; background: none; border: none; font-size: 1.8rem; color: var(--texto); cursor: pointer; transition: all 0.3s; padding: 5px; z-index: 10; }
.close-btn:hover { color: var(--rojo); transform: rotate(90deg); }
.panel-content { margin-top: 30px; }
.panel-content h2 { color: var(--rojo); font-size: 1.8rem; margin-bottom: 15px; line-height: 1.2; }
.panel-content p { color: var(--gris); font-size: 1.05rem; line-height: 1.5; margin-bottom: 40px; transition: color 0.5s ease; }
.contact-links { display: flex; flex-direction: column; gap: 20px; }
.contact-card { display: flex; align-items: center; gap: 20px; padding: 20px; background: var(--cristal); border-radius: 16px; text-decoration: none; color: var(--texto); border: 1px solid var(--borde-cristal); box-shadow: var(--sombra); transition: all 0.3s, background-color 0.5s ease; }
.contact-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(237, 54, 50, 0.15); background: var(--fondo); border-color: var(--rojo); }
.contact-info { display: flex; flex-direction: column; }
.contact-info strong { font-size: 1.1rem; margin-bottom: 3px; }
.contact-info span { font-size: 0.95rem; color: var(--gris); }

.legal-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 650px; max-height: 85vh;
  background: var(--cristal-panel); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  z-index: 2500; border-radius: 24px; border: 1px solid var(--borde-cristal); box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  padding: 40px; box-sizing: border-box; display: flex; flex-direction: column; overflow-y: auto; transition: background-color 0.5s ease, border-color 0.5s ease;
}
.legal-body { overflow-y: auto; padding-right: 15px; margin-top: 10px; font-size: 0.95rem; color: var(--gris); line-height: 1.6; }
.legal-body h3 { color: var(--texto); font-size: 1.1rem; margin: 25px 0 10px 0; transition: color 0.5s ease; }
.legal-body p { margin-bottom: 15px; }


/* =========================================
   ADAPTACIONES MÓVILES
   ========================================= */
@media (max-width: 900px) { .bento-grid { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 768px) {
  .hero-title-container h2 { font-size: clamp(2rem, 8vw, 2.5rem); }
  .hero-title-container p { font-size: 0.95rem; }
  .mobile-hint { display: block; top: 100px; opacity: 1 !important; }
  
  /* === NAVBAR ISLA FLOTANTE SUPERIOR === */
  .navbar-wrapper { 
    bottom: auto; top: 15px; height: 60px; 
  }
  .navbar-glass { 
    width: 95%; max-width: 450px; padding: 0 10px 0 15px; border-radius: 30px; gap: 5px; 
    border: 1px solid var(--borde-cristal); 
  }
  
  .navbar-wrapper.fixed-top { top: 0; height: 65px; }
  .fixed-top .navbar-glass { width: 100%; max-width: 100%; border-radius: 0; border: none; border-bottom: 2px solid var(--rojo); padding: 0 15px; }
  
  .nav-brand { gap: 8px; flex-shrink: 1; min-width: 0; }
  .nav-logo { height: 32px; max-width: 45px; }
  .fixed-top .nav-logo { height: 30px; }
  .nav-title { font-size: 0.75rem; white-space: normal; line-height: 1.1; min-width: 0; }
  .fixed-top .nav-title { font-size: 0.75rem; }
  
  .cta-btn { padding: 8px 12px; font-size: 0.8rem; border-radius: 20px; flex-shrink: 0; margin-left: auto; }
  .fixed-top .cta-btn { padding: 6px 10px; font-size: 0.75rem; border-radius: 8px; margin-left: 0; }

  /* === LÓGICA DEL MENÚ HAMBURGUESA === */
  .nav-links { display: none !important; } 
  .mobile-menu-btn { display: none !important; }
  
  .fixed-top .mobile-menu-btn {
    display: flex !important; align-items: center; justify-content: center; background: none; 
    border: none; color: var(--texto); padding: 5px; margin-left: 5px; cursor: pointer; flex-shrink: 0;
  }
  .mobile-menu-btn svg { width: 26px; height: 26px; }

  /* Diseño, Alineación y Candado Anti-GSAP del Menú Desplegable */
  .fixed-top .nav-links { 
    display: flex !important; position: absolute; top: 65px; right: 0; width: 100%; flex-direction: column; gap: 20px;
    align-items: center; /* Alineación central de los elementos */
    text-align: center; /* Alineación central del texto */
    background: var(--cristal-panel); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    padding: 20px 25px 25px 25px; border-radius: 0 0 25px 25px; border: none; border-bottom: 1px solid var(--borde-cristal);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15); 
    
    visibility: hidden; 
    opacity: 0 !important; 
    pointer-events: none; 
    transform: translateY(-10px); transition: all 0.3s ease;
  }

  /* Estética de botones para los enlaces del submenú */
  .fixed-top .nav-links a {
    font-size: 1.05rem;
    padding: 5px 0;
    width: 100%;
  }
  
  .fixed-top .nav-links.active { 
    visibility: visible; 
    opacity: 1 !important; 
    pointer-events: auto; 
    transform: translateY(0); 
  }

  .scroll-indicator { 
    display: block; bottom: 40px; left: 50%; right: auto; 
    transform: translateX(-50%) scale(0.85); background: rgba(0,0,0,0.4); 
  }
  .scroll-indicator::after { 
    content: 'Desliza'; position: absolute; top: -24px; left: 50%; 
    transform: translateX(-50%); color: #FFF; font-size: 0.95rem; font-weight: 700; letter-spacing: 1px; 
  }

  .offcanvas-panel {
    top: auto; bottom: 0; left: 0; width: 100vw; height: auto; min-height: 50svh;
    border-left: none; border-top: 1px solid var(--borde-cristal); border-radius: 35px 35px 0 0;
    padding: 40px 25px 50px 25px; transform: translateY(100%);
  }
  .close-btn { top: 15px; right: 20px; }
  .panel-content h2 { font-size: 1.5rem; }
  .panel-content p { font-size: 1rem; margin-bottom: 30px; }
  
  .legal-modal { padding: 30px 20px; width: 95%; max-height: 80vh; }
  .site-footer { padding-top: 50px; padding-bottom: 20px; }
}

@media (max-width: 600px) {
  .servicios-bento { padding-top: 100px; }
  .bento-grid { grid-template-columns: 1fr; grid-auto-rows: 280px; }
  .card-large, .card-wide, .card-tall, .card-regular { grid-column: span 1 !important; grid-row: span 1 !important; }
  .bento-img { filter: blur(0px) brightness(0.9); }
  
  .bento-glass { top: auto; bottom: 15px; height: max-content; background: var(--cristal-panel); padding: 15px 20px; flex-direction: row; align-items: center; }
  .bento-text { flex-grow: 1; }
  .bento-text p { display: none; } 
  .bento-text h3 { font-size: 1.15rem; margin: 0; }
  .bento-arrow { color: var(--rojo); font-size: 1.5rem; align-self: center; }
}