/* ============================================================
   個人網站共用樣式 — 現代極簡（亮色）
   透過 CSS 變數控制配色，暗色模式自動切換
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --text: #1a1d23;
  --text-secondary: #5b6472;
  --text-faint: #9aa3af;
  --border: #e5e8ec;
  --accent: #2f6fed;
  --accent-soft: #eaf0fe;
  --card-bg: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
  --radius: 12px;
  --container: 960px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC",
    "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Noto Serif TC", "Songti TC", "PMingLiU", serif;
}

/* 深色模式（跟隨系統偏好，也可由 JS 手動切換） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --bg-soft: #1c1f25;
    --text: #e8eaed;
    --text-secondary: #a7afba;
    --text-faint: #6b7480;
    --border: #2a2f38;
    --accent: #6d9bff;
    --accent-soft: #1d2942;
    --card-bg: #1b1e24;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --bg-soft: #1c1f25;
  --text: #e8eaed;
  --text-secondary: #a7afba;
  --text-faint: #6b7480;
  --border: #2a2f38;
  --accent: #6d9bff;
  --accent-soft: #1d2942;
  --card-bg: #1b1e24;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ---------- 基礎 ---------- */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

::selection {
  background: var(--accent);
  color: #fff;
}

/* ---------- 導覽列 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.brand:hover {
  text-decoration: none;
}

.brand .dot {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--bg-soft);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 主題切換按鈕 */
.theme-toggle {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: inline;
}

/* 行動版選單按鈕 */
.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  align-items: center;
  justify-content: center;
}

@media (max-width: 720px) {
  .menu-toggle {
    display: inline-flex;
  }

  .nav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px 20px;
    gap: 2px;
    display: none;
    box-shadow: var(--shadow);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 12px 14px;
  }
}

/* ---------- 首頁 Hero ---------- */

.hero {
  padding: 96px 0 72px;
}

.hero .eyebrow {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.hero h1 .highlight {
  color: var(--accent);
}

.hero .subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 560px;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- 按鈕 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--text-faint);
  background: var(--bg-soft);
}

/* ---------- 區段 ---------- */

.section {
  padding: 72px 0;
}

.section + .section {
  border-top: 1px solid var(--border);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 36px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-title .no {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  margin-right: 8px;
}

.section-more {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ---------- 文章卡片 ---------- */

.article-card {
  display: block;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  transition: all 0.2s ease;
}

.article-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--text-faint);
}

.article-card .meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.article-card .tag {
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.article-card h3 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 8px;
}

.article-card p {
  font-size: 15px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card .read-more {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* ---------- 文章列表（作品集頁） ---------- */

.works-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 720px) {
  .works-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* 分類過濾 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.filter-btn {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--text-faint);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- 履歷 ---------- */

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 40px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
}

.timeline-item .period {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.timeline-item h3 {
  font-size: 18px;
  font-weight: 700;
}

.timeline-item .org {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.timeline-item ul {
  padding-left: 20px;
}

.timeline-item li {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* 技能標籤 */
.skill-group {
  margin-bottom: 28px;
}

.skill-group h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: none;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tags span {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 14px;
}

/* 履歷區段列 */
.resume-section {
  margin-bottom: 48px;
}

.resume-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ---------- 單篇文章 ---------- */

.article-page {
  max-width: 720px;
}

.article-page .article-header {
  margin-bottom: 40px;
}

.article-page .article-header .meta {
  font-size: 14px;
  color: var(--text-faint);
  margin-bottom: 16px;
}

.article-page h1 {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

.article-body {
  font-size: 17px;
  line-height: 2;
  color: var(--text);
}

.article-body h2 {
  font-size: 1.4rem;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.article-body h3 {
  font-size: 1.15rem;
  margin: 32px 0 12px;
}

.article-body p {
  margin-bottom: 20px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 20px 24px;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

.article-body code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.9em;
  font-family: "SF Mono", Consolas, "Courier New", monospace;
}

.article-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
}

/* ---------- 頁尾 ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 48px;
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.site-footer p {
  font-size: 14px;
  color: var(--text-faint);
}

.footer-links {
  display: flex;
  gap: 20px;
  list-style: none;
}

.footer-links a {
  font-size: 14px;
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--text);
}

/* ---------- 捲動淡入動畫 ---------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ---------- 其他 ---------- */

.page-head {
  padding: 72px 0 40px;
}

.page-head h1 {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

.page-head p {
  color: var(--text-secondary);
  max-width: 560px;
}

.text-center {
  text-align: center;
}

.muted {
  color: var(--text-secondary);
}
