.video-gallery {
  position: relative;
  z-index: 1;
  padding: 70px 0 80px;
  background-color: rgba(var(--adhvan-base-rgb), 0.04);
}

.video-gallery__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  margin-top: 32px;
}

.video-gallery-modal__close i {
  display: inline-block;
  font-style: normal;
  line-height: 1;
}

.video-gallery-modal__close i::before {
  content: "✕";
  display: block;
  font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
  font-size: 1.05rem;
  line-height: 1;
  color: inherit;
}

.video-gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.video-gallery-modal[hidden] {
  display: none;
}

.video-gallery-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.video-gallery-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 20, 0.78);
  backdrop-filter: blur(4px);
}

.video-gallery-modal__content {
  position: relative;
  width: min(1100px, calc(100vw - 48px));
  height: auto;
  max-height: calc(100vh - 100px);
  max-height: calc(100dvh - 100px);
  min-height: 0;
  box-sizing: border-box;
  overflow: auto;
  padding: 16px;
  background: #101914;
  border-radius: 22px;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.38);
  z-index: 1;
  transform: translateY(14px) scale(0.985);
  transition: transform 0.22s ease;
}

.video-gallery-modal.is-open .video-gallery-modal__content {
  transform: translateY(0) scale(1);
}

.video-gallery-modal__content:focus-visible {
  outline: 2px solid rgba(var(--adhvan-base-rgb), 0.6);
  outline-offset: 2px;
}

.video-gallery-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #39433e;
  background: #24332d;
  color: var(--adhvan-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.video-gallery-modal__close i {
  font-size: 1.1rem;
  line-height: 1;
}

.video-gallery-modal__close:hover,
.video-gallery-modal__close:focus-visible {
  background: var(--adhvan-base);
}

.video-gallery-modal__close:focus-visible {
  outline: 3px solid var(--adhvan-white);
  outline-offset: 3px;
}

.video-gallery-modal__body {
  display: grid;
  grid-template-columns: 175px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

.video-gallery-modal__gallery {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: flex-start;
}

.video-gallery-modal__player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  min-width: 0;
  max-width: 800px;
  max-height: min(450px, calc(100vh - 220px));
  max-height: min(450px, calc(100dvh - 220px));
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 10px;
  background: #24332d;
}

.video-gallery-modal__player iframe,
.video-gallery-modal__player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

.video-gallery-modal__thumbnails {
  display: flex;
  width: 175px;
  min-width: 0;
  min-height: 0;
  height: auto;
  max-height: min(450px, calc(100vh - 220px));
  max-height: min(450px, calc(100dvh - 220px));
  align-self: start;
  flex-direction: column;
  gap: 6px;
  padding: 2px 5px 2px 2px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #39433e transparent;
  scrollbar-width: thin;
}

.video-gallery-modal__thumbnail-button {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  padding: 4px;
  overflow: hidden;
  border: 1px solid #39433e;
  border-radius: 8px;
  color: #c5cec8;
  background: #17211b;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.video-gallery-modal__thumbnail-button img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.video-gallery-modal__thumbnail-title {
  display: block;
  padding: 5px 2px 2px;
  font-size: 0.68rem;
  line-height: 1.3;
}

.video-gallery-modal__thumbnail-button:hover {
  background: #24332d;
  border-color: #718078;
}

.video-gallery-modal__thumbnail-button.is-selected {
  border-color: #72cbb8;
  background: #24332d;
}

.video-gallery-modal__thumbnail-button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.video-gallery-modal__thumbnail-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(8, 14, 11, 0.52);
  transform: translate(-50%, -50%);
}

.video-gallery-modal__thumbnail-play::before {
  content: "▶";
  display: grid;
  place-items: center;
  padding-left: 2px;
  color: #fff;
  font-size: 0.7rem;
}

.video-gallery-modal__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 24px;
  box-sizing: border-box;
  color: #f5f7f5;
  background: #24332d;
  border-radius: 10px;
}

.video-gallery-modal__placeholder-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid rgba(245, 247, 245, 0.8);
  border-radius: 50%;
}

.video-gallery-modal__placeholder-icon::before {
  content: "▶";
  padding-left: 4px;
  font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
  font-size: 1.25rem;
}

.video-gallery-modal__state {
  font-family: var(--adhvan-heading-font);
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 600;
  line-height: 1.4;
}

.video-gallery-modal__active-title {
  width: 100%;
  max-width: 800px;
  box-sizing: border-box;
  margin: 0 0 15px 0;
  color: #f5f7f5;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

@media (min-width: 1023px) {
  .video-gallery__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .video-gallery-modal {
    padding: 16px;
  }

  .video-gallery-modal__content {
    width: calc(100vw - 32px);
    padding: 12px;
  }

  .video-gallery-modal__body {
    grid-template-columns: 105px minmax(0, 1fr);
  }

  .video-gallery-modal__thumbnails {
    width: 105px;
  }

  @media (min-width: 720px) {
    .video-gallery__grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
}

@media (max-width: 767px) {
  .video-gallery {
    padding: 60px 0 70px;
  }

  .video-gallery-modal {
    padding: 12px;
  }

  .video-gallery-modal__content {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px;
  }

  .video-gallery-modal__close {
    position: sticky;
    top: 10px;
    display: flex;
    margin: 10px 10px -46px auto;
  }

  .video-gallery-modal__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: auto;
    min-height: 0;
  }

  .video-gallery-modal__thumbnails {
    flex-direction: row;
    gap: 8px;
    width: 100%;
    height: auto;
    max-height: none;
    padding: 2px 2px 7px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
  }

  .video-gallery-modal__thumbnail-button {
    flex: 0 0 100px;
  }

  .video-gallery-modal__gallery {
    width: 100%;
    min-width: 0;
  }

  .video-gallery-modal__player {
    width: 100%;
    max-width: none;
    max-height: none;
    height: auto;
    flex: none;
  }

  .video-gallery-modal__active-title {
    margin-bottom: 8px;
  }
}

@media (max-height: 700px) and (min-width: 768px) {
  .video-gallery-modal__body {
    padding-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {

  .video-gallery-modal,
  .video-gallery-modal__content,
  .video-gallery-modal__thumbnail-button,
  .video-gallery-modal__thumbnail-button img {
    transition-duration: 0.01ms;
  }
}
