/* Gallery lightbox: replaces fsLightbox's bare-image viewer on the homepage
   Portfolio section and the standalone Gallery page with an image + project
   info panel. Structural conventions (border-radius, scale+opacity open
   transition, flex layout) are lifted from this site's own .modal /
   .modal-wrapper / .modal__body components so it reads as a native part of
   the design system rather than a bolted-on widget.

   Prev/next (button, keyboard, or drag) slides the whole card - image and
   info panel together - out one side while the neighboring card's own
   image+info slides in from the other, via two absolutely-positioned
   .gallery-lightbox__card elements inside the clipped .dialog. Only one is
   visible at rest; the second becomes the drag/slide preview. */

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(9, 9, 9, 0.92);
}

.gallery-lightbox__close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.24s cubic-bezier(0.22, 1, 0.36, 1), color 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-lightbox__close:hover,
.gallery-lightbox__close:focus-visible {
  background-color: rgba(255, 255, 255, 0.22);
  color: #db4361;
}

.gallery-lightbox__close svg {
  width: 1.125rem;
  height: 1.125rem;
}

.gallery-lightbox__dialog {
  position: relative;
  z-index: 1;
  width: min(96vw, 115rem);
  height: min(92vh, 58rem);
  overflow: hidden;
  opacity: 0;
  transform: scale(0.96) translateY(12px);
  transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1), transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-lightbox.is-open .gallery-lightbox__dialog {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* The rounded shape and shadow live on the card itself, not the dialog
   viewport it slides within - that's what makes prev/next read as one
   whole card physically leaving while the next one arrives, rather than
   content changing inside a static frame. Dialog only clips; it has no
   visible shape of its own. */
.gallery-lightbox__card {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  width: 100%;
  height: 100%;
  background-color: #fff;
  border-radius: 0.313rem;
  box-shadow: 0 25px 70px rgba(9, 9, 9, 0.45);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-lightbox__card.is-dragging {
  transition: none;
}

.gallery-lightbox__card--peek {
  display: none;
}

.gallery-lightbox__card--peek.is-active {
  display: flex;
}

.gallery-lightbox__media {
  position: relative;
  flex: 0 0 56%;
  height: 100%;
  background-color: #090909;
  overflow: hidden;
  cursor: grab;
}

.gallery-lightbox__dialog.is-dragging .gallery-lightbox__media {
  cursor: grabbing;
}

.gallery-lightbox__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-lightbox__image.is-visible {
  opacity: 1;
}

.gallery-lightbox__media::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  height: 45%;
  background: linear-gradient(to top, rgba(9, 9, 9, 0.6), rgba(9, 9, 9, 0));
  pointer-events: none;
}

.gallery-lightbox__counter {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 2;
  color: #fff;
  font-family: "DM Sans", sans-serif;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.gallery-lightbox__caption {
  position: absolute;
  left: 2rem;
  bottom: 1.75rem;
  right: 2rem;
  z-index: 2;
  color: #fff;
}

.gallery-lightbox__caption-name {
  font-family: "DM Sans", sans-serif;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 8px rgba(9, 9, 9, 0.55), 0 1px 2px rgba(9, 9, 9, 0.4);
}

.gallery-lightbox__caption-architect {
  margin-top: 0.25rem;
  font-family: "DM Sans", sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 8px rgba(9, 9, 9, 0.55), 0 1px 2px rgba(9, 9, 9, 0.4);
}

.gallery-lightbox__caption-architect:empty {
  display: none;
}

.gallery-lightbox__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color 0.24s cubic-bezier(0.22, 1, 0.36, 1), color 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-lightbox__nav:hover,
.gallery-lightbox__nav:focus-visible {
  background-color: rgba(255, 255, 255, 0.22);
  color: #db4361;
}

.gallery-lightbox__nav svg {
  width: 1.125rem;
  height: 1.125rem;
}

.gallery-lightbox__nav--prev {
  left: 1rem;
}

.gallery-lightbox__nav--next {
  right: 1rem;
}

.gallery-lightbox__info {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: clamp(2rem, 1.6rem + 1.5vw, 2.75rem) clamp(1.75rem, 1.265rem + 2.07vw, 3.25rem);
  overflow-y: auto;
}

/* Content sits at the top; CTAs anchor to the bottom of the panel via
   margin-top: auto, with a divider marking the handoff from detail to
   action. That way a fixed-height panel with short placeholder copy reads
   as a deliberate top/bottom composition instead of trailing off into
   empty space - it holds regardless of how long the real description ends
   up being. */

.gallery-lightbox__info-content {
  min-height: 0;
}

/* Rhythm follows the 1.5x rule: eyebrow sits tight against the name (one
   identity unit with the architect line), then each step below opens up -
   description reads as a new block, "more" as a related block. */

.gallery-lightbox__eyebrow {
  margin: 0 0 0.5rem;
}

.gallery-lightbox__name {
  margin: 0;
}

.gallery-lightbox__architect {
  margin: 0.625rem 0 0;
}

.gallery-lightbox__description {
  margin: 2rem 0 0;
  color: var(--accent-color-6);
  font-size: 1.25rem;
  line-height: 1.7;
}

.gallery-lightbox__ctas {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 2.5rem;
  border-top: 1px solid rgba(9, 9, 9, 0.08);
}

.gallery-lightbox__cta-primary[hidden] {
  display: none;
}

.gallery-lightbox__more {
  margin-top: 2.5rem;
}

.gallery-lightbox__more[hidden] {
  display: none;
}

.gallery-lightbox__more-label {
  margin: 0 0 1rem;
}

.gallery-lightbox__more-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
}

.gallery-lightbox__more-thumb {
  position: relative;
  width: 6.5rem;
  height: 6.5rem;
  padding: 0;
  border: 0;
  border-radius: 0.313rem;
  overflow: hidden;
  cursor: pointer;
  background-color: #f3f3f3;
}

.gallery-lightbox__more-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-lightbox__more-thumb:hover img,
.gallery-lightbox__more-thumb:focus-visible img {
  transform: scale(1.08);
}

.gallery-lightbox__more-thumb:focus-visible {
  outline: 2px solid #db4361;
  outline-offset: 2px;
}

@media screen and (max-width: 56.25rem) {
  .gallery-lightbox {
    padding: 1rem;
  }

  .gallery-lightbox__dialog {
    width: 100%;
    height: min(46rem, 94vh);
  }

  .gallery-lightbox__card {
    flex-direction: column;
  }

  .gallery-lightbox__media {
    flex: 0 0 auto;
    height: clamp(16rem, 46vh, 26rem);
  }

  .gallery-lightbox__info {
    padding: 1.5rem;
  }

  .gallery-lightbox__description {
    margin-top: 0.75rem;
    font-size: 1rem;
    line-height: 1.6;
  }

  .gallery-lightbox__ctas {
    padding-top: 1.25rem;
  }

  .gallery-lightbox__more {
    margin-top: 1.25rem;
  }

  .gallery-lightbox__more-label {
    margin-bottom: 0.5rem;
  }

  .gallery-lightbox__more-thumb {
    width: 3.5rem;
    height: 3.5rem;
  }

  .gallery-lightbox__ctas .button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .gallery-lightbox__counter,
  .gallery-lightbox__caption {
    left: 1.25rem;
  }

  .gallery-lightbox__caption {
    right: 1.25rem;
    bottom: 1.25rem;
  }

  .gallery-lightbox__counter {
    top: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-lightbox,
  .gallery-lightbox__dialog,
  .gallery-lightbox__card,
  .gallery-lightbox__image,
  .gallery-lightbox__close,
  .gallery-lightbox__nav,
  .gallery-lightbox__more-thumb img {
    transition: none !important;
  }
}
