/* 黑色星期五活動樣式（2026）。設定在 src/_data/blackFriday.json，只在 blackFriday.enabled 時由 base.njk 載入。
   活動換裝只在 <html class="bf-2026"> 時生效（public/black-friday.js 依時間加上）；活動結束改成 bf-ended，
   細條留著顯示結束訊息、其餘規則失效，重新載入後就完全回到原版。
   不覆寫全站 body / header / button；只動 .bf-* 元件與商店、升級頁第一區塊（.bf-stage）內的表單。
   色票是活動專用的 --bf-*，不屬於全站主題 token；活動結束後整個檔案不再載入。 */

:root {
  --bf-ink: #0c0b0a;               /* 比站底 #141312 再深一階的「黑」 */
  --bf-gold-1: #ffd88f;
  --bf-gold-2: #ffb36b;
  --bf-gold-3: #f08a4b;
  --bf-gold-text: linear-gradient(90deg, #ffe2a8 0%, #fff6e6 45%, #ffbf85 100%);
  --bf-gold-line: linear-gradient(90deg, rgba(255, 216, 143, 0) 0%, rgba(255, 216, 143, 0.85) 30%, rgba(255, 179, 107, 0.85) 70%, rgba(255, 179, 107, 0) 100%);
  --bf-glow: rgba(255, 170, 90, 0.16);
  --bf-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 .85  0 0 0 0 .6  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* 活動外的保險：沒有 class 時活動專屬元素一律不顯示 */
.bf-only { display: none !important; }
html.bf-2026 .bf-only { display: revert !important; }
html.bf-2026 .bf-hide { display: none !important; }

/* ---------- 全站細條 ---------- */
.bf-bar { display: none; }
html.bf-2026 .bf-bar, html.bf-ended .bf-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 16px;
  background: radial-gradient(60% 180% at 50% 0%, rgba(255, 179, 107, 0.16) 0%, rgba(255, 179, 107, 0) 70%), var(--bf-ink);
  color: #f6efe6;
  font-size: 14px;
  font-weight: 600;
  line-height: 24px;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
}
html.bf-2026 .bf-bar::before { /* 底部金色細線 */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: var(--bf-gold-line);
  opacity: 0.7;
}
html.bf-2026 .bf-bar::after { /* 細緻顆粒 */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--bf-grain);
  opacity: 0.18;
  mix-blend-mode: overlay;
}
.bf-bar__tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 216, 143, 0.45);
  background: linear-gradient(180deg, rgba(255, 216, 143, 0.14), rgba(255, 179, 107, 0.06));
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.bf-bar__tag span,
.bf-bar__deal {
  background: var(--bf-gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.bf-bar__sep { color: rgba(246, 239, 230, 0.35); }
.bf-bar__muted { color: rgba(246, 239, 230, 0.72); font-weight: 500; }
.bf-bar__cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--bf-gold-1);
}
.bf-bar__cta svg { transition: transform var(--duration-fast) var(--ease-standard); }
a.bf-bar:hover .bf-bar__cta svg { transform: translateX(3px); }
a.bf-bar:hover .bf-bar__cta-text { text-decoration: underline; text-underline-offset: 3px; }
a.bf-bar:focus-visible {
  outline: 2px solid var(--bf-gold-1);
  outline-offset: -4px;
  border-radius: 8px;
}
/* 商店頁上的細條：不是連結，改成「已套用」狀態 */
.bf-bar--here .bf-check { color: var(--bf-gold-1); }

/* 掃光：每 8 秒一次，減少動態時關閉 */
@media (prefers-reduced-motion: no-preference) {
  html.bf-2026 .bf-bar__shine {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(100deg, transparent 40%, rgba(255, 216, 143, 0.12) 50%, transparent 60%);
    transform: translateX(-100%);
    animation: bf-shine 8s ease-in-out 1.5s infinite;
  }
}
@keyframes bf-shine { 0%, 70% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

@media (max-width: 640px) {
  html.bf-2026 .bf-bar { gap: 8px; font-size: 13px; padding: 6px 12px; }
  .bf-bar__tag { font-size: 11px; padding: 0 7px; height: 20px; letter-spacing: 0.04em; }
  .bf-bar__cta-text, .bf-bar__wide { display: none; }
}

/* ---------- 商店頁 Hero（第一區塊） ---------- */
html.bf-2026 .bf-stage {
  --gradient: var(--bf-gold-text);
  /* 光暈沿用原本區塊的做法（.section-block::after、內容寬、柔邊漸層圖），只把圖換成全站既有的橘色版本。
     圖的網址由模板寫在 section 的 --bf-glow-image（經過 url filter，支援部署子目錄）。 */
  --section-glow-image: var(--bf-glow-image);
  --spotlight-color: rgba(255, 179, 107, 0.07);
  --spotlight-color2: rgba(255, 179, 107, 0);
  --glow-color: #ffd88f77;
  isolation: isolate;
}
.bf-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto 20px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 216, 143, 0.35);
  background: rgba(255, 179, 107, 0.08);
  color: #f6dfbd;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: 0.02em;
}
.bf-eyebrow i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--bf-gold-1);
  box-shadow: 0 0 10px var(--bf-gold-2);
}
html.bf-2026 .bf-stage .section-header .section-content :is(h1, h2) { max-width: 900px; } /* 商店頁是 h1，升級頁是 h2 */
.bf-title-sub {
  background: linear-gradient(90deg, #fff 0%, #f3e9dc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
html.bf-2026 .bf-stage .section-header .section-content p strong {
  color: #f6dfbd;
  font-weight: 600;
}
.bf-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  letter-spacing: 0.02em;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 216, 143, 0.3);
  background: rgba(255, 179, 107, 0.08);
  color: #ffe2a8;
  white-space: nowrap;
}

/* ---------- 表單外框 ---------- */
html.bf-2026 .bf-stage .Store_store-form__wrapper {
  position: relative;
  border-color: rgba(255, 200, 130, 0.38) !important;
  background: linear-gradient(180deg, rgba(255, 179, 107, 0.05) 0%, rgba(247, 248, 248, 0.04) 30%);
  box-shadow: 0 0 0 1px rgba(255, 216, 143, 0.06), 0 30px 120px -40px rgba(255, 150, 70, 0.35);
}
html.bf-2026 .bf-stage .Store_store-form__wrapper > .bf-rim { /* 頂邊金線 */
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: var(--bf-gold-line);
  z-index: 2;
  pointer-events: none;
}
html.bf-2026 .bf-stage .Store_store-form__details {
  border-left-color: rgba(255, 200, 130, 0.22);
  background: linear-gradient(180deg, rgba(255, 179, 107, 0.05) 0%, rgba(247, 248, 248, 0.02) 60%);
}

/* 優惠碼欄：已套用 */
html.bf-2026 .bf-stage [data-field="coupon"] .Store_store-form__input-wrapper { position: relative; }
html.bf-2026 .bf-stage .Store_store-form__input.bf-applied {
  border-color: rgba(255, 200, 130, 0.55);
  background: rgba(255, 179, 107, 0.07);
  color: #ffe2a8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  letter-spacing: 0.03em;
  padding-right: 112px;
}
.bf-chip {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 216, 143, 0.22), rgba(255, 179, 107, 0.16));
  border: 1px solid rgba(255, 216, 143, 0.4);
  color: #ffe2a8;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}
.bf-chip--wait { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.18); color: rgba(255, 255, 255, 0.7); }
.bf-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; }
@media (prefers-reduced-motion: no-preference) { .bf-spin { animation: bf-rot 0.8s linear infinite; } }
@keyframes bf-rot { to { transform: rotate(360deg); } }
.bf-note {
  font-size: 13px;
  line-height: 20px;
  color: rgba(246, 223, 189, 0.82);
}
/* 活動結束後的提示：不是錯誤，用中性色；它不屬於活動主題，所以不受 bf-2026 控制 */
.bf-ended-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--foreground-tertiary);
  font-size: 13px;
  line-height: 20px;
  max-width: 100%;
}
.bf-ended-note svg { flex: none; margin-top: 2px; opacity: 0.8; }

/* 價格區 */
html.bf-2026 .bf-stage .Store_store-form__original-price { margin-top: 16px; }
.bf-save {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  margin-bottom: 6px;
  color: #ffcf96;
  font-weight: 600;
}
html.bf-2026 .bf-stage .Store_store-form__final-price-symbol,
html.bf-2026 .bf-stage .Store_store-form__final-price-value { background-image: var(--bf-gold-text); }
html.bf-2026 .bf-stage .Store_store-form__final-price-value { font-size: 32px; }

/* Pay Now：沿用 Comet 按鈕，只換色票 */
html.bf-2026 .bf-stage .Store_store-form__submit {
  background: linear-gradient(90deg, rgba(255, 196, 120, 0.26) 0%, rgba(240, 130, 70, 0.22) 100%);
  color: #fff6e6;
  box-shadow: 0 12px 40px -16px rgba(255, 150, 70, 0.6);
}
html.bf-2026 .bf-stage .Store_store-form__submit::before {
  background: linear-gradient(90deg, rgba(255, 216, 143, 0.85) 0%, rgba(240, 138, 75, 0.75) 100%) border-box !important;
}
html.bf-2026 .bf-stage .Store_store-form__submit:hover:not(.Comet_is-disabled) {
  background: linear-gradient(90deg, rgba(255, 196, 120, 0.36) 0%, rgba(240, 130, 70, 0.3) 100%);
}

/* 右欄角落：活動期間印章換成文字戳記，減少與金色衝突 */
html.bf-2026 .bf-stage .Store_store-form__details::before { opacity: 0.35; filter: sepia(1) saturate(2) hue-rotate(-10deg); }

@media (max-width: 640px) {
  .bf-eyebrow { font-size: 13px; margin-bottom: 14px; }
  html.bf-2026 .bf-stage .Store_store-form__input.bf-applied { font-size: 14px; padding-left: 12px; padding-right: 44px; letter-spacing: 0; }
  .bf-chip { width: 28px; padding: 0; justify-content: center; }
  .bf-chip__text { display: none; } /* 窄螢幕只留勾號，文字由下方說明與 aria-describedby 提供 */
}

/* ======================================================================
   第 2 輪新增：倒數（借自方案 C 的規則：等寬數字、固定寬度、報讀器只讀固定截止日）
   ====================================================================== */
.bf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bf-short { display: none; }
.bf-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ---- M2：中央分段金色數字格 ---- */
html.bf-2026 .bf-bar--m2 {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  min-height: 44px;
}
.bf-m2-left { display: inline-flex; align-items: center; gap: 10px; justify-self: end; }
.bf-m2-mid { display: inline-flex; align-items: center; gap: 10px; }
.bf-m2-right { justify-self: start; display: inline-flex; }
.bf-cells { display: inline-flex; align-items: center; gap: 4px; }
.bf-cell {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  min-width: 46px;
  height: 28px;
  padding: 0 7px;
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255, 216, 143, 0.16) 0%, rgba(255, 179, 107, 0.06) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 216, 143, 0.32), inset 0 1px 0 rgba(255, 246, 230, 0.12);
  line-height: 28px;
}
.bf-cell b {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--bf-gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.bf-cell i { font-style: normal; font-size: 11px; font-weight: 600; color: rgba(255, 226, 168, 0.7); }
.bf-colon { color: rgba(255, 216, 143, 0.45); font-weight: 700; }

/* 最後 24 小時：標籤換成實心金底「Last day」，不換紅色、不閃爍 */
.bf-bar.is-last .bf-bar__tag { background: linear-gradient(90deg, #ffd88f, #ffb36b); border-color: transparent; }
.bf-bar.is-last .bf-bar__tag span { background: none; -webkit-text-fill-color: #1a1208; color: #1a1208; }

/* 歸零後、頁面未重新整理：bf-2026 已拿掉，細條留著避免整頁上跳，改成灰色說明、不是連結 */
html.bf-ended .bf-bar {
  background: #1b1a19;
  color: var(--foreground-tertiary);
  font-weight: 500;
  display: flex;
}
html.bf-ended .bf-bar::before { content: ""; position: absolute; inset: auto 0 0 0; height: 1px; background: rgba(255, 255, 255, 0.1); }
html.bf-ended .bf-bar > :not(.bf-ended-msg) { display: none !important; }
.bf-ended-msg { display: none; }
html.bf-ended .bf-ended-msg { display: inline-flex; align-items: center; gap: 8px; }

@media (max-width: 640px) {
  .bf-long { display: none; }
  .bf-short { display: inline; }
  html.bf-2026 .bf-bar--m2 { display: flex; gap: 8px; min-height: 44px; }
  .bf-m2-left, .bf-m2-mid { gap: 6px; }
  .bf-cell { min-width: 38px; height: 26px; line-height: 26px; padding: 0 5px; }
  .bf-cell b { font-size: 14px; }
  .bf-cell i { font-size: 10px; }
  .bf-colon { display: none; }
}

/* ---- 商店頁 Hero 倒數面板（頁面上唯一會跳的時鐘） ---- */
html.bf-2026 .bf-stage .section-header .section-content p.bf-lead { margin-bottom: 28px; }
.bf-count {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 28px;
  margin: 0 auto 48px;
  padding: 14px 16px 14px 26px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 216, 143, 0.08) 0%, rgba(20, 19, 18, 0.4) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 216, 143, 0.26), 0 20px 60px -30px rgba(255, 150, 70, 0.45);
  text-align: left;
}
.bf-count::before { content: ""; position: absolute; inset: 0 18px auto; height: 1px; background: var(--bf-gold-line); }
.bf-count__text { display: flex; flex-direction: column; gap: 2px; }
.bf-count__label { color: #f6dfbd; font-size: 15px; font-weight: 600; line-height: 22px; white-space: nowrap; }
.bf-count__end { color: rgba(246, 239, 230, 0.6); font-size: 13px; line-height: 20px; white-space: nowrap; }
.bf-count__cells { display: flex; gap: 8px; }
.bf-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 62px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 216, 143, 0.14) 0%, rgba(255, 179, 107, 0.04) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 216, 143, 0.3), inset 0 1px 0 rgba(255, 246, 230, 0.14);
}
.bf-seg[hidden] { display: none; }
.bf-seg b {
  font-size: 28px;
  font-weight: 700;
  line-height: 32px;
  font-variant-numeric: tabular-nums;
  background: var(--bf-gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.bf-seg i { font-style: normal; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255, 226, 168, 0.65); }
.bf-count.is-last .bf-count__label::before { content: attr(data-last); margin-right: 6px; padding: 1px 7px; border-radius: 999px; background: linear-gradient(90deg, #ffd88f, #ffb36b); color: #1a1208; font-size: 12px; font-weight: 700; }

@media (max-width: 640px) {
  .bf-count { flex-direction: column; gap: 12px; padding: 14px 16px 16px; text-align: center; margin-bottom: 32px; width: 100%; }
  .bf-count__text { align-items: center; }
  .bf-count__cells { width: 100%; justify-content: center; }
  .bf-seg { flex: 1; max-width: 90px; height: 56px; }
  .bf-seg b { font-size: 24px; }
  html.bf-2026 .bf-stage .section-header .section-content p.bf-lead { margin-bottom: 20px; }
}
/* 結束提示：價格區上方的一行灰色說明 */
.bf-price-note { margin: 12px 0 0; color: var(--foreground-tertiary); font-size: 13px; line-height: 20px; }
/* 掃光層一律絕對定位（減少動態時也不佔版面格子） */
.bf-bar__shine { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
/* 商店、升級頁上的「已套用」細條：同樣 44px 高，不跳動、不可點 */
html.bf-2026 .bf-bar--here { min-height: 44px; }
/* M2 細條 44px：頁首高度 61 + 44 = 105px；結束後細條仍留著顯示結束訊息，所以 bf-ended 也一樣 */
:root.bf-2026, :root.bf-ended { --site-header-height: 105px; }
:root.has-announcement.bf-2026, :root.has-announcement.bf-ended { --site-header-height: 145px; }
@media (max-width: 640px) {
  .bf-bar--m2 .bf-bar__tag { font-size: 10px; padding: 0 6px; letter-spacing: 0.03em; }
  .bf-m2-mid .bf-cells { gap: 3px; }
}
/* 活動結束時的報讀提示 */
.bf-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
