/* Silky Tea House — фотогалереи под обоймами.
   Компактная лента с горизонтальной промоткой, snap, стрелки, lightbox. */

.gallery {
  margin: 22px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--rule-soft);
}

.gallery__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  font-family: var(--sans);
}

.gallery__label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.gallery__count {
  font-size: 11px;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

.gallery__viewport {
  position: relative;
}

/* Стрелки прибиты к краям поля страницы (viewport галереи = вся ширина поля),
   мышка всегда попадает в одну точку независимо от ширины кадра */

.gallery__track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

.gallery__track::-webkit-scrollbar { height: 6px; }
.gallery__track::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 6px; }
.gallery__track::-webkit-scrollbar-track { background: transparent; }

.gallery__slide {
  flex: 0 0 auto;
  width: 240px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: zoom-in;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
}

.gallery__slide:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius);
}

.gallery__frame {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--rule-soft);
  box-shadow: 0 1px 2px rgba(32,26,23,0.06), 0 6px 18px rgba(32,26,23,0.05);
}

.gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.gallery__slide:hover .gallery__img,
.gallery__slide:focus-visible .gallery__img {
  transform: scale(1.03);
}

.gallery__index {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  background: rgba(255,255,255,0.94);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(32,26,23,0.15);
  font-weight: 600;
}

.gallery__play {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.94);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  box-shadow: 0 1px 2px rgba(32,26,23,0.2);
}

.gallery__caption {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-soft);
  padding: 0 2px;
  hyphens: none;
}

/* Arrows */
.gallery__nav {
  position: absolute;
  top: 180px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  z-index: 5;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(32,26,23,0.10);
  transition: opacity 0.2s ease, transform 0.15s ease;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.gallery__nav:hover {
  transform: translateY(-50%) scale(1.06);
  background: var(--paper);
  border-color: var(--accent, #b58a3a);
}

.gallery__nav:disabled {
  opacity: 0;
  pointer-events: none;
}

.gallery__nav--prev { left: -6px; }
.gallery__nav--next { right: -6px; }

@media (max-width: 640px) {
  .gallery__slide { width: 180px; }
  .gallery__nav { display: none; }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(24,20,18,0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
  overscroll-behavior: contain;
}

.lightbox.is-open { display: flex; }

.lightbox__stage {
  position: relative;
  max-width: min(1400px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox__media {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 4px;
  background: #0a0806;
}

.lightbox__caption {
  color: #f2ece1;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  max-width: 780px;
  padding: 0 10px;
}

.lightbox__meta {
  color: #cdbfa9;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  margin: 0 0 4px;
}

.lightbox__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  transition: background 0.15s ease;
}

.lightbox__btn:hover { background: rgba(255,255,255,0.26); }
.lightbox__btn:disabled { opacity: 0.25; pointer-events: none; }

.lightbox__btn--prev { left: 10px; }
.lightbox__btn--next { right: 10px; }

.lightbox__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: 0;
  cursor: pointer;
  font-size: 18px;
  z-index: 2;
}

.lightbox__close:hover { background: rgba(255,255,255,0.26); }

@media (max-width: 640px) {
  .lightbox { padding: 10px; }
  .lightbox__btn { width: 36px; height: 36px; font-size: 16px; }
  .lightbox__btn--prev { left: 4px; }
  .lightbox__btn--next { right: 4px; }
  .lightbox__close { top: 8px; right: 8px; }
}

/* Ссылка-подпись под галереей "Блэкаут" */
.prep-link {
  margin: 6px 0 22px;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-mute);
}
.prep-link a {
  color: var(--tea);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.prep-link a:hover {
  color: var(--tea-soft);
  border-color: var(--tea-soft);
}

/* Telegram post embed (link + horizontal iframe) */
.tg-embed {
  margin: 14px 0 18px;
}
.tg-embed__link {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
}
.tg-embed__link a {
  color: var(--tea);
  text-decoration: none;
  border-bottom: 1px solid rgba(47, 90, 58, 0.3);
}
.tg-embed__link a:hover {
  border-bottom-color: var(--tea);
}
.tg-embed__frame {
  width: 100%;
  min-height: 220px;
  max-height: 620px;
  height: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  display: block;
}

/* Одиночная галерея: фото шире + без стрелок и без пустоты справа */
.gallery__track:has(> .gallery__slide:only-child) {
  overflow: visible;
}
.gallery__track:has(> .gallery__slide:only-child) > .gallery__slide {
  width: min(520px, 100%);
}
.gallery__viewport:has(.gallery__slide:only-child) .gallery__nav {
  display: none;
}
