/* ============================================
   SEO Teamer — Design System CSS
   v5.1 | 2026-04-03
   ============================================ */

/* --- Design Tokens --- */
:root {
  --brand: #4F46E5;
  --brand-light: #EEF2FF;
  --dark: #1E293B;
  --gray: #64748B;
  --gray-light: #94A3B8;
  --bg: #FFFFFF;
  --bg-alt: #F8FAFC;
  --bg-section: #F1F5F9;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --success: #059669;
  --success-bg: #ECFDF5;
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --cluster-a: #7C3AED;
  --cluster-b: #0891B2;
  --cluster-c: #EA580C;
  --cluster-d: #2563EB;
  --cluster-e: #16A34A;
  --cluster-f: #DB2777;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --font: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans TC', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-w: 1200px;
  --content-w: 780px;
  --sidebar-w: 320px;
  --gap: 40px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--dark); background: var(--bg); line-height: 1.8; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Skip Link (a11y) --- */
.skip-link { position: absolute; top: -40px; left: 0; background: var(--brand); color: #fff; padding: 8px 16px; z-index: 100; font-size: 14px; border-radius: 0 0 var(--radius-md) 0; }
.skip-link:focus { top: 0; }

/* --- Announcement Bar --- */
.announce { background: var(--brand); color: #fff; text-align: center; padding: 8px 16px; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.announce a { color: #fff; text-decoration: underline; }
.announce-close { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 18px; cursor: pointer; padding: 0 4px; }

/* --- Header / Nav --- */
.header { border-bottom: 3px solid var(--brand); background: var(--bg); position: sticky; top: 0; z-index: 50; }
.header-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; display: flex; align-items: center; gap: 2px; }
.logo-mark { width: 32px; height: 32px; margin-right: 6px; flex-shrink: 0; }
.logo-seo { color: var(--brand); }
.logo-teamer { color: var(--dark); font-weight: 400; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { padding: 8px 14px; font-size: 14px; color: var(--gray); border-radius: var(--radius-md); transition: background 0.15s; }
.nav a:hover { background: var(--bg-section); color: var(--dark); text-decoration: none; }
.nav-cta { background: var(--brand) !important; color: #fff !important; font-weight: 500; border-radius: var(--radius-md) !important; }
.nav-cta:hover { opacity: 0.9; }

/* Hamburger (mobile) */
.hamburger { display: none; background: none; border: none; padding: 8px; cursor: pointer; }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--dark); margin: 4px 0; transition: 0.3s; }
.mobile-menu { display: none; background: var(--bg); border-top: 1px solid var(--border); padding: 16px 20px; }
.mobile-menu.open { display: block; }
.mobile-menu a { display: block; padding: 12px 0; font-size: 15px; color: var(--dark); border-bottom: 1px solid var(--border-light); }

/* --- Breadcrumb --- */
.breadcrumb { max-width: var(--max-w); margin: 0 auto; padding: 12px 20px; font-size: 13px; color: var(--gray-light); }
.breadcrumb a { color: var(--gray); }
.breadcrumb span { margin: 0 6px; }

/* --- Layout --- */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.layout { display: flex; gap: var(--gap); align-items: flex-start; }
.main { flex: 1; min-width: 0; max-width: var(--content-w); }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; position: sticky; top: 80px; }

/* --- Article --- */
.article-header { margin-bottom: 24px; }
.article-header h1 { font-size: 28px; font-weight: 700; line-height: 1.4; margin-bottom: 12px; color: var(--dark); }
.article-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--gray); margin-bottom: 16px; }
.article-meta time { color: var(--gray); }

/* Share Bar */
.share-bar { display: flex; gap: 8px; margin-bottom: 24px; }
.share-bar a, .share-bar button { padding: 6px 14px; font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--gray); background: var(--bg); cursor: pointer; transition: 0.15s; }
.share-bar a:hover, .share-bar button:hover { background: var(--bg-section); text-decoration: none; }

/* Article Body */
.article-body { font-size: 16px; line-height: 1.8; color: var(--dark); }
.article-body h2 { font-size: 22px; font-weight: 700; margin: 40px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--bg-section); }
.article-body h3 { font-size: 18px; font-weight: 600; margin: 28px 0 12px; }
.article-body p { margin-bottom: 16px; }
.article-body ul, .article-body ol { margin: 0 0 16px 24px; }
.article-body li { margin-bottom: 6px; }
.article-body img { border-radius: var(--radius-md); margin: 20px 0; }
.article-body blockquote { border-left: 3px solid var(--brand); padding: 12px 20px; background: var(--brand-light); margin: 20px 0; border-radius: 0 var(--radius-md) var(--radius-md) 0; font-size: 15px; }
.article-body code { font-family: var(--font-mono); background: var(--bg-section); padding: 2px 6px; border-radius: var(--radius-sm); font-size: 14px; }
.article-body pre { background: var(--dark); color: #E2E8F0; padding: 20px; border-radius: var(--radius-md); overflow-x: auto; margin: 20px 0; font-size: 14px; line-height: 1.5; }
.article-body pre code { background: none; padding: 0; color: inherit; }
.article-body a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.article-body table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; }
.article-body th { background: var(--bg-section); padding: 10px 14px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--border); }
.article-body td { padding: 10px 14px; border-bottom: 1px solid var(--border-light); }

/* Auto Internal Link */
.auto-link { color: var(--brand); text-decoration: none; border-bottom: 1px dashed var(--brand); }
.auto-link:hover { text-decoration: none; border-bottom-style: solid; }

/* --- TOC --- */
.toc { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; margin: 24px 0; }
.toc-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list li { padding: 4px 0; }
.toc-list li a { font-size: 14px; color: var(--gray); }
.toc-list li a:hover { color: var(--brand); }
.toc-list .toc-sub { padding-left: 20px; font-size: 13px; }

/* --- Ad Units --- */
.ad-slot { margin: 24px 0; text-align: center; overflow: hidden; }
.ad-slot--top { min-height: 250px; }
.ad-slot--mid { min-height: 250px; }
.ad-slot--bottom { min-height: 200px; }

/* --- CTA Blocks --- */
.cta-mid, .cta-bottom { border-radius: var(--radius-lg); padding: 20px 24px; margin: 24px 0; }
.cta-mid { background: var(--brand-light); border: 1px solid #BFDBFE; }
.cta-bottom { background: var(--bg-section); border: 1px solid var(--border); }
.cta-mid-text { font-size: 14px; color: var(--gray); margin-bottom: 8px; }
.cta-mid-link { font-size: 16px; font-weight: 600; color: var(--brand); }
.cta-bottom h3 { font-size: 16px; margin-bottom: 12px; }
.cta-bottom-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.cta-bottom-card { display: block; padding: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); transition: 0.15s; }
.cta-bottom-card:hover { border-color: var(--brand); text-decoration: none; }
.cta-cluster-badge { font-size: 11px; color: var(--gray); }
.cta-card-title { font-size: 14px; font-weight: 500; color: var(--dark); display: block; margin-top: 4px; }
.cta-bottom-line { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--border); }
.cta-bottom-line p { font-size: 13px; color: var(--gray); }
.cta-bottom-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.cta-bottom-line a { background: var(--brand); color: #fff; padding: 8px 18px; border-radius: var(--radius-md); font-size: 13px; font-weight: 500; }
.cta-bottom-line a:hover { opacity: 0.9; text-decoration: none; color: #fff; }

/* --- Compare Table --- */
.compare-table { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin: 24px 0; }
.compare-header { padding: 12px 16px; background: var(--bg-section); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.compare-header strong { font-size: 15px; }
.compare-disclaimer { font-size: 11px; color: var(--gray-light); }
.compare-table table { width: 100%; border-collapse: collapse; }
.compare-table th { padding: 10px 14px; background: var(--bg-alt); text-align: center; font-size: 13px; font-weight: 600; }
.compare-table th:first-child { text-align: left; }
.compare-table td { padding: 10px 14px; text-align: center; border-bottom: 1px solid var(--border-light); font-size: 14px; }
.compare-table td:first-child { text-align: left; font-weight: 500; }
.compare-link { color: var(--brand); font-size: 13px; }

/* --- Related Links --- */
.related { background: var(--bg-alt); border-radius: var(--radius-lg); padding: 24px; margin: 24px 0; }
.related h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--gray); }
.related-list { list-style: none; padding: 0; margin: 0 0 20px; }
.related-list li { padding: 6px 0; }
.related-list li a { font-size: 14px; color: var(--dark); }
.related-list li a:hover { color: var(--brand); }
.related-action { display: inline-block; padding: 10px 20px; background: var(--brand); color: #fff; border-radius: var(--radius-md); font-size: 14px; font-weight: 500; }
.related-action:hover { opacity: 0.9; text-decoration: none; color: #fff; }

/* --- Sidebar --- */
.sidebar-section { margin-bottom: 24px; }
.sidebar-title { font-size: 13px; font-weight: 600; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.sidebar-list { list-style: none; padding: 0; }
.sidebar-list li { padding: 6px 0; border-bottom: 1px solid var(--border-light); }
.sidebar-list li a { font-size: 13px; color: var(--dark); }
.sidebar-list li a:hover { color: var(--brand); }
.sidebar-ad { min-height: 250px; margin: 16px 0; }
.sidebar-line { display: block; padding: 12px 16px; background: #06C755; color: #fff; border-radius: var(--radius-md); font-size: 13px; font-weight: 500; text-align: center; margin-top: 16px; }
.sidebar-line:hover { opacity: 0.9; text-decoration: none; color: #fff; }

/* --- FAQ --- */
.faq { margin: 32px 0; }
.faq h2 { font-size: 20px; margin-bottom: 16px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 8px; overflow: hidden; }
.faq-q { padding: 14px 18px; font-size: 15px; font-weight: 500; cursor: pointer; display: flex; justify-content: space-between; align-items: center; background: var(--bg); }
.faq-q::after { content: '+'; font-size: 18px; color: var(--gray); transition: 0.2s; }
.faq-item.open .faq-q::after { content: '-'; }
.faq-a { padding: 0 18px; max-height: 0; overflow: hidden; transition: max-height 0.3s, padding 0.3s; font-size: 14px; line-height: 1.7; color: var(--gray); }
.faq-item.open .faq-a { max-height: 500px; padding: 0 18px 14px; }

/* --- LINE Float --- */
.line-float { position: fixed; bottom: 24px; right: 24px; z-index: 40; opacity: 0; transform: translateY(20px); transition: all 0.3s; pointer-events: none; }
.line-float.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.line-float a { display: flex; align-items: center; gap: 8px; padding: 12px 18px; background: #06C755; color: #fff; border-radius: 999px; font-size: 13px; font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.line-float a:hover { transform: scale(1.05); text-decoration: none; color: #fff; }

/* --- Footer --- */
.footer { background: var(--bg-section); border-top: 1px solid var(--border); padding: 40px 20px; margin-top: 48px; }
.footer-inner { max-width: var(--max-w); margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; margin-bottom: 32px; }
.footer-col-title { font-size: 13px; font-weight: 600; color: var(--dark); margin-bottom: 12px; }
.footer-col a { display: block; font-size: 13px; color: var(--gray); padding: 4px 0; }
.footer-col a:hover { color: var(--brand); text-decoration: none; }
.footer-legal { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.footer-copy { font-size: 13px; color: var(--gray-light); margin: 0; }
.footer-legal-links { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-legal-links a { font-size: 13px; color: var(--gray-light); }
.footer-legal-links a:hover { color: var(--brand); text-decoration: none; }
.footer-disclaimer { font-size: 12px; color: var(--gray-light); max-width: 600px; line-height: 1.6; margin-top: 10px; }

/* --- Category Page --- */
.category-hero { padding: 32px 0; margin-bottom: 24px; }
.category-hero h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.category-hero p { font-size: 15px; color: var(--gray); }
.article-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.article-card { display: flex; gap: 16px; padding: 16px; border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: var(--radius-lg); transition: 0.15s; }
.article-card[data-cluster="A"] { border-left-color: var(--cluster-a); }
.article-card[data-cluster="B"] { border-left-color: var(--cluster-b); }
.article-card[data-cluster="C"] { border-left-color: var(--cluster-c); }
.article-card[data-cluster="D"] { border-left-color: var(--cluster-d); }
.article-card[data-cluster="E"] { border-left-color: var(--cluster-e); }
.article-card[data-cluster="F"] { border-left-color: var(--cluster-f); }
.article-card:hover { border-color: var(--brand); text-decoration: none; }
.article-card-body h2 { font-size: 16px; font-weight: 600; color: var(--dark); margin-bottom: 6px; }
.article-card-body p { font-size: 13px; color: var(--gray); line-height: 1.5; }
.article-card-meta { font-size: 12px; color: var(--gray-light); margin-top: 6px; }
.pagination { display: flex; gap: 4px; justify-content: center; padding: 32px 0; }
.pagination a, .pagination span { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 13px; color: var(--gray); }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* --- Homepage --- */
.hero { text-align: center; padding: 48px 20px; background: linear-gradient(135deg, #EEF2FF 0%, #F8FAFC 60%, #FFFFFF 100%); }
.hero h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.hero .slogan { font-size: 16px; color: var(--gray); margin-bottom: 24px; }
.hero-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-btn { padding: 12px 24px; border-radius: var(--radius-md); font-size: 14px; font-weight: 500; }
.hero-btn-primary { background: var(--brand); color: #fff; }
.hero-btn-secondary { background: var(--bg); border: 1px solid var(--border); color: var(--dark); }
.cluster-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; max-width: var(--max-w); margin: 0 auto; padding: 0 20px 32px; }
.cluster-card { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); text-align: center; transition: 0.15s; }
.cluster-card:hover { border-color: var(--brand); transform: translateY(-2px); text-decoration: none; }
.cluster-card-name { font-size: 14px; font-weight: 600; color: var(--dark); margin-top: 8px; }
.cluster-card-count { font-size: 12px; color: var(--gray-light); }

/* --- Radar Chart (SVG) --- */
.radar-wrap { max-width: 300px; margin: 20px auto; }

/* --- Responsive --- */
@media (max-width: 1023px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; position: static; margin-top: 40px; }
  .nav { display: none; }
  .hamburger { display: block; }
  .cta-bottom-cards { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .header-inner { height: 52px; }
  .logo { font-size: 18px; }
  .article-header h1 { font-size: 22px; }
  .hero h1 { font-size: 24px; }
  .cluster-grid { grid-template-columns: repeat(2, 1fr); }
  .article-body h2 { font-size: 19px; }
  .container { padding: 0 16px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-legal { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 479px) {
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* --- Content Upgrade --- */
.content-upgrade { display: flex; gap: 20px; align-items: flex-start; padding: 24px; background: var(--success-bg); border: 2px solid var(--success); border-radius: var(--radius-lg); margin: 32px 0; }
.content-upgrade-icon { font-size: 32px; flex-shrink: 0; }
.content-upgrade-body { flex: 1; }
.content-upgrade-title { font-size: 17px; font-weight: 700; color: var(--dark); margin-bottom: 6px; }
.content-upgrade-desc { font-size: 14px; color: var(--gray); margin-bottom: 12px; }
.content-upgrade-btn { display: inline-block; padding: 10px 24px; background: var(--success); color: #fff; border-radius: var(--radius-md); font-size: 14px; font-weight: 600; }
.content-upgrade-btn:hover { opacity: 0.9; text-decoration: none; color: #fff; }
.content-upgrade-note { font-size: 12px; color: var(--gray-light); margin-top: 8px; }

/* Footer corporate line */
.footer-corp { font-size: 12px; color: var(--gray-light); margin-top: 8px; }
.footer-corp a { color: var(--gray-light); text-decoration: underline; }
.footer-corp a:hover { color: var(--gray); }
/* ============================================
   mobile-bar + back-to-top — 追加到 style.css 最底部
   ============================================ */

/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 44;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--gray);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  background: var(--bg-section);
  color: var(--dark);
  border-color: var(--gray-light);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.16);
}
.back-to-top:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

/* 桌機：back-to-top 固定在右下角 */
.line-float.visible ~ .back-to-top.visible,
.back-to-top.visible {
  bottom: 24px;
}

/* --- Mobile Bottom Bar --- */
.mobile-bar {
  display: none;
}

@media (max-width: 1023px) {
  .mobile-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 45;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
    justify-content: space-around;
    align-items: center;
  }

  .mobile-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    color: var(--gray);
    text-decoration: none;
    font-size: 10px;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-bar-item:hover,
  .mobile-bar-item.active {
    color: var(--brand);
    text-decoration: none;
  }
  .mobile-bar-item svg {
    flex-shrink: 0;
  }

  /* 手機版：不使用浮動 LINE CTA，保留站內探索底欄 */
  .line-float {
    display: none !important;
  }

  /* 手機版：back-to-top 調整位置避開底欄 */
  .back-to-top {
    bottom: 70px;
    right: 16px;
    width: 36px;
    height: 36px;
  }
  .back-to-top.visible {
    bottom: 70px;
  }

  /* body 底部留空避免內容被底欄遮住 */
  body {
    padding-bottom: 64px;
  }

  /* footer 底部也要多留空 */
  .footer {
    padding-bottom: 80px;
  }
}
