/**
 * [포스터 레일 — 메인 ARTNET Spotlight · 전시홈 추천 전시]
 * - 역할: 포스터 카드를 한 줄로 놓는다. PC 4장 · 1199px 이하 3장 · 767px 이하 1.5장이 보이고,
 *         넘치면 옆으로 밀어 본다(PC 는 화살표도). 4개 이하면 PC 에서 넘칠 일이 없어 고정 4열처럼 보인다.
 * - 마크업: artnet/bbs/_inc/main_home/section_spotlight.php · artnet/bbs/_inc/exhibition_home/section_spotlight.php
 * - JS: artnet/assets/js/artnet-spot-rail.js (화살표 보이기·넘기기, 5개 이상이면 순서 섞기)
 * - 작성/수정일: 2026-11-30
 */
.an-spot-rail {
  --an-spot-gap: 24px;
  --an-spot-per: 4;
  position: relative;
}

.an-spot-rail__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - var(--an-spot-gap) * (var(--an-spot-per) - 1)) / var(--an-spot-per));
  gap: var(--an-spot-gap);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.an-spot-rail__track::-webkit-scrollbar {
  display: none;
}

.an-spot-rail__track > * {
  min-width: 0;
  scroll-snap-align: start;
}

/* 화살표: 넘칠 때만(JS 가 .is-scrollable), 마우스 쓰는 화면만 */
.an-spot-rail__nav {
  position: absolute;
  z-index: 4;
  top: calc(var(--an-spot-media-h, 50%) / 2);
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #171717;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: opacity 0.2s ease;
}

.an-spot-rail__nav--prev {
  left: -22px;
}

.an-spot-rail__nav--next {
  right: -22px;
}

.an-spot-rail__nav:disabled {
  opacity: 0;
  pointer-events: none;
}

@media (hover: hover) and (min-width: 768px) {
  .an-spot-rail.is-scrollable .an-spot-rail__nav {
    display: inline-flex;
  }
}

@media (max-width: 1199.98px) {
  .an-spot-rail {
    --an-spot-per: 3;
    --an-spot-gap: 20px;
  }
}

/* 휴대폰: 1.5장 보이게, 화면 오른쪽 끝까지 이어 보이게 */
@media (max-width: 767.98px) {
  .an-spot-rail {
    --an-spot-gap: 14px;
  }

  .an-spot-rail__track {
    grid-auto-columns: 62%;
    margin-right: calc(-1 * var(--container-pad, 12px));
    padding-right: var(--container-pad, 12px);
    scroll-padding-left: 0;
  }
}

/* [메인홈 슬라이더 화살표와 통일] 넘칠 때도 마우스를 올렸을 때만 보인다 — 작성/수정일: 2026-11-30 */
.an-spot-rail .an-spot-rail__nav {
  opacity: 0;
  pointer-events: none;
}

@media (hover: hover) and (min-width: 768px) {
  .an-spot-rail.is-scrollable:hover .an-spot-rail__nav:not(:disabled),
  .an-spot-rail.is-scrollable:focus-within .an-spot-rail__nav:not(:disabled) {
    opacity: 1;
    pointer-events: auto;
  }
}
