@layer image-viewer {
  /* ── Gallery ── */

  .gallery {
    width: 100%;
    max-width: 1024px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  @media (max-width: 64em) {
    .gallery {
    max-width: 800px;
  }
  }

  .gallery__item {
    cursor: pointer;
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: 0 8px 30px rgb(30, 34, 170, 0.2);
    transition: transform .25s ease, box-shadow .25s ease;
  }

  .gallery__item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgb(30, 34, 170, 0.6);
  }

  body.is-no-scroll .gallery__item {
    overflow: visible;
  }

  .gallery__item.is-active-item {
    z-index: 1001;
  }

  body.is-no-scroll .gallery__item:hover {
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
  }

  .gallery__img {
    display: block;
    width: auto;
    height: 560px;
    object-fit: contain;
    cursor: pointer;
    will-change: transform;
  }

  /* ── Animating image ── */

  .gallery__img.is-animating {
    position: relative;
    z-index: 1001;
    border-radius: 0;
    transition: transform .45s cubic-bezier(.4, 0, .15, 1),
                opacity .45s cubic-bezier(.4, 0, .15, 1);
    transform-origin: center center;
  }

  .gallery__img.is-expanded {
    position: relative;
    z-index: 1001;
    border-radius: 0;
    cursor: zoom-out;
  }

  /* ── Backdrop ── */

  .gallery__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, .88);
    opacity: 0;
    visibility: hidden;
    transition: opacity .45s cubic-bezier(.4, 0, .15, 1),
                visibility .45s cubic-bezier(.4, 0, .15, 1);
  }

  .gallery__backdrop.is-active {
    opacity: 1;
    visibility: visible;
  }

  /* ── Close button ── */

  .gallery-close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1002;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: none;
    border-radius: var(--radius-btn);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease, background .2s ease;
  }

  .gallery-close svg {
    width: 20px;
    height: 20px;
    stroke: var(--dark);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
  }

  .gallery-close:hover {
    background: var(--primary);
  }

  .gallery-close:hover svg {
    stroke: var(--white);
  }

  .gallery-close.is-active {
    opacity: 1;
    visibility: visible;
  }

  /* ── Responsive ── */

  @media (max-width: 64em) {
    .gallery__img {
      height: 500px;
    }
  }

  @media (max-width: 48em) {
    .gallery {
      flex-direction: column;
      gap: var(--gap-1em);
    }

    .gallery__img {
      height: auto;
      width: 100%;
      max-height: 70vh;
    }
  }
}
