html { scroll-behavior: smooth; scroll-padding-top: 100px; }
* { margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { background-color: #f1f5f9; color: #1e293b; overflow-x: hidden; min-height: 100vh; display: flex; flex-direction: column; width: 100%; }

/* =========================================
   Fondo Líquido Orgánico
   ========================================= */
.liquid-bg { position: fixed; inset: 0; z-index: -1; background: #f8fafc; overflow: hidden; width: 100vw; height: 100vh; }
.blobs-container { width: 100%; height: 100%; position: absolute; }
.blob { position: absolute; border-radius: 50%; opacity: 0.6; }

.blob-1 { width: 35vw; height: 35vw; top: 10%; left: 10%; background: radial-gradient(circle, #e2e8f0 0%, rgba(226, 232, 240, 0) 72%); animation: liquidPath1 36s infinite ease-in-out; }
.blob-2 { width: 30vw; height: 30vw; bottom: 20%; right: 10%; background: radial-gradient(circle, #e9eff5 0%, rgba(233, 239, 245, 0) 72%); animation: liquidPath2 42s infinite ease-in-out; }
.blob-3 { width: 25vw; height: 25vw; top: 40%; left: 30%; background: radial-gradient(circle, #cbd5e1 0%, rgba(203, 213, 225, 0) 72%); }
.blob-4 { width: 40vw; height: 40vw; bottom: -10%; left: 20%; background: radial-gradient(circle, #dce4ee 0%, rgba(220, 228, 238, 0) 72%); }

@keyframes liquidPath1 { 0% { transform: translate3d(0, 0, 0) scale(1); } 33% { transform: translate3d(15vw, -10vh, 0) scale(1.1); } 66% { transform: translate3d(5vw, 20vh, 0) scale(0.9); } 100% { transform: translate3d(0, 0, 0) scale(1); } }
@keyframes liquidPath2 { 0% { transform: translate3d(0, 0, 0) scale(1); } 33% { transform: translate3d(-20vw, 15vh, 0) scale(1.15); } 66% { transform: translate3d(-10vw, -10vh, 0) scale(0.95); } 100% { transform: translate3d(0, 0, 0) scale(1); } }
/* =========================================
   Navbar & Animación de Nombre
   ========================================= */
#main-nav { 
  position: fixed; top: 0; left: 0; width: 100%; height: 70px;
  z-index: 1000; display: flex; justify-content: flex-end; align-items: center; padding: 0 40px; 
}

#main-nav::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgba(255, 255, 255, 0.7); border-bottom: 1px solid rgba(255,255,255,0.4);
  opacity: 0; transition: opacity 0.25s ease;
}

.brand-lockup {
  position: fixed; top: 15vh; left: 50vw; z-index: 1002;
  width: max-content; transform: translateX(-50%);
  transform-origin: left top;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

#brand-name { 
  font-size: 4.5rem; font-weight: 800; letter-spacing: -2px; white-space: nowrap; 
  background: linear-gradient(to right, #0f172a 30%, #94a3b8 100%);
  color: transparent; -webkit-background-clip: text; background-clip: text; 
}

.brand-subtitle {
  margin-top: 2px; color: #475569; font-size: 1.15rem; font-weight: 600;
  letter-spacing: 0.04em; text-align: center; transition: opacity 0.2s ease;
}

.menu-toggle { display: none; flex-direction: column; cursor: pointer; gap: 6px; z-index: 1005; }
.menu-toggle .bar { width: 28px; height: 3px; background: #0f172a; transition: transform 0.25s ease, opacity 0.2s ease; border-radius: 3px; }

.nav-links { display: flex; gap: 30px; list-style: none; opacity: 0; transform: translateY(-8px); transition: opacity 0.2s ease, transform 0.2s ease; }
.nav-links a { text-decoration: none; color: #475569; font-weight: 600; font-size: 1rem; transition: color 0.3s; }
.nav-links a:hover { color: #0f172a; }

/* Estado Scrolled */
body.scrolled #main-nav::before { opacity: 1; }
body.scrolled .brand-lockup { transform: translate3d(calc(40px - 50vw), calc(15px - 15vh), 0) scale(0.34); }
body.scrolled .brand-subtitle { opacity: 0; }
body.scrolled .nav-links { opacity: 1; transform: translateY(0); }

/* =========================================
   Glassmorphism General
   ========================================= */
main { flex: 1; }
.container { max-width: 1000px; margin: 0 auto; padding: 0 20px 80px 20px; display: flex; flex-direction: column; gap: 50px; position: relative; z-index: 10; }
.scroll-sentinel { position: absolute; top: 40px; left: 0; width: 1px; height: 1px; pointer-events: none; }
.hero-spacer { height: 35vh; }

.glass-panel {
  background: rgba(255, 255, 255, 0.55); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.8); border-top: 1px solid rgba(255, 255, 255, 1); border-left: 1px solid rgba(255, 255, 255, 1);
  border-radius: 20px; padding: 35px; box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
}
.section-title { font-size: 1.8rem; font-weight: 800; color: #0f172a; margin-bottom: 20px; margin-left: 10px; }
.bio-text { font-size: 1.05rem; line-height: 1.8; color: #334155; margin-bottom: 20px; }
.bio-text:last-child { margin-bottom: 0; }
.tech-category { display: flex; align-items: center; font-size: 1.1rem; color: #64748b; margin-bottom: 15px; font-weight: 600; }

/* NUEVO: Texto de impacto para las áreas de dominio técnico */
.tech-impact-text {
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 15px;
  border-left: 3px solid #cbd5e1;
  padding-left: 12px;
}

/* =========================================
   Capacidades (Stats)
   ========================================= */
.stats-container { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; }
.stat-box { display: flex; flex-direction: column; flex: 1; min-width: 200px; background: rgba(255, 255, 255, 0.4); padding: 20px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.8); box-shadow: 0 4px 15px rgba(0,0,0,0.02); }
.stat-number { font-size: 1.25rem; font-weight: 800; color: #0f172a; line-height: 1.2; margin-bottom: 5px; }
.stat-label { font-size: 0.9rem; color: #475569; font-weight: 500; }

/* =========================================
   Botones Universales
   ========================================= */
.tech-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-wrapper, .tech-btn { position: relative; display: inline-block; }
.btn, .tech-btn {
  display: flex; align-items: center; justify-content: center; padding: 0.5em 1.2em; font-weight: 600; font-size: 0.85rem;
  background-color: rgba(255, 255, 255, 0.7); color: #1e293b; border: solid 1px rgba(255,255,255,0.8); border-radius: 24px; cursor: pointer;
  box-shadow: inset 0px 1px 2px rgba(255,255,255,1), 0px 4px 10px rgba(0,0,0,0.05); transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.tech-btn { cursor: default; }
.cert-btn { background-color: rgba(255, 255, 255, 0.9); border-color: #e2e8f0; }
.btn:hover { border-color: rgba(255,255,255,1); transform: translateY(-2px); background: rgba(255,255,255,0.9); }

/* =========================================
   TARJETAS GLASSMORPHISM CON IMAGEN
   ========================================= */
.design-card {
  background: rgba(255, 255, 255, 0.55); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.8); border-radius: 20px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,1);
  cursor: pointer; transition: transform 0.25s ease;
}
.design-card:hover { transform: translateY(-4px); }
.card-curve-header { height: 180px; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #cbd5e1; }
.header-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.project-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #1e293b; font-weight: 600; }
.wave { position: absolute; bottom: -1px; left: 0; width: 100%; height: auto; z-index: 2; }
.card-body { padding: 20px 25px 30px 25px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 15px; flex-grow: 1; z-index: 3; }
.card-body h3 { font-size: 1.25rem; color: #0f172a; }
.card-body p { font-size: 0.95rem; color: #475569; line-height: 1.5; flex-grow: 1; }
.card-btn { margin-top: auto; font-size: 0.85rem; padding: 0.5em 1.5em; width: 100%; }

/* =========================================
   SLIDER HORIZONTAL Y EFECTO FADE
   ========================================= */
.slider-wrapper { mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent); -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent); }
.horizontal-slider { display: flex; gap: 30px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px 20px 30px 20px; }
.horizontal-slider::-webkit-scrollbar { height: 8px; }
.horizontal-slider::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); border-radius: 10px; margin: 0 20px; }
.horizontal-slider::-webkit-scrollbar-thumb { background: rgba(15,23,42,0.2); border-radius: 10px; }
.slider-card {
  flex: 0 0 290px; scroll-snap-align: center; opacity: 0.45;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.slider-card.active-slide { opacity: 1; transform: translateY(0) scale(1); }
.slider-card:hover, .slider-card:focus-within { opacity: 1; transform: translateY(-4px) scale(1.01); }

/* =========================================
   Contacto Card
   ========================================= */
.contact-card { text-align: center; display: flex; flex-direction: column; align-items: center; padding: 40px 30px; }
.contact-quote { font-size: 1.15rem; font-weight: 600; color: #0f172a; margin-bottom: 20px; font-style: italic; line-height: 1.5; }
.quote-author { font-size: 0.95rem; font-weight: 400; color: #64748b; font-style: normal; display: block; margin-top: 5px; }
.contact-sub { color: #64748b; margin-bottom: 30px; font-size: 1.05rem; }
.contact-buttons-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }

/* =========================================
   Footer Final
   ========================================= */
.site-footer { border-top: 1px solid rgba(0,0,0,0.05); padding: 30px 0; margin-top: 40px; }
.footer-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; font-size: 0.85rem; color: #64748b; padding-bottom: 0; }
.footer-brand { color: #0f172a; font-weight: 600; }

/* =========================================
   MODAL DE DETALLES
   ========================================= */
.modal { position: fixed; inset: 0; z-index: 2000; display: flex; justify-content: center; align-items: center; pointer-events: none; }
.modal.active { pointer-events: auto; }
.modal-overlay { position: absolute; inset: 0; background: rgba(241, 245, 249, 0.82); opacity: 0; transition: opacity 0.2s ease; }
.modal.active .modal-overlay { opacity: 1; }
.modal-content { position: relative; width: 90%; max-width: 600px; z-index: 2001; opacity: 0; transform: translateY(12px); transition: opacity 0.2s ease, transform 0.2s ease; padding: 30px; border-radius: 24px; display: flex; flex-direction: column; gap: 15px; }
.modal.active .modal-content { opacity: 1; transform: translateY(0) scale(1); }
.close-btn { position: absolute; top: 15px; right: 20px; font-size: 1.8rem; color: #475569; cursor: pointer; transition: color 0.3s; z-index: 10; }
.close-btn:hover { color: #ef4444; }
#modal-img { width: 100%; height: 280px; object-fit: cover; border-radius: 16px; margin-bottom: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); background: #cbd5e1; }
#modal-title { font-size: 1.6rem; color: #0f172a; }
#modal-desc { color: #475569; line-height: 1.6; }

/* =========================================
   Aparición Bidireccional (Fade-Up)
   ========================================= */
.fade-up { opacity: 0; transform: translateY(12px); transition: opacity 0.35s ease-out, transform 0.35s ease-out; }
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* =========================================
   MÓVILES (Responsividad Total y Botón Visible)
   ========================================= */
@media (max-width: 768px) {
  /* ANTI-LAG */
  .blobs-container { opacity: 0.7; }
  .blob-1, .blob-2 { animation: none; }
  .glass-panel { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

  html, body { overflow-x: hidden; width: 100vw; }
  #main-nav { padding: 0 20px; justify-content: space-between; align-items: center; }
  
  .brand-lockup {
    top: 20px; left: 20px; transform: none; transform-origin: left top;
    transition: none;
  }
  #brand-name { font-size: 1.3rem; letter-spacing: -1px; }
  .brand-subtitle { margin-top: 1px; font-size: 0.7rem; letter-spacing: 0.03em; text-align: left; }
  body.scrolled .brand-lockup { transform: none; }
  body.scrolled .brand-subtitle { opacity: 1; }
  
  .container { padding: 0 15px 60px 15px; width: 100vw; }
  .glass-panel { padding: 22px 15px; }
  
  /* Forzamos que las tarjetas de capacidades ocupen el 100% y no causen scroll horizontal */
  .stats-container { flex-direction: column; gap: 12px; }
  .stat-box { min-width: 100%; width: 100%; text-align: center; }
  .footer-content { flex-direction: column; text-align: center; justify-content: center; }

  /* El botón de hamburguesa queda anclado de forma absoluta y visible en la esquina superior derecha */
  .menu-toggle { display: flex; position: fixed; right: 20px; top: 20px; z-index: 1005; }
  
  /* Menú lateral con efecto cristal difuminado fluido */
  .nav-links { 
    position: fixed; top: 0; right: -100%; width: 100%; height: 100vh; 
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 30%, rgba(255, 255, 255, 0.99) 100%);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    flex-direction: column; justify-content: center; align-items: center; 
    padding-left: 15%; transform: translateX(100%); transition: transform 0.3s ease; opacity: 1; pointer-events: none; z-index: 1003;
  }
  
  .nav-links.active { transform: translateX(0); pointer-events: auto; }
  .nav-links li { margin-bottom: 25px; }
  .nav-links a { font-size: 1.3rem; }
  .menu-toggle.is-active .bar:nth-child(1) { transform: translateY(9px) rotate(45deg); }
  .menu-toggle.is-active .bar:nth-child(2) { opacity: 0; }
  .menu-toggle.is-active .bar:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }
  
  .slider-card { flex-basis: 250px; }
  #modal-img { height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
