/* Галерея выполненных работ */

body.page-gallery {
  background: var(--page-canvas);
}

body.page-gallery main {
  padding-top: 14px;
  padding-bottom: clamp(34px, 4.2vw, 46px);
}

body.page-gallery .site-breadcrumb {
  margin: 6px 0 12px;
}

.gallery-hero {
  background: transparent;
  padding: 0 0 clamp(30px, 4vw, 42px);
}

.gallery-hero .container {
  position: relative;
  overflow: hidden;
  background: var(--hero-card-bg);
  border: 1px solid var(--hero-card-border);
  border-radius: 16px;
  box-shadow: var(--hero-card-shadow);
  padding: clamp(22px, 3.5vw, 34px) clamp(18px, 3vw, 34px);
  text-align: center;
}

.gallery-hero .container::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--gradient-primary);
}

.gallery-hero .section-title {
  color: var(--primary);
  text-shadow: none;
  margin-bottom: 14px;
}

.gallery-hero .section-subtitle {
  color: #3f4964;
  max-width: min(780px, 92%);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.gallery-disclaimer-inner {
  background: #fff;
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft-card);
  padding: clamp(16px, 2.4vw, 24px);
}

.gallery-disclaimer-inner p {
  margin: 0 0 12px;
  line-height: 1.6;
  color: var(--dark);
  font-size: 0.96rem;
}

.gallery-disclaimer-links {
  margin-bottom: 0 !important;
  color: var(--gray);
}

.gallery-disclaimer-inner a {
  color: var(--secondary);
  font-weight: 600;
  text-decoration: none;
}

.gallery-disclaimer-inner a:hover {
  text-decoration: underline;
}

/* Фильтры */
.gallery-filters {
  padding: 0 0 clamp(30px, 4vw, 42px);
  background: transparent;
}

.gallery-filters .container {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: flex-start;
  background: #fff;
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft-card);
  padding: clamp(16px, 2.2vw, 22px) clamp(16px, 2.8vw, 28px);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 200px;
}

.filter-label {
  font-weight: 600;
  color: var(--dark);
  font-size: 0.95rem;
}

.filter-select {
  padding: 12px 16px;
  border: 1px solid var(--surface-border);
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-family: inherit;
  background-color: white;
  color: var(--dark);
  transition: var(--transition-smooth);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px;
  padding-right: 40px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#reset-filters {
  margin-bottom: 0;
  border-radius: 999px;
  min-height: 46px;
}

/* Галерея */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 0;
}

.gallery-section .container {
  min-height: 55vh;
}

.gallery-item {
  background: white;
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-soft-card);
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  opacity: 0;
  animation: fadeInUp var(--motion-duration-slow) var(--motion-ease-emphasized) forwards;
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }

.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-large, 0 14px 30px rgba(34, 85, 245, 0.14));
}

.gallery-item-image {
  position: relative;
  width: 100%;
  height: 250px;
  overflow: hidden;
  cursor: pointer;
  background-color: #f0f0f0;
}

.gallery-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--motion-duration-slow) var(--motion-ease-emphasized);
}

.gallery-item:hover .gallery-item-image img {
  transform: scale(1.1);
}

.gallery-item-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transition: opacity var(--motion-duration-base) var(--motion-ease-standard);
  color: white;
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}

.gallery-item-overlay i {
  font-size: 2rem;
}

.gallery-item-overlay span {
  font-weight: 600;
}

.gallery-item-info {
  padding: 18px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.gallery-item-title {
  font-size: 1.12rem;
  margin-bottom: 8px;
  color: var(--dark);
  font-weight: 600;
}

.gallery-item-description {
  color: var(--gray);
  margin-bottom: 12px;
  flex-grow: 1;
  line-height: 1.6;
}

.gallery-item-meta {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 0.9rem;
  color: var(--gray);
}

.gallery-item-date {
  display: flex;
  align-items: center;
  gap: 5px;
}

.gallery-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--gray);
  background: #fff;
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft-card);
  margin-top: 0;
}

.gallery-disclaimer.section.section-gray {
  padding: 0 0 clamp(18px, 2.4vw, 24px);
  background: transparent;
}

.gallery-section.section {
  padding: 0;
}

.gallery-empty i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

.gallery-empty p {
  font-size: 1.2rem;
}

.page-business-gallery .gallery-case {
  background: #fff;
  border: 1px solid var(--surface-border, #e8ecf5);
  border-radius: 16px;
  box-shadow: var(--shadow-soft-card, 0 10px 32px rgba(25, 25, 50, 0.06));
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-business-gallery .gallery-case[hidden],
.page-business-gallery .blog-card[hidden] {
  display: none !important;
}

.page-business-case .gallery-case-kicker {
  padding: 0 0 8px;
}

.gallery-case-kicker {
  margin: 0;
  padding: 16px 18px 0;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--secondary, #2255f5);
}

.gallery-case-list {
  margin: 0 0 14px;
  padding: 0 0 0 1.1rem;
  color: var(--gray, #696969);
  font-size: 0.92rem;
  line-height: 1.45;
}

.gallery-case-list li {
  margin-bottom: 6px;
}

.gallery-case-note {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--gray, #696969);
}

.page-business-gallery .gallery-grid {
  align-items: start;
}

.page-business-gallery .gallery-item-description {
  flex-grow: 0;
}

/* Lightbox */
.gallery-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--motion-duration-base) var(--motion-ease-standard),
    visibility var(--motion-duration-base) var(--motion-ease-standard);
  padding: 20px;
}

.gallery-lightbox.lightbox-open {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--border-radius);
}

.lightbox-info {
  background: white;
  padding: 20px;
  border-radius: var(--border-radius);
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.lightbox-info h3 {
  font-size: 1.5rem;
  margin-bottom: 10px;
  color: var(--dark);
}

.lightbox-info p {
  color: var(--gray);
  line-height: 1.6;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: var(--transition-smooth);
  z-index: 10001;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.lightbox-close {
  top: 20px;
  right: 20px;
}

.lightbox-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev:hover,
.lightbox-next:hover {
  transform: translateY(-50%) scale(1.1);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
to {
  opacity: 1;
  transform: translateY(0);
}
}

/* Адаптивность */
@media (max-width: 768px) {
  .gallery-hero {
    padding-bottom: 26px;
  }

  .gallery-hero .container {
    padding: 24px 16px 22px;
    border-radius: 14px;
  }

  .gallery-disclaimer-inner {
    padding: 16px;
    border-radius: 14px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

.gallery-filters .container {
  flex-direction: column;
  align-items: stretch;
  padding: 14px;
  border-radius: 14px;
}

.filter-group {
  width: 100%;
}

#reset-filters {
  width: 100%;
}

.lightbox-prev,
.lightbox-next {
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
}

.lightbox-close {
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
}
}

@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .gallery-item-image img,
  .gallery-item-overlay,
  .gallery-lightbox,
  .lightbox-close,
  .lightbox-prev,
  .lightbox-next {
    animation: none !important;
    transition: none !important;
  }

  .gallery-item:hover,
  .gallery-item:hover .gallery-item-image img {
    transform: none !important;
  }
}
