/* ---------------- Variables ---------------- */
:root {
  --white: #F5F7F6;
  --iceberg: #D7E3E7;
  --romance: #9DB7C5;
  --navy: #2F3B4C;

  --muted: #6b7280;
  --glass: rgba(47,59,76,0.08);

  --max-width: 1200px;
  --radius: 12px;
  --transition: 0.35s cubic-bezier(.2,.9,.3,1);

  --blue-sky: #7ec8e3; /* azul cielo opaco */
  --blue-light: #b1c1d4; /* azul muy clarito, casi blanco */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Poppins', sans-serif;
  background: var(--white);
  color: var(--navy);
  font-size: 18px;
  line-height: 1.6;
}

.container { width: min(92%, var(--max-width)); margin: 0 auto; }

/* ---------------- Loader ---------------- */
#loader {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--white); z-index: 2000;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#loader.hidden { opacity: 0; visibility: hidden; }
.spinner {
  width: 48px; height: 48px; border: 4px solid var(--romance);
  border-top-color: transparent; border-radius: 50%;
  animation: spin 1s linear infinite; margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { font-size: 1rem; color: var(--navy); }

/* ---------------- Navbar ---------------- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  padding: 10px 0; background: rgba(47,59,76,0.95);
  backdrop-filter: blur(6px);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 600; font-size: 1.1rem; color: var(--white); }
.nav-links { display: flex; gap: 24px; }
.nav-links a {
  text-decoration: none; color: var(--white);
  font-weight: 500; position: relative; padding: 6px 0;
}
.nav-links a::after {
  content: ""; position: absolute; bottom: -4px; left: 0;
  width: 0; height: 2px; background: var(--romance);
  transition: width 0.3s ease;
}
.nav-links a:hover::after { width: 100%; }

.nav-actions { display: flex; gap: 10px; }
.icon-btn {
  background: transparent; border: none; cursor: pointer;
  padding: 10px; border-radius: 8px; font-size: 1.8rem; color: var(--white);
}
.icon-btn:hover { background: var(--glass); }
.hamburger { display: none; }

/* ---------------- Hero ---------------- */
.hero { padding: 120px 0 60px; }
.hero-grid {
  display: grid; grid-template-columns: 1fr 520px;
  gap: 32px; align-items: center;
}
.hero-info h1 { font-size: 2.2rem; margin-bottom: 12px; }
.hero-info .lead { margin-bottom: 20px; color: var(--muted); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.btn {
  display: inline-block; padding: 10px 20px;
  border-radius: var(--radius); cursor: pointer;
  font-weight: 600; text-decoration: none;
  transition: background 0.3s ease, color 0.3s ease;
}
.btn-primary { background: var(--romance); color: var(--navy); }
.btn-primary:hover { background: var(--navy); color: var(--white); }
.btn-ghost { background: transparent; border: 2px solid var(--romance); color: var(--navy); }
.btn-ghost:hover { background: var(--romance); color: var(--white); }

.hero-features { list-style: none; }
.hero-features li { margin-bottom: 6px; color: var(--muted); }
.hero-features i { color: var(--romance); margin-right: 6px; }

/* Carrusel Hero */
.hero-carousel { position: relative; border-radius: var(--radius); overflow: hidden; }
.slides { position: relative; height: 400px; }
.slide {
  position: absolute; inset: 0; opacity: 0;
  background-size: cover; background-position: center;
  transition: opacity 0.8s ease;
}
.slide.active { opacity: 1; }
.carousel-controls {
  position: absolute; top: 50%; width: 100%;
  display: flex; justify-content: space-between;
  transform: translateY(-50%); padding: 0 10px;
}
.control { background: rgba(0,0,0,0.5); border: none; color: white;
  font-size: 22px; cursor: pointer; padding: 6px 10px; border-radius: 6px; }
.carousel-indicators {
  position: absolute; bottom: 10px; width: 100%;
  display: flex; justify-content: center; gap: 6px;
}
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,0.6); border: none; cursor: pointer;
}
.dot.active { background: var(--romance); }

/* ---------------- Nosotros ---------------- */
.section { padding: 80px 0; }
.section.alt { background: var(--iceberg); }
h2 { text-align: center; font-size: 1.9rem; margin-bottom: 8px; }
.intro { text-align: center; margin-bottom: 28px; color: var(--muted); }

.nosotros-grid {
  display: grid; grid-template-columns: 520px 1fr;
  gap: 32px; align-items: center;
}
.nosotros-images { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.img-wrap { flex: 1; overflow: hidden; border-radius: 12px; max-width: 240px; }
.img-wrap img {
  width: 100%; aspect-ratio: 4/5;
  object-fit: cover; border-radius: 12px;
  transition: transform 0.6s ease;
}
.img-wrap:hover img { transform: scale(1.08); }
.nosotros-text { font-size: 1rem; color: var(--muted); }

/* ---------------- Servicios ---------------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  max-width: 1100px;
  margin: 0 auto;
}
.services-grid .service-card:nth-child(5) {
  grid-column: 2 / span 2;
}
.service-card {
  position: relative; padding: 18px; border-radius: 12px;
  background: var(--white); border: 1px solid var(--glass);
  box-shadow: 0 6px 18px rgba(47,59,76,0.06);
  overflow: hidden; cursor: pointer;
  transition: transform 0.3s ease;
}
.service-card:hover { transform: translateY(-8px); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; z-index: 2; position: relative; }
.card-head i { font-size: 1.5rem; color: var(--romance); }
.card-text { font-size: 0.95rem; color: var(--muted); z-index: 2; position: relative; }

.card-media {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.5s ease;
}
.card-media img {
  width: 100%; height: 100%; object-fit: cover;
  filter: brightness(0.6);
}
.service-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
  opacity: 0; transition: opacity 0.5s ease;
}
.service-card:hover .card-media,
.service-card:hover::after { opacity: 1; }
.service-card:hover .card-head h3,
.service-card:hover .card-text { color: #fff; }

/* ---------------- Diferencia ---------------- */
.diff-grid {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.diff-item {
  flex: 1;
  min-width: 240px;
  max-width: 300px;
  text-align: center;
  padding: 18px;
  border-radius: 10px;
  transition: transform .28s ease, box-shadow .28s ease;
  opacity: 0;
  transform: translateY(20px);
}
.diff-item.show {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.diff-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(47,59,76,0.06);
}
.diff-icon {
  width: 68px;
  height: 68px;
  border-radius: 14px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--iceberg), #ecf6f8);
  color: var(--navy);
  font-size: 1.35rem;
}

/* ---------------- Clientes ---------------- */
.clients-marquee {
  overflow: hidden;
  padding: 10px 0;
}

.marquee-track {
  display: flex;
  gap: 40px;
  width: max-content;
  animation: marquee 40s linear infinite;
}

.marquee-track img {
  width: 120px;
  height: 60px;
  object-fit: contain;
  filter: brightness(0.6);
  transition: transform 0.3s ease, filter 0.3s ease;
}

.marquee-track img:hover {
  transform: scale(1.15);
  filter: brightness(1) saturate(1.2);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); } /* recorre la mitad porque hay duplicado */
}

/* ---------------- Contacto ---------------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 40px;
}
.contact-card {
  position: relative;
  padding: 28px 20px;
  border-radius: 16px;
  background: var(--iceberg);
  text-align: center;
  box-shadow: 0 8px 22px rgba(47,59,76,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}
.contact-card:hover {
  transform: translateY(-10px) scale(1.03);
  box-shadow: 0 14px 32px rgba(47,59,76,0.12);
}
.contact-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--romance), var(--white));
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: inherit;
  z-index: 0;
}
.contact-card:hover::before { opacity: 0.15; }
.contact-card h3 {
  margin-bottom: 12px;
  font-size: 1.3rem;
  font-weight: 600;
  position: relative;
  z-index: 1;
}
.contact-card .link {
  display: inline-block;
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
  margin-top: 8px;
  transition: color 0.3s ease;
  position: relative;
  z-index: 1;
}
.contact-card .link:hover { color: var(--romance); }
.contact-card i {
  font-size: 2rem;
  color: var(--romance);
  margin-bottom: 12px;
  transition: transform 0.3s ease, color 0.3s ease;
  position: relative;
  z-index: 1;
}
.contact-card:hover i {
  transform: scale(1.2) rotate(-5deg);
  color: var(--navy);
}
@media (max-width: 768px) {
  .contact-card { padding: 22px 16px; }
  .contact-card h3 { font-size: 1.1rem; }
  .contact-card i { font-size: 1.8rem; }
}

/* ---------------- Footer ---------------- */
.site-footer { background: var(--navy); padding: 20px; text-align: center; }
.site-footer small { color: var(--white); }

/* ---------------- Dark Mode ---------------- */
body.dark { background: #0f1724; color: #e6eef8; }
body.dark .navbar { background: rgba(15,23,36,0.95); }
body.dark .brand, body.dark .nav-links a, body.dark .icon-btn { color: #e6eef8; }
body.dark .section.alt { background: #162231; }
body.dark .service-card { background: #1e293b; }
body.dark .card-text, body.dark .card-head h3 { color: #bfd7f5; }
body.dark .contact-card { background: #1e293b; }
body.dark .contact-card h3,
body.dark .contact-card .link { color: #ccddee; }  /* ✅ mejor contraste */
body.dark .site-footer { background: #111827; }

body.dark .marquee-track img {
  filter: brightness(2) invert(1); /* se aclaran y se ven "blancos" */
}

body.dark .marquee-track img:hover {
  filter: brightness(2.5) invert(0); /* hover más claro pero natural */
}

body.dark .hero-info .lead,
body.dark .hero-features li,
body.dark .nosotros-text,
body.dark .intro,
body.dark .card-text {
  color: var(--blue-light);
}
/* ---------------- Responsive ---------------- */

@media (max-width: 768px) {
  .marquee-track img {
    width: 90px;
    height: 45px;
  }
}
@media (max-width: 480px) {
  .marquee-track img {
    width: 70px;
    height: 35px;
  }
}

@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-cta { justify-content: center; }
  .nosotros-grid { grid-template-columns: 1fr; text-align: center; }
  .nosotros-images { justify-content: center; }
}
@media (max-width: 900px) {
  .nav-links {
    display: none; flex-direction: column;
    background: rgba(47,59,76,0.95);
    position: absolute; top: 60px; right: 10px;
    padding: 20px; border-radius: 8px;
  }
  .nav-links.open { display: flex; }
  .hamburger { display: block; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero-info h1 { font-size: 1.8rem; }
  h2 { font-size: 1.5rem; }
  .marquee-track img { height: 40px; }
}

@media (max-width: 1024px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .services-grid .service-card:nth-child(5) {
    grid-column: auto; /* el quinto ya no se centra */
  }
}

@media (max-width: 600px) {
  .services-grid {
    grid-template-columns: 1fr;
  }
  .services-grid .service-card:nth-child(5) {
    grid-column: auto;
  }
}