/* ==========================================================================
   Фотогалерея — «Лучшие кадры» (плитки + лайтбокс)
   ========================================================================== */

.gf-best-shots {
  padding-block: 1.5rem 3.5rem;
}

.gf-best-shots__intro {
  max-width: 40rem;
  margin-bottom: 1.75rem;
}

.gf-best-shots__lead {
  margin: 0.65rem 0 0;
  color: var(--gf-muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.gf-best-shots__module {
  margin-top: 0.25rem;
}

/* На странице альбома шапка страницы уже есть — компактнее отступ */
.gf-best-shots__module .photo-album {
  margin-top: 0.25rem;
}

.gf-best-shots__module .gallery-photos-list__header {
  display: none;
}

.gf-best-shots__loading,
.gf-best-shots__empty {
  margin: 0;
  color: var(--gf-faint);
}

.gf-best-shots__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.75rem;
}

.gf-best-shots__item {
  --span: 4;
  --ratio: 4 / 3;
  grid-column: span var(--span);
  margin: 0;
  padding: 0;
  border: 1px solid var(--gf-line);
  border-radius: var(--gf-radius-sm);
  background: var(--gf-surface);
  overflow: hidden;
  cursor: zoom-in;
  aspect-ratio: var(--ratio);
  transition:
    transform 220ms var(--gf-ease),
    border-color 180ms ease,
    box-shadow 220ms ease;
}

.gf-best-shots__item:nth-child(6n + 1) {
  --span: 7;
  --ratio: 16 / 10;
}

.gf-best-shots__item:nth-child(6n + 2) {
  --span: 5;
  --ratio: 4 / 5;
}

.gf-best-shots__item:nth-child(6n + 3),
.gf-best-shots__item:nth-child(6n + 4) {
  --span: 4;
  --ratio: 1 / 1;
}

.gf-best-shots__item:nth-child(6n + 5) {
  --span: 5;
  --ratio: 5 / 4;
}

.gf-best-shots__item:nth-child(6n + 6) {
  --span: 7;
  --ratio: 3 / 2;
}

.gf-best-shots__item:hover,
.gf-best-shots__item:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(77, 182, 165, 0.4);
  box-shadow: var(--gf-shadow-soft);
}

.gf-best-shots__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 420ms var(--gf-ease), filter 280ms ease;
  filter: saturate(0.92) brightness(0.92);
}

.gf-best-shots__item:hover img,
.gf-best-shots__item:focus-visible img {
  transform: scale(1.035);
  filter: saturate(1.05) brightness(1.05);
}

.gf-best-shots__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.6rem 0.85rem 0.75rem;
  background: linear-gradient(180deg, transparent, rgba(8, 10, 14, 0.78));
  color: var(--gf-ink);
  font-size: 0.92rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 200ms ease, transform 220ms var(--gf-ease);
  pointer-events: none;
}

.gf-best-shots__item {
  position: relative;
}

.gf-best-shots__item:hover .gf-best-shots__caption,
.gf-best-shots__item:focus-visible .gf-best-shots__caption {
  opacity: 1;
  transform: translateY(0);
}

/* Lightbox */
.gf-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(6, 8, 12, 0.86);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms;
}

.gf-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.gf-lightbox__dialog {
  position: relative;
  width: min(100%, 68rem);
  max-height: min(88svh, 52rem);
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 0.85rem;
}

.gf-lightbox__figure {
  margin: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: var(--gf-radius);
  overflow: hidden;
  background: #0a0d12;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--gf-shadow-soft);
}

.gf-lightbox__figure img {
  max-width: 100%;
  max-height: min(76svh, 46rem);
  width: auto;
  height: auto;
  object-fit: contain;
}

.gf-lightbox__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  color: var(--gf-ink-soft);
  font-size: 0.95rem;
}

.gf-lightbox__title {
  font-weight: 600;
  color: var(--gf-ink);
}

.gf-lightbox__count {
  color: var(--gf-faint);
  white-space: nowrap;
}

.gf-lightbox__close,
.gf-lightbox__nav {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 22, 28, 0.82);
  color: var(--gf-ink);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.gf-lightbox__close:hover,
.gf-lightbox__nav:hover {
  background: rgba(28, 34, 42, 0.95);
  border-color: rgba(77, 182, 165, 0.4);
  color: #fff;
}

.gf-lightbox__close {
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  font-size: 1.45rem;
  line-height: 1;
}

.gf-lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  font-size: 1.6rem;
  line-height: 1;
  z-index: 2;
}

.gf-lightbox__nav--prev {
  left: 0.65rem;
}

.gf-lightbox__nav--next {
  right: 0.65rem;
}

body.gf-lightbox-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .gf-best-shots__item,
  .gf-best-shots__item:nth-child(n) {
    --span: 6;
    --ratio: 4 / 3;
  }

  .gf-lightbox__nav--prev {
    left: 0.25rem;
  }

  .gf-lightbox__nav--next {
    right: 0.25rem;
  }
}

@media (max-width: 640px) {
  .gf-best-shots__item,
  .gf-best-shots__item:nth-child(n) {
    --span: 12;
  }

  .gf-lightbox {
    padding: 0.75rem;
  }

  .gf-lightbox__close {
    top: 0.5rem;
    right: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gf-best-shots__item,
  .gf-best-shots__item img,
  .gf-best-shots__caption,
  .gf-lightbox {
    transition: none !important;
  }

  .gf-best-shots__item:hover,
  .gf-best-shots__item:hover img {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Кинематографичная лента под альбомами
   -------------------------------------------------------------------------- */

.gf-gallery-strip {
  margin-top: 2.75rem;
  --gf-strip-sets: 2;
}

/* Компактная лента на главной */
.gf-gallery-strip--home {
  margin-top: 0;
  margin-bottom: 1.15rem;
}

.gf-gallery-strip--home .gf-gallery-strip__item,
.gf-gallery-strip--home .gf-gallery-strip__item.is-sm,
.gf-gallery-strip--home .gf-gallery-strip__item.is-md,
.gf-gallery-strip--home .gf-gallery-strip__item.is-lg,
.gf-gallery-strip--home .gf-gallery-strip__item.is-wide {
  height: clamp(6.75rem, 12vw, 9.25rem);
}

.gf-gallery-strip--home .gf-gallery-strip__item.is-sm {
  width: 7.75rem;
}

.gf-gallery-strip--home .gf-gallery-strip__item.is-md {
  width: 9.75rem;
}

.gf-gallery-strip--home .gf-gallery-strip__item,
.gf-gallery-strip--home .gf-gallery-strip__item.is-lg {
  width: 11.25rem;
}

.gf-gallery-strip--home .gf-gallery-strip__item.is-wide {
  width: 13.5rem;
}

.gf-gallery-strip--home .gf-gallery-strip__track {
  gap: 0.5rem;
}

.gf-gallery-strip--home.is-ready:not(.is-static) .gf-gallery-strip__track {
  animation-duration: 80s;
}

.gf-section--gallery .gf-section__more {
  margin-top: 0;
}

.gf-gallery-strip[hidden] {
  display: none;
}

.gf-gallery-strip__head {
  max-width: 36rem;
  margin-bottom: 1.1rem;
}

.gf-gallery-strip__title {
  margin: 0;
  font-family: var(--gf-font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--gf-ink);
}

.gf-gallery-strip__lead {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--gf-muted);
}

.gf-gallery-strip__viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding-block: 0.15rem;
  mask-image: linear-gradient(
    90deg,
    transparent 0%,
    #000 3%,
    #000 97%,
    transparent 100%
  );
}

.gf-gallery-strip__fade {
  display: none;
}

.gf-gallery-strip__track {
  display: flex;
  align-items: stretch;
  gap: 0.65rem;
  width: max-content;
  will-change: transform;
}

.gf-gallery-strip.is-ready:not(.is-static) .gf-gallery-strip__track {
  animation: gf-gallery-strip-scroll 55s linear infinite;
}

.gf-gallery-strip.is-ready:not(.is-static) .gf-gallery-strip__viewport:hover .gf-gallery-strip__track,
.gf-gallery-strip.is-ready:not(.is-static) .gf-gallery-strip__viewport:focus-within .gf-gallery-strip__track {
  animation-play-state: paused;
}

.gf-gallery-strip.is-static .gf-gallery-strip__viewport {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  mask-image: none;
}

@keyframes gf-gallery-strip-scroll {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    /* один полный набор из N дублей */
    transform: translate3d(calc(-100% / var(--gf-strip-sets)), 0, 0);
  }
}

.gf-gallery-strip__item {
  position: relative;
  flex: 0 0 auto;
  display: block;
  height: clamp(9.5rem, 18vw, 13.5rem);
  width: 11rem;
  border-radius: var(--gf-radius-sm);
  overflow: hidden;
  border: 1px solid var(--gf-line);
  background: var(--gf-surface);
  text-decoration: none;
  color: inherit;
  isolation: isolate;
}

.gf-gallery-strip__item.is-sm {
  width: 9.25rem;
}

.gf-gallery-strip__item.is-md {
  width: 12rem;
}

.gf-gallery-strip__item.is-lg {
  width: 14.5rem;
}

.gf-gallery-strip__item.is-wide {
  width: 17rem;
}

.gf-gallery-strip__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.94) brightness(0.93);
  transition: transform 420ms var(--gf-ease), filter 240ms ease;
}

.gf-gallery-strip__item:hover img,
.gf-gallery-strip__item:focus-visible img {
  transform: scale(1.04);
  filter: saturate(1.06) brightness(1.05);
}

.gf-gallery-strip__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.5rem 0.7rem 0.55rem;
  background: linear-gradient(180deg, transparent, rgba(8, 10, 14, 0.82));
  color: var(--gf-ink);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 200ms ease, transform 220ms var(--gf-ease);
  pointer-events: none;
}

.gf-gallery-strip__item:hover .gf-gallery-strip__caption,
.gf-gallery-strip__item:focus-visible .gf-gallery-strip__caption {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 640px) {
  .gf-gallery-strip {
    margin-top: 2.25rem;
  }

  .gf-gallery-strip__lead {
    font-size: 0.9rem;
  }

  .gf-gallery-strip__item,
  .gf-gallery-strip__item.is-sm,
  .gf-gallery-strip__item.is-md,
  .gf-gallery-strip__item.is-lg,
  .gf-gallery-strip__item.is-wide {
    width: 10.5rem;
    height: 9.75rem;
  }

  .gf-gallery-strip--home .gf-gallery-strip__item,
  .gf-gallery-strip--home .gf-gallery-strip__item.is-sm,
  .gf-gallery-strip--home .gf-gallery-strip__item.is-md,
  .gf-gallery-strip--home .gf-gallery-strip__item.is-lg,
  .gf-gallery-strip--home .gf-gallery-strip__item.is-wide {
    width: 8.25rem;
    height: 7.5rem;
  }

  .gf-gallery-strip.is-ready:not(.is-static) .gf-gallery-strip__track {
    animation-duration: 40s;
  }

  .gf-gallery-strip--home.is-ready:not(.is-static) .gf-gallery-strip__track {
    animation-duration: 60s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gf-gallery-strip.is-ready:not(.is-static) .gf-gallery-strip__track {
    animation: none;
  }

  .gf-gallery-strip__item img,
  .gf-gallery-strip__caption {
    transition: none;
  }

  .gf-gallery-strip__item:hover img,
  .gf-gallery-strip__item:focus-visible img {
    transform: none;
  }
}
