/* ====================================================
   Галерея портфолио — Стили
   ==================================================== */

/* Плавный переход при смене темы */
.gallery-section *,
.gallery-videos *,
.gallery-hero * {
  transition: background-color 0.35s cubic-bezier(0.4, 0, 0.2, 1) 0s, 
              border-color 0.35s cubic-bezier(0.4, 0, 0.2, 1) 0s,
              color 0.35s cubic-bezier(0.4, 0, 0.2, 1) 0s;
}

/* Hero секция галереи */
.gallery-hero {
  padding: clamp(60px, 9vw, 120px) 0 clamp(40px, 6vw, 80px);
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
  border-bottom: 1px solid var(--border);
}

.gallery-hero__inner {
  text-align: center;
}

.gallery-hero__title {
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 16px;
  color: var(--text);
}

.gallery-hero__lead {
  font-size: clamp(16px, 3vw, 18px);
  color: var(--text-dim);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Секция галереи */
.gallery-section {
  padding: clamp(32px, 5vw, 48px) 0 clamp(60px, 10vw, 100px);
  background: var(--bg);
}

/* Фильтры */
.gallery-filters {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: clamp(40px, 8vw, 60px);
}

.gallery-filter {
  padding: 10px 24px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface);
  cursor: pointer;
  transition: all .3s ease;
  letter-spacing: -0.01em;
}

.gallery-filter:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.gallery-filter.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Сетка галереи */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: clamp(12px, 2vw, 20px);
  margin-bottom: clamp(40px, 8vw, 60px);
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform .3s ease, box-shadow .3s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

.gallery-item__wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 133.33%;
  overflow: hidden;
  background: var(--bg);
}

.gallery-item__image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease, filter .3s ease;
}

.gallery-item:hover .gallery-item__image {
  transform: scale(1.05);
  filter: brightness(0.85);
}

.gallery-item__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity .3s ease;
}

.gallery-item:hover .gallery-item__overlay {
  opacity: 1;
}

.gallery-item__btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: transform .3s ease, background .3s ease;
  border: 2px solid #fff;
}

.gallery-item__btn:hover {
  transform: scale(1.1);
  background: var(--accent-2);
}

/* Видео секция */
.gallery-videos {
  padding: clamp(60px, 10vw, 100px) 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.gallery-videos .eyebrow {
  display: block;
  margin-bottom: 16px;
}

.gallery-videos .section-title {
  margin-bottom: clamp(40px, 8vw, 60px);
}

/* Сетка видео */
.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(24px, 4vw, 40px);
}

.video-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform .3s ease, box-shadow .3s ease;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

.video-card__wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  overflow: hidden;
  background: #000;
}

.video-card__wrapper iframe,
.video-card__wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: clamp(16px, 3vw, 24px) clamp(16px, 3vw, 24px) 8px;
  line-height: 1.3;
}

.video-card p {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0 clamp(16px, 3vw, 24px) clamp(16px, 3vw, 24px);
  line-height: 1.5;
  padding-bottom: clamp(16px, 3vw, 24px);
}

/* CTA с адаптивностью */
.cta-banner {
  padding: clamp(60px, 10vw, 100px) 0;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.cta-banner__title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 32px;
  color: var(--text);
}

.cta-banner .btn {
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* =================== АДАПТИВНОСТЬ =================== */

/* Планшеты (768px и выше) */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: clamp(12px, 2vw, 16px);
  }

  .gallery-filters {
    gap: 8px;
    margin-bottom: 32px;
  }

  .gallery-filter {
    padding: 8px 16px;
    font-size: 13px;
  }

  .videos-grid {
    grid-template-columns: 1fr;
  }

  .gallery-hero__title {
    font-size: 32px;
  }

  .cta-banner__title {
    font-size: 28px;
  }
}

/* Мобильные устройства (480px и ниже) */
@media (max-width: 480px) {
  .gallery-hero {
    padding: 40px 0 30px;
  }

  .gallery-hero__title {
    font-size: 24px;
    margin-bottom: 12px;
  }

  .gallery-hero__lead {
    font-size: 14px;
  }

  .gallery-section {
    padding: 40px 0;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
  }

  .gallery-filters {
    margin-bottom: 24px;
  }

  .gallery-filter {
    padding: 6px 12px;
    font-size: 12px;
  }

  .gallery-videos {
    padding: 40px 0;
  }

  .gallery-videos .section-title {
    margin-bottom: 24px;
  }

  .video-card h3 {
    font-size: 16px;
    margin: 12px;
  }

  .video-card p {
    font-size: 13px;
    margin: 0 12px 12px;
  }

  .videos-grid {
    gap: 16px;
  }

  .cta-banner {
    padding: 40px 0;
  }

  .cta-banner__title {
    font-size: 20px;
    margin-bottom: 24px;
  }
}

/* Очень маленькие экраны (320px) */
@media (max-width: 360px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-hero__title {
    font-size: 20px;
  }

  .gallery-filters {
    flex-direction: column;
  }

  .gallery-filter {
    width: 100%;
  }
}

/* =================== ЛАЙТБОКС =================== */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  cursor: pointer;
  z-index: -1;
}

.lightbox__container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  animation: zoomIn .3s ease;
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lightbox__image {
  width: 100%;
  height: 100%;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox__close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .3s ease;
  z-index: 2;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: rotate(90deg);
}

@media (max-width: 480px) {
  .lightbox__close {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .lightbox__image {
    border-radius: 4px;
  }
}

/* Тёмная тема */
body.dark .gallery-item__btn {
  background: var(--accent);
}

body.dark .gallery-item__btn:hover {
  background: var(--accent-2);
}

body.dark .video-card {
  background: var(--surface);
}
