@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700;900&display=swap');

:root {
  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --blue-light: #eff6ff;
  --green: #10b981;
  --green-dark: #059669;
  --green-light: #ecfdf5;
  --text: #1e293b;
  --text-light: #64748b;
  --bg: #f8fafc;
  --white: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --radius: 12px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans TC', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; transition: color .2s; }
a:hover { color: var(--blue-dark); }

img { max-width: 100%; height: auto; }
ul { list-style: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Navigation */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

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

.navbar .logo {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar .logo .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
}

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

.nav-links li a {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-light);
  transition: all .2s;
}

.nav-links li a:hover,
.nav-links li a.active {
  color: var(--blue);
  background: var(--blue-light);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 8px;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px;
    gap: 4px;
    box-shadow: var(--shadow-md);
  }
  .nav-links.open { display: flex; }
  .nav-links li a { display: block; padding: 12px 16px; }
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--blue-light) 0%, var(--green-light) 100%);
  padding: 80px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-badge {
  display: inline-block;
  background: rgba(59,130,246,.1);
  color: var(--blue);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: 24px;
}

/* Section */
.section { padding: 64px 0; }

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
}

.section-subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 40px;
  font-size: 1.05rem;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--blue-light), var(--green-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--blue);
}

.card-body { padding: 24px; }

.card-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 500;
  margin-bottom: 8px;
  background: var(--blue-light);
  color: var(--blue);
}

.card-tag.green { background: var(--green-light); color: var(--green-dark); }

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.5;
}

.card-title a { color: var(--text); }
.card-title a:hover { color: var(--blue); }

.card-text {
  font-size: .9rem;
  color: var(--text-light);
  line-height: 1.6;
}

.card-meta {
  font-size: .82rem;
  color: var(--text-light);
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .card-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .hero { padding: 48px 0; }
}

/* Tools grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 900px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .tools-grid { grid-template-columns: 1fr; }
}

.tool-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
  transition: transform .2s, box-shadow .2s;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.tool-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 16px;
}

.tool-card h4 { font-size: 1rem; margin-bottom: 6px; }
.tool-card p { font-size: .82rem; color: var(--text-light); }

/* Article Layout */
.article-layout {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  gap: 32px;
  padding: 40px 0;
}

@media (max-width: 1100px) {
  .article-layout { grid-template-columns: 1fr; }
}

/* TOC Sidebar */
.toc-sidebar {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
}

.toc-sidebar h4 {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-light);
  margin-bottom: 12px;
}

.toc-sidebar nav a {
  display: block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: .85rem;
  color: var(--text-light);
  border-left: 3px solid transparent;
  margin-bottom: 2px;
  transition: all .2s;
}

.toc-sidebar nav a:hover,
.toc-sidebar nav a.active {
  color: var(--blue);
  border-left-color: var(--blue);
  background: var(--blue-light);
}

.toc-sidebar nav a.h2 { padding-left: 12px; }
.toc-sidebar nav a.h3 { padding-left: 28px; font-size: .8rem; }

@media (max-width: 1100px) {
  .toc-sidebar {
    display: none;
  }
}

/* Article content */
.article-content {
  min-width: 0;
}

.article-header {
  margin-bottom: 32px;
}

.article-header h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-light);
  font-size: .88rem;
  flex-wrap: wrap;
}

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

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

.article-body p {
  margin-bottom: 16px;
  color: var(--text);
  line-height: 1.8;
}

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

.article-body li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.article-body ul li { list-style: disc; }
.article-body ol li { list-style: decimal; }

.article-body strong {
  font-weight: 600;
}

.article-body .tip-box {
  background: var(--blue-light);
  border-left: 4px solid var(--blue);
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin: 24px 0;
}

.article-body .tip-box.green {
  background: var(--green-light);
  border-left-color: var(--green);
}

.article-body .tip-box p { margin-bottom: 0; }

/* Ad placeholder */
.ad-placeholder {
  background: var(--white);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--text-light);
  font-size: .85rem;
  margin: 32px 0;
}

/* Right sidebar / Article sidebar */
.article-sidebar {
  position: sticky;
  top: 88px;
}

.article-sidebar .ad-placeholder {
  margin: 0 0 24px;
}

@media (max-width: 1100px) {
  .article-sidebar { display: none; }
}

/* Related articles */
.related-section {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 48px 0;
}

.related-section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 768px) {
  .related-grid { grid-template-columns: 1fr; }
}

/* Footer */
.footer {
  background: var(--text);
  color: #94a3b8;
  padding: 32px 0;
  text-align: center;
  font-size: .88rem;
}

.footer a { color: var(--blue); }
.footer a:hover { color: var(--blue-light); }

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: all .3s;
  z-index: 99;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--blue-dark);
  transform: translateY(-2px);
}
