:root {
  --bg: #f5f5f5; /* Gris muy claro */
  --card: #ffffff; /* Blanco puro */
  --text: #1a1a1a; /* Negro suave */
  --muted: #6b7280; /* Gris medio */
  --brand: #2563eb; /* Azul profesional */
  --brand-dark: #1e40af; /* Azul oscuro */
  --accent: #374151; /* Gris oscuro para acentos */
  --shadow-light: rgba(255, 255, 255, 0.9);
  --shadow-dark: rgba(0, 0, 0, 0.15);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--card);
  backdrop-filter: blur(8px);
  border-bottom: none;
  padding: 16px 20px;
  box-shadow: 
    0 8px 16px var(--shadow-dark),
    0 -2px 8px var(--shadow-light);
}
header h1 { margin: 0 0 6px; font-size: 20px; letter-spacing: 0.3px; }
header p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }

nav ul {
  display: flex;
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
nav a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 14px;
  transition: all 200ms ease;
}
nav a:hover { 
  box-shadow: 
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
}
nav a.active { 
  background: var(--brand);
  color: white;
  box-shadow: 
    4px 4px 8px var(--shadow-dark),
    -4px -4px 8px var(--shadow-light);
}

main { max-width: 1100px; margin: 0 auto; padding: 20px; }
section { padding: 80px 0; border-bottom: none; margin-bottom: 40px; }
section:last-of-type { border-bottom: 0; margin-bottom: 0; }

h2 { font-size: 32px; margin: 0 0 32px; line-height: 1.2; position: relative; }
h2::after { content: ""; display: block; width: 56px; height: 3px; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 2px; margin-top: 10px; opacity: 0.7; }

/* Iconos de sección */
.section-header-with-icon {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 40px;
}

.section-icon {
  width: 72px; /* desktop por defecto */
  height: 72px;
  flex-shrink: 0;
  filter: drop-shadow(8px 8px 16px var(--shadow-dark));
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { 
    transform: translateY(0px) rotate(0deg) scale(1); 
  }
  25% { 
    transform: translateY(-20px) rotate(-3deg) scale(1.05); 
  }
  50% { 
    transform: translateY(-25px) rotate(0deg) scale(1.08); 
  }
  75% { 
    transform: translateY(-20px) rotate(3deg) scale(1.05); 
  }
}

.section-header-with-icon h2 {
  margin: 0;
}

.section-header-with-icon h2::after {
  margin-top: 8px;
}
h3 { font-size: 20px; margin: 20px 0 6px; }
p { line-height: 1.7; color: #334155; }
h1 { font-size: 40px; margin: 0 0 16px; line-height: 1.2; }

article { 
  background: var(--card); 
  border: none;
  padding: 24px; 
  border-radius: 20px; 
  margin: 14px 0;
  box-shadow: 
    8px 8px 16px var(--shadow-dark),
    -8px -8px 16px var(--shadow-light);
  transition: all 300ms ease;
  position: relative;
}

/* Iconos de servicio */
.service-icon {
  width: 52px; /* desktop por defecto */
  height: 52px;
  margin: 0 auto 18px;
  display: block;
  filter: drop-shadow(3px 3px 6px var(--shadow-dark));
  transition: transform 400ms ease;
}

article:hover .service-icon {
  transform: scale(1.1) rotate(5deg);
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--card);
  color: var(--brand);
  border-radius: 16px;
  text-decoration: none;
  border: none;
  font-weight: 600;
  box-shadow: 
    6px 6px 12px var(--shadow-dark),
    -6px -6px 12px var(--shadow-light);
  transition: all 200ms ease;
}
.btn:hover { 
  box-shadow: 
    inset 4px 4px 8px var(--shadow-dark),
    inset -4px -4px 8px var(--shadow-light);
  color: var(--brand-dark);
}

/* Efecto pulso para CTA principal */
.btn.pulse { animation: cta-pulse 2200ms ease 1600ms 2 both; }
@keyframes cta-pulse {
  0% { transform: translateZ(0) scale(1); box-shadow: 0 0 0 rgba(14,165,233,0); }
  40% { transform: translateZ(0) scale(1.035); box-shadow: 0 8px 24px rgba(2,132,199,0.22); }
  100% { transform: translateZ(0) scale(1); box-shadow: 0 0 0 rgba(14,165,233,0); }
}

/* Optimización visual */
#inicio h2, #inicio p, #inicio .btn { will-change: transform, opacity; }

ul { padding-left: 18px; }
li { margin: 12px 0; line-height: 1.8; }

/* Lista de metodología mejorada */
.methodology-list {
  counter-reset: step-counter;
  list-style: none;
  padding-left: 0;
  max-width: 700px;
  margin: 0 auto;
}

.methodology-list li {
  counter-increment: step-counter;
  position: relative;
  padding: 20px 20px 20px 60px;
  margin: 16px 0;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 
    6px 6px 12px var(--shadow-dark),
    -6px -6px 12px var(--shadow-light);
  transition: transform 300ms ease, box-shadow 300ms ease;
}

.methodology-list li:hover {
  transform: translateX(8px);
  box-shadow: 
    8px 8px 16px var(--shadow-dark),
    -8px -8px 16px var(--shadow-light);
}

.methodology-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  box-shadow: 
    4px 4px 8px var(--shadow-dark),
    -2px -2px 6px var(--shadow-light);
}

/* Contenido de nosotros */
.nosotros-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.nosotros-content p {
  font-size: 18px;
  margin: 20px 0;
}

form { display: grid; gap: 10px; max-width: 560px; margin: 0 auto; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--text); }
input, textarea { 
  padding: 12px 16px; 
  border-radius: 12px; 
  border: none;
  background: var(--card); 
  color: var(--text);
  box-shadow: 
    inset 4px 4px 8px var(--shadow-dark),
    inset -4px -4px 8px var(--shadow-light);
  transition: box-shadow 200ms ease;
}
input:focus, textarea:focus {
  outline: none;
  box-shadow: 
    inset 6px 6px 12px var(--shadow-dark),
    inset -6px -6px 12px var(--shadow-light);
}
textarea { min-height: 120px; resize: vertical; }
button.btn { 
  cursor: pointer; 
  justify-self: start;
  background: var(--brand);
  color: white;
  box-shadow: 
    6px 6px 12px var(--shadow-dark),
    -6px -6px 12px var(--shadow-light);
}
button.btn:hover {
  background: var(--brand-dark);
  box-shadow: 
    4px 4px 8px var(--shadow-dark),
    -4px -4px 8px var(--shadow-light);
}
button.btn:active {
  box-shadow: 
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
}

footer { 
  text-align: center; 
  color: var(--muted); 
  padding: 32px 16px;
  background: var(--card);
  box-shadow: 
    0 -8px 16px var(--shadow-dark),
    0 2px 8px var(--shadow-light);
}
footer .footer-logos { display: flex; align-items: center; justify-content: center; gap: 24px; margin-bottom: 16px; }

footer .footer-logo { 
  height: auto; 
  max-height: 50px; 
  width: auto; 
  object-fit: contain;
  padding: 12px 20px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 
    6px 6px 12px var(--shadow-dark),
    -6px -6px 12px var(--shadow-light);
  transition: all 300ms ease;
}

footer .footer-logo:hover {
  transform: translateY(-4px);
  box-shadow: 
    8px 8px 16px var(--shadow-dark),
    -8px -8px 16px var(--shadow-light);
}

footer .footer-separator { 
  color: var(--muted); 
  font-size: 14px; 
  font-weight: 500;
}

footer a { 
  display: inline-flex; 
  align-items: center; 
  transition: transform 300ms ease;
  text-decoration: none;
}

footer a:hover { 
  transform: scale(1.05);
}
footer p { margin: 0; font-size: 14px; } 

/* Interacciones y animaciones */
header { transition: transform 200ms ease, box-shadow 200ms ease, background-color 200ms ease; }
header.hide { transform: translateY(-100%); }

.reveal { 
  opacity: 0; 
  transform: translateY(60px) scale(0.95); 
  filter: blur(10px); 
  transition: 
    opacity 800ms cubic-bezier(0.22, 1, 0.36, 1), 
    transform 800ms cubic-bezier(0.22, 1, 0.36, 1), 
    filter 800ms ease; 
}
.reveal-in { 
  opacity: 1; 
  transform: none; 
  filter: none; 
}

/* Animación de entrada inicial (stagger) */
.enter { 
  opacity: 0; 
  transform: translateY(40px) scale(0.96); 
  filter: blur(12px); 
}
.enter-in { 
  opacity: 1; 
  transform: none; 
  filter: none; 
  transition: 
    opacity 700ms cubic-bezier(0.22, 1, 0.36, 1), 
    transform 700ms cubic-bezier(0.22, 1, 0.36, 1), 
    filter 700ms ease; 
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .reveal, .enter { opacity: 1 !important; transform: none !important; filter: none !important; }
  .reveal-in, .enter-in { transition: none !important; }
}

/* Editorial improvements */
section { scroll-margin-top: 90px; }
section:nth-of-type(even) { background: var(--card); }
section:nth-of-type(odd) { background: var(--bg); }

/* Servicios grid */
#servicios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
#servicios > h2, #servicios > p, #servicios > .btn { grid-column: 1 / -1; }
#servicios > article { 
  transition: transform 160ms ease, box-shadow 300ms ease; 
  transform-style: preserve-3d; 
  will-change: transform; 
}
#servicios > article:hover { 
  transform: translateY(-4px); 
  box-shadow: 
    12px 12px 24px var(--shadow-dark),
    -12px -12px 24px var(--shadow-light);
}
#servicios > article.tilting { transition: transform 60ms linear; }

/* Listas en grilla donde aplique */
#industrias ul { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 16px; padding-left: 18px; }

/* Details/summary estilizado */
details { 
  background: var(--card); 
  border: none;
  border-radius: 16px; 
  padding: 14px 18px; 
  margin: 12px 0;
  box-shadow: 
    6px 6px 12px var(--shadow-dark),
    -6px -6px 12px var(--shadow-light);
}
summary { cursor: pointer; font-weight: 600; color: var(--text); list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "▾"; float: right; transition: transform 160ms ease; color: var(--muted); }
details[open] summary::after { transform: rotate(180deg); }

/* Nav refinado en hover/active */
nav a { transition: background-color 140ms ease, color 140ms ease; }

/* Responsive refinements para grillas */
@media (max-width: 1024px) {
  #servicios { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .hero-section {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .hero-graphic { order: -1; }
  .hero-graphic svg { max-width: 240px; }
}

/* Móvil retrato: tamaños más compactos */
@media (max-width: 640px) and (orientation: portrait) {
  .service-icon { width: 44px; height: 44px; }
  .section-icon { width: 56px; height: 56px; }
  .hero-graphic svg { max-width: 210px; }
  #servicios { grid-template-columns: 1fr; }
}

/* Móvil paisaje: más ancho, podemos permitir 2 columnas */
@media (max-width: 900px) and (orientation: landscape) {
  .service-icon { width: 48px; height: 48px; }
  .section-icon { width: 60px; height: 60px; }
  .hero-graphic svg { max-width: 260px; }
  #servicios { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* Desktop amplio: dar un poco más de presencia */
@media (min-width: 1280px) {
  .service-icon { width: 56px; height: 56px; }
  .section-icon { width: 80px; height: 80px; }
  .hero-graphic svg { max-width: 340px; }
}
@media (max-width: 640px) {
  #servicios { grid-template-columns: 1fr; }
  #industrias ul { grid-template-columns: 1fr; }
}

/* Responsive */
@media (max-width: 720px) {
  header { padding: 12px 14px; }
  main { padding: 12px; }
  section { padding: 56px 0; margin-bottom: 16px; }
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  nav a { font-size: 16px; padding: 10px 14px; }

  .hero-section { gap: 28px; min-height: auto; }
  .hero-content p { font-size: 16px; }
  .hero-content .btn { width: 100%; text-align: center; }

  .section-header-with-icon {
    flex-direction: column;
    text-align: center;
    gap: 14px;
  }
  .section-icon { width: 56px; height: 56px; }

  #servicios { gap: 12px; }
  #servicios > article { padding: 18px; }
  .service-icon { width: 44px; height: 44px; }

  .methodology-list { max-width: 100%; }
  .methodology-list li { padding: 14px 14px 14px 56px; }
  .methodology-list li::before { width: 30px; height: 30px; left: 12px; font-size: 13px; }

  footer .footer-logos { flex-wrap: wrap; gap: 12px; }
  footer .footer-logo { max-height: 40px; padding: 8px 14px; }
}

/* Marca y logo */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { display: block; height: 40px; width: auto; }
@media (min-width: 768px) { .brand-logo { height: 56px; } }

/* Solo para lectores de pantalla */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 1px, 1px); white-space: nowrap; border: 0; }

/* Bullets personalizados con logobul */
ul.bullets { list-style: none; }
ul.bullets li { position: relative; padding-left: 28px; }
ul.bullets li::before { content: ""; position: absolute; left: 0; top: 0.4em; width: 18px; height: 18px; background: url("img/logbul.png") no-repeat center/contain; }

/* Ajuste de padding cuando las listas de secciones usan bullets */
#industrias ul.bullets, #casos ul.bullets, #precios ul.bullets { padding-left: 0; }

/* Notificación toast elegante */
.toast-notification {
  position: fixed;
  top: 24px;
  right: 24px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 18px 24px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(16, 185, 129, 0.3), 0 4px 12px rgba(0, 0, 0, 0.1);
  font-weight: 500;
  font-size: 15px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 400px;
  animation: slideInRight 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(8px);
}

.toast-notification::before {
  content: "✓";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  font-weight: bold;
  font-size: 16px;
}

.toast-notification.fade-out {
  animation: slideOutRight 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Responsive para móvil */
@media (max-width: 640px) {
  .toast-notification {
    top: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }
  
  @keyframes slideInRight {
    from {
      transform: translateY(-100px);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  @keyframes slideOutRight {
    from {
      transform: translateY(0);
      opacity: 1;
    }
    to {
      transform: translateY(-100px);
      opacity: 0;
    }
  }
}