/* ==========================================================================
   EGGO 3J SAC — hoja de estilos única (CSS nativo, sin dependencias)
   ========================================================================== */

@font-face {
  font-family: "Open Sans";
  src: url("../fonts/open-sans-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --rojo: #f9041c;
  --rojo-oscuro: #bb2222;
  --azul: #354256;
  --azul-footer: #2b374a;
  --azul-footer-base: #263143;
  --gris-texto: #a0a2a6;
  --gris-claro: #f7f8f9;
  --header-h: 90px;
  --contenedor: 1100px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }

body {
  margin: 0;
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 14px;
  line-height: 26px;
  font-weight: 400;
  color: var(--gris-texto);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; }

h1, h2, h3, h4, h5, h6 { margin: 0; color: var(--azul); }
h2 { font-size: 30px; line-height: 35px; font-weight: 600; }
h3 { font-size: 20px; line-height: 25px; font-weight: 600; }
h6 { font-size: 15px; line-height: 27px; font-weight: 300; color: var(--gris-texto); }
p  { margin: 0 0 1em; }

.contenedor {
  width: 100%;
  max-width: var(--contenedor);
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Cabecera y navegación
   -------------------------------------------------------------------------- */
.cabecera {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  transition: height .25s ease, box-shadow .25s ease;
}
.cabecera.compacta { height: 70px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }

.cabecera .contenedor {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo img { height: 78px; width: auto; transition: height .25s ease; }
.cabecera.compacta .logo img { height: 60px; }

.menu { display: flex; list-style: none; }
.menu > li { position: relative; }
.menu > li > a {
  display: block;
  padding: 0 18px;
  line-height: var(--header-h);
  color: var(--azul);
  font-size: 14px;
  text-transform: uppercase;
  transition: color .2s ease, line-height .25s ease;
}
.cabecera.compacta .menu > li > a { line-height: 70px; }
.menu > li > a:hover,
.menu > li > a.activo { color: var(--rojo); }

.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 230px;
  list-style: none;
  background: var(--azul);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.tiene-submenu:hover > .submenu,
.tiene-submenu:focus-within > .submenu {
  opacity: 1; visibility: visible; transform: none;
}
.submenu a {
  display: block;
  padding: 12px 20px;
  color: #fff;
  font-size: 13px;
  line-height: 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.submenu li:last-child a { border-bottom: 0; }
.submenu a:hover { background: var(--rojo); }

.btn-menu {
  display: none;
  width: 44px; height: 44px;
  padding: 10px;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--azul);
}
.btn-menu svg { width: 100%; height: 100%; fill: currentColor; }

/* --------------------------------------------------------------------------
   Contenido general
   -------------------------------------------------------------------------- */
main { padding-top: var(--header-h); }

.seccion { padding: 80px 0; }
.seccion.centrada { text-align: center; }

.separador {
  display: block;
  width: 40px;
  height: 3px;
  margin: 20px auto 25px;
  background: var(--rojo);
}
.separador.izq { margin-left: 0; background: #dd2525; }

/* --------------------------------------------------------------------------
   Slider principal
   -------------------------------------------------------------------------- */
.slider {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1920 / 901; /* la imagen se ve completa, sin recortes, como en el original */
  background: #ddd;
}
.slide {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity .9s ease;
}
.slide.activa { opacity: 1; z-index: 1; }
.slide > img { width: 100%; height: 100%; object-fit: cover; }

/* Recuadro rojo: posición y tamaños proporcionales al lienzo original de 1920 px */
.slide-caja {
  position: absolute;
  left: 7.65%;
  top: 35.1%;
  width: 37.1%;
  height: 19.2%;
  padding: .75vw 1.3vw 0;
  background: rgba(214, 0, 0, .75);
  color: #fff;
  transform: translateY(20px);
  opacity: 0;
  transition: transform .7s ease .25s, opacity .7s ease .25s;
}
.slide.activa .slide-caja { transform: none; opacity: 1; }
.slide-caja h2 {
  color: #fff;
  font-size: 3.125vw;
  line-height: 1.083;
  font-weight: 800;
}
.slide-caja p {
  margin: .45vw 0 0;
  font-size: 2.6vw;
  line-height: 1.1;
}

/* Flechas laterales */
.slider-flecha {
  position: absolute;
  top: 28%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  padding: 0;
  color: #fff;
  background: rgba(90, 90, 90, .85);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background .2s ease;
}
.slider-flecha:hover { background: var(--rojo); }
.slider-flecha svg { width: 14px; height: 14px; fill: currentColor; }
.slider-flecha.ant { left: 18px; }
.slider-flecha.sig { right: 18px; }

/* --------------------------------------------------------------------------
   Franja roja de introducción
   -------------------------------------------------------------------------- */
.franja {
  padding: 39px 0 26px;
  background: var(--rojo);
  text-align: center;
}
.franja h3 { color: #fff; }

/* --------------------------------------------------------------------------
   Tarjetas de servicios
   -------------------------------------------------------------------------- */
.servicios { padding-top: 80px; }
.servicios h2 { text-align: center; }

.rejilla-servicios {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  margin-top: 56px;
  text-align: center;
}
.tarjeta-servicio img { width: 212px; max-width: 100%; margin: 0 auto 39px; }
.tarjeta-servicio h3 { margin-bottom: 17px; }
.tarjeta-servicio h3 a:hover { color: var(--rojo); }

/* Aparición al hacer scroll (JS añade .visible) */
.js .aparece { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s ease; }
.js .aparece.visible { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   Nosotros
   -------------------------------------------------------------------------- */
.nosotros { background: var(--gris-claro); padding: 95px 0 71px; }
.dos-columnas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}
.nosotros h2 { margin-top: 13px; }
.nosotros p { position: relative; padding-left: 24px; }
.nosotros p::before {
  content: "";
  position: absolute;
  left: 0; top: 9px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--rojo-oscuro);
}

.galeria { position: relative; aspect-ratio: 3 / 2; overflow: hidden; }
.galeria img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s ease;
}
.galeria img.activa { opacity: 1; }

/* --------------------------------------------------------------------------
   Contacto
   -------------------------------------------------------------------------- */
.contacto {
  padding: 77px 0 71px;
  text-align: center;
  background: url("../images/map-background.jpg") center / cover no-repeat;
}
.contacto .dos-columnas { align-items: start; }
.contacto img { margin: 0 auto 20px; }
.contacto h2 { margin-bottom: 10px; }
.contacto .separador { margin: 20px auto; }
.contacto-datos p { margin: 0 0 .9em; }
.contacto-datos a { color: inherit; }
.contacto-datos a:hover { color: var(--rojo); }

.formulario { text-align: left; }
.formulario input,
.formulario textarea {
  display: block;
  width: 100%;
  margin-bottom: 14px;
  padding: 13px 16px;
  font: inherit;
  color: var(--azul);
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 0;
}
.formulario textarea { min-height: 150px; resize: vertical; }
.formulario input:focus,
.formulario textarea:focus { outline: 0; border-color: var(--rojo); }
.formulario input.invalido,
.formulario textarea.invalido { border-color: var(--rojo); background: #fff6f6; }

.formulario button {
  padding: 13px 40px;
  font: inherit;
  font-weight: 600;
  text-transform: uppercase;
  color: #fff;
  background: var(--rojo);
  border: 0;
  cursor: pointer;
  transition: background .2s ease;
}
.formulario button:hover { background: var(--rojo-oscuro); }
.form-estado { margin-top: 12px; min-height: 22px; font-size: 13px; }
.form-estado.error { color: var(--rojo); }
.form-estado.ok { color: #2e7d32; }

/* --------------------------------------------------------------------------
   Franja de marca (antes del pie)
   -------------------------------------------------------------------------- */
.marca { background: var(--azul); }
.marca .contenedor {
  display: grid;
  grid-template-columns: 3fr 5fr 4fr;
  gap: 20px;
  align-items: center;
  padding-top: 16px;
  padding-bottom: 16px;
}
.marca p { margin: 0; }
.redes { display: flex; gap: 4px; }
.redes a {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  background: #455163;
  color: var(--gris-texto);
  transition: background .2s ease, color .2s ease;
}
.redes a:hover { background: var(--rojo-oscuro); color: #fff; }
.redes svg { width: 22px; height: 22px; fill: currentColor; }

/* --------------------------------------------------------------------------
   Pie de página
   -------------------------------------------------------------------------- */
.pie-superior { background: var(--azul-footer); padding: 45px 0 30px; }
.pie-columnas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; }
.pie-superior h5 { margin: 0; color: #fff; font-size: 18px; font-weight: 600; }
.pie-superior h5 a { color: #fff; }
.pie-superior h5 a:hover { color: var(--gris-texto); }
.pie-superior .separador { margin: 25px 0 15px; background: var(--gris-texto); }

.pie-inferior { background: var(--azul-footer-base); padding: 37px 0; text-align: center; }
.pie-inferior p { margin: 0; font-weight: 300; }

/* --------------------------------------------------------------------------
   Subpáginas: cabecera de título + ficha de servicio
   -------------------------------------------------------------------------- */
.titulo-pagina {
  height: 220px;
  display: flex;
  align-items: center;
  background: #f7f8f9 url("../images/map-background.jpg") center / cover no-repeat;
}
.titulo-pagina h1 { font-size: 30px; line-height: 40px; font-weight: 600; }
.migas { margin-top: 6px; font-size: 13px; }
.migas a:hover,
.migas [aria-current] { color: var(--rojo); }
.migas .sep { margin: 0 6px; }

.ficha { padding: 70px 0; }
.ficha .dos-columnas { align-items: start; }
.ficha h3 { margin-bottom: 14px; }
.ficha ul { margin: 0 0 1em 20px; }
.ficha li { margin-bottom: 4px; }
.video { position: relative; aspect-ratio: 16 / 9; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* --------------------------------------------------------------------------
   Botón "volver arriba"
   -------------------------------------------------------------------------- */
.arriba {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 90;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  color: #fff;
  background: var(--rojo);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s;
}
.arriba.visible { opacity: 1; visibility: visible; }
.arriba:hover { background: var(--rojo-oscuro); }
.arriba svg { width: 18px; height: 18px; fill: currentColor; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1000px) {
  .rejilla-servicios { grid-template-columns: repeat(2, 1fr); }
  .pie-columnas { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --header-h: 70px; }
  .cabecera.compacta { height: 70px; }
  .logo img,
  .cabecera.compacta .logo img { height: 56px; }

  .btn-menu { display: block; }

  .menu {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
  }
  .menu.abierto { max-height: 80vh; overflow-y: auto; }
  .menu > li > a,
  .cabecera.compacta .menu > li > a { line-height: 46px; padding: 0 20px; border-top: 1px solid #f0f0f0; }

  .submenu {
    position: static;
    min-width: 0;
    opacity: 1; visibility: visible; transform: none;
    background: var(--gris-claro);
  }
  .submenu a { color: var(--azul); padding-left: 40px; border-color: #ececec; }

  .seccion, .servicios { padding: 50px 0; }
  .nosotros { padding: 50px 0 40px; }
  .dos-columnas { grid-template-columns: 1fr; gap: 30px; }
  .marca .contenedor { grid-template-columns: 1fr; text-align: center; }
  .marca .contenedor > div:first-child img { margin: 0 auto; }
  .redes { justify-content: center; }
  /* En móvil el slider se hace más alto y el recuadro pasa a tamaños legibles */
  .slider { aspect-ratio: auto; height: 62vw; min-height: 260px; }
  .slide-caja { left: 5%; top: auto; bottom: 18%; width: 90%; height: auto; padding: 12px 16px 14px; }
  .slide-caja h2 { font-size: clamp(22px, 6.5vw, 34px); }
  .slide-caja p { margin-top: 6px; font-size: clamp(16px, 5vw, 26px); }
  .slider-flecha { top: 38%; width: 30px; height: 30px; }
  .slider-flecha.ant { left: 8px; }
  .slider-flecha.sig { right: 8px; }
}

@media (max-width: 520px) {
  .rejilla-servicios,
  .pie-columnas { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: .01ms !important; }
}
