.adv-grid {
  display: grid;
  gap: 16px;
  width: 100%;
  /* базовый вариант для десктопа */
  grid-template-columns: repeat(3, 1fr);
  justify-items: center; /* центрируем карточки внутри ячеек */
}

.adv-media {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.adv-media button{
  visibility: hidden;
}
.adv-media:hover button{
  visibility: visible;
}

.adv-item {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  background: #e5e7eb;
  min-height: 0;       
}

.adv-img {
  width: 100%;
  min-width: 100%;
  max-width: 485px;
  height: 100%;
  object-fit: fill;
  transition: opacity 0.4s ease;
}

.adv-img.is-active {
  opacity: 1;
  z-index: 1;
}

.adv-img.is-next {
  z-index: 2;
}

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 56px;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  border: none;
  background: var(--color-dark);
  cursor: pointer;
  opacity: 0.9;
  z-index: 2;
}

.nav-btn::before {
  content: '';
  display: block;
 
  width: 10px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
}

.nav-btn.prev {
  left: 12px;
}

.nav-btn.prev::before {
  transform: rotate(135deg);
  margin-left: 16px;
}

.nav-btn.next {
  right: 12px;
}

.nav-btn.next::before {
  transform: rotate(-45deg);
  margin-left: 14px;
}

.adv-caption {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  
  padding: 16px 0; 
  width: 100%;
  max-width: calc(100% - 16px); /* экран минус левый+правый padding */
  
  background-color: var(--color-dark-opacity);
  
  color: var(--color-white);
  border-radius: 20px;
  font-weight: 500;
  font-size: var(--font-size-xl);
  line-height: 32px;
  
  white-space: normal; /* разрешаем перенос строк */
  text-align: center;  /* чтобы текст был по центру */
  z-index: 2;
}


@media (max-width: 1024px) {
  .adv-grid {
    grid-template-columns: repeat(2, 1fr);

    gap: var(--spacing-sm)
  }

  .adv-item {
    max-width: 100%; /* чтобы умещалось в ячейку */
  }
  .adv-caption{  
    border-radius: 12px;
    font-weight: 500;
    font-size: 16px;
    line-height: 18px;
  }
  .adv-media:hover button{
    visibility: hidden;
  }
}

@media (max-width: 768px){
  .adv-caption{
    font-size: var(--font-size-xs);
    line-height: 16px;
  }
}

