/* Facilities, gallery grid, video frames and lightbox */

.facilities .credentials .bi {
  background: var(--blanco);
}

.facilities__media {
  position: relative;
  width: min(100%, 360px);
  margin: 0 auto;
  padding-bottom: var(--space-7);
}

.facilities__video video {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 140px 140px var(--radius-lg) var(--radius-lg);
  background: var(--azul-rey-oscuro);
  box-shadow: 0 0 0 10px var(--blanco), 0 0 0 14px rgb(79 195 224 / 0.45), var(--shadow-lg);
}

.facilities__facade {
  position: absolute;
  left: -14%;
  bottom: 0;
  width: 42%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 50% 40%;
  border-radius: 50%;
  box-shadow: 0 0 0 6px var(--blanco), 0 0 0 9px rgb(79 195 224 / 0.45), var(--shadow);
}

@media (max-width: 599.98px) {
  .facilities__facade {
    left: -4%;
  }
}

@media (min-width: 960px) {
  .facilities__media {
    width: min(100%, 400px);
  }
}

/* Gallery grid */

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 180px;
  gap: var(--space-3);
}

.gallery__item {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--cielo-claro);
  cursor: zoom-in;
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 15%;
  transition: transform 0.5s var(--ease);
}

.gallery__zoom {
  position: absolute;
  right: var(--space-3);
  bottom: var(--space-3);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.9);
  color: var(--azul-rey);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.gallery__item:hover img,
.gallery__item:focus-visible img {
  transform: scale(1.05);
}

.gallery__item:hover .gallery__zoom,
.gallery__item:focus-visible .gallery__zoom {
  opacity: 1;
  transform: none;
}

.gallery__cell--tall {
  grid-row: span 2;
}

.gallery__cell--video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--azul-rey-oscuro);
}

@media (min-width: 768px) {
  .gallery__grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 240px;
    gap: var(--space-4);
  }
}

@media (min-width: 1100px) {
  .gallery__grid {
    grid-auto-rows: 280px;
  }
}

/* Lightbox (native <dialog>) */

.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: var(--space-4);
  border: 0;
  background: transparent;
  color: var(--blanco);
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop {
  background: rgb(6 20 46 / 0.92);
}

.lightbox__figure {
  display: grid;
  gap: var(--space-3);
  justify-items: center;
  max-width: min(100%, 1000px);
}

.lightbox__img {
  max-width: 100%;
  max-height: calc(100dvh - 160px);
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.lightbox__caption {
  max-width: 60ch;
  text-align: center;
  font-size: var(--fs-sm);
  color: rgb(255 255 255 / 0.88);
}

.lightbox__btn {
  position: fixed;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.14);
  color: var(--blanco);
  font-size: 1.4rem;
  transition: background-color 0.2s var(--ease);
}

.lightbox__btn:hover {
  background: rgb(255 255 255 / 0.28);
}

.lightbox__close {
  top: var(--space-4);
  right: var(--space-4);
}

.lightbox__prev,
.lightbox__next {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__prev {
  left: var(--space-3);
}

.lightbox__next {
  right: var(--space-3);
}

@media (max-width: 599.98px) {
  .lightbox__prev,
  .lightbox__next {
    top: auto;
    bottom: var(--space-4);
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery__item:hover img,
  .gallery__item:focus-visible img {
    transform: none;
  }
}

.gallery__item .gallery__img--top {
  object-position: 50% 0%;
}
