/* Медиа в тексте статьи: слайдер из картинок и видео подряд, подписи картинок.
   Разметку строит src/themes/wolsu/lib/article-media.ts, стрелки, счётчик и миниатюры добавляет js/slider.js.
   Слайды листаются прокруткой с привязкой (scroll-snap): свайп на телефоне работает и без скрипта,
   а без поддержки скриптов вовсе слайды идут столбиком (в конце файла). Видео в слайдере и одиночные VK и Rutube —
   обложкой с кнопкой ▶, плеер встаёт на её место по щелчку. */
.wl-slider {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  text-indent: 0;
}
.wl-slider-viewport {
  position: relative;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: var(--borderradius);
  background: var(--color1);
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.wl-slider-viewport::-webkit-scrollbar {
  display: none;
}
.wl-slider-viewport:focus-visible {
  outline: 2px solid var(--maincolor);
  outline-offset: 2px;
}
.wl-slide {
  flex: 0 0 100%;
  min-width: 0;
  margin: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
/* Окно слайда — всегда 16:9: высота не прыгает ни при перелистывании, ни при загрузке картинок. Картинка заполняет
   окно; с пропорциями далеко от 16:9 — целиком, с полями (класс ставит js/slider.js). */
.wl-slide-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0f1315;
}
.wl-slide-media > a,
.wl-slide-media > img,
.wl-slide-media > iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  border: 0;
}
.wl-slide-media > a {
  display: flex;
}
/* Плеер трейлера на странице игры (<video> встаёт на место обложки, js/slider.js) — кадр целиком. */
.wl-slide-media > video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}
.wl-slide-media img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  object-fit: cover;
}
/* Пропорции далеки от 16:9 (js/slider.js): картинка целиком, с полями, а не обрезанной. */
.wl-slide-media img.wl-slide-contain {
  object-fit: contain;
}
.wl-slide-caption,
.wl-figure-caption {
  color: var(--color_gray);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  text-indent: 0;
}
.wl-slide-caption {
  padding: 8px 14px 10px;
}

/* Стрелки и счётчик (js/slider.js): поверх окна слайда, раскладку не сдвигают. */
.wl-slider-nav {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  aspect-ratio: 16 / 9;
  pointer-events: none;
}
.wl-slider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: var(--color_white);
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}
.wl-slider-btn:hover {
  background: var(--maincolor);
}
.wl-slider-btn:focus-visible {
  outline: 2px solid var(--color_white);
  outline-offset: 2px;
}
.wl-slider-btn:disabled {
  opacity: 0;
  pointer-events: none;
}
.wl-slider-btn svg {
  width: 22px;
  height: 22px;
}
.wl-slider-counter {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--color_white);
  font-size: 13px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* Миниатюры под слайдами (js/slider.js): одна строка, не помещаются — полоса листается; пока помещаются — по центру. */
.wl-slider-thumbs {
  position: relative;
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.wl-slider-thumbs::-webkit-scrollbar {
  display: none;
}
.wl-slider-thumb:first-child {
  margin-left: auto;
}
.wl-slider-thumb:last-child {
  margin-right: auto;
}
.wl-slider-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 88px;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: var(--borderradius);
  overflow: hidden;
  background: #0f1315;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.wl-slider-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px transparent;
  transition: box-shadow 0.2s ease;
}
.wl-slider-thumb:hover,
.wl-slider-thumb.is-active {
  opacity: 1;
}
.wl-slider-thumb.is-active::after {
  box-shadow: inset 0 0 0 2px var(--maincolor);
}
.wl-slider-thumb:focus-visible {
  outline: 2px solid var(--color_white);
  outline-offset: -2px;
}
.wl-slider-thumb img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  object-fit: cover;
}
.wl-slider-thumb-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 18px;
  margin: -9px 0 0 -13px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
}
.wl-slider-thumb-play::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -5px 0 0 -3px;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #fff;
}

/* Картинка слайдера крупно (js/slider.js): поверх страницы, крестик, стрелки, счётчик. Без «наездов» и
   увеличений — только короткое появление. */
.wl-slider .wl-zoomable,
.wl-slider .wl-zoomable img,
article.fullpage .wl-zoomable,
article.fullpage .wl-zoomable img {
  cursor: zoom-in;
}
html.wl-lightbox-open {
  overflow: hidden;
}
.wl-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: rgba(8, 10, 11, 0.94);
  animation: wl-lightbox-in 0.15s ease-out;
}
.wl-lightbox[hidden] {
  display: none;
}
.wl-lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 60px 76px 14px;
  touch-action: pan-y;
}
.wl-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--borderradius);
  user-select: none;
  -webkit-user-drag: none;
}
.wl-lightbox-caption {
  padding: 0 20px 18px;
  color: var(--color_white);
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
}
.wl-lightbox-caption:empty {
  display: none;
}
.wl-lightbox-counter {
  position: absolute;
  top: 18px;
  left: 18px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--color_white);
  font-size: 13px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.wl-lightbox-counter[hidden] {
  display: none;
}
.wl-lightbox .wl-slider-btn {
  position: absolute;
  width: 44px;
  height: 44px;
}
.wl-lightbox .wl-slider-btn[hidden] {
  display: none;
}
.wl-lightbox-close {
  top: 12px;
  right: 12px;
}
.wl-lightbox-prev,
.wl-lightbox-next {
  top: calc(50% - 22px);
}
.wl-lightbox-prev {
  left: 16px;
}
.wl-lightbox-next {
  right: 16px;
}
@keyframes wl-lightbox-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wl-lightbox {
    animation: none;
  }
}

/* Одиночная картинка с подписью. */
.wl-figure {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  text-indent: 0;
}
.wl-figure > a,
.wl-figure > img {
  max-width: 100%;
}
.wl-figure-caption {
  padding: 0 14px;
}
/* Одиночная картинка-превью DLE — на всю ширину текста, как слайдер, в своих пропорциях (правка Эмиля). Сильнее
   правила темы `a.highslide img` (fullpage.css: пропорция 16:9 по ширине превью). */
.wl-figure.wl-figure-wide {
  justify-items: stretch;
}
.wl-figure.wl-figure-wide > a {
  display: block;
}
main article.fullpage .article_desrc_full .wl-figure.wl-figure-wide > a > img,
.wl-figure.wl-figure-wide > a > img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 80vh;
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: var(--borderradius);
}

/* Видео обложкой: кадр, кнопка ▶ и имя сервиса; плеер (в <template>) — по щелчку, js/slider.js. */
.wl-slide-media > .wl-video,
.iframe-container > .wl-video {
  position: absolute;
  inset: 0;
}
.wl-video-cover {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  background: #0f1315;
  color: var(--color_white) !important;
  text-decoration: none !important;
  cursor: pointer;
}
.wl-video-cover:focus-visible {
  outline: 2px solid var(--maincolor);
  outline-offset: -2px;
}
.wl-video .wl-video-poster {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  object-fit: cover;
  transition: filter 0.2s ease;
}
.wl-video-cover:hover .wl-video-poster {
  filter: brightness(0.85);
}
.wl-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 68px;
  height: 48px;
  margin: -24px 0 0 -34px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.7);
  transition: background-color 0.2s ease;
}
.wl-video-play::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -6px;
  border-style: solid;
  border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent #fff;
}
.wl-video-cover:hover .wl-video-play,
.wl-video-cover:focus-visible .wl-video-play {
  background: var(--maincolor);
}
.wl-video-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  font-size: 13px;
  line-height: 1.6;
  text-indent: 0;
}

@media (max-width: 768px) {
  .wl-video-play {
    width: 56px;
    height: 40px;
    margin: -20px 0 0 -28px;
    border-radius: 12px;
  }
  .wl-video-label {
    bottom: 6px;
    left: 6px;
    font-size: 12px;
  }
  .wl-slider-nav {
    padding: 0 6px;
  }
  .wl-slider-btn {
    width: 34px;
    height: 34px;
  }
  .wl-slider-btn svg {
    width: 18px;
    height: 18px;
  }
  .wl-slider-counter {
    top: 6px;
    right: 6px;
    font-size: 12px;
  }
  .wl-slider-thumbs {
    gap: 6px;
    margin-top: 8px;
  }
  .wl-slider-thumb {
    width: 64px;
  }
  .wl-slide-caption,
  .wl-figure-caption {
    font-size: 13px;
  }
  /* Телефон: картинка во всю ширину, стрелки — поверх неё по краям. */
  .wl-lightbox-stage {
    padding: 60px 0 10px;
  }
  .wl-lightbox-img {
    border-radius: 0;
  }
  .wl-lightbox .wl-slider-btn {
    width: 38px;
    height: 38px;
  }
  .wl-lightbox-prev {
    left: 6px;
  }
  .wl-lightbox-next {
    right: 6px;
  }
  .wl-lightbox-caption {
    font-size: 14px;
  }
}

/* Скрипты выключены: слайды столбиком, картинки в своих пропорциях. */
@media (scripting: none) {
  .wl-slider-viewport {
    display: grid;
    gap: 20px;
    overflow: visible;
    border-radius: 0;
    background: none;
  }
  .wl-slide-media {
    aspect-ratio: auto;
    background: none;
  }
  .wl-slide-video .wl-slide-media {
    aspect-ratio: 16 / 9;
  }
  .wl-slide-media > a,
  .wl-slide-media > img {
    position: static;
    height: auto !important;
  }
  .wl-slide-media img {
    height: auto !important;
    border-radius: var(--borderradius) !important;
  }
}
