/*
 * tianji-cyberpunk.css — 天機閣視覺強化層（#738 視覺升級）
 * 
 * 疊加在 tianji-v2.css 之上，不改變任何功能邏輯。
 * 載入順序：tianji-tokens.css → tianji-v2.css → tianji-cyberpunk.css
 *
 * 色票維持書齋 palette 的墨綠+金基調，但加入：
 * - 動態星空粒子背景（canvas）
 * - Hero 文字霓虹光暈＋漸層動畫
 * - 按鈕邊框流光效果
 * - 卡片玻璃擬態（backdrop-filter）
 * - 微妙 scan-line 質感
 *
 * 瀏覽器：Chrome/Edge/Safari（backdrop-filter 需要）
 */

/* ══════════════════════════════════════════════════
   1. 全域動畫背景——星空粒子 canvas + aurora 漸層
   ══════════════════════════════════════════════════ */

/* Aurora 漸層底層（覆蓋原本純色背景） */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(201,169,97,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(100,180,255,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(30,60,45,0.3) 0%, transparent 70%);
  animation: auroraShift 20s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes auroraShift {
  0%   { opacity: 0.7; transform: scale(1); }
  50%  { opacity: 1;   transform: scale(1.05); }
  100% { opacity: 0.7; transform: scale(1); }
}

/* 星空 canvas 疊層 */
#tj-stars-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.6;
}

/* ══════════════════════════════════════════════════
   2. Hero 文字——霓虹光暈＋漸層動畫
   ══════════════════════════════════════════════════ */

/* 頁面主標題（h1 或 hero 區域標題） */
.landing-hero h1,
.hero-title,
[class*="hero"] h1 {
  background: linear-gradient(
    135deg,
    var(--tj-gold) 0%,
    var(--tj-gold-hi) 25%,
    #FFF8E7 50%,
    var(--tj-gold-hi) 75%,
    var(--tj-gold) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: goldShimmer 6s linear infinite;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(201,169,97,0.15));
}

@keyframes goldShimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* 英文副標 */
.hero-subtitle,
[class*="hero"] [class*="subtitle"],
[class*="hero"] em {
  letter-spacing: 0.15em;
  text-shadow: 0 0 20px rgba(201,169,97,0.3);
}

/* ══════════════════════════════════════════════════
   3. 按鈕——neon 邊框流光
   ══════════════════════════════════════════════════ */

/* 主 CTA 按鈕 */
[class*="btn-primary"],
[class*="cta"],
a[class*="btn"]:first-of-type,
button[class*="primary"] {
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

[class*="btn-primary"]:hover,
[class*="cta"]:hover,
a[class*="btn"]:first-of-type:hover {
  box-shadow:
    0 0 20px rgba(201,169,97,0.3),
    0 0 60px rgba(201,169,97,0.1),
    inset 0 0 15px rgba(201,169,97,0.1);
  transform: translateY(-2px);
}

/* 流光掃過效果 */
[class*="btn-primary"]::after,
[class*="cta"]::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255,255,255,0.08) 50%,
    transparent 100%
  );
  transform: skewX(-20deg);
  animation: btnShimmer 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btnShimmer {
  0%   { left: -60%; }
  50%  { left: 120%; }
  100% { left: 120%; }
}

/* ══════════════════════════════════════════════════
   4. 卡片——玻璃擬態
   ══════════════════════════════════════════════════ */

[class*="card"],
[class*="panel"],
[class*="modal-box"],
[class*="feature"] {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(201,169,97,0.12);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

[class*="card"]:hover,
[class*="panel"]:hover {
  border-color: rgba(201,169,97,0.25);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.3),
    0 0 30px rgba(201,169,97,0.06),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ══════════════════════════════════════════════════
   5. 導航欄——subtle 底部光暈
   ══════════════════════════════════════════════════ */

nav,
[class*="nav"],
header {
  box-shadow: 0 1px 0 rgba(201,169,97,0.08), 0 4px 30px rgba(0,0,0,0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ══════════════════════════════════════════════════
   6. 微妙 scan-line（全頁覆蓋，極低透明度）
   ══════════════════════════════════════════════════ */

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0,0,0,0.01) 2px,
    rgba(0,0,0,0.01) 4px
  );
  opacity: 0.3;
}

/* ══════════════════════════════════════════════════
   7. 減少動畫偏好
   ══════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  [class*="btn-primary"]::after,
  [class*="cta"]::after {
    animation: none !important;
  }
  #tj-stars-canvas {
    display: none;
  }
}

/* BUG-C guard（2026-11-06 回歸修正）：landing.html inline HIGH-1 的
   section.hero.tj-hero-starry { display: grid !important } 會蓋掉
   toggleHomeHero（tianji-app.js）以 inline display:none 隱藏非 home 路由 hero。
   attribute selector specificity (0,3,1) > HIGH-1 (0,2,1)，載入順序無影響。 */
section.hero.tj-hero-starry[style*="display: none"],
section.hero.tj-hero-starry[style*="display:none"] {
  display: none !important;
}
