/**
 * Lightbox de proyectos
 */

/* =========================================================
   Galería interactiva
   ========================================================= */

.project-gallery__link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  cursor: zoom-in;
}

.project-gallery__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 46, 94, 0);
  pointer-events: none;
  transition: background-color 320ms ease;
}

.project-gallery__zoom {
  position: absolute;
  top: 22px;
  right: 22px;
  z-index: 2;
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 46, 94, 0.72);
  box-shadow: 0 12px 28px rgba(7, 27, 47, 0.22);
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity 280ms ease,
    transform 360ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 220ms ease;
}

.project-gallery__zoom svg {
  display: block;
  width: 23px;
  height: 23px;
}

.project-gallery__zoom circle,
.project-gallery__zoom path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-gallery__link:hover::after,
.project-gallery__link:focus-visible::after {
  background: rgba(0, 46, 94, 0.18);
}

.project-gallery__link:hover .project-gallery__zoom,
.project-gallery__link:focus-visible .project-gallery__zoom {
  opacity: 1;
  transform: translateY(0);
}

.project-gallery__link:hover .project-gallery__image,
.project-gallery__link:focus-visible .project-gallery__image {
  transform: scale(1.035);
}

.project-gallery__link:focus-visible {
  outline: 3px solid var(--maetel-turquoise);
  outline-offset: 4px;
}

/* =========================================================
   Bloqueo de página
   ========================================================= */

body.is-project-lightbox-open {
  overflow: hidden;
}

/* =========================================================
   Lightbox
   ========================================================= */

.project-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 260ms ease,
    visibility 260ms ease;
}

.project-lightbox[hidden] {
  display: none !important;
}

.project-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.project-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 14, 28, 0.94);
  cursor: zoom-out;
  backdrop-filter: blur(5px);
}

.project-lightbox__dialog {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 1600px);
  height: min(92vh, 1000px);
  grid-template-columns: 70px minmax(0, 1fr) 70px;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  outline: none;
}

.project-lightbox__figure {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  grid-column: 2;
  grid-row: 1;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.project-lightbox__image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(92vh - 210px);
  object-fit: contain;
  opacity: 1;
  transform: scale(1);
  user-select: none;
  transition:
    opacity 180ms ease,
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-user-drag: none;
}

.project-lightbox__image.is-changing {
  opacity: 0;
  transform: scale(0.985);
}

.project-lightbox__caption {
  max-width: 900px;
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.66);
  font-size: var(--maetel-font-size-home-label, 15px);
  font-weight: 400;
  line-height: 1.45;
  text-align: center;
}

.project-lightbox__caption[hidden] {
  display: none;
}

/* =========================================================
   Información del proyecto
   ========================================================= */

.project-lightbox__project {
  width: min(100%, 980px);
  margin-top: 18px;
  text-align: center;
}

.project-lightbox__project-title {
  margin: 0;
  color: #fff;
  font-size: clamp(19px, 1.8vw, 27px);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.project-lightbox__project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px 10px;
  margin-top: 8px;
  line-height: 1.4;
}

.project-lightbox__project-area {
  color: var(--maetel-turquoise);
  font-size: var(--maetel-font-size-button, 12px);
  font-weight: 600;
  text-transform: uppercase;
}

.project-lightbox__project-separator {
  color: rgba(255, 255, 255, 0.42);
  font-size: 15px;
}

.project-lightbox__project-location {
  color: rgba(255, 255, 255, 0.76);
  font-size: var(--maetel-font-size-home-label, 15px);
  font-weight: 400;
}

/* =========================================================
   Cierre
   ========================================================= */

.project-lightbox__close {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 3;
  display: inline-flex;
  width: 50px;
  height: 50px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 46, 94, 0.56);
  cursor: pointer;
  transition:
    border-color 220ms ease,
    color 220ms ease,
    background-color 220ms ease,
    transform 220ms ease;
}

.project-lightbox__close svg {
  width: 23px;
  height: 23px;
}

.project-lightbox__close path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.project-lightbox__close:hover,
.project-lightbox__close:focus-visible {
  border-color: var(--maetel-turquoise);
  color: #fff;
  background: var(--maetel-turquoise);
  transform: rotate(4deg);
}

.project-lightbox__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

/* =========================================================
   Navegación
   ========================================================= */

.project-lightbox__navigation {
  display: inline-flex;
  width: 54px;
  height: 54px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 46, 94, 0.54);
  cursor: pointer;
  transition:
    border-color 220ms ease,
    color 220ms ease,
    background-color 220ms ease,
    transform 220ms ease;
}

.project-lightbox__navigation svg {
  width: 28px;
  height: 28px;
}

.project-lightbox__navigation path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-lightbox__navigation--previous {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.project-lightbox__navigation--next {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

.project-lightbox__navigation:hover,
.project-lightbox__navigation:focus-visible {
  border-color: var(--maetel-turquoise);
  color: #fff;
  background: var(--maetel-turquoise);
}

.project-lightbox__navigation--previous:hover,
.project-lightbox__navigation--previous:focus-visible {
  transform: translateX(-3px);
}

.project-lightbox__navigation--next:hover,
.project-lightbox__navigation--next:focus-visible {
  transform: translateX(3px);
}

.project-lightbox__navigation:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.project-lightbox__navigation[hidden] {
  display: none;
}

/* =========================================================
   Contador
   ========================================================= */

.project-lightbox__counter {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--maetel-font-size-home-label, 15px);
  font-weight: 500;
  line-height: 1;
  text-align: center;
}

/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 980px) {
  .project-lightbox {
    padding: 22px;
  }

  .project-lightbox__dialog {
    height: min(90vh, 900px);
    grid-template-columns: 58px minmax(0, 1fr) 58px;
    gap: 12px;
  }

  .project-lightbox__navigation {
    width: 48px;
    height: 48px;
  }

  .project-lightbox__image {
    max-height: calc(90vh - 210px);
  }

  .project-lightbox__close {
    top: 18px;
    right: 18px;
    width: 46px;
    height: 46px;
  }

  .project-lightbox__project-title {
    font-size: clamp(18px, 3vw, 24px);
  }
}

/* =========================================================
   Móvil
   ========================================================= */

@media (max-width: 640px) {
  .project-gallery__zoom {
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    opacity: 1;
    transform: none;
  }

  .project-lightbox {
    padding: 68px 14px 18px;
  }

  .project-lightbox__backdrop {
    backdrop-filter: none;
  }

  .project-lightbox__dialog {
    width: 100%;
    height: 100%;
    grid-template-columns: 1fr 1fr;
    grid-template-rows:
      minmax(0, 1fr)
      auto
      52px;
    gap: 10px 14px;
  }

  .project-lightbox__figure {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .project-lightbox__image {
    max-height: calc(100dvh - 270px);
    touch-action: pan-y;
  }

  .project-lightbox__caption {
    margin-top: 10px;
    font-size: var(--maetel-font-size-button, 12px);
  }

  .project-lightbox__project {
    margin-top: 14px;
  }

  .project-lightbox__project-title {
    font-size: 18px;
    line-height: 1.3;
  }

  .project-lightbox__project-meta {
    gap: 4px 8px;
    margin-top: 7px;
  }

  .project-lightbox__project-area {
    font-size: 11px;
  }

  .project-lightbox__project-location {
    font-size: 13px;
  }

  .project-lightbox__navigation {
    width: 48px;
    height: 48px;
  }

  .project-lightbox__navigation--previous {
    grid-column: 1;
    grid-row: 3;
    justify-self: end;
  }

  .project-lightbox__navigation--next {
    grid-column: 2;
    grid-row: 3;
    justify-self: start;
  }

  .project-lightbox__counter {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: var(--maetel-font-size-button, 12px);
  }

  .project-lightbox__close {
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
  }
}

/* =========================================================
   Movimiento reducido
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .project-gallery__link::after,
  .project-gallery__zoom,
  .project-lightbox,
  .project-lightbox__image,
  .project-lightbox__close,
  .project-lightbox__navigation {
    transition: none;
  }
}
