/* ================= GALLERY ================= */

.gallery {
    display: flex;
    gap: 10px;
    padding: 15px 0;
  }

.gallery .thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gallery .thumbs img {
  width: 80px !important;
  height: auto;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
}

.gallery .thumbs img:hover {
  border-color: #ff4500;
}

.gallery .medium {
  width: 630px;
}

.gallery .medium-item {
  display: none;
}

.gallery .medium-item:first-child {
  display: block;
}

.gallery .medium img {
  width: 100%;
  height: auto;
  cursor: zoom-in;
}

  /* ================= OVERLAY ================= */

  .image-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease;
  }

  .image-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .overlay-content {
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.35s ease;
    transform: scale(0.9);
    z-index: 1;
  }

  .image-overlay.active .overlay-content {
    transform: scale(1);
  }

  /* Ключевое исправление адаптивности */
  .overlay-content picture,
  .overlay-content img {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
  }

  .overlay-content img {
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.7);
    cursor: zoom-out;
  }

  /* Navigation */
  .gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 50px;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    padding: 20px;
    user-select: none;
    z-index: 2; /* ВАЖНО */
  }

  .gallery-nav.prev { left: 20px; }
  .gallery-nav.next { right: 20px; }

  .gallery-nav:hover {
    opacity: 0.7;
  }

  body.no-scroll {
    overflow: hidden;
  }

  /* ================= RESPONSIVE ================= */

  @media (max-width: 1000px) {
    .gallery {
      flex-direction: column;
      align-items: center;
    }

    .gallery .thumbs {
      flex-direction: row;
      justify-content: center;
    }

    .gallery .medium {
      width: 100%;
    }

    .gallery-nav {
      font-size: 40px;
    }
  }
