/* ============================================================
   退休試算所 — 主要樣式
   字體：系統字體堆疊（降低渲染阻塞）
   主色：#1d4ed8（藍）
   ============================================================ */

/* ── 重置 & 基礎 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #fff;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

img { max-width: 100%; height: auto; display: block; }
a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 版面容器 ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* ── 導覽列 ── */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}
.nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.nav-logo {
  font-size: 1.1rem; font-weight: 700; color: #111827;
  text-decoration: none; white-space: nowrap;
}
.nav-logo:hover { text-decoration: none; color: #1d4ed8; }

.nav-links {
  display: flex; gap: 8px; list-style: none; align-items: center;
}
.nav-links a {
  font-size: 0.9rem; color: #374151; padding: 6px 12px;
  border-radius: 6px; text-decoration: none; white-space: nowrap;
}
.nav-links a:hover { background: #f3f4f6; color: #1d4ed8; }
.nav-links .btn-nav {
  background: #1d4ed8; color: #fff !important;
  padding: 7px 16px; border-radius: 8px; font-weight: 600;
}
.nav-links .btn-nav:hover { background: #1e40af; }

/* 漢堡選單 */
.nav-toggle {
  display: none; cursor: pointer; background: none; border: none;
  padding: 8px; color: #374151;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: currentColor; margin: 5px 0; transition: all .2s;
}
.nav-mobile {
  display: none; background: #fff; border-top: 1px solid #e5e7eb;
  padding: 12px 20px;
}
.nav-mobile.open { display: block; }
.nav-mobile a {
  display: block; padding: 10px 0; color: #374151;
  border-bottom: 1px solid #f3f4f6; font-size: 1rem;
  text-decoration: none;
}
.nav-mobile a:last-child { border-bottom: none; }
.nav-mobile a:hover { color: #1d4ed8; }

/* ── Hero（首頁） ── */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 60%, #3b82f6 100%);
  color: #fff; padding: 80px 20px 90px; text-align: center;
}
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 800; line-height: 1.3; margin-bottom: 16px; }
.hero p { font-size: 1.1rem; opacity: .88; max-width: 560px; margin: 0 auto 32px; }
.hero-cta {
  display: inline-block; background: #fff; color: #1d4ed8;
  font-weight: 700; font-size: 1.05rem; padding: 14px 32px;
  border-radius: 50px; transition: transform .15s, box-shadow .15s;
}
.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  text-decoration: none;
}

/* ── 功能區塊（首頁三欄） ── */
.features { padding: 60px 20px; background: #f9fafb; }
.features h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 28px; }
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px;
}
.feature-card {
  background: #fff; border-radius: 12px; padding: 28px 24px;
  border: 1px solid #e5e7eb;
}
.feature-icon { font-size: 2rem; margin-bottom: 12px; }
.feature-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; color: #111827; }
.feature-card p { font-size: .9rem; color: #6b7280; line-height: 1.6; }

/* ── 文章列表（首頁 & 分類頁） ── */
.articles-section { padding: 60px 20px; }
.articles-section h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 28px; }
.article-list { max-width: 760px; }
.article-card {
  display: block; padding: 24px 0; border-bottom: 1px solid #e5e7eb;
  color: inherit; text-decoration: none;
}
.article-card:last-child { border-bottom: none; }
.article-card:hover { text-decoration: none; }
.article-card:hover .article-title { color: #1d4ed8; }
.article-tag {
  display: inline-block; font-size: .78rem; font-weight: 600;
  color: #1d4ed8; background: #eff6ff; padding: 2px 10px;
  border-radius: 20px; margin-bottom: 8px;
}
.article-title { font-size: 1.15rem; font-weight: 700; color: #111827; margin-bottom: 8px; line-height: 1.4; }
.article-desc { font-size: .9rem; color: #6b7280; line-height: 1.6; }
.article-meta { font-size: .8rem; color: #4b5563; margin-top: 8px; }

/* ── 文章頁 ── */
.article-header { padding: 48px 20px 0; }
.article-header .tag {
  display: inline-block; font-size: .8rem; font-weight: 600;
  color: #1d4ed8; background: #eff6ff; padding: 3px 12px;
  border-radius: 20px; margin-bottom: 16px;
}
.article-header h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 800;
  line-height: 1.35; color: #111827; margin-bottom: 16px;
}
.article-header .meta { font-size: .85rem; color: #9ca3af; }
.article-header .meta span + span::before { content: ' · '; }

.article-body { padding: 36px 20px 60px; }
.article-body h2 {
  font-size: 1.4rem; font-weight: 700; color: #111827;
  margin: 2.2em 0 .8em; line-height: 1.35;
}
.article-body h3 {
  font-size: 1.1rem; font-weight: 700; color: #374151;
  margin: 1.8em 0 .6em;
}
.article-body p { margin-bottom: 1.2em; color: #374151; }
.article-body ul, .article-body ol { margin: 1em 0 1.2em 1.4em; }
.article-body li { margin-bottom: .5em; color: #374151; }
.article-body strong { color: #111827; font-weight: 700; }
.article-body a { color: #1d4ed8; }
.article-body a:hover { text-decoration: underline; }

/* 表格 */
.article-body table {
  width: 100%; border-collapse: collapse;
  margin: 1.5em 0; font-size: .9rem; overflow-x: auto; display: block;
}
.article-body th {
  background: #f3f4f6; font-weight: 700; color: #374151;
  padding: 10px 14px; text-align: left; border: 1px solid #e5e7eb;
}
.article-body td {
  padding: 9px 14px; border: 1px solid #e5e7eb; color: #374151;
}
.article-body tr:nth-child(even) td { background: #fafafa; }

/* 提示框 */
.callout {
  border-left: 4px solid #1d4ed8; background: #eff6ff;
  padding: 16px 20px; margin: 1.5em 0; border-radius: 0 8px 8px 0;
}
.callout p { margin: 0; color: #1e40af; }

/* 文章底部免責聲明 */
.article-disclaimer {
  margin-top: 48px; padding: 20px; background: #f9fafb;
  border-radius: 8px; font-size: .82rem; color: #9ca3af; line-height: 1.6;
}

/* 文章內連結 */
.related-posts { padding: 40px 20px; border-top: 1px solid #e5e7eb; }
.related-posts h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: #6b7280; }
.related-list { list-style: none; }
.related-list li { margin-bottom: 10px; }
.related-list a { font-size: .95rem; color: #1d4ed8; }

/* ── 計算機 ── */
.calculator-page { padding: 48px 20px 80px; }
.calculator-page h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.calculator-page .subtitle { color: #6b7280; margin-bottom: 36px; }

.calc-form {
  background: #f9fafb; border-radius: 16px; padding: 32px;
  border: 1px solid #e5e7eb; margin-bottom: 28px;
}
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px;
}
.form-group label {
  display: block; font-size: .85rem; font-weight: 600;
  color: #374151; margin-bottom: 6px;
}
.form-group input, .form-group select {
  width: 100%; padding: 10px 14px; border: 1.5px solid #d1d5db;
  border-radius: 8px; font-size: .95rem; font-family: inherit;
  color: #111827; background: #fff; transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(29,78,216,.1);
}
.calc-submit {
  display: block; width: 100%; margin-top: 24px;
  background: #1d4ed8; color: #fff; font-size: 1rem; font-weight: 700;
  padding: 14px; border: none; border-radius: 10px; cursor: pointer;
  transition: background .15s;
}
.calc-submit:hover { background: #1e40af; }

/* 計算結果 */
.calc-result { display: none; }
.calc-result.show { display: block; }
.result-hero {
  text-align: center; padding: 36px 20px;
  border-radius: 14px; margin-bottom: 24px;
}
.result-hero.surplus { background: linear-gradient(135deg, #ecfdf5, #d1fae5); }
.result-hero.deficit { background: linear-gradient(135deg, #fef2f2, #fee2e2); }
.result-label { font-size: .9rem; font-weight: 600; color: #6b7280; margin-bottom: 8px; }
.result-amount { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 800; }
.result-hero.surplus .result-amount { color: #059669; }
.result-hero.deficit .result-amount { color: #dc2626; }
.result-monthly { margin-top: 12px; font-size: 1rem; font-weight: 600; color: #374151; }

.result-breakdown {
  background: #f9fafb; border-radius: 12px; padding: 24px;
  border: 1px solid #e5e7eb;
}
.result-breakdown h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.breakdown-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid #e5e7eb; font-size: .9rem;
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-label { color: #374151; }
.breakdown-value { font-weight: 700; color: #111827; }
.breakdown-value.positive { color: #059669; }
.breakdown-value.negative { color: #dc2626; }
.breakdown-note { font-size: .78rem; color: #9ca3af; margin-top: 2px; }

/* ── 頁尾 ── */
.site-footer {
  background: #111827; color: #9ca3af;
  padding: 40px 20px; text-align: center; font-size: .85rem;
}
.site-footer a { color: #9ca3af; }
.site-footer a:hover { color: #fff; }
.footer-links { margin-bottom: 12px; display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }

/* ── 關於我 ── */
.about-page { padding: 60px 20px; }
.about-page h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.about-lead { font-size: 1.05rem; color: #6b7280; margin-bottom: 36px; }
.about-body h2 { font-size: 1.25rem; font-weight: 700; margin: 2em 0 .8em; }
.about-body p { margin-bottom: 1.2em; color: #374151; }
.about-body ul { margin: .8em 0 1.2em 1.4em; }
.about-body li { margin-bottom: .5em; color: #374151; }
.disclaimer-box {
  background: #fefce8; border: 1px solid #fde68a;
  border-radius: 8px; padding: 16px 20px; margin-top: 32px;
  font-size: .85rem; color: #92400e;
}

/* ── 分類頁 ── */
.category-header { padding: 48px 20px 32px; border-bottom: 1px solid #e5e7eb; }
.category-header h1 { font-size: 1.8rem; font-weight: 800; }
.category-header p { color: #6b7280; margin-top: 8px; }

/* ── 通用工具 ── */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-8 { margin-bottom: 2rem; }

/* ── RWD ── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; flex-direction: column; justify-content: center; }
  .hero { padding: 60px 20px 70px; }
  .calc-form { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
}
