/* Evenwise 官網：紙與光（顏色對應 app/lib/core/theme.dart） */
:root {
  --paper: #f5f3ee;
  --ink: #1f2a2c;
  --muted: #5b6466;
  --faint: #8a9294;
  --line: #dad6cc;
  --jade: #2f6b63;
  --jade-deep: #1f4d47;
  --jade-tint: #e3ece9;
  --lamp: #e3ad55;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --sky: linear-gradient(160deg, #f8f5ef 0%, #eef5f2 55%, #e9eff7 100%);
  --night: linear-gradient(160deg, #1f2a44 0%, #363b60 55%, #232a3e 100%);
  --serif: "Noto Serif TC", "Songti TC", "Source Han Serif TC", "PMingLiU", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  color-scheme: light;
}

/* 深色：沒選過就跟系統，按過切換鈕就照選的（data-theme 由 site.js 設定） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161b1a;
    --ink: #ece8df;
    --muted: #a9b0ae;
    --faint: #8e9693;
    --line: #34403e;
    --jade: #8cc2b8;
    --jade-deep: #b5dad2;
    --jade-tint: rgba(140, 194, 184, 0.12);
    --glass: rgba(60, 68, 105, 0.3);
    --glass-edge: rgba(255, 255, 255, 0.13);
    --sky: linear-gradient(160deg, #1f2a44 0%, #363b60 55%, #232a3e 100%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161b1a;
  --ink: #ece8df;
  --muted: #a9b0ae;
  --faint: #8e9693;
  --line: #34403e;
  --jade: #8cc2b8;
  --jade-deep: #b5dad2;
  --jade-tint: rgba(140, 194, 184, 0.12);
  --glass: rgba(60, 68, 105, 0.3);
  --glass-edge: rgba(255, 255, 255, 0.13);
  --sky: linear-gradient(160deg, #1f2a44 0%, #363b60 55%, #232a3e 100%);
  color-scheme: dark;
}

/* 明暗切換鈕 */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--jade); }
.theme-toggle svg { width: 18px; height: 18px; animation: toggle-in 0.5s ease; }
@keyframes toggle-in { from { opacity: 0; transform: rotate(-90deg) scale(0.6); } }
.top nav { align-items: center; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.75 var(--sans);
  letter-spacing: 0.01em;
}

a { color: var(--jade); text-underline-offset: 3px; }
a:hover { color: var(--jade-deep); }

img { max-width: 100%; }

.wrap {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding-inline: 20px;
}

/* 頁首 */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.top nav { display: flex; gap: 18px; font-size: 15px; flex-wrap: wrap; justify-content: flex-end; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--ink); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; text-wrap: balance; }

/* 文件頁（隱私權政策、支援） */
.doc { padding-block: 40px 80px; }
.doc article { max-width: 44em; }
.doc h1 { margin: 0 0 6px; font-size: clamp(30px, 5vw, 40px); }
.doc .meta { margin: 0 0 32px; color: var(--faint); font-size: 15px; }
.doc h2 { margin: 44px 0 10px; font-size: 23px; }
.doc h3 { margin: 26px 0 6px; font-size: 18px; font-family: var(--sans); }
.doc p, .doc li { color: var(--ink); }
.doc ul { padding-left: 1.2em; }
.doc li + li { margin-top: 4px; }
.doc .summary {
  padding: 20px 24px;
  border-radius: 18px;
  background: var(--jade-tint);
}
.doc .summary ul { margin: 6px 0 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }

details { padding: 16px 0; border-bottom: 1px solid var(--line); }
details summary { cursor: pointer; font-weight: 600; }
details p { margin: 10px 0 0; color: var(--muted); }

.contact {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--jade-tint);
  font-weight: 600;
  user-select: all;
}

/* 常見問題：自訂箭頭 */
details summary { list-style: none; display: flex; justify-content: space-between; gap: 16px; }
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 0.6em;
  margin-right: 4px;
  border-right: 2px solid var(--faint);
  border-bottom: 2px solid var(--faint);
  transform: rotate(45deg);
  transition: transform 0.3s ease;
}
details[open] summary::after { transform: rotate(225deg); }
details summary:hover { color: var(--jade); }
details[open] p { animation: fade-down 0.35s ease; }
@keyframes fade-down { from { opacity: 0; transform: translateY(-6px); } }

/* 頁尾 */
footer {
  border-top: 1px solid var(--line);
  padding-block: 28px 40px;
  font-size: 14px;
  color: var(--faint);
}
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
footer a { color: var(--muted); text-decoration: none; }

/* ── 動態：慢、輕，像呼吸 ── */
:root { --ease: cubic-bezier(0.22, 1, 0.36, 1); }

/* 文件頁進場 */
.doc article { animation: rise 0.8s var(--ease) both; }
.reveal-ready .doc article { animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* 捲動淡入（site.js 加上 .reveal / .in） */
.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.reveal-ready .reveal.in { opacity: 1; transform: none; }

/* 連結、按鈕 */
a, .top nav a, footer a { transition: color 0.25s ease; }

/* 切換明暗時顏色漸變（只在按下時加 class，避免平常捲動卡頓） */
.theme-anim, .theme-anim * {
  transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 480px) {
  .top nav { gap: 12px; font-size: 14px; }
}
