/* ===========================
   RESET Y BASE
=========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Montserrat', Arial, sans-serif;
  background-color: #fff;
  color: #23272f;
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex-grow: 1;
}

/* ===========================
   CONTENIDO PRINCIPAL
=========================== */
.contenido-pagina {
  width: 100%;
  padding: 60px 40px;
  background: #fff;
}

.contenido-pagina h1 {
  text-align: center;
  color: #ffd932;
  font-size: 2.4em;
  margin-bottom: 48px;
  font-weight: 800;
  letter-spacing: -1px;
}

/* ===========================
   GRID DE SERVICIOS
=========================== */
.servicios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 40px;
  align-items: stretch;
}

/* ===========================
   BLOQUES DE SERVICIO
=========================== */
.servicio-bloque {
  border-radius: 16px;
  overflow: hidden;
  background-color: #0d1f23;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 40px;
  min-height: 350px;
  transition: background-color 0.3s ease;
}

.servicio-bloque:nth-child(even) {
  background-color: #f6f3f0;
  color: #0d1f23;
}

/* ===========================
   IMAGEN DEL SERVICIO
=========================== */
.servicio-imagen {
  flex: 1 1 50%;
  max-width: 50%;
  min-width: 0;
  display: flex;
  align-items: stretch;
  position: relative;
}

.servicio-imagen img,
.servicio-imagen video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
}

.servicio-imagen:hover img,
.servicio-imagen:hover video {
  transform: scale(1.05);
}

/* ===========================
   TEXTO DEL SERVICIO
=========================== */
.servicio-texto {
  flex: 1 1 50%;
  max-width: 50%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px;
  position: relative;
  transition: color 0.3s ease;
}

.servicio-texto h2 {
  font-size: 1.8rem;
  margin-bottom: 16px;
  font-weight: 700;
}

.servicio-texto p {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

.servicio-texto ul {
  padding-left: 20px;
  margin-bottom: 24px;
  margin-left: 10px;
}

.servicio-texto ul li {
  list-style: disc;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.servicio-texto a {
  font-weight: 600;
  font-size: 1rem;
  color: #ff4d00;
  text-decoration: none;
  margin-top: auto;
  transition: all 0.2s ease;
}

.servicio-texto a:hover {
  text-decoration: underline;
}

/* ===========================
   CONTROL DE ORDEN (IMAGEN/TEXTO)
=========================== */
.servicio-bloque.img-left .servicio-imagen { order: 1; }
.servicio-bloque.img-left .servicio-texto { order: 2; }
.servicio-bloque.img-right .servicio-imagen { order: 2; }
.servicio-bloque.img-right .servicio-texto { order: 1; }

/* ===========================
   BENEFICIOS NUMERADOS
=========================== */
.servicio-beneficios {
  counter-reset: ventaja;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 800px;
  margin: 32px 0 0 0;
  padding: 0;
  font-size: 1.1em;
  color: #333;
}

.servicio-beneficios li {
  position: relative;
  padding-left: 48px;
  font-size: 1.13em;
  color: #23272f;
  font-weight: 500;
  line-height: 1.5;
  background: rgba(255, 140, 50, 0.12);
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
  transition: color 0.2s, background 0.2s;
}

.servicio-beneficios li::before {
  counter-increment: ventaja;
  content: counter(ventaja);
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border: 2px solid #ff8c32;
  color: #ff8c32;
  font-weight: bold;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* ===========================
   CALEFACCIÓN
=========================== */
.servicio-calefaccion {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid #ff8c32;
}

.servicio-calefaccion h3 {
  font-size: 1.4rem;
  color: #ff8c32;
  font-weight: 700;
  margin-bottom: 12px;
}

.servicio-calefaccion p {
  font-size: 1.1rem;
  color: #444;
  margin-bottom: 18px;
  line-height: 1.5;
}

.servicio-calefaccion ul {
  list-style-type: disc;
  padding-left: 20px;
  color: #23272f;
}

.servicio-calefaccion ul li {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

/* ===========================
   ESTADÍSTICAS
=========================== */
.servicio-estadisticas {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 50px;
  gap: 30px;
  background-color: #f9f9f9;
  border-radius: 16px;
  padding: 30px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.estadistica-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.numero-contador {
  font-size: 3rem;
  color: #ffd932;
  font-weight: bold;
}

.grafica-proyectos {
  margin: 60px auto;
  text-align: center;
}

.grafica-proyectos h2 {
  font-size: 1.6rem;
  margin-bottom: 20px;
  color: #ff8c32;
}

/* ===========================
   FLIP CARD
=========================== */
.flip-card {
  background: transparent;
  width: 100%;
  height: 100%;
  perspective: 1000px;
  min-height: 400px;
  position: relative;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(.4,2,.3,1);
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.flip-card-front { z-index: 2; }

.flip-card-back {
  background: #fff;
  color: #222;
  transform: rotateY(180deg);
  z-index: 1;
  padding: 2em 1em;
  box-shadow: 0 0 20px rgba(0,0,0,0.08);
  min-height: 400px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.flip-card-back .servicio-texto {
  width: 100%;
  height: 100%;
  min-height: 100%;
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  padding: 10px 32px 32px 32px;
  max-width: 100%;
}

.flip-card-back .flip-back-btn {
  align-self: flex-end;
  margin-top: 24px;
  margin-right: 0;
  position: static;
}

/* ===========================
   BOTÓN FLIP (MÓVIL)
=========================== */
.flip-btn-movil {
  display: block;
  position: absolute;
  bottom: 1.2em;
  right: 1.2em;
  background: rgba(0,0,0,0.45);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 0.6em 1.6em 0.6em 1.2em;
  font-size: 1.05em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  z-index: 2;
  transition: background 0.2s, box-shadow 0.2s;
  opacity: 0.96;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.flip-btn-movil:hover,
.flip-btn-movil:focus {
  background: rgba(255,152,0,0.85);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  outline: none;
}

.flip-btn-movil .icon-arrow {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  vertical-align: middle;
  fill: currentColor;
}

/* ===========================
   BOTÓN "VER MÁS" (SOLO MÓVIL)
=========================== */
.ver-mas-btn {
  display: none;
  background: #ff9800;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 2.5em;
  height: 2.5em;
  font-size: 1.5em;
  cursor: pointer;
  position: absolute;
  bottom: 1em;
  right: 1em;
  z-index: 10;
}

.servicio-extra {
  display: none;
  margin-top: 1em;
  background: #fff8e1;
  color: #222;
  padding: 1em;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.servicio-texto.mostrar-extra .servicio-extra {
  display: block;
}

/* ===========================
   RESPONSIVE (MEDIA QUERIES)
=========================== */

/* --- Tablet y móvil (<=900px) --- */
@media (max-width: 900px) {
  .servicios-grid {
    grid-template-columns: 1fr;
  }

  .servicio-imagen {
    height: auto;
    max-height: 360px;
  }

  .servicio-imagen img,
  .servicio-imagen video {
    height: 100%;
    max-height: 360px;
  }

  .servicio-texto {
    padding: 24px 20px;
  }
}

/* --- Fix Mobile Width + Botón Volver --- */
@media (max-width: 600px) {
  .servicios-grid {
    grid-template-columns: 1fr;
  }

  .servicio-bloque,
  .flip-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-radius: 16px;
    overflow: hidden;
  }

  .flip-card-back {
    display: flex;
    flex-direction: column;
  }

  .flip-card-back .servicio-texto {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
  }

  .flip-card-back .flip-back-btn {
    position: relative;
    bottom: auto;
    margin-top: 20px;
    margin-left: 20px;
    align-self: center;
    background: #ff9800;
    color: #fff;
    padding: 0.6em 1.4em;
    border-radius: 24px;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  }
}

/* --- Móvil pequeño (<=480px) --- */
@media (max-width: 480px) {
  .contenido-pagina {
    margin: 28px 10px 18px 10px;
    padding: 20px 10px;
    height: auto;
  }

  .contenido-pagina h1 {
    font-size: 1.8rem;
  }

  .servicio-texto h2 {
    font-size: 1rem;
  }

  .servicio-texto p,
  .servicio-texto ul li {
    font-size: 0.98rem;
  }

  .flip-card-front {
    height: 100%;
  }

  .flip-card-front .servicio-imagen {
    width: 100%;
    height: 100%;
    position: relative;
  }

  .flip-btn-movil {
    font-size: 1em;
    padding: 1em;
    margin: 2em 1em 1em 1em;
  }
}
