/* ================================================================
   Белуга Арт — Gallery & Lightbox CSS
   ================================================================ */

/* ── Главный слайдер (бесконечный автоскролл в Index) ────────── */
.gallery-section {
  padding: 80px 0;
  background: var(--bg-dark);
  overflow: hidden;
  position: relative;
}

.gallery-section::before,
.gallery-section::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 120px;
  z-index: 2;
  pointer-events: none;
}

.gallery-section::before {
  left: 0;
  background: linear-gradient(to right, var(--bg-dark), transparent);
}

.gallery-section::after {
  right: 0;
  background: linear-gradient(to left, var(--bg-dark), transparent);
}

.gallery-section .section-head {
  position: relative;
  z-index: 3;
  margin-bottom: 40px;
}

.gallery-section .section-title {
  color: #fff;
}

.gallery-section .section-desc {
  color: rgba(255, 255, 255, .65);
}

/* Трек слайдера */
.gallery-ticker-wrap {
  overflow: hidden;
  position: relative;
}

.gallery-ticker {
  display: flex;
  gap: 16px;
  width: max-content;
  animation: galleryTicker 40s linear infinite;
}

.gallery-ticker:hover {
  animation-play-state: paused;
}

.gallery-ticker--row2 {
  animation-direction: reverse;
  animation-duration: 50s;
  margin-top: 16px;
}

@keyframes galleryTicker {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}

/* Каждый слайд */
.gallery-slide {
  flex-shrink: 0;
  width: 280px;
  height: 200px;
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .2);
  transition: transform .3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow .3s;
}

.gallery-slide:hover {
  transform: scale(1.04);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .4);
  z-index: 1;
}

.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.gallery-slide:hover img {
  transform: scale(1.05);
}

.gallery-slide__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, .8));
  color: #fff;
  font-size: .85rem;
  font-weight: 500;
  padding: 30px 16px 14px;
  opacity: 0;
  transition: opacity .3s ease;
}

.gallery-slide:hover .gallery-slide__caption {
  opacity: 1;
}

/* Управление слайдером */
.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  position: relative;
  z-index: 3;
}

.gallery-ctrl-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
  backdrop-filter: blur(8px);
}

.gallery-ctrl-btn:hover {
  background: #fff;
  color: var(--text);
  border-color: #fff;
}

.gallery-pause-btn {
  width: 52px;
  height: 52px;
  font-size: 1rem;
}

/* ── Галерея МК — миниатюры в карточке ───────────────────────── */
.mc-card__gallery {
  display: flex;
  gap: 6px;
  padding: 0 24px 20px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.mc-card__thumb {
  width: 56px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  border: 1px solid var(--border);
  transition: transform .2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.mc-card__thumb:hover {
  transform: scale(1.08);
}

.mc-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mc-card__thumb--more {
  width: 56px;
  height: 48px;
  border-radius: 10px;
  background: var(--bg-sec);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-sec);
  cursor: pointer;
  flex-shrink: 0;
  border: 1px solid var(--border);
  transition: all .2s;
}

.mc-card__thumb--more:hover {
  background: var(--border);
  color: var(--text);
}

/* ── ЛАЙТБОКС (Apple Style) ─────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.lightbox[hidden] {
  display: none;
}

.lightbox.visible {
  opacity: 1;
}

.lightbox__inner {
  position: relative;
  max-width: 1000px;
  width: 100%;
  transform: scale(.97);
  transition: transform .3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.lightbox.visible .lightbox__inner {
  transform: scale(1);
}

.lightbox__img-wrap {
  border-radius: 16px;
  overflow: hidden;
  background: transparent;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .4);
}

.lightbox__img-wrap img {
  max-height: 80vh;
  max-width: 100%;
  object-fit: contain;
  display: block;
  border-radius: 16px;
}

.lightbox__caption {
  text-align: center;
  color: rgba(255, 255, 255, .9);
  font-size: .95rem;
  margin-top: 16px;
  min-height: 1.4em;
  font-weight: 500;
}

.lightbox__counter {
  text-align: center;
  color: rgba(255, 255, 255, .5);
  font-size: .8rem;
  margin-top: 4px;
}

.lightbox__close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  backdrop-filter: blur(10px);
  z-index: 2001;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, .25);
  transform: scale(1.05);
}

.lightbox__prev,
.lightbox__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  backdrop-filter: blur(10px);
}

.lightbox__prev:hover,
.lightbox__next:hover {
  background: rgba(255, 255, 255, .25);
  transform: translateY(-50%) scale(1.05);
}

.lightbox__prev {
  left: -70px;
}

.lightbox__next {
  right: -70px;
}

.lightbox__dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.lightbox__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .3);
  cursor: pointer;
  border: none;
  transition: all .2s;
}

.lightbox__dot.active {
  background: #fff;
  transform: scale(1.2);
}

/* ── Thumbnails row in lightbox ──────────────────────────────── */
.lightbox__thumbs {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
  max-height: 80px;
  overflow: hidden;
}

.lightbox__thumb {
  width: 60px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s;
  opacity: .5;
}

.lightbox__thumb.active {
  border-color: #fff;
  opacity: 1;
  transform: scale(1.05);
}

.lightbox__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Admin: Upload Zone ──────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 20px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg-sec);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--brand);
  background: var(--brand-lt);
}

.upload-zone__icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.upload-zone__text {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.upload-zone__sub {
  font-size: .85rem;
  color: var(--text-sec);
  margin-top: 6px;
}

.upload-zone input[type="file"] {
  display: none;
}

/* Admin gallery grid */
.adm-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.adm-gallery-item {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-sec);
  aspect-ratio: 4/3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
  border: 1px solid var(--border);
}

.adm-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.adm-gallery-item__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .0);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .2s;
}

.adm-gallery-item:hover .adm-gallery-item__overlay {
  background: rgba(0, 0, 0, .4);
}

.adm-gallery-item__btn {
  opacity: 0;
  transform: scale(.8);
  transition: all .2s;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}

.adm-gallery-item:hover .adm-gallery-item__btn {
  opacity: 1;
  transform: scale(1);
}

.adm-gallery-item__btn--del {
  background: #FF3B30;
  color: #fff;
}

.adm-gallery-item__btn--view {
  background: #fff;
  color: var(--text);
}

.adm-gallery-item__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: .75rem;
  padding: 6px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(4px);
}

.adm-gallery-item--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  color: var(--text-sec);
  font-size: .85rem;
  gap: 8px;
  cursor: pointer;
  background: #fff !important;
  transition: all .2s;
  aspect-ratio: 4/3;
  border-radius: 16px;
}

.adm-gallery-item--empty:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* Upload progress bar */
.upload-progress-wrap {
  margin-top: 14px;
  display: none;
}

.upload-progress-wrap.visible {
  display: block;
}

.upload-progress-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
  width: 0%;
  transition: width .3s ease;
}

.upload-progress-label {
  font-size: .8rem;
  color: var(--text-sec);
  margin-top: 6px;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .lightbox__prev {
    left: -10px;
    background: rgba(0, 0, 0, .4);
    border-color: transparent;
  }

  .lightbox__next {
    right: -10px;
    background: rgba(0, 0, 0, .4);
    border-color: transparent;
  }

  .lightbox__close {
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, .4);
    border-color: transparent;
  }
}

@media (max-width: 640px) {
  .gallery-slide {
    width: 220px;
    height: 160px;
  }

  .lightbox__img-wrap {
    max-height: 70vh;
  }

  .lightbox__img-wrap img {
    max-height: 70vh;
  }
}