/* ================================================================
   АРТ-ЗАВАРКА — Gallery & Lightbox CSS
   ================================================================ */

/* ── Главный слайдер (бесконечный автоскролл) ─────────────────── */
.gallery-section {
  padding: 80px 0;
  background: linear-gradient(160deg, #2D2020 0%, #3D2C2C 50%, #1E1414 100%);
  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, #2D2020, transparent);
}

.gallery-section::after {
  right: 0;
  background: linear-gradient(to left, #2D2020, transparent);
}

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

.gallery-section .section-label {
  background: var(--orange);
}

.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: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .4);
  transition: transform .3s ease, box-shadow .3s ease;
}

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

.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}

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

.gallery-slide__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75));
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  padding: 20px 12px 10px;
  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: 2px solid rgba(255, 255, 255, .3);
  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(4px);
}

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

.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: 8px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .2s;
}

.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: 8px;
  background: var(--cream-d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 800;
  color: var(--orange);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .2s;
}

.mc-card__thumb--more:hover {
  background: var(--gray-lt);
}

/* ── ЛАЙТБОКС ───────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .92);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .25s ease;
}

.lightbox[hidden] {
  display: none;
}

.lightbox.visible {
  opacity: 1;
}

.lightbox__inner {
  position: relative;
  max-width: 900px;
  width: 100%;
  transform: scale(.94);
  transition: transform .25s ease;
}

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

.lightbox__img-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #111;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__img-wrap img {
  max-height: 70vh;
  max-width: 100%;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-lg);
}

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

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

.lightbox__close {
  position: absolute;
  top: -48px;
  right: 0;
  background: rgba(255, 255, 255, .15);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}

.lightbox__close:hover {
  background: var(--orange);
}

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

.lightbox__prev:hover,
.lightbox__next:hover {
  background: var(--orange);
  transform: translateY(-50%) scale(1.1);
}

.lightbox__prev {
  left: -68px;
}

.lightbox__next {
  right: -68px;
}

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

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

.lightbox__dot.active {
  background: var(--orange);
  transform: scale(1.3);
}

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

.lightbox__thumb {
  width: 56px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .2s, opacity .2s;
  opacity: .65;
}

.lightbox__thumb.active {
  border-color: var(--orange);
  opacity: 1;
}

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

/* ── Admin: Upload Zone ──────────────────────────────────────── */
.upload-zone {
  border: 3px dashed var(--gray-lt);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--cream);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--orange);
  background: #FFF0E8;
}

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

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

.upload-zone__sub {
  font-size: .82rem;
  color: var(--gray);
  margin-top: 4px;
}

.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: 12px;
  margin-top: 20px;
}

.adm-gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--cream-d);
  aspect-ratio: 4/3;
  box-shadow: var(--shadow);
}

.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, .55);
}

.adm-gallery-item__btn {
  opacity: 0;
  transform: scale(.8);
  transition: opacity .2s, transform .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: 700;
}

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

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

.adm-gallery-item__btn--view {
  background: var(--white);
  color: var(--brown);
}

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

.adm-gallery-item--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--gray-lt);
  color: var(--gray);
  font-size: .82rem;
  gap: 6px;
  cursor: pointer;
  background: var(--white) !important;
  transition: border-color .2s;
  aspect-ratio: 4/3;
  border-radius: var(--radius);
}

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

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

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

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

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

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

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .gallery-slide {
    width: 200px;
    height: 150px;
  }

  .lightbox__prev {
    left: -8px;
  }

  .lightbox__next {
    right: -8px;
  }

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

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