/* ===== BROKLUV 視覺動態（低調精緻）=====
   所有效果都由 fx.js 在 <html> 加上 class="fx" 後才啟用；使用者系統設定「減少動態效果」時會自動關閉。 */

/* --- 膠片顆粒 + 暗角 --- */
#fx-grain { position: fixed; inset: -50%; width: 200%; height: 200%; pointer-events: none; z-index: 9000; opacity: .055;
  background-image: 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='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: fxGrain .9s steps(6) infinite; }
@keyframes fxGrain { 0% { transform: translate(0,0); } 20% { transform: translate(-5%,3%); } 40% { transform: translate(4%,-6%); } 60% { transform: translate(-3%,7%); } 80% { transform: translate(6%,2%); } 100% { transform: translate(0,0); } }
#fx-vignette { position: fixed; inset: 0; pointer-events: none; z-index: 8999; background: radial-gradient(ellipse at center, transparent 58%, rgba(0,0,0,.34) 100%); }
html.fx-reduce #fx-grain { animation: none; }
@media (max-width: 760px) { #fx-grain { opacity: .04; } }

/* --- 滾動視差：商品圖與橫幅 --- */
html.fx .feat-main img { transform: translate3d(0, var(--py, 0px), 0) scale(1.08); will-change: transform; }
html.fx .banner-inner { transform: translate3d(0, var(--bpy, 0px), 0); will-change: transform; }
html.fx #banner-video { transform: scale(1.06) translate3d(0, var(--bvy, 0px), 0); }

/* --- 商品資訊卡依序進場（區塊進到畫面後，序號、名稱、價格、尺寸、按鈕一個一個浮現）--- */
html.fx .feat .feat-inner > * { opacity: 0; transform: translateY(16px); transition: opacity .9s ease, transform 1s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--i, 0) * 80ms + 160ms); }
html.fx .feat.in .feat-inner > * { opacity: 1; transform: none; }
html.fx .feat .feat-inner > *:nth-child(1) { --i: 0; } html.fx .feat .feat-inner > *:nth-child(2) { --i: 1; } html.fx .feat .feat-inner > *:nth-child(3) { --i: 2; }
html.fx .feat .feat-inner > *:nth-child(4) { --i: 3; } html.fx .feat .feat-inner > *:nth-child(5) { --i: 4; } html.fx .feat .feat-inner > *:nth-child(6) { --i: 5; }
html.fx .feat .feat-inner > *:nth-child(7) { --i: 6; } html.fx .feat .feat-inner > *:nth-child(8) { --i: 7; } html.fx .feat .feat-inner > *:nth-child(9) { --i: 8; }
html.fx .feat .feat-inner > *:nth-child(n+10) { --i: 9; }

/* --- 低庫存脈動提示 --- */
.low-note { display: flex; align-items: center; gap: 9px; }
.low-note::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #ff5a4d; flex: none; box-shadow: 0 0 0 0 rgba(255,90,77,.55); animation: fxPulse 1.8s ease-out infinite; }
@keyframes fxPulse { 0% { box-shadow: 0 0 0 0 rgba(255,90,77,.55); } 70% { box-shadow: 0 0 0 9px rgba(255,90,77,0); } 100% { box-shadow: 0 0 0 0 rgba(255,90,77,0); } }
.pill { position: relative; }
.pill[title]:not([title=""]):not(:disabled)::after { content: ''; position: absolute; top: 5px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: #ff5a4d; animation: fxBlink 1.8s ease-in-out infinite; }
@keyframes fxBlink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* --- 加入購物袋：縮圖飛進購物袋，圖示彈跳 --- */
.fx-fly { position: fixed; z-index: 9400; pointer-events: none; object-fit: cover; border: 1px solid rgba(243,239,232,.5); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.bag-btn.fx-bump { animation: fxBump .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes fxBump { 0% { transform: scale(1); } 35% { transform: scale(1.28) rotate(-6deg); } 100% { transform: scale(1); } }

/* --- 自訂游標（只有電腦滑鼠才會啟用）與磁吸按鈕 --- */
html.fx-cur, html.fx-cur * { cursor: none !important; }
html.fx-cur input, html.fx-cur textarea, html.fx-cur select { cursor: auto !important; }
#fx-dot, #fx-ring { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 9600; opacity: 0; transition: opacity .25s ease; will-change: transform; }
#fx-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #f3efe8; }
#fx-ring { width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; border: 1px solid rgba(243,239,232,.7); display: grid; place-items: center; transition: opacity .25s ease, width .3s cubic-bezier(.2,.7,.2,1), height .3s cubic-bezier(.2,.7,.2,1), margin .3s cubic-bezier(.2,.7,.2,1), background .3s ease, border-color .3s ease; }
#fx-ring span { font: 700 9px/1 'Space Mono', monospace; letter-spacing: 2px; color: #0a0a0a; opacity: 0; transition: opacity .2s; }
html.fx-cur-on #fx-dot, html.fx-cur-on #fx-ring { opacity: 1; }
html.fx-hover #fx-ring { width: 58px; height: 58px; margin: -29px 0 0 -29px; border-color: rgba(243,239,232,.95); }
html.fx-label #fx-ring { width: 84px; height: 84px; margin: -42px 0 0 -42px; background: #f3efe8; border-color: #f3efe8; }
html.fx-label #fx-ring span { opacity: 1; }
html.fx-label #fx-dot { opacity: 0; }
html.fx-down #fx-ring { transform-origin: center; }
html.fx-text #fx-dot, html.fx-text #fx-ring { opacity: 0 !important; }

/* --- 頁面轉場：切換頁面時，一層深色幕從下往上擦過去 --- */
#fx-curtain { position: fixed; inset: 0; z-index: 9500; pointer-events: none; background: #0a0a0a; clip-path: inset(100% 0 0 0); display: grid; place-items: center; }
#fx-curtain b { font-family: 'Archivo Black', Impact, sans-serif; font-weight: 400; letter-spacing: 12px; padding-left: 12px; font-size: clamp(1.2rem, 3vw, 2rem); color: #f3efe8; opacity: .85; }

/* --- 發售倒數：大字 --- */
.banner-count { gap: clamp(18px, 4vw, 54px); align-items: flex-start; margin-top: 40px; }
.banner-count > div { min-width: 0; border: none; background: none; padding: 0; position: relative; text-align: center; }
.banner-count b { font-family: 'Archivo Black', Impact, sans-serif; font-weight: 400; font-size: clamp(2.6rem, 9vw, 6.4rem); line-height: 1; letter-spacing: 2px; color: #f3efe8; font-variant-numeric: tabular-nums; }
.banner-count > div + div::before { content: ':'; position: absolute; left: calc(clamp(18px, 4vw, 54px) / -2 - .2em); top: .02em; font-family: 'Archivo Black', Impact, sans-serif; font-size: clamp(2.2rem, 7.5vw, 5.2rem); color: #55524c; line-height: 1; }
.banner-count span { display: block; margin-top: 10px; letter-spacing: 6px; font-size: .62rem; }
#countdown { font-size: clamp(1.6rem, 6vw, 3.2rem) !important; letter-spacing: 6px !important; }
@media (max-width: 520px) { .banner-count { gap: 14px; } }

@media (prefers-reduced-motion: reduce) {
  html.fx .feat .feat-inner > * { opacity: 1 !important; transform: none !important; transition: none !important; }
  html.fx .feat-main img, html.fx .banner-inner, html.fx #banner-video { transform: none !important; }
  .low-note::before, .pill[title]:not([title=""])::after { animation: none; }
}

/* 游標在白色按鈕上也看得見：用「反相混合」，壓在白色上的那一半自動變黑，壓在深色上的那一半維持白色
   （游標只有一半在按鈕裡時，兩半各自顯示對應的顏色）。顯示文字標籤（ZOOM／OPEN）的實心圓不用反相，維持原樣。 */
#fx-dot, #fx-ring { mix-blend-mode: difference; }
html.fx-label #fx-ring { mix-blend-mode: normal; }


/* --- 頁尾：滿版巨大字標 + 台北時間 --- */
.sf-giant { margin-top: clamp(40px, 7vw, 90px); padding-top: 18px; border-top: 1px solid #1d1d1d; }
.sf-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font: 400 .66rem 'Space Mono', monospace; letter-spacing: 4px; color: #77746d; margin-bottom: 8px; }
.sf-giant svg { display: block; width: 100%; height: auto; overflow: visible; }
.sf-giant text { font-family: 'Archivo Black', Impact, 'Arial Black', sans-serif; font-size: 138px; fill: transparent; stroke: rgba(243,239,232,.26); stroke-width: 1.1; transition: fill .8s ease, stroke .8s ease; }
.sf-giant img { display: block; height: clamp(120px, 22vw, 300px); width: auto; margin: 0 auto; opacity: .3; transition: opacity .8s ease; }
.sf-giant:hover img { opacity: .95; }
.sf-giant:hover text { fill: rgba(243,239,232,.92); stroke: rgba(243,239,232,.92); }
@media (max-width: 760px) { .sf-meta { letter-spacing: 2px; font-size: .56rem; } .sf-meta span:nth-child(2) { display: none; } }

/* --- 開場：BROKLUV 先是空心描邊，再由左到右填滿 --- */
@keyframes heroOutlineIn { from { opacity: 0; letter-spacing: 22px; } to { opacity: 1; letter-spacing: 8px; } }
@keyframes heroFill { to { background-position: 0 0; } }
#hero .hero-title { color: transparent; -webkit-text-stroke: 1.5px rgba(243,239,232,.92); text-shadow: none;
  background: linear-gradient(90deg, #f3efe8 50%, transparent 50%) 100% 0 / 200% 100% no-repeat; -webkit-background-clip: text; background-clip: text;
  animation: heroOutlineIn 1.1s cubic-bezier(.2,.7,.2,1) both, heroFill 1.3s cubic-bezier(.7,0,.2,1) .75s forwards, titleOut 1.1s cubic-bezier(.55,0,.3,1) 2.8s forwards; }
@media (prefers-reduced-motion: reduce) { #hero .hero-title { animation: none; color: #f3efe8; -webkit-text-stroke: 0; background: none; } }

/* --- 手機底部固定「加入購物袋」列 --- */
#fx-sticky { display: none; }
@media (max-width: 760px) {
  #fx-sticky { display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 800; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: rgba(10,10,10,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid #262626; transform: translateY(110%); transition: transform .45s cubic-bezier(.2,.7,.2,1); }
  #fx-sticky.on { transform: none; }
  #fx-sticky .fs-info { flex: 1; min-width: 0; }
  #fx-sticky .fs-name { font: 700 .72rem 'Space Mono', monospace; letter-spacing: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #f3efe8; text-transform: uppercase; }
  #fx-sticky .fs-sub { font: 400 .68rem 'Space Mono', monospace; letter-spacing: 1px; color: #9a968c; margin-top: 3px; }
  #fx-sticky button { flex: none; padding: 14px 22px; border: none; border-radius: 999px; background: #f3efe8; color: #0a0a0a; font: 700 .7rem 'Space Mono', monospace; letter-spacing: 3px; cursor: pointer; }
  #fx-sticky button:disabled { opacity: .4; }
  body.fx-bag-open #fx-sticky, body.fx-popup-open #fx-sticky { transform: translateY(110%); }
}

#fx-curtain img { height: clamp(60px, 12vh, 100px); width: auto; opacity: .88; display: block; }

/* 開場：logo 由左到右顯現（取代文字描邊填滿）*/
@keyframes heroLogoIn { from { clip-path: inset(0 100% 0 0); opacity: .25; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
#hero .hero-title { background: none; -webkit-text-stroke: 0; color: inherit; letter-spacing: 0; line-height: 0; animation: heroLogoIn 1.5s cubic-bezier(.7,0,.2,1) both, titleOut 1.1s cubic-bezier(.55,0,.3,1) 2.8s forwards; }
#hero .hero-title img { display: block; height: clamp(110px, 24vh, 240px); width: auto; max-width: 88vw; margin: 0 auto; filter: drop-shadow(0 4px 24px rgba(0,0,0,.6)); }
@media (prefers-reduced-motion: reduce) { #hero .hero-title { animation: none; clip-path: none; } }
