/**
 * Простая галерея проектов - ТОЧНО по Figma node 42:11001
 * Без lightGallery
 */

/* Overlay - фон */
.gallery-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Контейнер галереи - центрирован */
.gallery-container {
  position: relative;
  width: 1200px;
  max-width: calc(100vw - 80px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* Главное изображение - 700px высота */
.gallery-main-image {
  width: 100%;
  height: 700px;
  object-fit: contain;
  border-radius: 20px;
  background: transparent;
  align-self: stretch;
  transition: opacity 0.2s ease;
}

/* Pagination bar внизу */
.gallery-pagination {
  width: 100%;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  align-self: stretch;
}

.gallery-pagination-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

/* Миниатюры */
.gallery-thumbs {
  display: flex;
  gap: 6px;
  align-items: center;
}

.gallery-thumb {
  position: relative;
  width: 60px;
  height: 50px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.3s;
}

.gallery-thumb:hover {
  opacity: 0.8;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Активная миниатюра - белый overlay */
.gallery-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  border-radius: 12px;
}

/* Стрелки навигации */
.gallery-arrows {
  display: flex;
  gap: 12px;
  align-items: center;
}

.gallery-arrow-prev,
.gallery-arrow-next {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}

.gallery-arrow-prev:hover,
.gallery-arrow-next:hover {
  opacity: 0.7;
}

.gallery-arrow-prev svg,
.gallery-arrow-next svg {
  display: block;
}

/* Кнопка CTA */
.gallery-cta {
  padding: 12px 24px;
  background: #C39A6B;
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-family: 'Rising Sun', sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.3s;
  white-space: nowrap;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-cta:hover {
  background: #D4AA7A;
}

.gallery-cta:active {
  transform: scale(0.98);
}

/* Кнопка закрытия - ТОЧНО по Figma: left: 1208px, top: -56px */
.gallery-close {
  position: absolute;
  left: 1208px;
  top: -56px;
  width: 48px;
  height: 48px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
  z-index: 10;
}

.gallery-close:hover {
  opacity: 0.7;
}

.gallery-close svg {
  display: block;
}

/* Адаптивность для средних экранов */
@media (max-width: 1600px) {
  .gallery-container {
    width: calc(100vw - 160px);
    max-width: 1100px;
  }
  
  .gallery-main-image {
    height: 600px;
  }
  
  .gallery-close {
    right: -60px;
    left: auto;
    top: 0;
  }
}

@media (max-width: 1440px) {
  .gallery-container {
    width: calc(100vw - 120px);
    max-width: 1000px;
  }
  
  .gallery-main-image {
    height: 550px;
  }
  
  .gallery-close {
    right: -50px;
  }
  
  .gallery-thumb {
    width: 50px;
    height: 42px;
  }
}

@media (max-width: 1280px) {
  .gallery-container {
    width: calc(100vw - 80px);
    max-width: 900px;
  }
  
  .gallery-main-image {
    height: 480px;
  }
  
  .gallery-close {
    right: 0;
    top: -50px;
  }
  
  .gallery-thumb {
    width: 45px;
    height: 38px;
  }
  
  .gallery-cta {
    font-size: 16px;
    padding: 10px 20px;
  }
}

@media (max-width: 768px) {
  /* Mobile lightbox по Figma node-id=42-11067 */
  .gallery-overlay {
    background: rgba(0, 0, 0, 0.6);
  }
  
  .gallery-container {
    display: flex;
    width: calc(100% - 32px) !important;
    max-width: 343px !important;
    flex-direction: column;
    align-items: flex-end;
    gap: 92px;
    position: fixed !important;
    left: 50% !important;
    top: auto !important;
    bottom: 16px !important;
    margin-top: 0 !important;
    transform: translateX(-50%) !important;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow: hidden;
  }
  
  /* Главное изображение: 343×350px, border-radius 16px */
  .gallery-main-image {
    height: 350px;
    border-radius: 16px;
    width: 100%;
    object-fit: cover;
    align-self: stretch;
  }
  
  /* Pagination bar: backdrop blur(4px), padding 32px 16px 16px 16px */
  .gallery-pagination {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 16px;
    padding: 32px 16px 16px 16px;
    flex-direction: column;
    gap: 32px;
    align-self: stretch;
  }
  
  .gallery-pagination-left {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }
  
  /* Thumbs: 5 миниатюр 30×25px, gap 6px */
  .gallery-thumbs {
    gap: 6px;
  }
  
  .gallery-thumb {
    width: 30px;
    height: 25px;
    border-radius: 4px;
  }
  
  /* Активная миниатюра с белым overlay 70% */
  .gallery-thumb-overlay {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
  }
  
  /* Arrows: gap 12px, размер 24×24px */
  .gallery-arrows {
    gap: 12px;
  }
  
  .gallery-arrow-prev,
  .gallery-arrow-next {
    width: 24px;
    height: 24px;
  }
  
  .gallery-arrow-prev svg,
  .gallery-arrow-next svg {
    width: 24px;
    height: 24px;
  }
  
  /* CTA Button: #C39A6B, 16px, height 50px, padding 12px 24px */
  .gallery-cta {
    background: #C39A6B;
    width: 100%;
    height: 50px;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 6px;
    color: #FFFFFF;
    font-family: 'Rising Sun', sans-serif;
    font-weight: 500;
    line-height: 1.2;
    align-self: stretch;
  }
  
  /* Close button: right 0, top 0 (внутри контейнера), 24×24px */
  .gallery-close {
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    left: auto !important;
    width: 24px !important;
    height: 24px !important;
    z-index: 10001 !important;
  }
  
  .gallery-close svg {
    width: 24px;
    height: 24px;
  }
}

/* ========================================
   FOLD DEVICES (600-900px)
   Увеличенные размеры для лучшего UX
   ======================================== */
@media (min-width: 600px) and (max-width: 900px) {
  .gallery-overlay {
    background: rgba(0, 0, 0, 0.85);
  }
  
  .gallery-container {
    width: calc(100% - 48px) !important;
    max-width: 720px !important;
    gap: 24px;
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
  }
  
  /* Главное изображение: увеличенная высота для Fold */
  .gallery-main-image {
    height: 420px;
    border-radius: 16px;
    width: 100%;
    object-fit: contain;
  }
  
  /* Pagination bar */
  .gallery-pagination {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px 24px;
    flex-direction: row;
    gap: 24px;
  }
  
  .gallery-pagination-left {
    flex: 1;
    justify-content: flex-start;
    gap: 24px;
  }
  
  /* Миниатюры: УВЕЛИЧЕННЫЕ для Fold - 60×50px */
  .gallery-thumbs {
    gap: 8px;
  }
  
  .gallery-thumb {
    width: 60px;
    height: 50px;
    border-radius: 8px;
  }
  
  .gallery-thumb-overlay {
    border-radius: 8px;
  }
  
  /* Стрелки навигации */
  .gallery-arrows {
    gap: 12px;
  }
  
  .gallery-arrow-prev,
  .gallery-arrow-next {
    width: 36px;
    height: 36px;
  }
  
  .gallery-arrow-prev svg,
  .gallery-arrow-next svg {
    width: 36px;
    height: 36px;
  }
  
  /* CTA Button */
  .gallery-cta {
    padding: 14px 28px;
    font-size: 16px;
    height: auto;
    min-height: 48px;
    white-space: nowrap;
  }
  
  /* Close button */
  .gallery-close {
    position: absolute !important;
    right: 0 !important;
    top: -48px !important;
    left: auto !important;
    width: 40px !important;
    height: 40px !important;
  }
  
  .gallery-close svg {
    width: 40px;
    height: 40px;
  }
}
