/* Screenshots Section - 3D Gallery with Realistic Glass Effect */
.screenshots {
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  position: relative;
  padding: 4rem 0;
}

.screenshots::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 20% 30%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(6, 182, 212, 0.15) 0%, transparent 50%),
    linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
  pointer-events: none;
  z-index: 1;
}

.screenshots .container {
  position: relative;
  z-index: 2;
}

.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 0;
  position: relative;
  z-index: 2;
}

.screenshot-thumbnail {
  cursor: pointer;
  transition: all 0.6s ease;
  opacity: 1;
  transform: translateY(0);
  position: relative;
  display: block;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
}

.screenshot-thumbnail.animate {
  opacity: 1;
  transform: translateY(0);
}

.screenshot-thumbnail:hover {
  transform: translateY(-15px) scale(1.03);
  z-index: 10;
}

.thumbnail-container {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: 1rem;
  overflow: hidden !important; /* Принудительно скрываем переполнение */
  background: rgba(139, 92, 246, 0.1);
  border: 2px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(139, 92, 246, 0.4), inset 0 2px 0
    rgba(255, 255, 255, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
  transition: all 0.6s ease;
  display: block;
  /* Дополнительная защита от переполнения */
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
}

.screenshot-thumbnail:hover .thumbnail-container {
  border-color: rgba(139, 92, 246, 0.7);
  box-shadow: 0 35px 80px rgba(139, 92, 246, 0.6), 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 3px 0
    rgba(255, 255, 255, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.4);
}

/* Дополнительный wrapper для изображения */
.image-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 1rem;
  overflow: hidden !important;
  z-index: 1;
}

.thumbnail-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  border-radius: 1rem;
  /* Принудительное обрезание */
  clip-path: inset(0 round 1rem);
  -webkit-clip-path: inset(0 round 1rem);
}

.screenshot-thumbnail:hover .thumbnail-container img {
  transform: scale(1.08);
}

/* Realistic Glass Surface */
.thumbnail-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(139, 92, 246, 0.2) 15%,
      rgba(255, 255, 255, 0.1) 30%,
      rgba(6, 182, 212, 0.2) 45%,
      rgba(255, 255, 255, 0.05) 60%,
      rgba(139, 92, 246, 0.15) 75%,
      rgba(255, 255, 255, 0.3) 100%
    ), radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.6) 0%, transparent 30%),
    radial-gradient(circle at 70% 80%, rgba(6, 182, 212, 0.4) 0%, transparent 25%);
  backdrop-filter: blur(2px) saturate(1.2);
  z-index: 2;
  pointer-events: none;
  transition: all 0.4s ease;
  border-radius: 1rem;
}

.screenshot-thumbnail:hover .thumbnail-container::before {
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.6) 0%,
      rgba(139, 92, 246, 0.3) 15%,
      rgba(255, 255, 255, 0.2) 30%,
      rgba(6, 182, 212, 0.3) 45%,
      rgba(255, 255, 255, 0.1) 60%,
      rgba(139, 92, 246, 0.25) 75%,
      rgba(255, 255, 255, 0.5) 100%
    ), radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.8) 0%, transparent 35%),
    radial-gradient(circle at 70% 80%, rgba(6, 182, 212, 0.6) 0%, transparent 30%);
  backdrop-filter: blur(3px) saturate(1.4);
}

/* Dynamic Light Reflection */
.thumbnail-container::after {
  content: "";
  position: absolute;
  top: -100%;
  left: -100%;
  width: 300%;
  height: 300%;
  background: linear-gradient(
    45deg,
    transparent 20%,
    rgba(255, 255, 255, 0.1) 35%,
    rgba(139, 92, 246, 0.4) 40%,
    rgba(255, 255, 255, 0.8) 45%,
    rgba(6, 182, 212, 0.4) 50%,
    rgba(255, 255, 255, 0.1) 55%,
    transparent 70%
  );
  transform: translateX(-150%) translateY(-150%) rotate(45deg);
  transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 3;
  pointer-events: none;
  opacity: 0;
}

.screenshot-thumbnail:hover .thumbnail-container::after {
  transform: translateX(150%) translateY(150%) rotate(45deg);
  opacity: 1;
}

/* Enhanced Overlay */
.thumbnail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.85) 0%, rgba(6, 182, 212, 0.85) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.4s ease;
  backdrop-filter: blur(15px) saturate(1.5);
  z-index: 7;
  border-radius: 1rem;
}

.screenshot-thumbnail:hover .thumbnail-overlay {
  opacity: 1;
}

.zoom-icon {
  width: 70px;
  height: 70px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  border: 3px solid rgba(255, 255, 255, 0.4);
  margin-bottom: 1rem;
  transition: all 0.4s ease;
  backdrop-filter: blur(10px);
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.zoom-icon::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  background: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(139, 92, 246, 0.3) 25%,
    rgba(6, 182, 212, 0.3) 75%,
    rgba(255, 255, 255, 0.5) 100%
  );
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.zoom-icon:hover {
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.2)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
  transform: scale(1.15);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(255, 255, 255, 0.3), inset 0 3px 0 rgba(255, 255, 255, 0.5),
    inset 0 -3px 0 rgba(0, 0, 0, 0.3);
}

.zoom-icon:hover::before {
  opacity: 1;
}

.thumbnail-title {
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
  text-align: center;
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.thumbnail-title::before {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.8),
    rgba(139, 92, 246, 0.6),
    rgba(6, 182, 212, 0.6),
    rgba(255, 255, 255, 0.8),
    transparent
  );
  transition: width 0.4s ease;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.screenshot-thumbnail:hover .thumbnail-title::before {
  width: 120%;
}

/* МОБИЛЬНАЯ АДАПТАЦИЯ */
@media (max-width: 768px) {
  .screenshots-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1rem 0;
  }

  .thumbnail-container {
    height: 150px;
    border-radius: 0.75rem;
  }

  .image-wrapper {
    border-radius: 0.75rem;
  }

  .thumbnail-container img {
    border-radius: 0.75rem;
    clip-path: inset(0 round 0.75rem);
    -webkit-clip-path: inset(0 round 0.75rem);
  }

  .zoom-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 0.5rem;
  }

  .thumbnail-title {
    font-size: 0.9rem;
  }

  .screenshot-thumbnail:hover {
    transform: translateY(-5px) scale(1.02);
  }

  .screenshot-thumbnail:hover .thumbnail-container {
    border-color: rgba(139, 92, 246, 0.7);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.4), 0 10px 25px rgba(0, 0, 0, 0.4);
  }

  .screenshot-thumbnail:hover .thumbnail-container img {
    transform: scale(1.05);
  }

  .screenshot-thumbnail:hover .thumbnail-overlay {
    opacity: 1;
  }

  .screenshot-thumbnail:active {
    transform: scale(0.98);
  }

  .screenshot-thumbnail:active .thumbnail-overlay {
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .screenshots-grid {
    gap: 1rem;
  }

  .thumbnail-container {
    height: 120px;
    border-radius: 0.5rem;
  }

  .image-wrapper {
    border-radius: 0.5rem;
  }

  .thumbnail-container img {
    border-radius: 0.5rem;
    clip-path: inset(0 round 0.5rem);
    -webkit-clip-path: inset(0 round 0.5rem);
  }

  .zoom-icon {
    width: 45px;
    height: 45px;
    margin-bottom: 0.4rem;
  }

  .thumbnail-title {
    font-size: 0.85rem;
  }
}

/* Исправления для сенсорных устройств */
@media (hover: none) and (pointer: coarse) {
  .screenshot-thumbnail:hover {
    transform: none;
  }

  .screenshot-thumbnail:hover .thumbnail-container {
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 5px 15px rgba(139, 92, 246, 0.2);
  }

  .screenshot-thumbnail:hover .thumbnail-container img {
    transform: none;
  }

  .screenshot-thumbnail:hover .thumbnail-overlay {
    opacity: 0;
  }

  .screenshot-thumbnail:active .thumbnail-overlay {
    opacity: 1;
  }
}
