/* =====================================================
   AI智慧職場 - Main Design System
   上班族友善配色 v2.0
   ===================================================== */

/* ── 設計變數 ─────────────────────────────────────── */
:root {
  /* 品牌色：深藍靛 → 穩重專業 */
  --primary:        #2563eb;
  --primary-light:  #3b82f6;
  --primary-dark:   #1d4ed8;

  /* 強調色：暖橘棕 → 親切不刺眼 */
  --accent:         #ea580c;
  --accent-light:   #f97316;
  --accent-dark:    #c2410c;

  /* 語義色 */
  --success:  #16a34a;
  --warning:  #d97706;
  --danger:   #dc2626;
  --info:     #0284c7;

  /* 背景：米白系 → 護眼不刺白 */
  --bg:         #f5f5f0;
  --bg-alt:     #ffffff;
  --bg-card:    #ffffff;
  --bg-elevated:#eeede8;
  --border:     #d6d3c0;
  --border-light:#e8e7df;

  /* 文字：暖黑系 → 舒適閱讀 */
  --text:       #1c1917;
  --text-muted: #57534e;
  --text-light: #a8a29e;
  --text-inv:   #ffffff;

  /* 字型 */
  --font-sans:  'Noto Sans TC', 'Inter', system-ui, sans-serif;
  --font-mono:  'Consolas', 'Monaco', 'Courier New', monospace;

  /* 字級 */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;

  /* 間距 */
  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem;
  --sp-4: 1rem;    --sp-5: 1.25rem; --sp-6: 1.5rem;
  --sp-8: 2rem;    --sp-10:2.5rem;  --sp-12:3rem;
  --sp-16:4rem;    --sp-20:5rem;    --sp-24:6rem;

  /* 圓角 */
  --r-sm:   0.375rem;
  --r-md:   0.75rem;
  --r-lg:   1rem;
  --r-xl:   1.5rem;
  --r-full: 9999px;

  /* 陰影：暖棕調 */
  --shadow-sm:  0 1px 3px rgba(28,25,23,.06);
  --shadow-md:  0 4px 16px rgba(28,25,23,.08);
  --shadow-lg:  0 8px 30px rgba(28,25,23,.12);
  --shadow-xl:  0 20px 60px rgba(28,25,23,.16);

  /* 動畫 */
  --transition:      0.25s ease;
  --transition-fast: 0.15s ease;

  /* 排版 */
  --container: 1200px;
  --header-h:  64px;
}

/* ── 深色模式 ────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #1c1917;
  --bg-alt:      #292524;
  --bg-card:     #2c2825;
  --bg-elevated: #363130;
  --border:      #44403c;
  --border-light:#3c3835;
  --text:        #e7e5e4;
  --text-muted:  #a8a29e;
  --text-light:  #78716c;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.3);
  --shadow-md:   0 4px 16px rgba(0,0,0,.4);
  --shadow-lg:   0 8px 30px rgba(0,0,0,.5);
}

/* ── Reset & Base ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* ── Container ───────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

/* ══════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════ */
.site-header {
  background: var(--bg-alt);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: box-shadow var(--transition);
}
.site-header.scrolled { box-shadow: var(--shadow-md); }

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  flex-shrink: 0;
}
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
}
.logo-name   { font-size: var(--text-lg); font-weight: 800; color: var(--primary); line-height: 1.2; }
.logo-slogan { font-size: 0.65rem; color: var(--text-muted); font-weight: 400; }
[data-theme="dark"] .logo-name { color: var(--text); }

/* 主導覽 */
.main-nav, .site-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-left: var(--sp-4);
  flex: 1;
}

.nav-link, .site-nav a {
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  transition: background var(--transition-fast), color var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  white-space: nowrap;
  text-decoration: none;
}
.nav-link:hover, .nav-link.active,
.site-nav a:hover {
  background: #eff6ff;
  color: var(--primary);
}
[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .site-nav a:hover {
  background: rgba(255,255,255,.07);
  color: var(--primary-light);
}

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown > a {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  cursor: pointer;
}

/* 用 padding-top 填補間隙，滑鼠不會斷開 */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  padding-top: 8px;
  z-index: 999;
  min-width: 200px;
}
.dropdown-menu-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-2);
  overflow: hidden;
}
.nav-dropdown:hover .dropdown-menu { display: block; animation: fadeInDown .15s ease; }

.dropdown-item, .dropdown-menu a {
  display: flex !important;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  color: var(--text) !important;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--transition-fast);
  text-decoration: none;
}
.dropdown-item:hover, .dropdown-menu a:hover {
  background: #eff6ff;
  color: var(--primary) !important;
}

/* 工具列 */
.header-tools { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
}
.icon-btn:hover {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary);
}
.nav-toggle { display: none; }

/* ══════════════════════════════════════════════════
   HERO（深藍色系，穩重感）
══════════════════════════════════════════════════ */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #1e40af 100%);
  padding: var(--sp-24) 0 var(--sp-20);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-16);
  align-items: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: rgba(234,88,12,.18);
  border: 1px solid rgba(234,88,12,.35);
  color: #fdba74;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--sp-1) var(--sp-4);
  border-radius: var(--r-full);
  margin-bottom: var(--sp-5);
}
.hero-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  color: #fff;
  line-height: 1.2;
  margin-bottom: var(--sp-5);
  letter-spacing: -0.02em;
}
.hero-title .highlight,
.text-accent {
  background: linear-gradient(135deg, #fb923c, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-desc {
  font-size: var(--text-base);
  color: rgba(255,255,255,.78);
  line-height: 1.85;
  margin-bottom: var(--sp-8);
  max-width: 520px;
}
.hero-actions, .hero-btns {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

/* 英雄統計卡 */
.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
.stat-card {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  text-align: center;
  backdrop-filter: blur(10px);
  transition: background var(--transition-fast);
}
.stat-card:hover { background: rgba(255,255,255,.14); }
.stat-num   { font-size: var(--text-4xl); font-weight: 900; color: #fff; line-height: 1; display: block; }
.stat-unit  { font-size: var(--text-sm); color: #fdba74; font-weight: 700; }
.stat-label { font-size: var(--text-sm); color: rgba(255,255,255,.62); margin-top: var(--sp-1); display: block; }

/* ══════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════ */
.btn, .btn-primary, .btn-outline, .btn-outline-white {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 700;
  font-size: var(--text-sm);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--r-full);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(234,88,12,.35);
}
.btn-primary:hover {
  background: var(--accent-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(234,88,12,.45);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}
.btn-outline-white {
  background: transparent;
  color: rgba(255,255,255,.88);
  border: 2px solid rgba(255,255,255,.35);
}
.btn-outline-white:hover {
  border-color: #fff;
  color: #fff;
}
.btn-sm { padding: var(--sp-1) var(--sp-4); font-size: var(--text-xs); }
.btn-success {
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: var(--r-full);
  padding: var(--sp-3) var(--sp-6);
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  transition: background var(--transition-fast);
}
.btn-success:hover { background: #15803d; }

/* ══════════════════════════════════════════════════
   SECTIONS
══════════════════════════════════════════════════ */
.section { padding: var(--sp-20) 0; }
.section--gray, .section-alt { background: var(--bg-elevated); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-10);
}
.section-title {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.section-more {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  white-space: nowrap;
}
.section-more:hover { color: var(--accent); }
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: #eff6ff;
  color: var(--primary);
  font-size: var(--text-sm);
  font-weight: 700;
  padding: var(--sp-1) var(--sp-4);
  border-radius: var(--r-full);
  margin-bottom: var(--sp-4);
}
.section-desc { font-size: var(--text-base); color: var(--text-muted); max-width: 600px; margin: 0 auto; }

/* ══════════════════════════════════════════════════
   CARDS（文章卡片）
══════════════════════════════════════════════════ */
.cards-grid, .article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-6);
}
.cards-grid--featured { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }

.card, .article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
}
.card:hover, .article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #bfdbfe;
}

.card-img-wrap, .card-cover {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-img-wrap img, .card-cover img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}
.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(255,255,255,.25);
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
}

.card-body { padding: var(--sp-6); flex: 1; display: flex; flex-direction: column; gap: var(--sp-3); }

.card-cat, .cat-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--text-xs);
  font-weight: 700;
  color: #fff;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  align-self: flex-start;
}

.card-title, .card-title a {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}
.card-title a:hover { color: var(--primary); }

.card-excerpt, .card-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.75;
  flex: 1;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-light);
  font-size: var(--text-xs);
  color: var(--text-light);
}
.card-meta span { display: flex; align-items: center; gap: var(--sp-1); }

/* ══════════════════════════════════════════════════
   分類卡片
══════════════════════════════════════════════════ */
.cats-grid, .cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-4);
}
.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-3);
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.cat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #bfdbfe;
}
.cat-icon {
  width: 52px; height: 52px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  background: var(--cat-color, var(--primary));
}
.cat-name  { font-weight: 700; color: var(--text); font-size: var(--text-base); }
.cat-desc  { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5; }
.cat-count { font-size: var(--text-xs); color: var(--text-light); }

/* ══════════════════════════════════════════════════
   Skill 卡片
══════════════════════════════════════════════════ */
.card-skill .card-body { background: var(--bg-card); }
.skill-header { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.tag--lang {
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
  font-family: var(--font-mono);
}
.tag--diff { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }
.skill-usecase {
  font-size: var(--text-xs);
  color: var(--info);
  background: rgba(2,132,199,.07);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-3);
  border-left: 3px solid var(--info);
}

/* ══════════════════════════════════════════════════
   頁面英雄（list/skills/about 等子頁）
══════════════════════════════════════════════════ */
.page-hero {
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
  padding: var(--sp-16) 0 var(--sp-12);
  text-align: center;
}
.page-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 900;
  color: #fff;
  margin: var(--sp-3) 0 var(--sp-2);
}
.page-desc { font-size: var(--text-base); color: rgba(255,255,255,.72); }

/* ══════════════════════════════════════════════════
   篩選按鈕列
══════════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-8);
}
.filter-bar--multi { flex-direction: column; gap: var(--sp-4); }
.filter-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.filter-label { font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-4);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.filter-btn:hover  { border-color: var(--primary); color: var(--primary); background: #eff6ff; }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ══════════════════════════════════════════════════
   Sidebar Layout（list.php）
══════════════════════════════════════════════════ */
.layout-sidebar {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--sp-10);
  padding: var(--sp-12) 0;
  align-items: start;
}
.layout-main { min-width: 0; }
.layout-sidebar__aside { display: flex; flex-direction: column; gap: var(--sp-6); }

.widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
}
.widget-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* 標籤雲 */
.tag-cloud { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
  text-decoration: none;
}
.tag:hover, .tag--active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 分類列表 */
.cat-list li { margin-bottom: var(--sp-1); }
.cat-list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.cat-list-item:hover, .cat-list-item.active {
  background: #eff6ff;
  color: var(--primary);
}

/* ══════════════════════════════════════════════════
   分頁
══════════════════════════════════════════════════ */
.pagination-wrap, .pagination {
  margin-top: var(--sp-12);
  display: flex;
  justify-content: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px; height: 40px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); background: #eff6ff; }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ══════════════════════════════════════════════════
   Empty State
══════════════════════════════════════════════════ */
.empty-state, .empty-hint {
  text-align: center;
  padding: var(--sp-20) var(--sp-8);
  color: var(--text-light);
}
.empty-state i { font-size: 3rem; display: block; margin-bottom: var(--sp-4); }
.empty-state p { margin-bottom: var(--sp-6); }

/* ══════════════════════════════════════════════════
   文章詳情
══════════════════════════════════════════════════ */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--sp-12);
  align-items: start;
  padding: var(--sp-12) 0;
}
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--primary-light));
  z-index: 9999;
  width: 0%;
  transition: width .1s ease;
}
.article-title-h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 900;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: var(--sp-6);
  letter-spacing: -0.03em;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  flex-wrap: wrap;
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-8);
}
.article-meta-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* 文章內文 */
.article-content {
  font-size: var(--text-lg);
  line-height: 1.9;
  color: var(--text);
}
.article-content h2 { font-size: var(--text-2xl); font-weight: 800; margin: 2.5em 0 .75em; color: var(--text); padding-bottom: .5em; border-bottom: 2px solid var(--border); }
.article-content h3 { font-size: var(--text-xl); font-weight: 700; margin: 2em 0 .5em; color: var(--text); }
.article-content h4 { font-size: var(--text-lg); font-weight: 700; margin: 1.5em 0 .5em; }
.article-content p  { margin-bottom: 1.5em; }
.article-content ul, .article-content ol { margin: 1em 0 1.5em 1.5em; }
.article-content ul { list-style: disc; }
.article-content ol { list-style: decimal; }
.article-content li { margin-bottom: .5em; }
.article-content a  { color: var(--primary); text-decoration: underline; text-decoration-color: rgba(37,99,235,.3); }
.article-content a:hover { text-decoration-color: var(--primary); }
.article-content strong { font-weight: 700; color: var(--text); }
.article-content em     { font-style: italic; color: var(--text-muted); }
.article-content blockquote {
  border-left: 4px solid var(--accent);
  background: #fff7ed;
  margin: 1.5em 0;
  padding: var(--sp-4) var(--sp-6);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-style: italic;
  color: var(--text-muted);
}
.article-content hr { border: none; border-top: 1px solid var(--border); margin: 2.5em 0; }

/* Code */
.code-block-wrap { position: relative; margin: 1.5em 0; }
.code-block-wrap pre { border-radius: var(--r-lg); overflow: auto; font-size: var(--text-sm); line-height: 1.7; }
.code-copy-btn {
  position: absolute;
  top: var(--sp-3); right: var(--sp-3);
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.8);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  display: flex; align-items: center; gap: var(--sp-1);
}
.code-copy-btn:hover  { background: rgba(255,255,255,.22); }
.code-copy-btn.copied { background: rgba(22,163,74,.35); color: #86efac; }
code:not(pre code) {
  background: #eff6ff;
  color: var(--primary-dark);
  font-family: var(--font-mono);
  font-size: .875em;
  padding: .125em .375em;
  border-radius: .25rem;
  border: 1px solid #bfdbfe;
}

/* 側邊欄 */
.article-sidebar { display: flex; flex-direction: column; gap: var(--sp-6); }
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
}
.sidebar-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-2);
  text-transform: uppercase;
  letter-spacing: .05em;
}
#toc ul  { list-style: none; padding-left: 0; }
#toc li  { padding: var(--sp-1) 0; border-bottom: 1px solid var(--border-light); }
#toc a   { font-size: var(--text-sm); color: var(--text-muted); }
#toc a:hover, #toc a.active { color: var(--primary); }
#toc .toc-h3 { padding-left: var(--sp-4); }

/* ══════════════════════════════════════════════════
   留言區
══════════════════════════════════════════════════ */
.comment-section { margin-top: var(--sp-12); padding-top: var(--sp-10); border-top: 1px solid var(--border); }
.comment-item { display: flex; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.comment-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: var(--text-lg); flex-shrink: 0;
}
.comment-bubble {
  background: #f0f9ff;
  border: 1px solid #bfdbfe;
  border-radius: 0 var(--r-lg) var(--r-lg) var(--r-lg);
  padding: var(--sp-4) var(--sp-6); flex: 1;
}
[data-theme="dark"] .comment-bubble {
  background: var(--bg-elevated);
  border-color: var(--border);
}
.comment-name { font-weight: 700; font-size: var(--text-sm); color: var(--text); }
.comment-date { font-size: var(--text-xs); color: var(--text-light); margin-left: var(--sp-3); }
.comment-body { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--sp-2); line-height: 1.7; }
.comment-form { background: var(--bg-elevated); border-radius: var(--r-xl); padding: var(--sp-8); margin-top: var(--sp-8); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form-group { margin-bottom: var(--sp-4); }
.form-label { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--text); margin-bottom: var(--sp-2); }
.form-control {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--text);
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
textarea.form-control { resize: vertical; min-height: 120px; }
.btn-submit {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  background: var(--primary); color: #fff; font-weight: 700; font-size: var(--text-sm);
  padding: var(--sp-3) var(--sp-8); border-radius: var(--r-full); border: none; cursor: pointer;
  transition: background var(--transition-fast);
}
.btn-submit:hover { background: var(--primary-dark); }

/* ══════════════════════════════════════════════════
   電子報
══════════════════════════════════════════════════ */
.newsletter-section {
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
  padding: var(--sp-16) 0;
}
.newsletter-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-10);
  flex-wrap: wrap;
}
.newsletter-text h2 { font-size: var(--text-2xl); font-weight: 800; color: #fff; margin-bottom: var(--sp-2); }
.newsletter-text p  { font-size: var(--text-sm); color: rgba(255,255,255,.72); }
.newsletter-form {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  align-items: center;
}
.newsletter-form input[type="email"], .nl-input {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--r-full);
  padding: var(--sp-3) var(--sp-5);
  color: #fff;
  font-size: var(--text-sm);
  outline: none;
  min-width: 220px;
}
.newsletter-form input[type="email"]::placeholder,
.nl-input::placeholder { color: rgba(255,255,255,.5); }
.newsletter-form input:focus, .nl-input:focus { border-color: #fdba74; }
.nl-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-full);
  padding: var(--sp-3) var(--sp-6);
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.nl-btn:hover { background: var(--accent-dark); transform: translateY(-1px); }
.newsletter-msg, .nl-msg { color: rgba(255,255,255,.9); font-size: var(--text-sm); margin-top: var(--sp-3); width: 100%; }

/* ══════════════════════════════════════════════════
   頁尾
══════════════════════════════════════════════════ */
.site-footer { background: #0f172a; color: rgba(255,255,255,.75); padding-top: var(--sp-16); }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-10);
  padding-bottom: var(--sp-12);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.footer-brand, .footer-about { }
.footer-logo  { display: flex; align-items: center; gap: var(--sp-3); color: #fff; font-size: var(--text-lg); font-weight: 800; margin-bottom: var(--sp-4); text-decoration: none; }
.footer-brand p { font-size: var(--text-sm); color: rgba(255,255,255,.55); line-height: 1.75; }
.footer-author { font-size: var(--text-sm); color: rgba(255,255,255,.55); margin-top: var(--sp-3); }
.social-links { display: flex; gap: var(--sp-3); margin-top: var(--sp-4); }
.social-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.6);
  font-size: .95rem;
  transition: all var(--transition-fast);
}
.social-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.footer-heading, .footer-nav h4, .footer-cats h4, .footer-contact h4 {
  font-size: var(--text-sm); font-weight: 700; color: #fff;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: var(--sp-4);
}
.footer-links li, .footer-nav ul li, .footer-cats ul li { margin-bottom: var(--sp-3); }
.footer-links a, .footer-nav ul a, .footer-cats ul a {
  font-size: var(--text-sm);
  color: rgba(255,255,255,.55);
  display: flex; align-items: center; gap: var(--sp-2);
  transition: color var(--transition-fast);
}
.footer-links a:hover, .footer-nav ul a:hover, .footer-cats ul a:hover { color: #fdba74; }
.footer-contact p { font-size: var(--text-sm); color: rgba(255,255,255,.55); margin-bottom: var(--sp-3); }
.footer-contact a { color: #93c5fd; }
.footer-contact a:hover { color: #fff; }
.footer-bottom { padding: var(--sp-6) 0; }
.footer-bottom .container, .footer-bottom-inner {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-4);
}
.footer-bottom span, .footer-bottom p { font-size: var(--text-xs); color: rgba(255,255,255,.35); }

/* ══════════════════════════════════════════════════
   後台
══════════════════════════════════════════════════ */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-sidebar { background: #0f172a; padding: var(--sp-8) var(--sp-6); }
.admin-sidebar-logo { display: flex; align-items: center; gap: var(--sp-3); color: #fff; font-weight: 800; font-size: var(--text-lg); margin-bottom: var(--sp-10); }
.admin-nav-link { display: flex; align-items: center; gap: var(--sp-3); color: rgba(255,255,255,.6); font-size: var(--text-sm); font-weight: 500; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); margin-bottom: var(--sp-1); transition: all var(--transition-fast); text-decoration: none; }
.admin-nav-link:hover, .admin-nav-link.active { background: rgba(255,255,255,.08); color: #fff; }
.admin-main { padding: var(--sp-10); background: var(--bg); }
.admin-header { margin-bottom: var(--sp-8); }
.admin-title { font-size: var(--text-2xl); font-weight: 800; color: var(--text); }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-8); }
.admin-stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-6); display: flex; align-items: center; gap: var(--sp-4); }
.admin-stat-icon { width: 48px; height: 48px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.admin-stat-num   { font-size: var(--text-2xl); font-weight: 800; color: var(--text); line-height: 1; }
.admin-stat-label { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--sp-1); }
.admin-table-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-xl); overflow: hidden; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { background: var(--bg-elevated); padding: var(--sp-4) var(--sp-6); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); text-align: left; }
.admin-table td { padding: var(--sp-4) var(--sp-6); font-size: var(--text-sm); color: var(--text); border-top: 1px solid var(--border-light); }
.admin-table tr:hover td { background: var(--bg-elevated); }
.badge { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--text-xs); font-weight: 700; padding: var(--sp-1) var(--sp-3); border-radius: var(--r-full); }
.badge-green  { background: rgba(22,163,74,.12);  color: var(--success); }
.badge-gray   { background: var(--bg-elevated);    color: var(--text-muted); }
.badge-orange { background: rgba(234,88,12,.12);   color: var(--accent); }
.btn-action { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--text-xs); font-weight: 600; padding: var(--sp-1) var(--sp-3); border-radius: var(--r-sm); border: none; cursor: pointer; transition: all var(--transition-fast); }
.btn-edit   { background: rgba(37,99,235,.1);   color: var(--primary); }
.btn-delete { background: rgba(220,38,38,.1);   color: var(--danger); }
.btn-edit:hover   { background: var(--primary); color: #fff; }
.btn-delete:hover { background: var(--danger);  color: #fff; }

/* ══════════════════════════════════════════════════
   麵包屑 / Alert
══════════════════════════════════════════════════ */
.breadcrumb { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--sp-8); flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-light); }

.alert { padding: var(--sp-4) var(--sp-6); border-radius: var(--r-md); margin-bottom: var(--sp-4); font-size: var(--text-sm); display: flex; align-items: flex-start; gap: var(--sp-3); }
.alert-success { background: rgba(22,163,74,.08);  color: var(--success); border-left: 4px solid var(--success); }
.alert-error   { background: rgba(220,38,38,.08);  color: var(--danger);  border-left: 4px solid var(--danger); }
.alert-info    { background: rgba(2,132,199,.08);  color: var(--info);    border-left: 4px solid var(--info); }

/* ══════════════════════════════════════════════════
   回頂端
══════════════════════════════════════════════════ */
.back-to-top {
  position: fixed;
  bottom: var(--sp-8); right: var(--sp-8);
  width: 44px; height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition);
  z-index: 900;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover   { background: var(--primary-dark); transform: translateY(-4px); }

/* ══════════════════════════════════════════════════
   動畫
══════════════════════════════════════════════════ */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to   { opacity: 1; max-height: 200px; }
}
.animate-in { animation: fadeInUp .5s ease both; }
.reveal { animation: fadeInUp .4s ease both; }

/* ══════════════════════════════════════════════════
   RWD
══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero-inner  { grid-template-columns: 1fr; text-align: center; }
  .hero-actions, .hero-btns { justify-content: center; }
  .hero-stats  { max-width: 480px; margin: 0 auto; }
  .article-layout    { grid-template-columns: 1fr; }
  .layout-sidebar    { grid-template-columns: 1fr; }
  .admin-layout      { grid-template-columns: 1fr; }
  .stat-cards        { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {

  /* 預設隱藏導覽列 */
  .site-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: var(--header-h, 60px);
    left: 0;
    right: 0;
    background: var(--bg, #fff);
    border-top: 1px solid var(--border, #e5e7eb);
    padding: 1rem 1.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 999;
  }

  /* 開啟時顯示 */
  .site-nav.open {
    display: flex;
  }

  /* 每個連結獨立一行 */
  .site-nav a,
  .site-nav .nav-dropdown > a {
    padding: .75rem 0;
    border-bottom: 1px solid var(--border, #e5e7eb);
    width: 100%;
    display: block;
  }

  /* 手機版 Dropdown 子選單 */
  .nav-dropdown .dropdown-menu {
    position: static;
    display: none;
    padding-left: 1rem;
    box-shadow: none;
  }

  .nav-dropdown.open .dropdown-menu {
    display: block;
  }

  /* 漢堡按鈕顯示 */
  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
/* 桌機版隱藏漢堡按鈕 */
@media (min-width: 769px) {
  .nav-toggle { display: none; }
}
@media (max-width: 480px) {
  .hero-stats  { grid-template-columns: 1fr 1fr; }
  .cats-grid   { grid-template-columns: 1fr 1fr; }
  .stat-cards  { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════
   列印
══════════════════════════════════════════════════ */
@media print {
  .site-header, .newsletter-section, .site-footer,
  .reading-progress, .back-to-top, .comment-form, .code-copy-btn { display: none; }
  .article-layout { display: block; }
  body { font-size: 14pt; color: #000; background: #fff; }
}