/* ============================================
   🎨 base.css — 設計系統基礎

   💡 這裡定義了整個網站的「基因」：
   顏色、字體、間距、重置樣式。
   所有頁面共用這些變數，確保視覺一致性。
   ============================================ */

/* 🔧 【CSS 變數】全站設計 token
   💡 集中管理顏色和字體，改一處就改全站 */
:root {
  /* 🌙 背景色系 — 深靛藍漸層，不是純黑，帶一點溫度 */
  --bg-deep: #08081a;
  --bg-mid: #0e0e24;
  --bg-surface: #14142e;
  --bg-elevated: #1a1a3a;

  /* ✨ 金色系 — 暖金，不是亮黃，像老銅器的光澤 */
  --gold: #c9a84c;
  --gold-dim: #a08636;
  --gold-glow: rgba(201, 168, 76, 0.15);

  /* 📝 文字色 — off-white 比純白柔和，讀起來不刺眼 */
  --text-primary: #e8e4d9;
  --text-secondary: #C4C0B8;
  --text-muted: #6b675e;

  /* 🚦 功能色 */
  --error: #d4654a;
  --success: #5a9e6f;

  /* 🔤 字體 */
  --font-serif: 'Cormorant Garamond', 'Georgia', serif;
  --font-sans: 'Inter', -apple-system, 'Segoe UI', sans-serif;

  /* 📐 間距 */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 3.5rem;
  --space-2xl: 6rem;

  /* 📏 最大內容寬度 */
  --content-width: 720px;
  --page-width: 1080px;
}

/* 🔄 【Reset】清除瀏覽器預設樣式
   💡 讓所有元素從零開始，避免跨瀏覽器差異 */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.7;
  color: var(--text-primary);
  /* 💡 背景色移到 html 而非 body — 因為 body 有不透明背景時，
     z-index 為負的偽元素（漸層、噪點）會被蓋住看不到 */
  background: transparent;
  min-height: 100vh;
  overflow-x: hidden;
}

html {
  background: var(--bg-deep);
}

/* 🎨 【背景漸層】從深到稍淺的靛藍
   💡 不用純色是因為純色看起來太「數位」，
   漸層給人一種空間深度感 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(
    175deg,
    var(--bg-deep) 0%,
    var(--bg-mid) 45%,
    var(--bg-surface) 100%
  );
  z-index: -2;
}

/* ✨ 【星空背景層】
   💡 用三個偽元素層疊出星空效果：小星 / 中星 / 大星
   每層用 box-shadow 畫幾十個點，大小和亮度不同，
   製造「稀疏但明確」的星空感，比 noise 紋理更有占星主題感。
   為什麼不用 canvas/JS？純 CSS 零依賴、不阻塞渲染 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

/* 🌟 小星點層 — 1px，數量最多，最暗 */
body::after {
  width: 1px;
  height: 1px;
  background: transparent;
  box-shadow:
    42px 120px rgba(255,255,255,0.4),
    187px 68px rgba(255,255,255,0.3),
    340px 210px rgba(255,255,255,0.35),
    520px 45px rgba(255,255,255,0.25),
    680px 310px rgba(255,255,255,0.4),
    95px 420px rgba(255,255,255,0.3),
    810px 180px rgba(255,255,255,0.35),
    260px 530px rgba(255,255,255,0.25),
    450px 650px rgba(255,255,255,0.45),
    730px 490px rgba(255,255,255,0.3),
    1050px 75px rgba(255,255,255,0.35),
    1180px 340px rgba(255,255,255,0.25),
    920px 610px rgba(255,255,255,0.3),
    150px 780px rgba(255,255,255,0.4),
    1300px 150px rgba(255,255,255,0.45),
    580px 850px rgba(255,255,255,0.25),
    1400px 520px rgba(255,255,255,0.3),
    310px 960px rgba(255,255,255,0.35),
    1100px 700px rgba(255,255,255,0.4),
    60px 1100px rgba(255,255,255,0.3),
    780px 1050px rgba(255,255,255,0.25),
    1250px 890px rgba(255,255,255,0.35),
    430px 1200px rgba(255,255,255,0.3),
    950px 1300px rgba(255,255,255,0.45),
    200px 1400px rgba(255,255,255,0.25),
    1350px 1100px rgba(255,255,255,0.35),
    670px 1500px rgba(255,255,255,0.3),
    1500px 50px rgba(255,255,255,0.25),
    1600px 400px rgba(255,255,255,0.3),
    1700px 750px rgba(255,255,255,0.35),
    1800px 200px rgba(255,255,255,0.25),
    1550px 950px rgba(255,255,255,0.3),
    1650px 1200px rgba(255,255,255,0.45),
    1750px 600px rgba(255,255,255,0.3),
    1850px 1000px rgba(255,255,255,0.25),
    1900px 300px rgba(255,255,255,0.35);
}

/* 🌟 中星點 + 大星點 — 用 .starfield 容器內的偽元素 */
.starfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

/* 中星點 — 1.5px，較少，稍亮 */
.starfield::before {
  content: '';
  position: absolute;
  width: 1.5px;
  height: 1.5px;
  background: transparent;
  border-radius: 50%;
  box-shadow:
    130px 90px rgba(255,255,255,0.5),
    480px 260px rgba(255,255,255,0.4),
    750px 150px rgba(255,255,255,0.45),
    290px 470px rgba(255,255,255,0.35),
    1020px 350px rgba(255,255,255,0.5),
    600px 700px rgba(255,255,255,0.4),
    180px 900px rgba(255,255,255,0.35),
    870px 560px rgba(255,255,255,0.45),
    1200px 200px rgba(255,255,255,0.4),
    400px 1100px rgba(255,255,255,0.35),
    1080px 800px rgba(255,255,255,0.5),
    50px 1300px rgba(255,255,255,0.4),
    700px 1250px rgba(255,255,255,0.35),
    1350px 650px rgba(255,255,255,0.5),
    550px 1450px rgba(255,255,255,0.4),
    1500px 300px rgba(255,255,255,0.35),
    1650px 550px rgba(255,255,255,0.5),
    1800px 850px rgba(255,255,255,0.4),
    1700px 100px rgba(255,255,255,0.35),
    1550px 1100px rgba(255,255,255,0.5);
}

/* 大星點 — 2px，最少，最亮 */
.starfield::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 2px;
  background: transparent;
  border-radius: 50%;
  box-shadow:
    350px 180px rgba(232,228,217,0.6),
    820px 420px rgba(232,228,217,0.55),
    1150px 110px rgba(232,228,217,0.5),
    550px 580px rgba(232,228,217,0.6),
    170px 750px rgba(232,228,217,0.5),
    980px 900px rgba(232,228,217,0.55),
    1300px 480px rgba(232,228,217,0.5),
    420px 1150px rgba(232,228,217,0.6),
    750px 1350px rgba(232,228,217,0.55),
    1100px 1050px rgba(232,228,217,0.5),
    1600px 250px rgba(232,228,217,0.55),
    1750px 680px rgba(232,228,217,0.5),
    1850px 1100px rgba(232,228,217,0.6);
}

/* 🔤 【排版系統】
   💡 標題用 serif（Cormorant Garamond），正文用 sans（Inter）
   這個組合讓頁面有「editorial」感覺，像雜誌而不是 SaaS 產品 */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
}

h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
}

h3 {
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
}

p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--text-primary);
}

/* 📏 【通用容器】限制內容寬度，水平置中 */
.container {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--narrow {
  max-width: var(--content-width);
}

/* ✨ 【金色分隔線】比 <hr> 好看，帶漸變消隱 */
.divider {
  border: none;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--gold-dim) 30%,
    var(--gold-dim) 70%,
    transparent 100%
  );
  margin: var(--space-xl) 0;
  opacity: 0.3;
}

/* 🎯 【主按鈕】
   💡 不用圓角膠囊按鈕（太 AI 味），
   而是用細邊框 + 微圓角，像手工刻印的感覺 */
.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  background: transparent;
  padding: 0.85em 2.2em;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

.btn:hover {
  background: var(--gold-glow);
  border-color: var(--gold);
  color: var(--text-primary);
}

.btn--filled {
  background: var(--gold-dim);
  color: var(--bg-deep);
  border-color: var(--gold-dim);
}

.btn--filled:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-deep);
}

/* 🛡️ 【表單基礎】 */
input, textarea, select {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 2px;
  padding: 0.75em 1em;
  width: 100%;
  transition: border-color 0.3s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold-dim);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

/* 🔧 【原生 UI 控件覆蓋】
   💡 瀏覽器預設的 date/time picker icon、number spinner、select arrow
   在深色背景下顯示為白色系統樣式，非常突兀，全部改成符合主題的樣式 */

/* 隱藏 date/time 輸入框的 calendar/clock icon */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.4) sepia(1) saturate(0.5) hue-rotate(5deg) brightness(0.8);
  opacity: 0.5;
  cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 0.9;
}

/* 隱藏 number 輸入框的 spinner 上下箭頭 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* 🎨 【Select 自定義樣式】用 SVG 箭頭取代原生下拉箭頭 */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a08636' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9em center;
  padding-right: 2.5em;
}

label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

/* 🌈 【漸入動畫】用於頁面元素載入時 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeInUp 0.8s ease-out both;
}

.fade-in--delay-1 { animation-delay: 0.15s; }
.fade-in--delay-2 { animation-delay: 0.3s; }
.fade-in--delay-3 { animation-delay: 0.5s; }

/* 📱 【響應式斷點】 */
@media (max-width: 768px) {
  :root {
    --space-xl: 2.5rem;
    --space-2xl: 4rem;
  }

  .container {
    padding: 0 20px;
  }
}
