/* ============================================================
   團購平台｜首頁、團購頁、團購卡：像逛電商一樣
   跟開團的畫面（open.css）同一個調性：白底卡片＋商品圖（shots.js）、熱賣紅的價格（--c-hot）。
   按鈕、價格、橫幅、商品圖庫、價格帶、排序、動作列沿用 open.css 的 op- 元件；
   這裡放團購卡（gcard、gt-、gf-）、首頁（hm-）、團購頁（gp-）自己的。
   動畫在 prefers-reduced-motion: reduce 時關掉。
   ============================================================ */

/* ---------- 團購卡：一行一團（圈子頁、檔期頁） ---------- */
.glist { display: grid; gap: 10px; }
.gcard { display: flex; gap: 12px; padding: 10px; background: var(--c-surface); border-radius: var(--r-lg); box-shadow: var(--sh-card); text-decoration: none; color: var(--c-ink); }
.gthumb { position: relative; width: 92px; flex: none; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--c-surface-2); }
.gthumb-more { position: absolute; right: 4px; bottom: 4px; padding: 0 7px; border-radius: var(--r-pill); background: rgba(22, 24, 29, .72); color: #fff; font-size: 11px; font-weight: 700; }
.gbody { min-width: 0; flex: 1; display: grid; gap: 3px; align-content: start; }
.gtitle { font-size: var(--f-sm); font-weight: 700; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gmeta { font-size: var(--f-xs); color: var(--c-ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard .op-price { font-size: 17px; }
.gleft { font-size: var(--f-xs); font-weight: 700; color: var(--c-ink-2); white-space: nowrap; }
.gleft.is-soon { color: var(--c-hot); }
.ghot { font-size: var(--f-xs); color: var(--c-hot); font-weight: 700; }

/* ---------- 團購卡：兩欄的格子（首頁） ---------- */
.gt { display: grid; align-content: start; background: var(--c-surface); border-radius: 12px; overflow: hidden; box-shadow: var(--sh-card); text-decoration: none; color: var(--c-ink); }
.gt-img { position: relative; aspect-ratio: 1; overflow: hidden; }
.gt-left {
  position: absolute; left: 6px; top: 6px; display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px 3px 6px;
  border-radius: var(--r-pill); background: rgba(22, 24, 29, .74); color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.gt-left svg { width: 12px; height: 12px; }
.gt-left.is-soon { background: var(--c-hot); }
.gt-st { position: absolute; left: 6px; top: 6px; }
.gt-more {
  position: absolute; right: 6px; bottom: 6px; padding: 1px 8px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .94);
  color: var(--c-ink); font-size: 11px; font-weight: 700; box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.gt-body { min-width: 0; display: grid; gap: 4px; padding: 8px 10px 10px; }
.gt-name { min-height: 2.8em; font-size: 13px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gt-row { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; min-width: 0; }
.gt .op-price { font-size: 17px; }
.gt-sold { flex: none; font-size: 11px; color: var(--c-ink-soft); white-space: nowrap; }
.gt-hot {
  justify-self: start; max-width: 100%; padding: 2px 7px; border-radius: 4px; background: var(--c-hot-050); color: var(--c-hot);
  font-size: 11px; font-weight: 700; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gt-by { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 11px; color: var(--c-ink-soft); }
.gt-av { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--c-ink-2); color: #fff; font-size: 10px; font-weight: 700; }

/* ---------- 團購卡：快成團的橫滑小卡 ---------- */
.gf { scroll-snap-align: start; display: grid; align-content: start; background: var(--c-surface); border: 1px solid var(--c-line-2); border-radius: 10px; overflow: hidden; text-decoration: none; color: var(--c-ink); }
.gf-img { position: relative; aspect-ratio: 1; overflow: hidden; }
.gf-badge {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 4px; background: rgba(185, 38, 23, .94); color: #fff;
  font-size: 11px; font-weight: 800; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gf-body { min-width: 0; display: grid; gap: 2px; padding: 6px 8px 8px; }
.gf-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gf-price { display: flex; align-items: baseline; gap: 3px; }
.gf-price > small { font-size: 11px; font-weight: 700; color: var(--c-hot); }
.gf .op-price { font-size: 16px; }
.gf-left { font-size: 11px; color: var(--c-ink-soft); }
.gf-left.is-soon { color: var(--c-hot); font-weight: 700; }

/* ---------- 首頁 ---------- */
.hm-search { margin-right: 0; }
.hm-search .sr-only { position: absolute; }
.hm-scope {
  display: flex; align-items: center; gap: 4px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: var(--r-lg);
  background: var(--c-surface); box-shadow: var(--sh-card); color: var(--c-ink); font-size: var(--f-sm); text-align: left; cursor: pointer;
}
.hm-scope svg { width: 16px; height: 16px; flex: none; color: var(--c-ink-soft); }
.hm-scope > svg:first-child { width: 18px; height: 18px; color: var(--c-hot); }
.hm-scope-k { flex: none; color: var(--c-ink-soft); }
.hm-scope b { min-width: 0; font-weight: 800; }
.hm-scope-n { flex: none; margin-left: auto; padding-left: 8px; color: var(--c-hot); font-size: var(--f-xs); font-weight: 700; white-space: nowrap; }
.hm-scope:focus-visible, .hm-cat:focus-visible, .gp-pick:focus-visible, .gp-fact:focus-visible, .gp-lead:focus-visible, .hm-explore:focus-visible { outline: 3px solid rgba(210, 51, 31, .4); outline-offset: 2px; }

.hm-cats {
  display: grid; grid-auto-flow: column; grid-auto-columns: 62px; gap: 2px; overflow-x: auto; margin: 6px -16px 0; padding: 8px 16px 4px;
  scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding: 0 16px;
}
.hm-cats::-webkit-scrollbar { display: none; }
.hm-cat {
  scroll-snap-align: start; display: grid; justify-items: center; gap: 5px; padding: 0; border: 0; background: none;
  color: var(--c-ink-2); font-size: var(--f-xs); white-space: nowrap; cursor: pointer;
}
.hm-cat-img { width: 50px; height: 50px; border-radius: 16px; overflow: hidden; display: grid; place-items: center; transition: box-shadow .15s; }
.hm-cat-img .shot { transform: scale(1.2); }
.hm-cat-all { background: var(--grad-hot); color: #fff; }
.hm-cat-all svg { width: 24px; height: 24px; }
.hm-cat[aria-pressed="true"] { color: var(--c-hot); font-weight: 800; }
.hm-cat[aria-pressed="true"] .hm-cat-img { box-shadow: 0 0 0 2px var(--c-bg), 0 0 0 4px var(--c-hot); }

.hm-flash { margin-top: 14px; background: var(--c-surface); border-radius: var(--r-lg); box-shadow: var(--sh-card); overflow: hidden; }
.hm-flash-h { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 12px; background: var(--grad-hot); color: #fff; }
.hm-flash-t { display: inline-flex; align-items: center; gap: 3px; flex: none; font-size: 17px; font-weight: 900; letter-spacing: .5px; }
.hm-flash-t svg { width: 18px; height: 18px; fill: var(--c-gold); stroke: var(--c-gold); }
.hm-flash-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-flash-cd { flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; white-space: nowrap; }
.hm-flash .op-cd b { min-width: 22px; padding: 2px 3px; border-radius: 4px; background: var(--c-ink); font-size: 12px; }
.hm-flash .op-cd span { margin: 0 2px 0 1px; font-size: 11px; }
.hm-flash .op-cd i { color: #fff; }
.hm-flash-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 112px; gap: 8px; overflow-x: auto; padding: 10px 12px 12px;
  scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding: 0 12px;
}
.hm-flash-row::-webkit-scrollbar { display: none; }

.hm-promo { margin-top: 14px; min-height: 150px; border-radius: var(--r-lg); box-shadow: var(--sh-card); }
.hm-promo-sub { font-size: var(--f-xs); line-height: 1.5; }
.hm-promo-go {
  justify-self: start; display: inline-flex; align-items: center; gap: 2px; margin-top: 6px; padding: 6px 10px 6px 14px;
  border-radius: var(--r-pill); background: #fff; color: var(--c-hot); font-size: var(--f-sm); font-weight: 800;
}
.hm-promo-go svg { width: 16px; height: 16px; }
.hm-explore { border: 0; background: none; padding: 4px 0; cursor: pointer; }

/* ---------- 團購頁 ---------- */
.gp .op-band-r b { font-size: 17px; }
.gp-lead {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--c-surface-2);
  border: 1px solid var(--c-line-2); color: var(--c-ink); text-decoration: none;
}
.gp-av { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--c-hot); color: #fff; font-size: 15px; font-weight: 800; }
.gp-lead-t { flex: 1; min-width: 0; display: grid; gap: 1px; }
.gp-lead-t b { font-size: var(--f-sm); }
.gp-lead-t small { font-size: var(--f-xs); color: var(--c-ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-note { margin: 0; padding: 10px 12px; border-radius: 4px 14px 14px 14px; background: var(--c-hot-050); color: var(--c-ink); font-size: var(--f-sm); line-height: 1.6; }
.gp-note b { margin-right: 6px; color: var(--c-hot); }

.gp-facts { padding-top: 2px; padding-bottom: 2px; }
.gp-fact {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 0; border: 0; border-bottom: 1px solid var(--c-line-2);
  background: none; color: var(--c-ink-2); font-size: var(--f-xs); text-align: left;
}
.gp-fact:last-child { border-bottom: 0; }
button.gp-fact { cursor: pointer; }
.gp-fact > svg:first-child { width: 18px; height: 18px; flex: none; color: var(--c-ink-soft); }
.gp-fact-k { flex: none; color: var(--c-ink-soft); }
.gp-fact-v { flex: 1; min-width: 0; color: var(--c-ink); }
.gp-fact-v b { color: var(--c-hot); }
.gp-ok { color: var(--c-success); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gp-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--c-line-2); }
.gp-item:first-child { padding-top: 0; }
.gp-item:last-child { padding-bottom: 0; border-bottom: 0; }
.gp-item-img { width: 84px; height: 84px; flex: none; border-radius: 10px; overflow: hidden; }
.gp-item-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.gp-item-name { font-size: var(--f-sm); font-weight: 700; line-height: 1.4; }
.gp-item-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 4px; }
.gp-item-price .op-price { font-size: 18px; }
.gp-item-price s { font-size: 11px; color: var(--c-ink-soft); }
.gp-per { font-size: 11px; color: var(--c-ink-soft); }
.gp-meter { display: grid; gap: 4px; }
.gp-meter-bar { height: 6px; border-radius: 3px; background: rgba(210, 51, 31, .16); overflow: hidden; }
.gp-meter-bar i { display: block; height: 100%; border-radius: 3px; background: var(--grad-hot); }
.gp-meter-t { font-size: 11px; color: var(--c-ink-2); }
.gp-meter-t b { font-variant-numeric: tabular-nums; }
.gp-hot { color: var(--c-hot); }
.gp-pick {
  position: relative; align-self: center; flex: none; min-height: 36px; padding: 0 14px; border: 0; border-radius: var(--r-pill);
  background: var(--grad-hot); color: #fff; font-size: var(--f-sm); font-weight: 800; cursor: pointer; box-shadow: 0 4px 10px rgba(210, 51, 31, .25);
}
.gp-pick i {
  position: absolute; top: -6px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--c-gold);
  color: var(--c-gold-ink); font-style: normal; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
}

/* 選購抽屜最上面 */
.gp-sku { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.gp-sku-img { width: 72px; height: 72px; flex: none; border-radius: 12px; overflow: hidden; box-shadow: var(--sh-card); }
.gp-sku-t { min-width: 0; display: grid; gap: 2px; }

/* 動作列：購物車是按鈕 */
button.op-barbag { border: 0; background: none; padding: 0; font-family: inherit; cursor: pointer; }
.gp-sum { flex: none; max-width: 40%; }
.gp-sum small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 減少動態、窄手機 ---------- */
@media (prefers-reduced-motion: reduce) {
  .hm-cat-img { transition: none; }
  .hm-cats, .hm-flash-row { scroll-behavior: auto; }
}
@media (max-width: 380px) {
  .hm-flash-sub { display: none; }
}
@media (max-width: 360px) {
  .gt-body { padding: 8px 8px 10px; }
  .gt .op-price { font-size: 16px; }
  .gp-item-img { width: 72px; height: 72px; }
  .gp-pick { padding: 0 12px; }
}
