/* ══════════════════════════════════════════════
   polish.css — 細節打磨層
   1. 滾動進度條 (頂部 + section dots)
   2. Cursor 光暈 (僅桌面)
   3. count-up (相依 effects.js 已有的邏輯,這裡只補進場 trigger 樣式)
   4. 按鈕 ripple
   ══════════════════════════════════════════════ */

/* ── 1. 滾動進度條 ───────────────────────── */
.pl-scrollbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 150;
  background: transparent;
  pointer-events: none;
}
.pl-scrollbar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 50%, var(--green) 100%);
  box-shadow: 0 0 8px var(--brand-glow);
  transform-origin: left;
  transition: width 0.05s linear;
}

/* section dots: 右側垂直導航 */
.pl-dots {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 14px;
  pointer-events: auto;
}
@media (max-width: 900px) { .pl-dots { display: none; } }

.pl-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-4);
  opacity: 0.35;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(.2,.7,.3,1);
  position: relative;
}
.pl-dot:hover { opacity: 0.85; transform: scale(1.3); }
.pl-dot.active {
  background: var(--brand);
  opacity: 1;
  box-shadow: 0 0 10px var(--brand-glow), 0 0 0 1px rgba(124,140,255,0.3);
  transform: scale(1.2);
}
.pl-dot::after {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  background: rgba(8,9,11,0.8);
  backdrop-filter: blur(6px);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.pl-dot:hover::after,
.pl-dot.active::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ── 2. Cursor 光暈 ────────────────────── */
.pl-cursor {
  position: fixed;
  top: 0; left: 0;
  width: 320px; height: 320px;
  margin-left: -160px;
  margin-top: -160px;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(
    circle at center,
    rgba(124, 140, 255, 0.10) 0%,
    rgba(124, 140, 255, 0.04) 40%,
    transparent 70%
  );
  mix-blend-mode: screen;
  transition: opacity 0.3s, transform 0.08s ease-out;
  opacity: 0;
  filter: blur(12px);
  will-change: transform;
}
.pl-cursor.show { opacity: 1; }
/* 滑到可互動元素時:變成更小更亮的點 */
.pl-cursor.hot {
  width: 80px; height: 80px;
  margin-left: -40px; margin-top: -40px;
  background: radial-gradient(
    circle at center,
    rgba(124, 140, 255, 0.45) 0%,
    rgba(167, 139, 250, 0.2) 40%,
    transparent 75%
  );
  filter: blur(4px);
}

/* 觸控裝置直接關掉 */
@media (pointer: coarse), (hover: none) {
  .pl-cursor { display: none !important; }
}

/* ── 3. count-up flash (進入 viewport 時的高光) ── */
.pl-count-flash {
  position: relative;
  overflow: hidden;
}
.pl-count-flash::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(124,140,255,0.10) 50%,
    transparent 65%
  );
  transform: translateX(-100%);
  pointer-events: none;
  opacity: 0;
}
.pl-count-flash.flash::after {
  animation: pl-flash 0.7s cubic-bezier(.2,.7,.3,1) 1;
}
@keyframes pl-flash {
  0%   { transform: translateX(-100%); opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

/* ── 4. 按鈕 ripple ────────────────────── */
.pl-ripple-host {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.pl-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  animation: pl-ripple-anim 0.7s cubic-bezier(.2,.7,.3,1) forwards;
  z-index: 0;
}
/* 主按鈕(深底)用淺色漣漪;反轉按鈕(.btn-primary 白底)用深色漣漪 */
.btn-primary .pl-ripple { background: rgba(8, 9, 11, 0.18); }
.btn-ghost   .pl-ripple { background: rgba(255, 255, 255, 0.18); }

@keyframes pl-ripple-anim {
  to {
    transform: translate(-50%, -50%) scale(2.6);
    opacity: 0;
  }
}

/* 確保 ripple 不蓋住按鈕內容 */
.pl-ripple-host > * { position: relative; z-index: 1; }

/* ── 5. reduced motion 全關 ───────────── */
@media (prefers-reduced-motion: reduce) {
  .pl-cursor { display: none !important; }
  .pl-ripple { animation: none !important; opacity: 0 !important; }
  .pl-count-flash::after { animation: none !important; }
  .pl-scrollbar-fill { transition: none; }
}
