/* ════════════════════════════════════════════════════════════════
   gallery.css
   Место: user/themes/YOUR_THEME/css/gallery.css
   Подключение в base.html.twig:
     {% do assets.addCss('theme://css/gallery.css') %}
   ════════════════════════════════════════════════════════════════ */

:root {
  --gl-accent:    #e8c97e;
  --gl-bg:        #e2d8d8;
  --gl-surface:   #1a1a1a;
  --gl-border:    rgba(232, 201, 126, .18);
  --gl-radius:    1rem;
  --gl-ease:      cubic-bezier(.76, 0, .24, 1);
}

/* ── Секция ── */
.grav-gallery {
  background: var(--gl-bg);
  padding: 3rem 1.5rem;
  font-family: Georgia, serif;
}

.gl-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Сцена ── */
.gl-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--gl-radius);
  background: var(--gl-surface);
  aspect-ratio: 16 / 9;
  box-shadow: 0 40px 100px rgba(0,0,0,.7);
  border: 1px solid var(--gl-border);
}

/* ── Трек / Слайды ── */
.gl-track {
  display: grid;
  width: 100%;
  height: 100%;
}

.gl-slide {
  grid-area: 1 / 1;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: scale(1.04) translateX(40px);
  transition: opacity 700ms var(--gl-ease), transform 700ms var(--gl-ease);
  pointer-events: none;
  will-change: transform, opacity;
}

.gl-slide.is-active {
  opacity: 1;
  transform: scale(1) translateX(0);
  pointer-events: auto;
  z-index: 2;
}

.gl-slide.is-leaving {
  opacity: 0;
  transform: scale(.96) translateX(-40px);
  z-index: 1;
}

.gl-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 8s ease;
}

.gl-slide.is-active .gl-img {
  transform: scale(1.05); /* Ken Burns */
}

/* ── Подпись ── */
.gl-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4rem 2rem 1.5rem;
  background: linear-gradient(to top, rgba(0,0,0,.8) 0%, transparent 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .4s .3s, transform .4s .3s;
}

.gl-slide.is-active .gl-caption {
  opacity: 1;
  transform: translateY(0);
}

.gl-caption-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gl-accent);
  line-height: 1.3;
}

.gl-caption-desc {
  font-size: .875rem;
  opacity: .8;
  line-height: 1.5;
}

/* ── Кнопки навигации ── */
.gl-btn {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  z-index: 10;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  border: 1px solid var(--gl-border);
  color: var(--gl-accent);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background .2s, scale .15s, border-color .2s;
  outline: none;
}

.gl-btn:hover {
  background: rgba(232, 201, 126, .15);
  scale: 1.1;
  border-color: var(--gl-accent);
}

.gl-btn svg { width: 1.25rem; height: 1.25rem; }

.gl-btn--prev { left: 1.25rem; }
.gl-btn--next { right: 1.25rem; }

/* ── Прогресс ── */
.gl-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,.1);
  z-index: 10;
}

.gl-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--gl-accent);
}

.gl-progress-bar.is-running {
  width: 100%;
}

/* ── Счётчик ── */
.gl-counter {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 10;
  font-size: .75rem;
  letter-spacing: .15em;
  color: rgba(255,255,255,.7);
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(6px);
  padding: .35rem .8rem;
  border-radius: 2rem;
  border: 1px solid var(--gl-border);
  font-family: 'Courier New', monospace;
}

.gl-counter-sep { margin: 0 .3em; opacity: .4; }

/* ── Миниатюры ── */
.gl-thumbs {
  display: flex;
  gap: .6rem;
  overflow-x: auto;
  padding-bottom: .25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gl-border) transparent;
}

.gl-thumbs::-webkit-scrollbar { height: 4px; }
.gl-thumbs::-webkit-scrollbar-track { background: transparent; }
.gl-thumbs::-webkit-scrollbar-thumb { background: var(--gl-border); border-radius: 2px; }

.gl-thumb {
  flex-shrink: 0;
  position: relative;
  width: 6.5rem;
  aspect-ratio: 16 / 10;
  border-radius: .5rem;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--gl-surface);
  transition: border-color .25s, scale .2s;
  outline: none;
  padding: 0;
}

.gl-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gl-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  transition: opacity .25s;
}

.gl-thumb.is-active {
  border-color: var(--gl-accent);
  scale: 1.05;
}

.gl-thumb.is-active .gl-thumb-overlay { opacity: 0; }

.gl-thumb:hover:not(.is-active) { border-color: rgba(232,201,126,.4); }
.gl-thumb:hover .gl-thumb-overlay { opacity: .2; }

/* ── Адаптив ── */
@media (max-width: 640px) {
  .gl-btn { width: 2.5rem; height: 2.5rem; }
  .gl-thumb { width: 4.5rem; }
  .grav-gallery { padding: 2rem 1rem; }
  .gl-caption { padding: 3rem 1.25rem 1.25rem; }
}
