/* Sección "Instalaciones": tres tarjetas de servicio (alarmas, cámaras, audio).
   Arriba de cada tarjeta va una animación del mismo tamaño. Las fotos de trabajos
   reales la reemplazan solo cuando los tres servicios tienen una (lo decide
   instalaciones.js), así las tres tarjetas siempre se ven iguales. */

.servicios-inst {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: clamp(40px, 7vw, 88px);
}
.servicio-inst {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: clamp(20px, 2.4vw, 30px);
  border: 1px solid #2b372e;
  border-radius: 16px;
  background: linear-gradient(180deg, #131a14 0%, #0d120e 100%);
  color: #e4ebe5;
  transition: border-color .2s ease-out;
}
@media (hover: hover) {
  .servicio-inst:hover { border-color: #3f6b49; }
}
.servicio-inst h3 {
  margin: 4px 0 0;
  font: 700 clamp(1.3rem, 2vw, 1.6rem)/1.15 'Space Grotesk', Archivo, system-ui, sans-serif;
  letter-spacing: -.02em;
  color: #f3f7f3;
}
.servicio-texto { margin: 0; color: #c3d0c5; line-height: 1.5; }
.servicio-sub {
  margin: 6px 0 0;
  color: #8fe3a1;
  font: 600 .78rem/1.3 'Space Grotesk', Archivo, system-ui, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.servicio-inst ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #d6dfd7;
}
.servicio-inst li { position: relative; padding-left: 18px; line-height: 1.45; }
.servicio-inst li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .62em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #45e065;
}
.servicio-consultar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  min-height: 46px;
  margin-top: auto;
  padding: 0 20px;
  border-radius: 999px;
  background: #3ddc5c;
  color: #04120a;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .16s ease-out, transform .16s ease-out;
}
@media (hover: hover) {
  .servicio-consultar:hover { background: #5be678; }
}
.servicio-consultar:active { transform: scale(.97); }
.servicio-consultar:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* Imagen de un trabajo real, solo si existe. */
.servicio-trabajo {
  margin: calc(-1 * clamp(20px, 2.4vw, 30px)) calc(-1 * clamp(20px, 2.4vw, 30px)) 4px;
  border-radius: 15px 15px 0 0;
  overflow: hidden;
}
.servicio-trabajo[hidden] { display: none; }
.servicio-trabajo img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #080d09;
  object-fit: cover;
}
.servicio-trabajo figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 10px clamp(20px, 2.4vw, 30px) 0;
  color: #b9c8bc;
  font-size: .85rem;
}
.servicio-trabajo figcaption a { color: #8fe3a1; font-weight: 600; }

/* ---- Animaciones de cada servicio ---- */
.servicio-anim {
  position: relative;
  margin: calc(-1 * clamp(20px, 2.4vw, 30px)) calc(-1 * clamp(20px, 2.4vw, 30px)) 4px;
  aspect-ratio: 16 / 10;
  border-radius: 15px 15px 0 0;
  overflow: hidden;
  border-bottom: 1px solid #22301f;
  background:
    radial-gradient(70% 80% at 50% 55%, #1b3b2266, transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 23px, #2fc94e12 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, #2fc94e12 23px 24px),
    #0a110c;
}
.servicio-inst.con-imagen .servicio-anim { display: none; }
.servicio-anim svg { display: block; width: 100%; height: 100%; }
.servicio-anim :is(path, rect, circle) {
  fill: none;
  stroke: #45e065;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.servicio-anim .a-piso { stroke: #2b4a31; }
.servicio-anim .a-casa { stroke: #6fe88a; fill: #0e1a11; }
.servicio-anim .a-led { fill: #45e065; stroke: none; }
.servicio-anim .a-rec { fill: #ff4d4f; }
.servicio-anim .a-estado rect { fill: #0e1a11; stroke: #2f5a38; stroke-width: 1.5; }
.servicio-anim .a-estado text { fill: #c9f5d3; font: 700 11px/1 'Space Grotesk', Archivo, system-ui, sans-serif; letter-spacing: .08em; }
.servicio-anim * { transform-box: fill-box; transform-origin: center; }

/* Alarmas: ondas que salen del sensor y luz que titila. */
.anim-alarmas .a-sensor { fill: #0e1a11; stroke: #6fe88a; }
.anim-alarmas .a-ondas circle { stroke: #45e065; stroke-width: 2; opacity: 0; }
.anim-activa.anim-alarmas .a-ondas circle { animation: a-onda 2.7s cubic-bezier(.2, .6, .35, 1) infinite; }
.anim-activa.anim-alarmas .a-ondas circle:nth-child(2) { animation-delay: .9s; }
.anim-activa.anim-alarmas .a-ondas circle:nth-child(3) { animation-delay: 1.8s; }
@keyframes a-onda {
  0% { transform: scale(.35); opacity: .9; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* Cámaras: el campo de visión barre de un lado a otro. */
.anim-camaras .a-cono { fill: #45e06526; stroke: #45e06566; stroke-width: 1.5; transform-box: view-box; transform-origin: 122px 47px; }
.anim-camaras .a-camara rect { fill: #0e1a11; stroke: #6fe88a; }
.anim-camaras .a-camara { transform-box: view-box; transform-origin: 76px 47px; }
.anim-activa.anim-camaras .a-cono { animation: a-barrido 5s ease-in-out infinite alternate; }
.anim-activa.anim-camaras .a-camara { animation: a-giro 5s ease-in-out infinite alternate; }
@keyframes a-barrido { from { transform: rotate(-9deg); } to { transform: rotate(16deg); } }
@keyframes a-giro { from { transform: rotate(-4deg); } to { transform: rotate(7deg); } }

/* Audio: el parlante late, salen ondas y se mueve el ecualizador. */
.anim-audio .a-cono-parlante { fill: #143a1d; stroke: #45e065; }
.anim-audio .a-ondas-audio path { stroke: #45e065; opacity: .25; }
.anim-audio .a-eq rect { fill: #45e065; stroke: none; transform-origin: bottom; }
.anim-activa.anim-audio .a-cono-parlante { animation: a-latido .48s ease-out infinite alternate; }
.anim-activa.anim-audio .a-ondas-audio path { animation: a-sonido 1.44s ease-out infinite; }
.anim-activa.anim-audio .a-ondas-audio path:nth-child(2) { animation-delay: .16s; }
.anim-activa.anim-audio .a-ondas-audio path:nth-child(3) { animation-delay: .32s; }
.anim-activa.anim-audio .a-eq rect { animation: a-eq .9s ease-in-out infinite alternate; }
.anim-activa.anim-audio .a-eq rect:nth-child(2) { animation-duration: .7s; animation-delay: -.3s; }
.anim-activa.anim-audio .a-eq rect:nth-child(3) { animation-duration: 1.1s; animation-delay: -.6s; }
@keyframes a-latido { from { transform: scale(1); } to { transform: scale(1.12); } }
@keyframes a-sonido { 0% { opacity: .15; } 30% { opacity: 1; } 100% { opacity: .15; } }
@keyframes a-eq { from { transform: scaleY(.25); } to { transform: scaleY(1); } }

.anim-activa .a-led { animation: a-titila 1.6s steps(2, jump-none) infinite; }
@keyframes a-titila { from { opacity: 1; } to { opacity: .25; } }

@media (max-width: 900px) {
  .servicios-inst { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .servicio-consultar { align-self: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  .servicio-inst, .servicio-consultar { transition: none; }
  .servicio-anim * { animation: none !important; }
  .anim-alarmas .a-ondas circle:first-child { opacity: .5; transform: scale(1.3); }
  .anim-audio .a-ondas-audio path { opacity: .7; }
}
