/* BestAutoService — нативный слайдер (block styles ядровой галереи).
   Движок: assets/js/slider.js. Стили блока: bas-slider (full width),
   bas-slider-peek (карусель по контейнеру). Опции: bas-dots, bas-lightbox. */

html.bas-bleed { overflow-x: clip; }

.wp-block-gallery.is-style-bas-slider,
.wp-block-gallery.is-style-bas-slider-peek {
  display: block !important; /* отключаем flex-layout ядровой галереи */
  gap: 0;
  margin-block: 40px;
}

/* Core печатает свои gap-правила ПОСЛЕ нашей таблицы */
.wp-block-gallery.is-style-bas-slider.is-layout-flex,
.wp-block-gallery.is-style-bas-slider-peek.is-layout-flex {
  gap: 0;
}

/* Во всю ширину окна (breakout из .bas-container) */
.wp-block-gallery.is-style-bas-slider {
  --bas-sl-h: clamp(320px, 52vw, 640px);
  position: relative;
  width: 100vw;
  max-width: 100vw;
  margin-inline: calc(50% - 50vw);
}

/* По ширине контейнера: центр ~50%, половинки соседей */
.wp-block-gallery.is-style-bas-slider-peek {
  --bas-sl-h: clamp(260px, 34vw, 460px);
  position: relative;
  margin-inline: 0;
}

.bas-slTrack {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-radius: var(--bas-radius);
  cursor: grab;
}

.bas-slTrack::-webkit-scrollbar { display: none; }
.bas-slTrack.bas-dragging { cursor: grabbing; }

.bas-slTrack:focus-visible {
  outline: 2px solid var(--bas-accent-ink);
  outline-offset: 2px;
}

.is-style-bas-slider .bas-slTrack { padding: 0; }

.is-style-bas-slider-peek .bas-slTrack {
  gap: 16px;
  padding: 4px calc(25% - 8px) 0;
}

.bas-slide {
  position: relative;
  margin: 0;
  flex: 0 0 100%;
  scroll-snap-align: center;
  min-width: 0;
}

/* Core печатает .wp-block-image{margin-bottom:1em} ПОСЛЕ нашей таблицы —
   поднимаем специфичность, чтобы слайды не получали лишний отступ
   (иначе точки уезжают ниже фото) */
.wp-block-gallery.is-style-bas-slider .bas-slide,
.wp-block-gallery.is-style-bas-slider-peek .bas-slide {
  margin: 0;
}

.bas-slide img {
  display: block;
  width: 100%;
  height: var(--bas-sl-h);
  object-fit: cover;
  border-radius: var(--bas-radius);
  user-select: none;
}

/* Core печатает свои margin-правила ПОСЛЕ нашей таблицы —
   с высокой специфичностью держим слайды без лишних отступов */
.wp-block-gallery.is-style-bas-slider .bas-slide img,
.wp-block-gallery.is-style-bas-slider-peek .bas-slide img {
  margin: 0;
}

.bas-slide figcaption {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 2;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.62);
  color: #fff;
  font-size: 14px;
  line-height: 1.3;
  pointer-events: none;
  white-space: nowrap;
}

/* Точки включены — подписи не пересекаются с ними */
.wp-block-gallery.bas-dots .bas-slide figcaption { bottom: 20px; }

/* Стрелки-шевроны: круглые кнопки, иконка и кнопка отцентрированы */
.bas-slBtn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(17, 17, 17, 0.55);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
}

.bas-slBtn:hover { background: rgba(17, 17, 17, 0.78); }

.wp-block-gallery.is-style-bas-slider:hover .bas-slBtn,
.wp-block-gallery.is-style-bas-slider:focus-within .bas-slBtn,
.wp-block-gallery.is-style-bas-slider-peek:hover .bas-slBtn,
.wp-block-gallery.is-style-bas-slider-peek:focus-within .bas-slBtn,
.bas-slBtn:focus-visible {
  opacity: 1;
}

.bas-slBtn:focus-visible {
  opacity: 1;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.bas-slBtn--prev { left: 16px; }
.bas-slBtn--next { right: 16px; }

.is-style-bas-slider-peek .bas-slBtn--prev { left: 8px; }
.is-style-bas-slider-peek .bas-slBtn--next { right: 8px; }

@media (pointer: coarse) {
  .bas-slBtn { opacity: 0.85; }
}

/* Точки-индикаторы (опция bas-dots) */
.bas-dotsWrap {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  display: flex;
  gap: 8px;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}

.bas-dot {
  pointer-events: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.bas-dot.is-act {
  background: #fff;
  transform: scale(1.3);
}

/* Лайтбокс (опция bas-lightbox) */
#bas-lightbox[hidden] { display: none; }

#bas-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(10, 10, 10, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#bas-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

#bas-lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: var(--bas-radius);
}

#bas-lightbox .bas-lbBtn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}

#bas-lightbox .bas-lbBtn:hover { background: rgba(255, 255, 255, 0.28); }
#bas-lightbox .bas-lbBtn--prev { left: 20px; }
#bas-lightbox .bas-lbBtn--next { right: 20px; }

#bas-lightbox .bas-lbX {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}

#bas-lightbox .bas-lbX:hover { background: rgba(255, 255, 255, 0.28); }

@media (max-width: 640px) {
  .wp-block-gallery.is-style-bas-slider { --bas-sl-h: clamp(240px, 60vw, 420px); }
  .wp-block-gallery.is-style-bas-slider-peek { --bas-sl-h: clamp(220px, 62vw, 380px); }
  .bas-slBtn { width: 40px; height: 40px; }
}
