/*
 * KosaQ — dynamic storefront pieces: announcement ticker, hero slider,
 * trending rail, category band, swipe rows and "recently bought" pop-ups.
 * Motion pauses on hover / touch and stops for "reduce motion" devices.
 */

/* ---------- announcement ticker ---------- */
.ticker { display: flex; overflow: hidden; white-space: nowrap; -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker__track { display: flex; flex-shrink: 0; gap: 48px; margin: 0; padding: 9px 24px 9px 0; list-style: none; animation: kq-marquee 42s linear infinite; }
.ticker__track li { display: inline-flex; align-items: center; gap: 8px; }
.ticker__track svg { color: var(--gold); flex-shrink: 0; }
.ticker:hover .ticker__track, .ticker:focus-within .ticker__track { animation-play-state: paused; }
@keyframes kq-marquee { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ---------- hero slider ---------- */
.hero-carousel { margin-top: 28px; position: relative; }
.hero-carousel .hero { margin-top: 0; }
.hero-carousel .carousel-inner { border-radius: 28px; }
.hero-carousel .carousel-item { transition: transform .8s cubic-bezier(.22, .8, .25, 1); }
.hero-carousel.carousel-fade .carousel-item { transition: opacity .6s ease; }
.hero-carousel .carousel-item > * { height: 100%; }

.promo-slide { position: relative; overflow: hidden; height: 100%; min-height: 520px; border-radius: 28px; padding: clamp(28px, 4vw, 56px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(20px, 4vw, 56px); align-items: center; }
.promo-slide--dark  { background: var(--black); color: var(--ivory); }
.promo-slide--dark .eyebrow { color: var(--gold); }
.promo-slide--gold  { background: linear-gradient(135deg, var(--gold-light), #E6D29C); color: var(--black); }
.promo-slide--gold .eyebrow, .promo-slide--ivory .eyebrow { color: var(--gold-dark); }
.promo-slide--ivory { background: var(--surface); border: 1px solid var(--border); color: var(--black); }
.promo-slide__ring { position: absolute; left: -12%; bottom: -30%; width: 46%; aspect-ratio: 1; border-radius: 50%; border: clamp(18px, 3vw, 34px) solid var(--gold); opacity: .3; pointer-events: none; }
.promo-slide--ivory .promo-slide__ring { opacity: .18; }
.promo-slide__copy { position: relative; z-index: 1; max-width: 460px; }
.promo-slide__copy h2 { font-size: clamp(2.2rem, 4.2vw, 3.5rem); letter-spacing: -0.03em; line-height: 1.02; margin: 6px 0 14px; }
.promo-slide__copy p { font-size: 1.0625rem; opacity: .92; }
.promo-slide__cta { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 22px; }
.promo-slide__tag { display: inline-flex; padding: 6px 14px; border-radius: 999px; background: var(--gold); color: var(--black); font-weight: 700; }
.promo-slide__stack { position: relative; z-index: 1; width: 100%; max-width: 380px; justify-self: end; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.promo-slide__tile { display: block; aspect-ratio: 1; border-radius: 20px; overflow: hidden; background: #26241f; }
.promo-slide__tile:nth-child(even) { transform: translateY(22px); }
.promo-slide__tile img { width: 100%; height: 100%; object-fit: cover; }
.promo-slide__cards { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.promo-card { display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); color: var(--black); text-decoration: none; box-shadow: 0 18px 40px -24px rgba(17, 17, 17, .35); }
.promo-card:nth-child(2) { transform: translateY(-18px); }
.promo-card__img { display: block; aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden; }
.promo-card__img img { width: 100%; height: 100%; object-fit: cover; }
.promo-card strong { font-size: .95rem; line-height: 1.25; }
.promo-card span:last-child { font-weight: 700; }
.promo-card s { color: var(--text2); font-weight: 400; margin-left: 4px; }
.promo-card:hover { color: var(--black); border-color: var(--gold); }

.hero-controls { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 999px; background: rgba(17, 17, 17, .55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.hero-arrow { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 0; background: transparent; color: var(--ivory); font-size: 1.5rem; line-height: 1; cursor: pointer; transition: background-color .2s, color .2s; }
.hero-arrow:hover { background: var(--gold); color: var(--black); }
.hero-dots.carousel-indicators { position: static; margin: 0; gap: 6px; display: flex; align-items: center; }
.hero-dots [data-bs-target] { box-sizing: content-box; width: 8px; height: 8px; margin: 0; padding: 0; border: 0; border-radius: 999px; background: var(--ivory); opacity: .5; text-indent: 0; transition: width .35s ease, opacity .35s ease, background-color .35s; }
.hero-dots [data-bs-target].active { width: 28px; opacity: 1; background: var(--gold); }
.hero-progress { position: absolute; left: 0; right: 0; top: 0; z-index: 5; height: 3px; pointer-events: none; }
.hero-progress span { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 0 3px 3px 0; }
.hero-progress.is-running span { animation: kq-progress var(--hero-interval, 6.5s) linear forwards; }
.hero-carousel:hover .hero-progress span { animation-play-state: paused; }
@keyframes kq-progress { to { width: 100%; } }

/* ---------- trending rail ---------- */
.live-dot { display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%; background: #2DBE6C; vertical-align: middle; box-shadow: 0 0 0 0 rgba(45, 190, 108, .5); animation: kq-live 1.8s ease-out infinite; }
@keyframes kq-live { to { box-shadow: 0 0 0 10px rgba(45, 190, 108, 0); } }
.trend-rail { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; cursor: grab; -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); outline: none; }
.trend-rail::-webkit-scrollbar { display: none; }
.trend-rail.is-dragging { cursor: grabbing; user-select: none; }
.trend-rail:focus-visible { box-shadow: 0 0 0 3px var(--bs-focus-ring-color, rgba(201, 161, 59, .35)); border-radius: 20px; }
.trend-rail__track { display: flex; gap: 16px; width: max-content; padding: 6px 2px 10px; }
.trend-item { position: relative; display: flex; align-items: center; gap: 14px; width: 300px; padding: 10px 16px 10px 10px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); color: var(--black); text-decoration: none; transition: border-color .25s, transform .25s, box-shadow .25s; }
.trend-item:hover { border-color: var(--gold); transform: translateY(-3px); box-shadow: var(--shadow-gold); color: var(--black); }
.trend-item__img { flex-shrink: 0; width: 84px; height: 84px; border-radius: 14px; overflow: hidden; }
.trend-item__img img { width: 100%; height: 100%; object-fit: cover; }
.trend-item__img .img-placeholder span { font-size: 1.6rem; }
.trend-item__img .img-placeholder small { display: none; }
.trend-item__rank { position: absolute; left: 4px; top: 4px; padding: 2px 8px; border-radius: 999px; background: var(--black); color: var(--gold); font-size: .72rem; font-weight: 700; }
.trend-item__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.trend-item__text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trend-item__text > span { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.trend-item .shop-tag { position: static; }

/* ---------- category band ---------- */
.cat-band { display: flex; overflow: hidden; margin-top: clamp(48px, 7vw, 88px); padding: 22px 0; border-radius: 24px; background: var(--black); -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.cat-band__track { display: flex; flex-shrink: 0; align-items: center; gap: 0; margin: 0; padding: 0; list-style: none; animation: kq-marquee 55s linear infinite; }
.cat-band__track li { display: inline-flex; align-items: center; }
.cat-band__track a { font-family: var(--font-head); font-size: clamp(1.6rem, 3.6vw, 2.8rem); font-weight: 700; letter-spacing: -0.02em; color: var(--ivory); text-decoration: none; white-space: nowrap; padding: 0 22px; transition: color .2s; }
.cat-band__track a.tone-gold { color: var(--gold); }
.cat-band__track a:hover { color: var(--gold); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
.cat-band__track span { color: var(--gold); font-size: 1.2rem; }
.cat-band:hover .cat-band__track, .cat-band:focus-within .cat-band__track { animation-play-state: paused; }
.cat-band__track:nth-child(2) { animation-name: kq-marquee; }

/* ---------- recently bought pop-up ---------- */
.recent-buy { position: fixed; left: 20px; bottom: 20px; z-index: 65; display: flex; align-items: center; gap: 12px; max-width: min(360px, calc(100vw - 40px)); padding: 12px 40px 12px 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 18px 40px -16px rgba(17, 17, 17, .35); transform: translateY(16px); opacity: 0; transition: transform .45s cubic-bezier(.22, .8, .25, 1), opacity .35s; }
.recent-buy.is-shown { transform: none; opacity: 1; }
.recent-buy__icon { flex-shrink: 0; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--gold-light); color: var(--gold-dark); }
.recent-buy__text { margin: 0; font-size: .875rem; line-height: 1.35; }
.recent-buy__text strong { display: block; }
.recent-buy__text small { color: var(--text2); }
.recent-buy__close { position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--text2); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.recent-buy__close:hover { background: var(--ivory-deep); color: var(--black); }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .promo-slide { grid-template-columns: minmax(0, 1fr); align-content: center; }
  .promo-slide__stack { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: none; justify-self: stretch; }
  .promo-slide__tile:nth-child(even) { transform: none; }
}
@media (max-width: 767px) {
  .announce .ticker__track { padding-top: 8px; padding-bottom: 8px; font-size: .78rem; gap: 36px; animation-duration: 34s; }
  .hero-carousel .carousel-inner { border-radius: 24px; }
  .promo-slide { padding: 26px 22px 72px; border-radius: 24px; }
  .promo-slide__cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .promo-card { padding: 6px 6px 10px; border-radius: 14px; }
  .promo-card strong { font-size: .78rem; }
  .promo-card span:last-child { font-size: .78rem; }
  .promo-card s { display: none; }
  .promo-card:nth-child(2) { transform: none; }
  .promo-slide__stack { gap: 8px; }
  .hero-controls { bottom: 14px; }
  .trend-item { width: 260px; }
  .trend-item__img { width: 70px; height: 70px; }
  .recent-buy { left: 12px; right: 84px; bottom: 84px; max-width: none; }

  /* product rows become swipeable on phones */
  .product-grid--swipe { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: 2px; padding: 4px 2px 12px; margin-right: calc(-1 * clamp(16px, 4vw, 48px)); scrollbar-width: none; }
  .product-grid--swipe::-webkit-scrollbar { display: none; }
  .product-grid--swipe > * { flex: 0 0 72%; scroll-snap-align: start; }
}

/* Devices set to "reduce motion": no auto-scrolling; the ticker and band wrap instead */
@media (prefers-reduced-motion: reduce) {
  .ticker, .cat-band { -webkit-mask-image: none; mask-image: none; }
  .ticker { justify-content: center; white-space: normal; }
  .ticker__track { animation: none; flex-wrap: wrap; justify-content: center; gap: 6px 28px; padding: 9px 16px; }
  .ticker__track[aria-hidden], .cat-band__track[aria-hidden] { display: none; }
  .cat-band { flex-wrap: wrap; }
  .cat-band__track { animation: none; flex-wrap: wrap; justify-content: center; row-gap: 8px; }
  .live-dot { animation: none; }
  .hero-progress { display: none; }
}

/* phones: each shop panel is its own slide */
@media (max-width: 767px) {
  .hero-carousel .hero-panel { min-height: 0; height: 100%; padding-bottom: 76px; }
  .hero-carousel .hero { height: 100%; }
}
.hero-carousel .carousel-item.active, .hero-carousel .carousel-item-next, .hero-carousel .carousel-item-prev { display: flex; }
.hero-carousel .carousel-item > * { flex: 1 1 auto; width: 100%; }
@media (max-width: 767px) {
  .promo-slide__tile .img-placeholder small, .promo-card__img .img-placeholder small { display: none; }
  .promo-slide__tile .img-placeholder span, .promo-card__img .img-placeholder span { font-size: 1.6rem; }
}
