/* =================================================================
   Spotlight — "สิ่งที่น่าสนใจ" promotions carousel
   Figma "Spotlight" 1440×633 @ y=550: pad 60/0/60, title 36/1.3 SemiBold,
   gap 24, banner 1140×420 r16, gap 16, dots 52×6, arrows 44×44 centred on
   the banner edges at y+177.
   ================================================================= */
.s-spotlight {
  --sp-radius: 16px;
  --sp-gap: 24px;                         /* distance between slides while sliding */
  /* slide travel is a spring in spotlight.js (one slide ≈ 700ms, gentle start) */
  --sp-calm: cubic-bezier(0.33, 1, 0.68, 1);  /* dot pill: calm, even ease-out */
  --sp-autoplay: 6s;
  /* hover motion (client: "smooth, not harsh") — one curve, one tempo, both directions */
  --sp-hover-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sp-hover-dur: 600ms;                  /* shadow bloom */
  --sp-zoom-dur: 760ms;                   /* image drift, a touch slower than the bloom */
  --sp-press-dur: 160ms;
  position: relative;
  padding: 60px 0;
  background: #FFFFFF;
  overflow-x: clip;                       /* phone peek never causes page scroll */
}

.s-spotlight .s-spotlight__title {
  font-family: var(--font);
  font-weight: var(--fw-semibold);
  font-size: 36px;
  line-height: 1.3;
  min-height: 47px;                       /* Figma text box: 47 (36 × 1.3 rounds up) */
  color: var(--ink);
  margin: 0 0 24px;
}

.s-spotlight .s-spotlight__carousel { position: relative; }
.s-spotlight .s-spotlight__stage {
  position: relative;
  isolation: isolate;                     /* keeps the bloom (z -1) above the section background */
  transition: transform var(--sp-press-dur) var(--sp-hover-ease);
}
/* Hover shadow bloom: a pre-rendered shadow on a pseudo-element that only fades
   (opacity is composited — no per-frame repaint of a 1140px blur). Sits exactly on the
   banner box (the stage = viewport box ≥768) behind it; the arrows paint above. */
.s-spotlight .s-spotlight__stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: var(--sp-radius);
  box-shadow: 0 24px 48px -26px rgba(42, 42, 42, 0.38), 0 6px 18px -12px rgba(42, 42, 42, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--sp-hover-dur) var(--sp-hover-ease);
}

/* ---------- viewport / track / slides ---------- */
.s-spotlight .s-spotlight__viewport {
  position: relative;
  border-radius: var(--sp-radius);
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);               /* keep the rounded clip during transforms (Safari) */
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.s-spotlight .s-spotlight__track {
  display: grid;
  position: relative;
}
.s-spotlight .sl {
  grid-area: 1 / 1;
  min-width: 0;
  /* --o is driven per frame by spotlight.js (spring) — no CSS transition here */
  transform: translate3d(calc(var(--o, 0) * (100% + var(--sp-gap))), 0, 0);
  will-change: transform;
}

.s-spotlight .sl__frame {
  position: relative;
  aspect-ratio: 1140 / 420;
  border-radius: var(--sp-radius);
  overflow: hidden;
  background: #FAEADD;
  container-type: inline-size;
}
.s-spotlight .sl--2 .sl__frame { background: #0B2A6B; }
.s-spotlight .sl--3 .sl__frame { background: #BFD6FA; }

.s-spotlight .sl__media,
.s-spotlight .sl__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.s-spotlight .sl__media img {
  object-fit: cover;
  -webkit-user-drag: none;
  transform-origin: 60% 50%;
  transform: scale(1);
  transition: transform var(--sp-zoom-dur) var(--sp-hover-ease);
}

.s-spotlight .sl__logo { display: none; }

/* whole banner → the promotion's page on gsb.or.th (slides 1 and 3 only) */
.s-spotlight .sl__link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
}
.s-spotlight .sl__link:focus-visible {
  outline: 3px solid #FFFFFF;
  outline-offset: -7px;
  box-shadow: inset 0 0 0 4px var(--gsb-pink);
  border-radius: var(--sp-radius);
}

/* copy: real text, visually hidden on the designed banners (≥768) */
.s-spotlight .sl__body {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* MyMo button — laid exactly over the designed one, scales with the banner (cqw of 1140) */
.s-spotlight .sl__cta {
  position: absolute;
  z-index: 2;
  left: 4.2105cqw;                        /* 48 / 1140 */
  top: var(--cta-top, 28.2456cqw);        /* 322 / 1140 */
  width: 22.9825cqw;                      /* 262 */
  height: 4.9123cqw;                      /* 56 */
  display: flex;
  align-items: center;
  gap: 0.5263cqw;                         /* 6 */
  padding: 0 0 0 1.7544cqw;               /* 20 */
  border-radius: 1.2281cqw;               /* 14 */
  background: #FFFFFF;
  color: var(--ink);
  font-family: var(--font);
  font-weight: var(--fw-medium);
  font-size: 1.4035cqw;                   /* 16 */
  line-height: 1;
  white-space: nowrap;
  transition: transform 480ms var(--sp-hover-ease);
  -webkit-tap-highlight-color: transparent;
}
.s-spotlight .sl__cta::after {             /* hover shadow, faded in via opacity */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 12px 24px -12px rgba(42, 42, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 480ms var(--sp-hover-ease);
}
.s-spotlight .sl--3 .sl__cta { --cta-top: 25.3509cqw; }  /* 289 / 1140 */
.s-spotlight .sl__cta-icon {
  width: 2.1053cqw;                       /* 24 */
  height: auto;
  flex: none;
  -webkit-user-drag: none;
  transition: transform 520ms var(--sp-hover-ease);
}
.s-spotlight .sl__cta:active { transform: scale(0.985); transition-duration: var(--sp-press-dur); }
.s-spotlight .sl__cta:focus-visible { outline: 3px solid var(--gsb-pink); outline-offset: 3px; border-radius: 1.2281cqw; }

/* ---------- arrows (Figma "Arrow Left/Right": 44×44, #FFF/.95, drop shadow 0 0 4 /.1) ---------- */
.s-spotlight .s-spotlight__arrow {
  position: absolute;
  z-index: 3;
  top: 42.1429%;                          /* 177 / 420 */
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.1);
  transition:
    transform 420ms var(--sp-hover-ease),
    box-shadow 420ms var(--sp-hover-ease),
    color 280ms var(--sp-hover-ease);
  -webkit-tap-highlight-color: transparent;
}
.s-spotlight .s-spotlight__arrow--prev { left: -22px; }
.s-spotlight .s-spotlight__arrow--next { right: -22px; }
.s-spotlight .s-spotlight__arrow svg {
  width: 18.86px;
  height: 18.86px;
  transition: transform 420ms var(--sp-hover-ease);
}
.s-spotlight .s-spotlight__arrow--prev svg { transform: scaleX(-1); }
.s-spotlight .s-spotlight__arrow:active { transform: scale(0.94); transition-duration: var(--sp-press-dur); }
.s-spotlight .s-spotlight__arrow:focus-visible { outline: 2px solid var(--gsb-pink); outline-offset: 3px; border-radius: 50%; }

/* ---------- dots (Figma "Group 48238": 3 × 6px, 52 wide) ----------
   Each dot is a fixed 23×24 button (6px dot + the designed 17px gap → centres 23px
   apart, exactly as designed) and only the pill inside it changes width, growing
   symmetrically about its own centre — so no dot ever moves and a quick second click
   always lands on the dot that was under the pointer. */
.s-spotlight .s-spotlight__dots {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 6px;
  margin-top: 16px;
}
.s-spotlight .s-spotlight__dot {
  position: relative;
  width: 23px;
  height: 24px;
  flex: none;
  -webkit-tap-highlight-color: transparent;
}
.s-spotlight .s-spotlight__pip {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 8.5px;                            /* 6px dot, centred in the button */
  right: 8.5px;
  border-radius: 3px;
  background: var(--line-2);
  transition:
    left 420ms var(--sp-calm),
    right 420ms var(--sp-calm),
    background-color var(--t-med) var(--ease-out);
}
.s-spotlight .s-spotlight__dot.is-active .s-spotlight__pip { background: var(--gsb-pink); }
.s-spotlight .s-spotlight__dot-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--gsb-pink);
  opacity: 0;
}
.s-spotlight .s-spotlight__dot:focus-visible { outline: none; }
.s-spotlight .s-spotlight__dot:focus-visible .s-spotlight__pip { outline: 2px solid var(--gsb-pink); outline-offset: 4px; }

/* live (autoplay) — the active dot becomes a 20px pill whose fill is the countdown;
   it grows about its own centre, so the gaps to its neighbours become 10px (as designed)
   while every dot keeps its place */
.s-spotlight .s-spotlight__carousel.is-live .s-spotlight__dot.is-active .s-spotlight__pip {
  left: 1.5px;
  right: 1.5px;
  background: rgba(237, 0, 140, 0.2);
}
.s-spotlight .s-spotlight__carousel.is-live .s-spotlight__dot.is-active .s-spotlight__dot-fill {
  opacity: 1;
  animation: sp-progress var(--sp-autoplay) linear forwards;
}
.s-spotlight .s-spotlight__carousel.is-live.is-paused .s-spotlight__dot.is-active .s-spotlight__dot-fill { animation-play-state: paused; }
@keyframes sp-progress {
  from { clip-path: inset(0 100% 0 0 round 3px); }
  to   { clip-path: inset(0 0 0 0 round 3px); }
}

/* ---------- pause / play autoplay (only while autoplay runs) ----------
   Absolutely placed just right of the dot group so the dots keep their designed spot. */
.s-spotlight .s-spotlight__toggle {
  display: none;
  position: absolute;
  bottom: -11px;                          /* centred on the 6px dot row */
  left: calc(50% + 26px + 18px);          /* dot group is 52px wide, centred; clear of the active pill */
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--ink-2);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition:
    color var(--t-med) var(--ease-out),
    box-shadow var(--t-med) var(--ease-out),
    transform var(--t-med) var(--ease-out);
}
.s-spotlight .s-spotlight__carousel.is-live .s-spotlight__toggle:not([hidden]) { display: grid; }
.s-spotlight .s-spotlight__toggle::before {  /* 44px touch target */
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
}
.s-spotlight .s-spotlight__toggle svg { grid-area: 1 / 1; transition: opacity 180ms var(--ease-out), transform 240ms var(--ease-out); }
.s-spotlight .s-spotlight__toggle-play { opacity: 0; transform: scale(0.6); }
.s-spotlight .s-spotlight__toggle[aria-pressed="true"] { color: var(--gsb-pink); box-shadow: inset 0 0 0 1px currentColor; }
.s-spotlight .s-spotlight__toggle[aria-pressed="true"] .s-spotlight__toggle-pause { opacity: 0; transform: scale(0.6); }
.s-spotlight .s-spotlight__toggle[aria-pressed="true"] .s-spotlight__toggle-play { opacity: 1; transform: none; }
.s-spotlight .s-spotlight__toggle:active { transform: scale(0.92); transition-duration: 90ms; }
.s-spotlight .s-spotlight__toggle:focus-visible { outline: 2px solid var(--gsb-pink); outline-offset: 3px; }

/* ---------- hover (mouse / trackpad only; never on touch) ----------
   Only a banner that actually links somewhere reacts: a soft shadow bloom behind it
   and a slow ≤1.5% drift of the art inside its mask — no lift, no pop-in overlays.
   Transitions live on the base states above, so hover-out retraces the same curve. */
@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
  .s-spotlight .s-spotlight__stage:has(.sl.is-active .sl__link):hover::after { opacity: 1; }
  .s-spotlight .s-spotlight__stage:has(.sl.is-active .sl__link):hover .sl.is-active .sl__media img {
    transform: scale(1.015);
    will-change: transform;
  }
  /* press: the whole banner (bloom and arrows included) settles in slightly */
  .s-spotlight .s-spotlight__stage:has(.sl.is-active .sl__link:active):not(:has(.is-dragging)) { transform: scale(0.985); }
}
@media (hover: hover) and (pointer: fine) {
  .s-spotlight .sl__cta:hover { transform: translateY(-2px); will-change: transform; }
  .s-spotlight .sl__cta:hover::after { opacity: 1; }
  .s-spotlight .sl__cta:hover .sl__cta-icon { transform: rotate(-6deg) scale(1.06); }
  .s-spotlight .sl__cta:active { transform: scale(0.985); }
  .s-spotlight .s-spotlight__arrow:hover {
    transform: scale(1.06);
    color: var(--gsb-pink);
    box-shadow: 0 10px 24px -10px rgba(42, 42, 42, 0.32), 0 0 4px rgba(0, 0, 0, 0.08);
  }
  .s-spotlight .s-spotlight__arrow--next:hover svg { transform: translateX(1.5px); }
  .s-spotlight .s-spotlight__arrow--prev:hover svg { transform: scaleX(-1) translateX(1.5px); }
  .s-spotlight .s-spotlight__arrow:active { transform: scale(0.94); }
  .s-spotlight .s-spotlight__dot:not(.is-active):hover .s-spotlight__pip { background: #BDBDBD; }
  .s-spotlight .s-spotlight__toggle:hover { color: var(--gsb-pink); box-shadow: inset 0 0 0 1px var(--gsb-pink); }
}

/* ---------- laptop ---------- */
@media (max-width: 1279px) {
  .s-spotlight { padding: 56px 0; }
  .s-spotlight .s-spotlight__title { font-size: 34px; }
}

/* ---------- tablet: banners scale, arrows sit on the banner ---------- */
@media (max-width: 1023px) {
  .s-spotlight { padding: 48px 0; }
  .s-spotlight .s-spotlight__title { font-size: 30px; margin-bottom: 20px; }
  .s-spotlight .s-spotlight__arrow {
    top: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
  }
  .s-spotlight .s-spotlight__arrow--prev { left: -20px; }
  .s-spotlight .s-spotlight__arrow--next { right: -20px; }
}

/* ---------- phone: 4:5 cards, real text, swipe with a peek of the next card ---------- */
@media (max-width: 767px) {
  .s-spotlight {
    --sp-radius: 20px;
    --sp-gap: 16px;                       /* = gutter, so the previous card never peeks on the left */
    --sp-peek: 28px;
    padding: 40px 0 36px;
  }
  .s-spotlight .s-spotlight__title { font-size: 26px; margin-bottom: 16px; }
  .s-spotlight .s-spotlight__viewport {
    margin: -6px calc(-1 * var(--gutter)) -22px;
    padding: 6px var(--gutter) 22px;       /* room for the card shadow */
    border-radius: 0;
    overflow: hidden;
    transform: none;
  }
  .s-spotlight .s-spotlight__track { width: calc(100% - var(--sp-peek)); }
  /* 4:5 card; if the copy needs more room the card grows (grid: ::before holds the 4:5
     minimum, the copy sits in the same cell) and the art stays anchored to the bottom
     over the slide's own top colour. */
  .s-spotlight .sl__frame {
    aspect-ratio: auto;
    display: grid;
    height: 100%;
    background: var(--sl-top);
    box-shadow: 0 12px 28px -16px rgba(42, 42, 42, 0.45);
  }
  .s-spotlight .sl__frame::before { content: ""; grid-area: 1 / 1; padding-top: 125%; }  /* 4:5 minimum */
  .s-spotlight .sl--1 { --sl-top: #9B0862; --art-reserve: 70%; }
  .s-spotlight .sl--2 { --sl-top: #020F37; --art-reserve: 68%; }
  .s-spotlight .sl--3 { --sl-top: #34A1FB; --art-reserve: 72%; }
  .s-spotlight .sl--2 .sl__frame,
  .s-spotlight .sl--3 .sl__frame { background: var(--sl-top); }
  .s-spotlight .sl__media { top: auto; height: auto; aspect-ratio: 4 / 5; }
  .s-spotlight .sl__media img {
    transform-origin: 50% 50%;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 7%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 7%);
  }
  .s-spotlight .sl:not(.is-active) .sl__frame { cursor: pointer; }
  .s-spotlight .sl__logo {
    display: block;
    position: absolute;
    z-index: 2;
    top: 0;
    right: 4.5%;
    width: 12.2%;
    height: auto;
    pointer-events: none;
  }

  .s-spotlight .sl__body {
    position: relative !important;
    grid-area: 1 / 1;
    z-index: 2;
    width: auto; height: auto; margin: 0; clip: auto; overflow: visible; white-space: normal;
    --sl-pad: 20px;
    padding: var(--sl-pad) var(--sl-pad) var(--art-reserve);  /* % of card width: keeps the art's subject clear */
    pointer-events: none;
    color: #FFFFFF;
  }
  .s-spotlight .sl--dark .sl__body { color: var(--ink); }
  .s-spotlight .sl--light .sl__body { text-shadow: 0 1px 14px rgba(0, 0, 0, 0.22); }
  .s-spotlight .sl__title {
    font-size: 23px;
    font-weight: var(--fw-semibold);
    line-height: 1.3;
    text-wrap: balance;
  }
  /* Clear the ออมสิน logo tab (top 0, right 4.5cqw, 12.2cqw wide, 92/78 as tall): a float the
     size of the tab's footprint inside the copy box, so only the lines level with the tab
     wrap early — the title's first line(s), or the description when a short title leaves it
     up there (≈600–767px) — and everything below keeps the full card width. */
  .s-spotlight .sl--1 .sl__body::before,
  .s-spotlight .sl--3 .sl__body::before {
    content: "";
    float: right;
    width: calc(16.7cqw - var(--sl-pad) + 10px);
    height: calc(14.39cqw - var(--sl-pad) + 4px);
  }
  .s-spotlight .sl__nb { white-space: nowrap; }
  .s-spotlight .sl__desc {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.45;
    font-weight: var(--fw-regular);
  }
  .s-spotlight .sl__desc strong { font-weight: var(--fw-bold); }
  .s-spotlight .sl__date {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.2;
    font-weight: var(--fw-bold);
  }
  .s-spotlight .sl__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
  }
  .s-spotlight .sl__brand img:first-child { width: 36px; height: auto; }
  .s-spotlight .sl__brand img:last-child { width: 76px; height: auto; }
  .s-spotlight .sl--2 .sl__title { font-size: 20px; }
  .s-spotlight .sl--2 .sl__desc { font-size: 14px; opacity: 0.92; }

  .s-spotlight .s-spotlight__stage::after { display: none; }   /* phone cards carry their own shadow */
  .s-spotlight .sl__cta {
    left: 16px;
    right: auto;
    top: auto;
    bottom: 16px;
    width: auto;
    height: 48px;
    display: inline-flex;
    gap: 8px;
    padding: 0 12px 0 18px;
    border-radius: 14px;
    font-size: 15px;
    box-shadow: 0 10px 24px -10px rgba(42, 42, 42, 0.5);
  }
  .s-spotlight .sl__cta-icon { width: 26px; }
  .s-spotlight .sl__cta:focus-visible { border-radius: 14px; }

  .s-spotlight .s-spotlight__arrow { display: none; }
  .s-spotlight .s-spotlight__dots { margin-top: 16px; }
  .s-spotlight .s-spotlight__dot::before {       /* 44px tall touch target */
    content: "";
    position: absolute;
    inset: -10px 0;
  }
}

@media (max-width: 479px) {
  .s-spotlight { --sp-peek: 24px; }
  .s-spotlight .sl__body { --sl-pad: 18px; }
  .s-spotlight .sl__title { font-size: 21px; }
  .s-spotlight .sl--2 .sl__title { font-size: 18px; }
  .s-spotlight .sl__desc { font-size: 13px; }
  .s-spotlight .sl__cta { font-size: 14px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  /* no movement: the art stays still, only the shadow fades (quickly) */
  .s-spotlight .sl__media img,
  .s-spotlight .s-spotlight__stage:has(.sl.is-active .sl__link):hover .sl.is-active .sl__media img { transform: none; transition: none; }
  .s-spotlight .s-spotlight__stage,
  .s-spotlight .s-spotlight__stage:has(.sl.is-active .sl__link:active):not(:has(.is-dragging)) { transform: none; transition: none; }
  .s-spotlight .s-spotlight__stage::after,
  .s-spotlight .sl__cta::after { transition-duration: 200ms; }
  .s-spotlight .sl__cta,
  .s-spotlight .sl__cta:hover,
  .s-spotlight .sl__cta-icon,
  .s-spotlight .sl__cta:hover .sl__cta-icon { transform: none; transition: none; }
}
