/* Mini-gallery component — horizontal scroll-snap carousel + lightbox.
   Shared across product/service pages of derevo-kraska.ru. */

.mini-gallery {
  max-width: 1200px;
  margin: 64px auto;
  padding: 0 16px;
}
.mini-gallery h2 {
  font-family: "Rubik", Arial, sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: #092f33;
  text-align: center;
  margin: 0 0 8px;
}
.mini-gallery .mg-sub {
  font-size: 15px;
  color: #555;
  text-align: center;
  margin: 0 0 28px;
}
.mini-gallery .mg-wrap {
  position: relative;
}
.mini-gallery .mg-scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(220px, 28vw, 300px);
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 12px;
  scrollbar-width: thin;
}
.mini-gallery .mg-scroller::-webkit-scrollbar { height: 8px; }
.mini-gallery .mg-scroller::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 4px; }
.mini-gallery .mg-scroller a {
  scroll-snap-align: start;
  aspect-ratio: 1/1;
  display: block;
  overflow: hidden;
  border-radius: 10px;
  background: #ededed;
  cursor: zoom-in;
  position: relative;
}
.mini-gallery .mg-scroller img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.mini-gallery .mg-scroller a:hover img { transform: scale(1.05); }

.mini-gallery .mg-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  font-size: 24px;
  line-height: 1;
  color: #092f33;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  font-family: inherit;
  padding: 0;
}
.mini-gallery .mg-arrow:hover { background: #fff; transform: translateY(-50%) scale(1.06); }
.mini-gallery .mg-arrow[disabled] { opacity: 0.35; cursor: default; }
.mini-gallery .mg-arrow[disabled]:hover { background: rgba(255,255,255,0.96); transform: translateY(-50%); }
.mini-gallery .mg-prev { left: -10px; }
.mini-gallery .mg-next { right: -10px; }

.mini-gallery .mg-link {
  text-align: center;
  margin-top: 20px;
}
.mini-gallery .mg-link a {
  color: #7aa624;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px dashed rgba(122,166,36,0.5);
}
.mini-gallery .mg-link a:hover { color: #5e8019; }

@media (max-width: 768px) {
  .mini-gallery { margin: 40px auto; }
  .mini-gallery h2 { font-size: 24px; }
  .mini-gallery .mg-arrow { display: none; }
  .mini-gallery .mg-scroller { grid-auto-columns: 70vw; gap: 8px; }
}

/* ---- Shared lightbox ---- */
#mg-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#mg-lightbox.open { display: flex; }
#mg-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  border-radius: 4px;
}
#mg-lightbox button {
  position: absolute;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
  font-family: inherit;
}
#mg-lightbox button:hover { background: rgba(255,255,255,0.2); }
#mg-lightbox .lb-close {
  top: 20px; right: 20px; width: 44px; height: 44px;
  border-radius: 50%; font-size: 22px; line-height: 44px; text-align: center;
}
#mg-lightbox .lb-prev, #mg-lightbox .lb-next {
  top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; border-radius: 50%; font-size: 28px;
}
#mg-lightbox .lb-prev { left: 24px; }
#mg-lightbox .lb-next { right: 24px; }
#mg-lightbox .lb-counter {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.7); font-size: 14px;
}
@media (max-width: 768px) {
  #mg-lightbox .lb-prev { left: 8px; width: 44px; height: 44px; font-size: 22px; }
  #mg-lightbox .lb-next { right: 8px; width: 44px; height: 44px; font-size: 22px; }
}
