/* Fotografías dinámicas: dos imágenes por tarjeta, hasta 2 segundos cada una. */
.photo-switcher {
  position: relative;
  overflow: hidden;
  background: #f4e9e8;
  isolation: isolate;
  cursor: zoom-in;
  transform: translateZ(0);
  transition: transform .35s ease, box-shadow .35s ease;
}

.photo-switcher img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  opacity: 0;
  transform: scale(1.04);
  animation-name: photoCycle;
  animation-duration: var(--cycle, 4s);
  animation-delay: var(--delay-one, 0s);
  animation-iteration-count: infinite;
  animation-timing-function: cubic-bezier(.4, 0, .2, 1);
  will-change: opacity, transform;
  backface-visibility: hidden;
}

.photo-switcher img:first-child { opacity: 1; }
.photo-switcher img:nth-child(2) { animation-delay: var(--delay-two, -2s); }

.photo-switcher::after {
  content: "Ver imagen  +";
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 4;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(10, 42, 76, .82);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}

.service:hover .photo-switcher,
.method:hover .photo-switcher,
.photo-switcher:focus {
  transform: scale(1.025);
  box-shadow: 0 18px 35px rgba(8, 38, 72, .2);
  outline: none;
}

.service:hover .photo-switcher::after,
.method:hover .photo-switcher::after,
.photo-switcher:focus::after {
  opacity: 1;
  transform: translateY(0);
}

.service-media {
  clear: both;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 18px -25px 20px;
}

.method {
  padding: 0;
  display: block;
  overflow: hidden;
}

.method-media {
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 15px 15px 0 0;
}

.method-body {
  display: flex;
  gap: 18px;
  padding: 22px 24px 25px;
}

.method-body > b {
  flex: 0 0 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  font: 700 18px Georgia, serif;
}

@keyframes photoCycle {
  0%, 25% {
    opacity: 1;
    transform: scale(1.035) translate3d(0, 0, 0);
  }
  50%, 75% {
    opacity: 0;
    transform: scale(1.075) translate3d(-.8%, .5%, 0);
  }
  100% {
    opacity: 1;
    transform: scale(1.035) translate3d(0, 0, 0);
  }
}

/* Tiempos escalonados: ningún carrusel cambia al mismo instante. */
.services-grid .service:nth-child(1) { --cycle: 3.2s; --delay-one: -.25s; --delay-two: -1.85s; }
.services-grid .service:nth-child(2) { --cycle: 3.45s; --delay-one: -.75s; --delay-two: -2.475s; }
.services-grid .service:nth-child(3) { --cycle: 3.7s; --delay-one: -1.1s; --delay-two: -2.95s; }
.services-grid .service:nth-child(4) { --cycle: 4s; --delay-one: -1.45s; --delay-two: -3.45s; }

.method-grid .method:nth-child(1) { --cycle: 3.1s; --delay-one: -.2s; --delay-two: -1.75s; }
.method-grid .method:nth-child(2) { --cycle: 3.3s; --delay-one: -.55s; --delay-two: -2.2s; }
.method-grid .method:nth-child(3) { --cycle: 3.5s; --delay-one: -.9s; --delay-two: -2.65s; }
.method-grid .method:nth-child(4) { --cycle: 3.65s; --delay-one: -1.2s; --delay-two: -3.025s; }
.method-grid .method:nth-child(5) { --cycle: 3.8s; --delay-one: -1.5s; --delay-two: -3.4s; }
.method-grid .method:nth-child(6) { --cycle: 4s; --delay-one: -1.8s; --delay-two: -3.8s; }

/* Popup fotográfico */
body.modal-open { overflow: hidden; }
.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
}
.photo-modal.open { opacity: 1; visibility: visible; }
.photo-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(5, 25, 49, .82);
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.photo-modal-dialog {
  position: relative;
  z-index: 2;
  width: min(1040px, 94vw);
  max-height: 90vh;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(270px, .75fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 34px 90px rgba(0, 0, 0, .38);
  transform: translateY(24px) scale(.97);
  transition: transform .32s ease;
}
.photo-modal.open .photo-modal-dialog { transform: translateY(0) scale(1); }
.photo-modal-image-wrap {
  min-height: 430px;
  background: #0d315b;
  overflow: hidden;
}
.photo-modal-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  animation: modalImageIn .55s ease both;
}
.photo-modal-copy {
  padding: 54px 34px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(145deg, #fff, #fff5f4);
}
.photo-modal-copy span {
  color: var(--pink2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.photo-modal-copy h3 {
  margin: 12px 0;
  color: var(--navy);
  font: 700 30px/1.15 Georgia, serif;
}
.photo-modal-copy p { color: var(--muted); line-height: 1.75; }
.photo-modal-copy a {
  margin-top: 12px;
  align-self: flex-start;
  padding: 13px 18px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--pink), var(--pink2));
  color: #fff;
  font-weight: 800;
}
.photo-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 25px;
  cursor: pointer;
  transition: transform .25s ease, background .25s ease;
}
.photo-modal-close:hover { transform: rotate(90deg) scale(1.06); background: var(--pink2); }
@keyframes modalImageIn { from { opacity: 0; transform: scale(1.08); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 760px) {
  .service-media, .method-media { height: auto; aspect-ratio: 16 / 9; }
  .photo-switcher::after { opacity: 1; transform: none; }
  .photo-modal { padding: 12px; }
  .photo-modal-dialog { grid-template-columns: 1fr; max-height: 94vh; overflow-y: auto; border-radius: 18px; }
  .photo-modal-image-wrap { min-height: 0; aspect-ratio: 16 / 9; }
  .photo-modal-copy { padding: 28px 24px 30px; }
  .photo-modal-copy h3 { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  .photo-switcher img { animation: none; transform: none; }
  .photo-switcher img:nth-child(2) { display: none; }
}
