/* ===========================================================================
   theme.css ── 全站共用樣式（2026-10 改版：清晨／夜晚）
   顏色全部寫成變數，改這裡全站一起變。
   主題由 theme.js 決定，寫在 <html data-theme="dawn|night">。
   字型：Noto Serif TC（標題）＋ Noto Sans TC（內文），由各頁 <head> 載入 Google Fonts。
   ===========================================================================*/

:root,
:root[data-theme="dawn"] {
  --bg: #F1F2F7;
  --bg-alt: #E6E8F1;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #FFFFFF;
  --surface-soft: rgba(230, 232, 241, 0.85);
  --text: #2B3044;
  --text-2: #4A5068;
  --text-3: #5E6884;
  --line: #DDE0EB;
  --line-strong: #B9BED3;
  --primary: #2B3044;
  --on-primary: #F1F2F7;
  --sun: #F2DE9B;
  --on-sun: #2B3044;
  --header-bg: rgba(241, 242, 247, 0.9);
  --card-back: #454B66;
  --card-back-text: #F1F2F7;
  --card-face: #FFFFFF;
  --shadow: 0 18px 40px rgba(43, 48, 68, 0.14);
  --sky: linear-gradient(180deg, #DCE0EC 0%, #E8E9F2 40%, #F1EEF0 72%, #F6EBCB 100%);
  --sky-glow: rgba(242, 222, 155, 0.55);
  --star-opacity: 0;
}

:root[data-theme="night"] {
  --bg: #181B2C;
  --bg-alt: rgba(18, 21, 38, 0.55);
  --surface: rgba(18, 21, 38, 0.6);
  --surface-strong: rgba(18, 21, 38, 0.82);
  --surface-soft: rgba(233, 234, 242, 0.08);
  --text: #E9EAF2;
  --text-2: #C3C7DA;
  --text-3: #AEB3CB;
  --line: rgba(233, 234, 242, 0.14);
  --line-strong: rgba(233, 234, 242, 0.35);
  --primary: #E9EAF2;
  --on-primary: #1E2238;
  --sun: #F2DE9B;
  --on-sun: #1E2238;
  --header-bg: rgba(24, 27, 44, 0.88);
  --card-back: #1A1D31;
  --card-back-text: #F1F2F7;
  --card-face: #F4F0E8;
  --shadow: 0 20px 48px rgba(8, 10, 20, 0.5);
  --sky: linear-gradient(180deg, #121526 0%, #1A1E3A 38%, #2E3258 64%, #554F7A 84%, #8C7690 100%);
  --sky-glow: rgba(242, 222, 155, 0.32);
  --star-opacity: 1;
}

/* 卡片正面永遠是淺底深字，兩個主題共用 */
/* ===== 全站字級（2026-10-31 統一）=====
   --fs-display 首頁主視覺 | --fs-page 每頁大標題(h1) | --fs-section 區塊標題(h2)／文章標題
   --fs-sub 小標題(h3) | 改這裡就會全站一起變 */
:root { --fs-display: 46px; --fs-page: 40px; --fs-section: 32px; --fs-sub: 22px; --ls-title: .04em; }
@media (max-width: 600px) { :root { --fs-display: 32px; --fs-page: 30px; --fs-section: 26px; --fs-sub: 20px; } }

:root {
  --face-text: #2B3044;
  --face-text-2: #4A5068;
  --face-text-3: #5E6884;
  --face-tip: #F2E7C4;
  --face-q: #E3E5EF;
  --serif: 'Noto Serif TC', 'Songti TC', serif;
  --sans: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', system-ui, sans-serif;
  --radius: 20px;
  --max: 1200px;
}

/* ── 基礎 ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.02em;
  transition: background-color .6s ease, color .6s ease;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--text-3); }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--sun); outline-offset: 3px; border-radius: 6px; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.serif { font-family: var(--serif); }
.eyebrow { margin: 0; font-size: 13px; letter-spacing: 0.3em; color: var(--text-3); }
.section-title { margin: 0; font-family: var(--serif); font-weight: 600; font-size: var(--fs-section); line-height: 1.45; letter-spacing: var(--ls-title); }
.muted { color: var(--text-2); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 只在某個主題顯示的元素 */
:root[data-theme="dawn"] .only-night,
:root:not([data-theme]) .only-night { display: none !important; }
:root[data-theme="night"] .only-dawn { display: none !important; }

/* ── 固定天空背景（捲動時不動） ─────────────────────── */
.sky {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: var(--sky);
  transition: opacity .6s ease;
}
.sky::after {
  content: ""; position: absolute; left: 50%; bottom: -300px;
  width: 600px; height: 600px; margin-left: -300px; border-radius: 50%;
  background: radial-gradient(circle, var(--sky-glow) 0%, rgba(242,222,155,0) 70%);
}
.sky .star {
  position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: #F1F2F7; opacity: calc(var(--star-opacity) * var(--o, .6));
}

/* ── 按鈕 ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 26px; border-radius: 999px;
  font-size: 16px; font-weight: 500; line-height: 1.2; cursor: pointer;
  border: 1px solid transparent; transition: transform .15s ease, opacity .15s ease, background-color .3s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sun { background: var(--sun); color: var(--on-sun); }
.btn-sun:hover { color: var(--on-sun); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { color: var(--on-primary); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { min-height: 44px; padding: 10px 20px; font-size: 15px; }
.link-arrow {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  font-weight: 500; border-bottom: 1px solid currentColor; padding: 0;
}

/* ── 導覽列 ─────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.site-header .container {
  min-height: 72px; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 8px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: 0.08em; white-space: nowrap; }
.brand-mark { flex-shrink: 0; }
.site-nav {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 2px;
  overflow-x: auto; max-width: 100%; scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px;
  font-size: 15px; white-space: nowrap;
}
.site-nav .btn { margin-left: 6px; white-space: nowrap; }
/* 中英並列導覽（中文在上、英文小字在下） */
.site-nav a.bi { flex-direction: column; justify-content: center; gap: 0; line-height: 1.2; padding: 6px 12px; }
.site-nav a.bi small { font-size: 10px; letter-spacing: .18em; color: var(--text-3); }
.sm-only { display: none; }
@media (max-width: 480px) {
  .lg-only { display: none; }
  .sm-only { display: inline; }
  .site-nav a.bi { padding: 6px 8px; }
}
.section-title .en { font-family: var(--sans); font-weight: 400; font-size: .5em; letter-spacing: .2em; color: var(--text-3); text-transform: uppercase; margin-left: 6px; }
.theme-toggle {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}

/* ── 頁尾 ─────────────────────────────────────────── */
.site-footer {
  background: var(--surface-strong);
  border-top: 1px solid var(--line);
  padding: 48px 0 36px;
}
.site-footer .row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; align-items: flex-start; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 4px; }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; font-size: 14px; }
.site-footer .quote { margin: 28px 0 0; font-size: 13px; color: var(--text-3); line-height: 1.8; }

/* ── 彈窗（小費、能量流共用） ───────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(10, 12, 22, 0.6); align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 24px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
:root[data-theme="night"] .modal { background: #20243B; }
.modal h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 20px; }


/* 彈窗內容（小費輸入框、按鈕列）全站共用 */
.modal .sub { margin: 0 0 16px; font-size: 14px; color: var(--text-2); }
.modal input[type="number"] {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--text); font-size: 18px; text-align: center; font-family: inherit;
  -moz-appearance: textfield; appearance: textfield;
}
.modal input[type="number"]::-webkit-outer-spin-button,
.modal input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.modal .hint { margin: 6px 0 0; font-size: 12px; color: var(--text-3); text-align: center; }
.modal .err { min-height: 20px; margin: 6px 0; font-size: 13px; color: #C4524A; text-align: center; }
:root[data-theme="night"] .modal .err { color: #FF9A8A; }
.modal .row { display: flex; gap: 10px; margin-top: 8px; }
.modal .row .btn { flex: 1; }
.modal .row.col { flex-direction: column; }

@media (max-width: 600px) {
  .brand-name { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
