/* Слайдер первого экрана главной (.at-hs) и галерея «Наш шоурум и офис» (.at-gal) с просмотром на весь экран (.at-lb).
   Логика — /assets/site/gallery.js. Фото слайдов и галереи — обычные <img> в разметке главной, их можно менять в редакторе. */

/* ---------- Слайдер первого экрана ---------- */
.at-hs {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  cursor: grab;
  background: #101113;
}
.at-hs.is-drag { cursor: grabbing; }
.at-hs__slide {
  position: absolute;
  inset: 0;
  margin: 0;
  overflow: hidden;
  transform: translate3d(100%, 0, 0);
  backface-visibility: hidden;
}
.at-hs__slide:first-child { transform: none; }
.at-hs__slide img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  -webkit-user-drag: none;
}
/* вертикальные фото и коллажи: целиком, по бокам — размытая копия */
.at-hs__slide--fit::before,
.at-lb__slide::before {
  content: "";
  position: absolute;
  inset: -48px;
  background: var(--at-bg) center / cover no-repeat;
  filter: blur(30px) brightness(.5) saturate(1.15);
}
.at-hs__slide--fit img { object-fit: contain; }
/* надпись поверх слайдов не мешает листать */
.title-mp-section .title-mp-item_picture .section__text { pointer-events: none; }

.at-hs__dots {
  position: absolute;
  z-index: 3;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(10, 11, 13, .34);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.at-hs__dot {
  position: relative;
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, .5);
  cursor: pointer;
  transition: width .35s ease, background-color .35s ease;
}
.at-hs__dot::before { content: ""; position: absolute; inset: -8px -3px; } /* попадание пальцем */
.at-hs__dot:hover { background: rgba(255, 255, 255, .8); }
.at-hs__dot.is-on { width: 30px; background: rgba(255, 255, 255, .32); }
.at-hs__dot.is-on::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #fff;
  transform-origin: left center;
  transform: scaleX(0);
  animation: atHsProgress var(--at-hs-int, 5.5s) linear forwards;
}
.title-mp-item_picture.is-paused .at-hs__dot.is-on::after { animation-play-state: paused; }
.title-mp-item_picture.is-still .at-hs__dot.is-on::after { animation: none; transform: none; }
@keyframes atHsProgress { to { transform: scaleX(1); } }

.at-hs__arrow,
.at-lb__btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  background: rgba(12, 13, 15, .38);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
  transition: opacity .25s ease, transform .25s ease, background-color .2s ease, border-color .2s ease;
}
.at-hs__arrow:hover,
.at-lb__btn:hover { background: var(--at-accent, #dc2626); border-color: transparent; }
.at-hs__arrow:focus-visible,
.at-hs__dot:focus-visible,
.at-lb__btn:focus-visible,
.at-gal__item:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.at-hs__arrow svg,
.at-lb__btn svg { width: 22px; height: 22px; }
.at-hs__arrow {
  position: absolute;
  z-index: 3;
  top: 50%;
  margin-top: -23px;
  opacity: 0;
}
.at-hs__arrow--prev { left: 18px; transform: translateX(-8px); }
.at-hs__arrow--next { right: 18px; transform: translateX(8px); }
.title-mp-item_picture:hover .at-hs__arrow,
.at-hs__arrow:focus-visible { opacity: 1; transform: none; }
@media (hover: none), (max-width: 991.98px) {
  .at-hs__arrow { display: none; }
}
@media (max-width: 991.98px) {
  .at-hs__dots { top: 12px; right: 12px; padding: 7px 9px; gap: 5px; }
  .at-hs__dot { width: 6px; height: 6px; }
  .at-hs__dot.is-on { width: 22px; }
}

/* ---------- Галерея «Наш шоурум и офис» ---------- */
.at-gal-section {
  padding: 8px 0 64px;
  font-family: var(--at-ui-font);
  color: var(--at-c-fg);
}
.at-gal__head { margin: 0 0 22px; }
.at-gal__head h2 {
  margin: 0;
  font: 800 clamp(24px, 2.6vw, 32px) / 1.15 var(--at-ui-font);
  letter-spacing: -.01em;
  text-transform: none;
  color: var(--at-c-fg);
}
.at-gal__head p {
  margin: 8px 0 0;
  font: 500 15px / 1.5 var(--at-ui-font);
  color: var(--at-c-muted);
}
.at-gal {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: clamp(150px, 14.5vw, 230px);
  gap: 14px;
}
.at-gal__item {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 20px;
  background: var(--at-c-soft, rgba(127, 127, 127, .12));
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}
.at-gal__item--big { grid-column: span 2; grid-row: span 2; }
.at-gal__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}
.at-gal__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .5));
  opacity: 0;
  transition: opacity .3s ease;
}
.at-gal__zoom {
  position: absolute;
  z-index: 1;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  color: #111317;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s ease, transform .3s ease;
}
.at-gal__zoom svg { width: 18px; height: 18px; }
@media (hover: hover) {
  .at-gal__item:hover img { transform: scale(1.05); }
  .at-gal__item:hover::after { opacity: 1; }
  .at-gal__item:hover .at-gal__zoom { opacity: 1; transform: none; }
}
.at-gal__bar { display: none; }

/* телефон и планшет: лента, листается пальцем */
@media (max-width: 991.98px) {
  .at-gal-section { padding-bottom: 44px; }
  .at-gal__head { margin-bottom: 16px; }
  .at-gal__head p { font-size: 14px; }
  .at-gal {
    display: flex;
    gap: 10px;
    margin: 0 calc(-1 * var(--at-gal-gutter, 15px));
    padding: 0 var(--at-gal-gutter, 15px);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 var(--at-gal-gutter, 15px);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .at-gal::-webkit-scrollbar { display: none; }
  .at-gal__item,
  .at-gal__item--big {
    flex: 0 0 min(80%, 420px);
    aspect-ratio: 4 / 3;
    border-radius: 16px;
    scroll-snap-align: start;
  }
  .at-gal__zoom { width: 32px; height: 32px; right: 10px; bottom: 10px; opacity: 1; transform: none; }
  .at-gal__zoom svg { width: 15px; height: 15px; }
  .at-gal__bar {
    display: block;
    position: relative;
    height: 3px;
    margin: 14px auto 0;
    width: min(160px, 40%);
    border-radius: 3px;
    overflow: hidden;
    background: var(--at-c-line, rgba(127, 127, 127, .25));
  }
  .at-gal__bar i {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background: var(--at-accent, #dc2626);
  }
}

/* ---------- Просмотр на весь экран ---------- */
.at-lb {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: rgba(7, 8, 10, .96);
  opacity: 0;
  transition: opacity .25s ease;
  font-family: var(--at-ui-font, system-ui, sans-serif);
}
.at-lb.is-open { opacity: 1; }
.at-lb__stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.at-lb__slide {
  position: absolute;
  inset: 0;
  margin: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 88px;
  transform: translate3d(100%, 0, 0);
  will-change: transform;
}
.at-lb__slide::before { opacity: .55; }
.at-lb__slide img {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
  pointer-events: none;
  -webkit-user-drag: none;
}
.at-lb__bar {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  color: #fff;
  font: 600 15px / 1 var(--at-ui-font, system-ui, sans-serif);
  pointer-events: none;
}
.at-lb__bar > * { pointer-events: auto; }
.at-lb__count { opacity: .85; letter-spacing: .02em; }
.at-lb__btn--prev,
.at-lb__btn--next { position: absolute; z-index: 2; top: 50%; margin-top: -23px; }
.at-lb__btn--prev { left: 22px; }
.at-lb__btn--next { right: 22px; }
@media (max-width: 767.98px) {
  .at-lb__slide { padding: 64px 0; }
  .at-lb__slide img { border-radius: 0; box-shadow: none; }
  .at-lb__btn--prev,
  .at-lb__btn--next { display: none; }
  .at-lb__bar { padding: 12px 12px 12px 18px; }
}
html.at-lb-open,
html.at-lb-open body { overflow: hidden !important; }

@media (prefers-reduced-motion: reduce) {
  .at-hs__slide, .at-lb__slide { transition: none !important; }
  .at-gal__item img { transition: none; }
}
