/* 商品頁外連導購主行動區（合作商城導購／店家官網直連，_ext_only）— 2026-12-06
   只由 item.html 的 head_extra 在 merchant_external_only 時載入；不改共用主 CSS。
   載入順序在 neon_theme.css 之前，所以選取器都比 neon 多一層（.item-page／.has-buybar）來取得優先權。
   色彩一律用主題變數：--accent／--accent-deep（翡翠綠）、--gold-*（暖金）、--price-hover（售價橘深）。
   白字對比：--accent #0b7a5c 5.3:1、--accent-deep #075943 8.4:1、--price-hover #c9401a 4.9:1（皆 ≥4.5:1）。 */

/* ── 1. 省錢膠囊：比原價現省 NT$… · 約 X 折 ── */
.item-page .buy-save {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: flex-start;
  max-width: 100%;
  gap: 4px 8px;
  margin: 12px 0 0;
  padding: 5px 6px 5px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: .02em;
  color: var(--price-hover, var(--brass));
  background: var(--gold-soft, var(--accent-soft));
  box-shadow: inset 0 0 0 1px var(--gold-border, var(--line));
  font-variant-numeric: tabular-nums;
}
.item-page .buy-save-dot { color: var(--gold-border, var(--line)); font-weight: 400; }
.item-page .buy-save .buy-save-off {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  color: var(--accent-ink);
  background: var(--price-hover, var(--accent));
  box-shadow: none;
}

/* ── 2. 主按鈕：滿版、≥48px、膠囊、清楚的外開箭頭與輕微動效 ── */
.item-page .buy-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.item-page .buy-save + .buy-cta { margin-top: 10px; }
.item-page .buy-cta .btn.buy-go {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.2;
  white-space: nowrap;
  /* neon_theme.css 對 .btn-primary 背景下了 !important，這裡只對外連主按鈕加深漸層 */
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep, var(--accent)) 100%) !important;
  border-color: var(--accent-deep, var(--accent)) !important;
  color: var(--accent-ink) !important;
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
/* 掃光：hover 時一道柔光從左滑到右（純 transform，不觸發重排） */
.item-page .buy-cta .btn.buy-go::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .22) 50%, transparent 70%);
  transform: translateX(-110%);
  pointer-events: none;
}
.item-page .buy-cta .btn.buy-go:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 12px 26px -12px color-mix(in srgb, var(--accent) 78%, transparent), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.item-page .buy-cta .btn.buy-go:active {
  transform: translateY(0) scale(.98);
  filter: brightness(.97);
  box-shadow: 0 3px 8px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}
.item-page .buy-cta .btn.buy-go:focus-visible {
  outline: 3px solid var(--gold, var(--accent));
  outline-offset: 3px;
}
.item-page .buy-cta .affiliate-badge { flex: 0 0 auto; }

/* ── 3. 一行安心提示 ── */
.item-page .buy-assure {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .03em;
  color: var(--ink-2);
}
.item-page .buy-assure-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.item-page .buy-assure-text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ── 4. 底部固定購買列（本檔只在外連商品頁載入，所以只影響外連商品） ── */
.has-buybar .buybar .btn.btn-primary {
  min-height: 48px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep, var(--accent)) 100%) !important;
  border-color: var(--accent-deep, var(--accent)) !important;
  color: var(--accent-ink) !important;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.has-buybar .buybar .btn.btn-primary:focus-visible { outline: 3px solid var(--gold, var(--accent)); outline-offset: 2px; }

@media (max-width: 719px) {
  .item-page .buy-save { font-size: 14px; padding-left: 12px; }
  .item-page .buy-cta .btn.buy-go { min-height: 52px; padding: 0 18px; font-size: 16px; }

  .has-buybar .buybar {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
  }
  .has-buybar .buybar-row {
    min-height: 64px;
    padding-top: 8px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    gap: 10px;
  }
  .has-buybar .buybar-price-col { flex: 1 1 auto; min-width: 0; }
  .has-buybar .buybar .btn.btn-primary {
    flex: 0 1 auto;
    max-width: 64%;
    min-width: 0;
    min-height: 48px;
    padding: 0 18px;
    font-size: 15px;
    letter-spacing: .03em;
  }
  body.has-buybar { padding-bottom: calc(64px + 8px + max(10px, env(safe-area-inset-bottom)) + 12px); }
}
@media (max-width: 360px) {
  .item-page .buy-cta .btn.buy-go { padding: 0 14px; font-size: 15px; letter-spacing: .01em; }
  .has-buybar .buybar .btn.btn-primary { padding: 0 12px; font-size: 14px; letter-spacing: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .item-page .buy-cta .btn.buy-go::after { transition: transform .6s ease; }
  .item-page .buy-cta .btn.buy-go:hover::after { transform: translateX(110%); }
}
@media (prefers-reduced-motion: reduce) {
  .item-page .buy-cta .btn.buy-go,
  .has-buybar .buybar .btn.btn-primary { transition: none; }
  .item-page .buy-cta .btn.buy-go:hover,
  .item-page .buy-cta .btn.buy-go:active { transform: none; }
}
