/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', sans-serif;
  background-color: #f2f2f2;
  color: #222;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Navegación */
.nav {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: #e6e6e6;
  padding: 12px 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav .logo {
  font-size: 22px;
  font-weight: bold;
  color: #e60000;
}

.nav ul {
  display: flex;
  list-style: none;
}

.nav ul li {
  margin: 0 15px;
}

.nav ul li a {
  text-decoration: none;
  color: #222;
  font-weight: bold;
  transition: color 0.3s;
}

.nav ul li a:hover {
  color: #e60000;
}

/* Menú hamburguesa */
.menu-toggle {
  display: none;
  font-size: 28px;
  cursor: pointer;
}

/* Encabezado */
.header {
  background-color: #e6e6e6;
  color: #222;
  padding: 18px 20px;
  text-align: center;
  border-radius: 8px;
  margin: 70px 20px 25px; 
}

.header img {
  width: 95px;         
  margin-bottom: 6px;      
}

.header img:hover {
  transform: scale(1.05);
}

.header h1 {
  font-size: 30px;
  color: #e60000;
}

/* Texto principal */
.texto {
  background-color: #fff;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin: 20px;
}

.texto p {
  font-size: 18px;
  text-align: justify;
}

.texto img {
  display: block;
  max-width: 300px;
  width: 90%;
  margin: 20px auto 0;
  border-radius: 8px;
  transition: transform 0.3s;
}

.texto img:hover {
  transform: scale(1.03);
}

/* Contacto */
.contacto {
  background-color: #fff;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin: 20px;
}

.contacto h3 {
  color: #e60000;
  margin-bottom: 15px;
}

.contacto ul {
  list-style-type: none;
}

.contacto li {
  font-size: 18px;
  margin-bottom: 8px;
}

.contacto a {
  color: #e60000;
  text-decoration: none;
  transition: color 0.3s;
}

.contacto a:hover {
  text-decoration: underline;
  color: #c40000;
}

/* Productos en galería y marcas */
.productos-galeria {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  margin: 20px auto;
  max-width: 1200px;
}

.producto {
  background-color: #fff;
  border-radius: 8px;
  padding: 15px;
  width: 260px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: transform 0.3s;
}

.producto:hover {
  transform: scale(1.03);
}

.producto img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 10px;
}

.producto h3 {
  font-size: 20px;
  margin-bottom: 10px;
  color: #e60000;
}

/* Ajuste para títulos largos */
.producto h3.largo {
  font-size: 18px;
  line-height: 1.2;
  min-height: 48px; /* mantiene altura pareja en todas las tarjetas */
}

.productos-galeria,
.especialidades-galeria {
  margin-bottom: 25px !important; /* Menos espacio abajo */
}

.volver-contenedor {
  text-align: center;
  margin: 20px 0 40px 0; /* Mucho más natural */
}


/* Botón */
.boton-rojo {
  display: inline-block;
  padding: 10px 20px;
  background-color: #e60000;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  margin-top: 15px;
  transition: background-color 0.3s;
}

.boton-rojo:hover {
  background-color: #c40000;
}

/* Ficha de producto */
.ficha-producto {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 30px 20px;
  margin: 30px 20px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}


.imagen-producto {
  flex: 1 1 300px;
  text-align: center;
}

.imagen-producto img {
  width: 100%;
  max-width: 380px; /* tamaño uniforme y equilibrado */
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  transition: transform 0.3s;
}


.imagen-producto img:hover {
  transform: scale(1.05);
}

.info-producto {
  flex: 2 1 400px;
}

.info-producto h2 {
  color: #e60000;
  margin-bottom: 10px;
}

.info-producto ul {
  list-style-type: disc;
  padding-left: 20px;
  margin-bottom: 20px;
}

.info-producto p {
  text-align: justify;
  font-size: 17px;
  margin-bottom: 20px;
}

/* Footer */
footer {
  background-color: #e6e6e6;
  color: #222;
  text-align: center;
  padding: 15px;
  margin-top: 30px;
  border-radius: 8px;
  width: 100%;
  clear: both;
  position: relative;
}

/* --- SECCIÓN ESPECIALIDADES --- */

.especialidades-galeria {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 25px;
  padding: 20px;
  margin: 20px auto;
  max-width: 1200px;
}

.especialidad-card {
  background-color: #fff;
  border-radius: 8px;
  width: 260px;
  height: 400px; /* altura uniforme */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 20px 15px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: transform 0.3s;
}

.especialidad-card:hover {
  transform: scale(1.03);
}

.especialidad-card img {
  width: 100%;
  height: 200px;
  object-fit: cover; /* todas iguales sin deformarse */
  border-radius: 8px;
  margin-bottom: 10px;
}

.especialidad-card h3 {
  font-size: 20px;
  font-weight: bold;
  color: #e60000;
  margin: 10px 0;
}

.especialidad-card .boton-rojo {
  margin-top: 10px;
}


main {
  flex: 1;
}

footer {
  margin-top: auto;
}

/* Responsivo */
@media (max-width: 768px) {

  /* NAV */
  .nav ul {
    position: absolute;
    top: 55px;
    left: 0;
    width: 100%;
    background-color: #e6e6e6;
    flex-direction: column;
    align-items: center;
    display: none;
    padding: 15px 0;
  }

  .nav ul.active {
    display: flex;
  }

  .nav ul li {
    margin: 12px 0;
  }

  .menu-toggle {
    display: block;
    color: #222;
  }

  /* Encabezado */
  .header h1 {
    font-size: 26px;
  }

  /* ---- ARREGLO DEL TEXTO EN MOBILE ---- */
  .texto p,
  .info-producto p,
  .ficha-producto p,
  .contacto li {
    text-align: left !important;      /* saca justify en celu */
    font-size: 16px;
    word-spacing: normal !important;   /* evita espacios raros */
    letter-spacing: normal !important;
    line-height: 1.45;
  }

  /* ---- ESPECIALIDADES ---- */
  .especialidades-galeria {
    flex-direction: column;
    align-items: center;
    gap: 18px;
  }

  .especialidad-card {
    width: 90%;
    max-width: 350px;
    height: auto;
    padding: 18px 15px;
  }

  .especialidad-card img {
    height: auto;
    object-fit: contain;
  }

  /* ---- PRODUCTOS DE CADA ESPECIALIDAD ---- */
  .productos-galeria {
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 10px;
  }

  .producto {
    width: 90%;
    max-width: 350px;
    height: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  .producto img {
    width: 100%;
    height: auto;
    object-fit: contain;
    margin-bottom: 15px;
  }

  .producto h3 {
    font-size: 20px;
    margin-bottom: 10px;
    min-height: unset;
  }

  .boton-rojo {
    padding: 10px 18px;
    font-size: 17px;
    align-self: center;
  }

  /* FICHA INDIVIDUAL */
  .ficha-producto {
    flex-direction: column;
    text-align: center;
  }

  .info-producto {
    text-align: center;
  }
}
