/* OS Gallery — галерея на сайті: сітка квадратних мініатюр (як на старому сайті) + лайтбокс */

.osg-gallery { margin: 1.2em 0; clear: both; }

.osg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
@media (max-width: 575.98px) { .osg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.osg-item { display: block; aspect-ratio: 1 / 1; overflow: hidden; background: #e9eef5; border-radius: 4px; }
.osg-gallery .osg-item img {
  /* !important — шаблон сайту задає img { height: auto } з більшою специфічністю */
  width: 100% !important; height: 100% !important; max-width: none; object-fit: cover; display: block; border-radius: 0 !important;
  transition: transform 0.35s ease, filter 0.2s ease;
}
.osg-item:hover img, .osg-item:focus-visible img { transform: scale(1.05); filter: brightness(1.05); }

/* окремі фото {os-gal-G-C-ID-left|right|center} */
.osg-inline .osg-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.osg-inline .osg-item { width: 220px; }
.osg-align-left { float: left; margin: 0.3em 1.2em 0.8em 0; clear: none; }
.osg-align-right { float: right; margin: 0.3em 0 0.8em 1.2em; clear: none; }
.osg-align-center .osg-grid { justify-content: center; }

.osg-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.osg-tab {
  border: 1px solid #c9d5e6; background: #fff; color: #245fa6; border-radius: 999px; padding: 5px 14px;
  font-size: 0.9rem; cursor: pointer;
}
.osg-tab.active, .osg-tab:hover { background: #2f79d4; border-color: #2f79d4; color: #fff; }

/* ---------- лайтбокс ---------- */

.osg-lb {
  position: fixed; inset: 0; z-index: 10000; background: rgba(10, 12, 16, 0.94); color: #fff;
  display: grid; grid-template-rows: auto 1fr auto; user-select: none; touch-action: pan-y;
  opacity: 0; transition: opacity 0.2s;
}
.osg-lb.open { opacity: 1; }
.osg-lb-top { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; }
.osg-lb-count { font-size: 0.9rem; opacity: 0.85; padding-left: 6px; }
.osg-lb-tools { display: flex; gap: 2px; }
.osg-lb button {
  background: transparent; border: 0; color: #fff; width: 44px; height: 44px; font-size: 20px; cursor: pointer;
  border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; opacity: 0.85;
}
.osg-lb button:hover, .osg-lb button:focus-visible { background: rgba(255, 255, 255, 0.12); opacity: 1; }
.osg-lb button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.osg-lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
.osg-lb-img { max-width: calc(100vw - 140px); max-height: 100%; object-fit: contain; box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5); transition: opacity 0.2s; }
.osg-lb-img.loading { opacity: 0.25; }
@media (max-width: 767.98px) { .osg-lb-img { max-width: 100vw; } }

.osg-lb-prev, .osg-lb-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0, 0, 0, 0.35) !important; }
.osg-lb-prev { left: 12px; }
.osg-lb-next { right: 12px; }
@media (max-width: 767.98px) { .osg-lb-prev, .osg-lb-next { display: none !important; } }

.osg-lb-bottom { padding: 6px 10px 10px; }
.osg-lb-caption { text-align: center; font-size: 0.95rem; min-height: 1.2em; padding: 0 0 6px; opacity: 0.9; }
.osg-lb-thumbs { display: flex; gap: 6px; overflow-x: auto; justify-content: safe center; padding: 2px; scrollbar-width: thin; }
.osg-lb-thumbs img { width: 76px; height: 52px; object-fit: cover; opacity: 0.45; cursor: pointer; border: 2px solid transparent; flex: 0 0 auto; }
.osg-lb-thumbs img.on { opacity: 1; border-color: #ffd200; }
.osg-lb.no-thumbs .osg-lb-thumbs { display: none; }
.osg-lb .is-playing { background: rgba(255, 210, 0, 0.25); }
