.gal-root {
  display: flex;
  gap: 16px;
  user-select: none;
}

.gal-main-container {
  flex: 1;
  position: relative;
}

.gal-main {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  aspect-ratio: 4/3;
  cursor: zoom-in;
}

.gal-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 40px;
  transition: transform .25s ease;
  display: block;
}

.gal-main:hover img {
  transform: scale(1.05);
}

.gal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgb(255 255 255 / 60%);
  border: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.gal-nav:hover { background: #1a56a0; border-color: #1a56a0; }
.gal-nav:hover i { color: white; }
.gal-nav.prev { left: 12px; }
.gal-nav.next { right: 12px; }
.gal-nav i { font-size: 18px; color: #1e293b; transition: color 0.2s; }

.gal-thumbs-vertical-wrap {
  width: 85px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gal-thumb-scroll {
  display: none;
  width: 28px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
}
.gal-thumb-scroll:hover:not(:disabled) {
  border-color: #1a56a0;
  color: #1a56a0;
}
.gal-thumb-scroll:disabled {
  opacity: 0.35;
  cursor: default;
}
/* Стрелки показываем, только если миниатюр больше 4 — не занимают
   место зря, когда прокручивать нечего. */
.gal-thumbs-vertical-wrap.scrollable .gal-thumb-scroll {
  display: flex;
}

.gal-thumbs-vertical {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: none;
}
.gal-thumbs-vertical::-webkit-scrollbar {
  display: none;
}
/* Ровно 4 миниатюры (81px картинка + 2*2px рамка) + 3 промежутка —
   остальные скрыты за прокруткой, а не растягивают колонку до
   произвольной длины (была реальная проблема при 7+ фото). При 4
   фото и меньше высота обычная, по контенту — иначе снизу пустовало
   бы место. */
.gal-thumbs-vertical-wrap.scrollable .gal-thumbs-vertical {
  height: 356px;
}

.gal-thumb-vertical {
  width: 100%;
  aspect-ratio: 1/1;
  flex-shrink: 0;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}

.gal-thumb-vertical img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.gal-thumb-vertical.active,
.gal-thumb-vertical:hover {
  border-color: #1a56a0;
  box-shadow: 0 0 0 2px rgba(26,86,160,0.2);
}

.gal-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.gal-modal-bg.open { display: flex; }

.gal-modal {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 20px;
  box-sizing: border-box;
}

.gal-modal-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgb(227 224 219);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: all 0.2s;
}

.gal-modal-close i { font-size: 24px; color: white; }
.gal-modal-close:hover { background: var(--blue); transform: scale(1.05); }

.gal-modal-main {
  display: flex;
  gap: 24px;
  flex: 1;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 20px 60px;
}

.gal-modal-img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
}

.gal-modal-img-wrap img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.gal-modal-thumbs-vertical {
  width: 90px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  max-height: 70vh;
  padding: 8px 4px;
}

.gal-modal-thumb-vertical {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.2);
  background: #1a1a24;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}

.gal-modal-thumb-vertical img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  background: #ffffff;
}

.gal-modal-thumb-vertical.active,
.gal-modal-thumb-vertical:hover {
  border-color: #1a56a0;
  box-shadow: 0 0 0 3px rgba(26,86,160,0.4);
}

.modal-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgb(227 224 219);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 15;
}

.modal-nav-arrow:hover { background: #1a56a0; border-color: #1a56a0; }
.modal-nav-arrow i { font-size: 26px; color: white; }
.modal-nav-arrow.prev-arrow { left: 24px; }
.modal-nav-arrow.next-arrow { right: 24px; }

.gal-modal-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.5);
  padding: 6px 14px;
  border-radius: 30px;
  z-index: 15;
}
