/* ═══════════════════════════════════════════════════════════
   PhAI 資源館 · 共用設計系統
   index.html 與 submit/index.html 共用；頁面專屬樣式放各頁 <style>
   ═══════════════════════════════════════════════════════════ */

:root {
  /* 中性色 */
  --bg: #f4f5fb;
  --bg-soft: #eaecf6;
  --paper: #ffffff;
  --paper-2: #f8f9fd;
  --ink: #191e33;
  --muted: #565e75;
  --faint: #8c93a9;
  --line: #e3e6f1;
  --line-strong: #ccd2e5;
  /* 品牌色 */
  --brand: #5854e8;
  --brand-ink: #4744d6;
  --brand-soft: rgba(88, 84, 232, .10);
  --cyan: #0aa8b4;
  --amber: #f0a11b;
  --ok: #0f9d58;
  --warn: #e8930c;
  /* 深空面板（hero / CTA） */
  --space: #0c1027;
  --space-2: #232a63;
  --space-glow: #3b2f86;
  --space-ink: #eef1ff;
  --space-muted: #a6b0da;
  --space-line: rgba(255, 255, 255, .14);
  /* 陰影、圓角、寬度 */
  --shadow: 0 18px 44px rgba(23, 28, 52, .11);
  --shadow-soft: 0 5px 16px rgba(23, 28, 52, .06);
  --r-xl: 26px; --r-lg: 20px; --r-md: 15px; --r-sm: 11px;
  --max: 1180px;
  --btn-dark-bg: #1d2342;
  --btn-dark-fg: #ffffff;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0b0f1e;
  --bg-soft: #111629;
  --paper: #151b31;
  --paper-2: #1a2140;
  --ink: #e9ecfa;
  --muted: #a2abc8;
  --faint: #747e9c;
  --line: #262e51;
  --line-strong: #364070;
  --brand: #7b78ff;
  --brand-ink: #928fff;
  --brand-soft: rgba(123, 120, 255, .14);
  --cyan: #2cc7d3;
  --ok: #2ecb80;
  --space: #0a0e22;
  --space-2: #202968;
  --shadow: 0 18px 44px rgba(0, 0, 0, .5);
  --shadow-soft: 0 5px 16px rgba(0, 0, 0, .38);
  --btn-dark-bg: #e9ecfa;
  --btn-dark-fg: #12172e;
  color-scheme: dark;
}

/* ── 基礎 ─────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink); line-height: 1.7;
  font-family: "Noto Sans TC", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.latin, .num { font-family: "Space Grotesk", "Noto Sans TC", sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: rgba(88, 84, 232, .22); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.shell { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 999px; text-decoration: none; }
.skip:focus { left: 8px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ── 頂欄 ─────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.nav { max-width: var(--max); margin: 0 auto; padding: 11px 24px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; margin-right: auto; min-width: 0; }
.brand svg { width: 39px; height: 39px; flex: none; border-radius: 12px; box-shadow: var(--shadow-soft); }
.brand b { font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; margin-top: -3px; white-space: nowrap; }
.nav-links { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { text-decoration: none; color: var(--muted); font-weight: 500; font-size: 14.5px; padding: 8px 13px; border-radius: 999px; white-space: nowrap; transition: background .15s ease, color .15s ease; }
.nav-links a:hover { color: var(--ink); background: var(--bg-soft); }
.nav-links a.active { color: var(--brand-ink); background: var(--brand-soft); font-weight: 700; }
.icon-btn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; cursor: pointer; color: var(--muted); transition: color .15s, border-color .15s; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 19px; height: 19px; }
html[data-theme="dark"] .icon-moon { display: none; }
html:not([data-theme="dark"]) .icon-sun { display: none; }

/* ── 按鈕 ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: 999px; border: 1px solid transparent;
  text-decoration: none; font-weight: 700; font-size: 15px; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.solid { background: var(--brand); color: #fff; box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 38%, transparent); }
.btn.solid:hover { background: var(--brand-ink); }
.btn.dark { background: var(--btn-dark-bg); color: var(--btn-dark-fg); }
.btn.dark:hover { opacity: .9; }
.btn.ghost { border-color: var(--line-strong); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-soft); }
.btn.ghost:hover { border-color: var(--faint); }
.btn.space-ghost { border-color: var(--space-line); background: rgba(255, 255, 255, .06); color: var(--space-ink); }
.btn.space-ghost:hover { background: rgba(255, 255, 255, .13); }
.nav .btn { min-height: 38px; padding: 7px 16px; font-size: 14px; }

/* ── 深空面板（hero / CTA 共用底） ────────── */
.space-panel {
  position: relative; overflow: hidden; color: var(--space-ink);
  background:
    radial-gradient(52rem 30rem at 82% -20%, var(--space-2), transparent 62%),
    radial-gradient(40rem 26rem at -12% 110%, var(--space-glow), transparent 55%),
    var(--space);
}
.space-panel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .13) 1px, transparent 1.5px);
  background-size: 28px 28px;
  mask-image: linear-gradient(112deg, transparent 40%, #000 92%);
}

/* ── 區塊標題 ─────────────────────────────── */
section.block { padding: 62px 0 8px; scroll-margin-top: 70px; }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.sec-head h2 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.1rem); letter-spacing: -.02em; font-weight: 900; line-height: 1.25; }
.sec-head .sec-sub { margin: 7px 0 0; color: var(--muted); max-width: 620px; font-size: 15px; }
.sec-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--brand-ink);
  font-family: "Space Grotesk", sans-serif;
}
.sec-kicker::before { content: ""; width: 22px; height: 2px; background: var(--brand); border-radius: 2px; }

/* ── 徽章 / 圓標 ──────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 11px;
  font-size: 12px; font-weight: 700; background: rgba(10, 14, 34, .55); color: #fff;
  backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .2);
}
.badge .dot { width: 7px; height: 7px; border-radius: 999px; background: #3ddc84; box-shadow: 0 0 0 3px rgba(61, 220, 132, .28); }
.badge.pending .dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(240, 161, 27, .3); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 4px 11px; white-space: nowrap; }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.tag { font-size: 12px; color: var(--muted); background: var(--bg-soft); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }

/* ── 面板 / 清單 ──────────────────────────── */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-soft); }
.panel h3 { margin: 0 0 10px; font-size: 1.12rem; letter-spacing: -.01em; }
.panel p { margin: 0 0 8px; color: var(--muted); font-size: 14.5px; }
.check-list { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.check-list li { display: flex; gap: 10px; color: var(--muted); font-size: 14.5px; }
.check-list svg { width: 19px; height: 19px; flex: none; color: var(--cyan); margin-top: 3px; }

/* ── 步驟 ─────────────────────────────────── */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; counter-reset: step; }
.steps.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.step { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px 18px 18px; box-shadow: var(--shadow-soft); }
.step .n {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--cyan)); color: #fff;
  font-weight: 700; font-size: 15px; margin-bottom: 12px; font-family: "Space Grotesk", sans-serif;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 30%, transparent);
}
.step b { display: block; font-size: 1.03rem; margin-bottom: 4px; }
.step span { color: var(--muted); font-size: 13.8px; }
.step::after {
  content: "→"; position: absolute; right: -13px; top: 24px; z-index: 1;
  color: var(--faint); font-weight: 700; font-size: 15px;
}
.step:last-child::after { display: none; }

/* ── CTA 橫幅 ─────────────────────────────── */
.cta-banner {
  margin-top: 28px; border-radius: var(--r-xl); padding: 32px 30px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px;
}
.cta-banner h3 { margin: 0 0 5px; font-size: 1.4rem; letter-spacing: -.02em; }
.cta-banner p { margin: 0; color: var(--space-muted); font-size: 14.5px; max-width: 36em; }
.cta-banner > * { position: relative; }

/* ── 頁尾 ─────────────────────────────────── */
footer.site-foot { margin-top: 72px; border-top: 1px solid var(--line); background: var(--paper); }
.foot-grid { max-width: var(--max); margin: 0 auto; padding: 36px 24px 26px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 26px; }
.foot-brand { display: flex; align-items: flex-start; gap: 12px; }
.foot-brand svg { width: 40px; height: 40px; flex: none; border-radius: 12px; }
.foot-brand b { font-size: 16px; }
.foot-brand p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 30em; }
.foot-col b { display: block; font-size: 13px; letter-spacing: .1em; color: var(--faint); margin-bottom: 10px; font-weight: 700; }
.foot-col a { display: block; color: var(--muted); text-decoration: none; font-size: 14.5px; padding: 3px 0; }
.foot-col a:hover { color: var(--ink); text-decoration: underline; }
.foot-bar { border-top: 1px solid var(--line); }
.foot-bar .inner { max-width: var(--max); margin: 0 auto; padding: 14px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--faint); font-size: 13px; }

/* ── 回頂端 ───────────────────────────────── */
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 45;
  width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--muted); cursor: pointer; display: grid; place-items: center;
  box-shadow: var(--shadow-soft); opacity: 0; translate: 0 10px; pointer-events: none;
  transition: opacity .2s ease, translate .2s ease;
}
.to-top.show { opacity: 1; translate: 0 0; pointer-events: auto; }
.to-top:hover { color: var(--ink); border-color: var(--faint); }
.to-top svg { width: 20px; height: 20px; }

/* ── 表單元素 ─────────────────────────────── */
input[type="search"], select {
  width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper-2); padding: 10px 13px; transition: border-color .15s ease;
}
input[type="search"]:focus, select:focus { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--brand) 18%, transparent); }

/* ── RWD 共通 ─────────────────────────────── */
@media (max-width: 960px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps.three { grid-template-columns: 1fr; }
  .step::after { display: none; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .shell, .nav { padding-left: 16px; padding-right: 16px; }
  .nav { flex-wrap: wrap; row-gap: 4px; }
  .nav-links { order: 3; width: 100%; margin: 0 -16px; padding: 0 16px; }
  .brand small { display: none; }
  section.block { padding-top: 46px; }
  .steps { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; gap: 20px; }
  .to-top { right: 14px; bottom: 14px; }
}
