/* =================================================================
   App — "บริการแนะนำ / เริ่มต้นการเงินที่ดี เริ่มต้นที่ออมสิน"
   (Figma "App", 1440×717). Horizontal card carousel with peek.
   ================================================================= */
.s-app {
  /* shared by cards, go buttons and the floating arrows (the arrows sit outside
     .app-slide, so these must live on the section or their transitions drop out) */
  --app-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --app-dur: 560ms;
  --app-card-h: 410px;
  --app-card-w: 366px;
  --app-card-w-wide: 560px;
  --app-gap: 20px;
  --app-radius: 16px;
  position: relative;
  padding: 80px 0;
  background: #fff;
  overflow: hidden;
}

/* ---------- heading ---------- */
.s-app .app-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.s-app .app-eyebrow {
  font-size: 14px;
  line-height: 1.4;
  min-height: 20px;
  color: var(--gsb-pink);
}
.s-app .app-title {
  min-height: 47px;
  font-size: 36px;
  line-height: 1.3;
  font-weight: var(--fw-semibold);
  color: var(--ink);
}

.s-app .app-nb { display: inline-block; }

/* ---------- carousel ---------- */
.s-app .app-carousel {
  position: relative;
  margin-top: 32px;
}
.s-app .app-track {
  display: flex;
  gap: var(--app-gap);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  /* align the first card with .container at any width (centred beyond 1440) */
  scroll-padding-inline: max(var(--gutter), calc((100% - var(--container)) / 2));
  padding-inline: max(var(--gutter), calc((100% - var(--container)) / 2));
  /* room for the hover lift + shadow without clipping */
  padding-block: 12px 28px;
  margin-block: -12px -28px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}
.s-app .app-track::-webkit-scrollbar { display: none; }
.s-app .app-track.is-dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; }
/* Only once the pointer has really moved (app.js sets .is-moved past 4px):
   a plain mouse click must still land on the <a class="app-card">. */
.s-app .app-track.is-dragging.is-moved .app-card { pointer-events: none; }
.s-app .app-track:focus-visible { outline: none; }
.s-app .app-track:focus-visible .app-slide.is-active .app-card {
  outline: 2px solid var(--gsb-pink);
  outline-offset: 3px;
}

.s-app .app-slide {
  position: relative;
  flex: 0 0 auto;
  width: var(--app-card-w);
  scroll-snap-align: start;
  display: flex;
}
.s-app .app-slide:first-child { width: var(--app-card-w-wide); }
/* Hover shadow on its own layer (the card clips its overflow), riding along with the
   card's lift; only opacity + transform animate — never box-shadow itself. */
.s-app .app-slide::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--app-radius);
  box-shadow: 0 22px 40px -24px rgba(42, 42, 42, 0.34), 0 6px 14px -10px rgba(42, 42, 42, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--app-dur) var(--app-ease), transform var(--app-dur) var(--app-ease);
}
/* the last card can't reach the start edge — let it snap to the end */
.s-app .app-slide:last-child { scroll-snap-align: end; }

/* ---------- card ---------- */
.s-app .app-card {
  --px: 0;
  --py: 0;
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  height: var(--app-card-h);
  border-radius: var(--app-radius);
  overflow: hidden;
  color: var(--ink);
  background: #f7eee7;
  transform: translateZ(0);
  -webkit-user-drag: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--app-dur) var(--app-ease);
}
.s-app .app-card:focus-visible { outline: 2px solid var(--gsb-pink); outline-offset: 3px; border-radius: var(--app-radius); }

.s-app .app-card__art {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.s-app .app-card__art--top { z-index: 3; }
.s-app .app-art {
  position: absolute;
  display: block;
  max-width: none;
  transition: transform 700ms var(--app-ease);
  will-change: transform;
}
.s-app .app-art[data-depth="1"] { transform: translate3d(calc(var(--px) * 6px), calc(var(--py) * 5px), 0); }
.s-app .app-art[data-depth="2"] { transform: translate3d(calc(var(--px) * 12px), calc(var(--py) * 10px), 0); }

.s-app .app-card__body {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 32px;
}
.s-app .app-card__eyebrow {
  font-size: 14px;
  line-height: 1.4;
  color: var(--gsb-pink);
}
.s-app .app-card__eyebrow { min-height: 20px; }
.s-app .app-card__eyebrow--sm { font-size: 12px; min-height: 17px; }
.s-app .app-card__title {
  min-height: 31px;
  font-size: 24px;
  line-height: 1.3;
  font-weight: var(--fw-semibold);
  color: var(--ink);
}
.s-app .app-card__desc {
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-2);
}
.s-app .app-card--light .app-card__eyebrow,
.s-app .app-card--light .app-card__title,
.s-app .app-card--light .app-card__desc { color: #fff; }

/* the 44×44 "go" button */
.s-app .app-go {
  position: absolute;
  z-index: 2;
  left: 32px;
  top: 334px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #ededed;
  color: var(--ink);
  transition:
    background-color 480ms var(--app-ease),
    box-shadow 480ms var(--app-ease),
    color 480ms var(--app-ease),
    transform 480ms var(--app-ease);
}
.s-app .app-card--aomunity .app-go { box-shadow: inset 0 0 0 1px #ebebeb; }
.s-app .app-go__icon { width: 18px; height: 18px; transition: transform var(--app-dur) var(--app-ease); }

/* ---- card 1: CoachAom (cream) ---- */
.s-app .app-card--coach { background: #f7eee7; }
.s-app .app-art--coach-swirl { left: -237px; top: -40px; width: 799px; height: 450px; }
.s-app .app-art--coach-phone { left: 202px; top: 13px; width: 395px; height: 389px; }

/* ---- card 2: Aomunity (blue sky) ---- */
.s-app .app-card--aomunity { background: #ffeef8; }
.s-app .app-art--aom-scene { left: -181px; top: -11px; width: 582px; height: 447px; }
.s-app .app-art--aom-logo { left: 241px; top: 202px; width: 61px; height: 13px; }

/* ---- card 3: GSB NOW (LINE Official) ---- */
.s-app .app-card--now { background: linear-gradient(217deg, #ffeeff 0%, #ff42b0 100%); }
.s-app .app-art--now-bg { left: -9px; top: -15px; width: 486px; height: 486px; }
.s-app .app-art--now-phone { left: 139px; top: 147px; width: 221px; height: 332px; }
.s-app .app-art--now-robot { left: 45px; top: 216px; width: 169px; height: 148px; }

/* ---- card 4: MyMo (pink tint) ---- */
.s-app .app-card--mymo { background: linear-gradient(160deg, #fff4fa 0%, #ffe3f2 55%, #ffc9e6 100%); }
.s-app .app-art--mymo-glow {
  right: -90px;
  bottom: -110px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(237, 0, 140, 0.22), rgba(237, 0, 140, 0));
}
.s-app .app-art--mymo-phone { left: 96px; top: 146px; width: 280px; height: 299px; }

/* ---- card 5: financial tips (photo grid) ---- */
.s-app .app-card--tips { background: linear-gradient(137.6deg, #fbf5f9 3.9%, #f0ddea 89.7%); }
.s-app .app-tips {
  position: absolute;
  left: 32px;
  top: 178.37px;
  display: grid;
  grid-template-columns: repeat(2, 184.9px);
  grid-auto-rows: 109.57px;
  gap: 16.2px;
}
.s-app .app-tips__cell {
  position: relative;
  overflow: hidden;
  border-radius: 9.93px;
  background: #d9d9d9;
}
.s-app .app-tips__cell img {
  position: absolute;
  max-width: none;
  transition: transform 720ms var(--app-ease);
}

/* ---------- hover / press ---------- */
@media (hover: hover) and (pointer: fine) {
  .s-app .app-slide:hover::before { opacity: 1; transform: translateY(-4px); }
  .s-app .app-card:hover { transform: translateY(-4px); }
  .s-app .app-card:hover .app-art--coach-swirl,
  .s-app .app-card:hover .app-art--now-bg { transform: scale(1.03); }
  .s-app .app-card:hover .app-art--aom-scene { transform: translate3d(calc(var(--px) * 6px), calc(var(--py) * 5px), 0) scale(1.03); }
  .s-app .app-card:hover .app-tips__cell img { transform: scale(1.03); }
  .s-app .app-card:hover:active { transform: translateY(-4px) scale(0.985); }
  .s-app .app-slide:hover:has(.app-card:active)::before { transform: translateY(-4px) scale(0.985); }
}
@media (hover: hover) and (pointer: fine) {
  .s-app .app-card:hover .app-go {
    background: var(--gsb-pink);
    color: #fff;
    box-shadow: inset 0 0 0 1px var(--gsb-pink), var(--shadow-pink);
  }
  .s-app .app-card:hover .app-go__icon { transform: translateX(3px); }
}
.s-app .app-card:active { transform: scale(0.985); transition-duration: 160ms; }
.s-app .app-slide:has(.app-card:active)::before { transition-duration: 160ms; }
.s-app .app-card:active .app-go { transform: scale(0.94); transition-duration: 160ms; }

/* ---------- floating prev / next (appear on hover / keyboard focus) ---------- */
.s-app .app-nav {
  position: absolute;
  top: calc(var(--app-card-h) / 2 - 26px);
  z-index: 5;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 10px 24px -10px rgba(42, 42, 42, 0.35), inset 0 0 0 1px rgba(42, 42, 42, 0.06);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9);
  transition:
    opacity var(--t-med) var(--ease-out),
    transform var(--t-med) var(--ease-out),
    background-color var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out),
    visibility 0s linear var(--t-med);
}
.s-app .app-nav .app-go__icon { width: 22px; height: 22px; }
.s-app .app-nav--prev { left: max(16px, calc(max(var(--gutter), (100% - var(--container)) / 2) - 26px)); }
.s-app .app-nav--prev .app-go__icon { transform: scaleX(-1) translateX(0); }
.s-app .app-nav--next { right: max(24px, calc((100% - var(--container)) / 2 - 26px)); }
.s-app .app-carousel:focus-within .app-nav:not(:disabled) {
  opacity: 1; visibility: visible; transform: none;
  transition-delay: 0s;
}
@media (hover: hover) and (pointer: fine) {
  .s-app .app-carousel:hover .app-nav:not(:disabled) {
    opacity: 1; visibility: visible; transform: none;
    transition-delay: 0s;
  }
  .s-app .app-nav:hover { background: var(--gsb-pink); color: #fff; }
  .s-app .app-nav--next:hover .app-go__icon { transform: translateX(2px); }
  .s-app .app-nav--prev:hover .app-go__icon { transform: scaleX(-1) translateX(2px); }
}
.s-app .app-carousel .app-nav:active { transform: scale(0.94); }
.s-app .app-nav:disabled { opacity: 0; visibility: hidden; pointer-events: none; }
.s-app .app-nav:focus-visible { outline: 2px solid var(--gsb-pink); outline-offset: 3px; border-radius: 50%; }

/* ---------- dots ---------- */
.s-app .app-foot { margin-top: 32px; }
.s-app .app-dots {
  display: flex;
  align-items: center;
  height: 6px;
  margin-left: -8.5px;
}
.s-app .app-dot {
  position: relative;
  flex: none;
  width: 23px;
  height: 32px;
  margin-block: -13px;
  border-radius: 0;
}
.s-app .app-dot::before {
  content: "";
  position: absolute;
  left: 8.5px;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d9d9d9;
  transition: background-color var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-spring);
}
.s-app .app-dot.is-active::before { background: var(--gsb-pink); transform: scale(1.25); }
@media (hover: hover) and (pointer: fine) {
  .s-app .app-dot:not(.is-active):hover::before { background: #f59ccc; transform: scale(1.3); }
}
.s-app .app-dot:focus-visible { outline: none; }
.s-app .app-dot:focus-visible::before { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--gsb-pink); }
html.static .s-app .app-dot.is-active::before { transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1279px) {
  .s-app { padding: 72px 0; }
}

@media (max-width: 1023px) {
  .s-app { --app-card-w-wide: 520px; padding: 64px 0; }
  .s-app .app-title { font-size: 32px; }
  .s-app .app-art--coach-phone { left: 170px; }
  .s-app .app-art--coach-swirl { left: -260px; }
}

@media (max-width: 767px) {
  .s-app {
    --app-card-w: min(320px, calc(100vw - 2 * var(--gutter) - 40px));
    --app-card-w-wide: var(--app-card-w);
    --app-card-h: 420px;
    --app-gap: 12px;
    padding: 56px 0;
  }
  .s-app .app-head { gap: 6px; }
  .s-app .app-title { font-size: 26px; line-height: 1.35; }
  .s-app .app-carousel { margin-top: 24px; }
  .s-app .app-track { cursor: auto; }
  .s-app .app-card__body { padding: 24px; gap: 10px; }
  .s-app .app-card__title { font-size: 22px; }
  .s-app .app-go { left: 24px; top: auto; bottom: 24px; }
  .s-app .app-nav { display: none; }
  .s-app .app-foot { margin-top: 24px; }
  /* bigger touch targets for the dots */
  .s-app .app-dots { margin-left: -11px; }
  .s-app .app-dot { width: 28px; height: 44px; margin-block: -19px; }
  .s-app .app-dot::before { left: 11px; top: 19px; }

  /* card 1: phone bottom-right, smaller */
  .s-app .app-art--coach-swirl { left: -330px; top: 60px; }
  .s-app .app-art--coach-phone { left: auto; right: -52px; top: auto; bottom: -10px; width: 280px; height: 276px; }
  /* card 2 */
  .s-app .app-art--aom-scene { left: -150px; top: 0; width: 546px; height: 420px; }
  .s-app .app-art--aom-logo { left: 244px; top: 208px; width: 57px; height: 12px; }
  /* card 3 */
  .s-app .app-art--now-bg { left: -40px; top: -20px; width: 500px; height: 500px; }
  .s-app .app-art--now-phone { left: auto; right: -40px; top: 170px; width: 200px; height: 300px; }
  .s-app .app-art--now-robot { left: auto; right: 118px; top: 236px; width: 150px; height: 131px; }
  /* card 4 */
  .s-app .app-art--mymo-phone { left: auto; right: -12px; top: auto; bottom: -28px; width: 250px; height: 267px; }
  /* card 5 */
  .s-app .app-tips { left: 24px; top: auto; bottom: 80px; transform: scale(0.82); transform-origin: left bottom; }
}

@media (max-width: 359px) {
  .s-app .app-title { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .s-app .app-art { transition: none; transform: none !important; }
  .s-app .app-card:hover,
  .s-app .app-card:active,
  .s-app .app-slide:hover::before,
  .s-app .app-card:hover .app-tips__cell img { transform: none; }
}
