/* Gallery — в стиле основного сайта, без заголовка */
.section-gallery {
  padding: 4rem 0;
}

.section-gallery .container {
  max-width: 1200px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 200px;
  gap: 1rem;
  grid-auto-flow: row dense;
}

.gallery-item {
  position: relative;
  background: var(--surface-accent);
  border: 1px solid var(--line);
  border-radius: 1rem;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.3s ease, transform 0.3s ease;
  display: block;
}

.gallery-item:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}

.gallery-item img,
.gallery-item .gallery-item__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  vertical-align: middle;
}

/* Размеры ячеек */
.gallery-item--1x1 {
  grid-column: span 1;
  grid-row: span 1;
}

.gallery-item--1x2 {
  grid-column: span 1;
  grid-row: span 2;
}

.gallery-item--2x2 {
  grid-column: span 2;
  grid-row: span 2;
}

/* Иконка воспроизведения по центру для видео */
.gallery-item__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: background 0.3s ease, transform 0.3s ease;
}

.gallery-item__play svg {
  width: 36px;
  height: 36px;
  margin-left: 4px;
}

.gallery-item:hover .gallery-item__play {
  background: var(--accent);
  transform: translate(-50%, -50%) scale(1.1);
}

/* Video modal — открывается отдельно от блока */
.video-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
}

.video-modal.is-open {
  display: flex;
}

.video-modal__close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
  z-index: 10;
}

.video-modal__close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.video-modal__content {
  width: 100%;
  height: 100%;
  max-width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-modal__iframe-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0;
}

.video-modal__iframe-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
}

.video-modal__player {
  width: 100%;
  max-width: 900px;
  max-height: 80vh;
  display: block;
  border-radius: 0.5rem;
  background: #000;
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 160px;
    gap: 0.75rem;
  }
  .gallery-item--2x2 {
    grid-column: span 2;
    grid-row: span 2;
  }
  .gallery-item--1x2 {
    grid-column: span 1;
    grid-row: span 2;
  }
  .gallery-item__play {
    width: 56px;
    height: 56px;
  }
  .gallery-item__play svg {
    width: 28px;
    height: 28px;
  }
  .video-modal__iframe-wrapper {
    padding: 0;
  }
}
