/* ---------- 網頁效果 demo 專用樣式（services.html 的「網頁效果」分頁載入） ---------- */

.effect-demo {
  position: relative;
  height: 190px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-hover);
}

.effect-card .card-body { gap: 10px; display: flex; flex-direction: column; }
.effect-replay { align-self: flex-start; margin-top: 4px; }

/* 1. 捲動淡入（用 CSS animation 而非 transition：transition 在短時間內重複觸發時，
   淡出還沒播完就被下一次淡入蓋過，等於看不到效果；animation 一移除 class 就會瞬間
   回到起始畫格，重播時保證每次都完整播完整段淡入，跟下面「掃描辨識」用同一套手法） */
.demo-reveal-box {
  padding: 14px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-weight: 700;
  opacity: 0;
  transform: translateY(24px);
}
.demo-reveal-box.playing { animation: reveal-in 0.6s ease forwards; }
@keyframes reveal-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* 2. 打字機 */
.demo-typewriter {
  font-family: var(--mono);
  font-size: 1.05rem;
  color: var(--accent);
  white-space: nowrap;
}
.demo-typewriter::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: -0.15em;
  animation: caret-blink 0.9s steps(1) infinite;
}

/* 3. 數字滾動 */
.demo-counter {
  font-family: var(--mono);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--accent);
}
.demo-counter .suffix { font-size: 1.4rem; color: var(--muted); margin-left: 4px; }

/* 4. 玻璃霧面（背景加更多色塊＋更高飽和度，讓模糊玻璃質感有東西可以模糊，對比更明顯） */
.demo-glass-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 25%, rgba(255,107,107,0.55), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(255,196,0,0.5), transparent 50%),
    radial-gradient(circle at 30% 80%, rgba(30,58,95,0.6), transparent 55%),
    radial-gradient(circle at 85% 75%, rgba(126,163,209,0.55), transparent 50%);
  animation: glass-bg-shift 6s ease-in-out infinite alternate;
}
@keyframes glass-bg-shift { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(35deg); } }
.demo-glass-card {
  position: relative;
  z-index: 1;
  padding: 18px 30px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.4);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,0.35);
  font-weight: 700;
}

/* 5. 3D 傾斜卡片（角度加大、加動態陰影＋隨滑鼠位置移動的高光，立體感更明顯） */
.demo-tilt-wrap { perspective: 500px; }
.demo-tilt-card {
  position: relative;
  width: 160px;
  height: 100px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  font-weight: 700;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
  transform-style: preserve-3d;
  will-change: transform;
  box-shadow: 0 10px 20px -6px rgba(0,0,0,0.35);
}
.demo-tilt-card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at var(--glare-x, 50%) var(--glare-y, 50%), rgba(255,255,255,0.55), transparent 45%);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.demo-tilt-wrap:hover .demo-tilt-card::before { opacity: 1; }

/* 6. 粒子背景 */
.demo-particles canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.demo-particles span {
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--muted);
}

/* 7. 漸層文字動畫（品牌色是單一深藍，做這個demo特別用鮮豔多色漸層，效果才看得明顯） */
.demo-gradient-text {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(90deg, #4285f4, #ea4335, #fbbc05, #34a853, #4285f4);
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient-shift 2.4s linear infinite;
}

/* 8. 掃描辨識（沿用客戶案例卡片的簽名效果） */
.demo-scan {
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 24px 24px;
}
.demo-scan-icon { font-size: 2.4rem; }
.demo-scan-icon svg { width: 40px; height: 40px; color: var(--accent); stroke-width: 1.5; animation: scan-icon-pulse 1.6s ease-in-out infinite; }
.demo-scan-line {
  position: absolute;
  left: 0; right: 0; top: 4%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #34a853, #4285f4, transparent);
  filter: drop-shadow(0 0 10px #4285f4);
  opacity: 0;
}
.demo-scan-line.playing { animation: scan-sweep 1.4s ease-in-out infinite; }
@keyframes scan-icon-pulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }

@keyframes caret-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes gradient-shift { to { background-position: 200% center; } }
/* 這支keyframe原本沒有定義（animation指到一個不存在的名稱瀏覽器會靜默不播），
   掃描線一直看不到動畫就是因為這個，現在補上讓線從上往下掃過卡片再重來 */
@keyframes scan-sweep {
  0% { top: 4%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 92%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-reveal-box.playing { animation: none; opacity: 1; transform: none; }
  .demo-typewriter::after { animation: none; opacity: 1; }
  .demo-gradient-text { animation: none; }
  .demo-scan-line.playing { animation: none; opacity: 0; }
  .demo-scan-icon svg { animation: none; }
  .demo-glass-bg { animation: none; }
}
