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

:root {
  --blue-900: #1a365d;
  --blue-800: #1a4a6e;
  --blue-700: #2c5282;
  --blue-100: #e8f5e9;
  --green-600: #4a9e3f;
  --green-500: #7cc242;
  --green-700: #3d8b35;
  --accent: #7cc242;
  --accent-dark: #3d8b35;
  --red-500: #e53e3e;
  --red-600: #c53030;
  --gray-50: #f7fafc;
  --gray-100: #edf2f7;
  --gray-200: #e2e8f0;
  --gray-500: #a0aec0;
  --gray-600: #718096;
  --gray-700: #4a5568;
  --gray-800: #2d3748;
  --gray-900: #1a202c;
  --white: #ffffff;
  --font-sans: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-width: 1200px;
  --content-width: 800px;
}

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

body {
  font-family: var(--font-sans);
  color: var(--gray-800);
  line-height: 1.8;
  background: var(--white);
}

a { color: var(--blue-700); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--green-600); }

img { max-width: 100%; height: auto; }

/* ===== Header ===== */
.site-header {
  background: var(--white);
  color: var(--gray-800);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border-bottom: 2px solid var(--green-500);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo-img {
  height: 64px;
  width: auto;
  transition: opacity 0.2s;
}
.site-logo:hover .logo-img { opacity: 0.8; }

/* Navigation */
.site-nav { display: flex; gap: 0.25rem; }

.site-nav a {
  color: var(--gray-700);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--green-600);
  background: var(--blue-100);
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--blue-900);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

/* ===== Hero ===== */
.hero {
  background: var(--white);
  color: var(--gray-800);
  padding: 5rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--gray-200);
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.3;
  color: var(--blue-900);
}

.hero p {
  font-size: 1.2rem;
  color: var(--gray-600);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero-cta {
  display: inline-block;
  background: var(--green-500);
  color: var(--white);
  padding: 0.875rem 2rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(124,194,66,0.3);
}
.hero-cta:hover {
  background: var(--green-700);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(124,194,66,0.4);
}

/* ===== Main Content ===== */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.content-narrow {
  max-width: var(--content-width);
  margin: 0 auto;
}

/* ===== Section Cards (Homepage) ===== */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.section-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 2rem;
  transition: all 0.2s;
}
.section-card:hover {
  border-color: var(--green-500);
  box-shadow: 0 4px 16px rgba(124,194,66,0.12);
  transform: translateY(-2px);
}

.section-card h3 {
  font-size: 1.2rem;
  color: var(--blue-900);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--green-500);
}

.section-card p {
  color: var(--gray-600);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ===== Article List ===== */
.article-list { list-style: none; }

.article-item {
  border-bottom: 1px solid var(--gray-100);
  padding: 1.5rem 0;
}
.article-item:last-child { border-bottom: none; }

.article-item a {
  display: block;
  color: var(--gray-800);
}
.article-item a:hover { color: var(--blue-700); }

.article-item h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.article-meta {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 0.5rem;
}

.article-summary {
  color: var(--gray-600);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ===== Article Content ===== */
.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--blue-100);
}

.article-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--blue-900);
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.article-author {
  font-size: 0.9rem;
  color: var(--gray-600);
}

.article-body h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--blue-900);
  margin: 2.5rem 0 1rem;
  padding-left: 0.75rem;
  border-left: 4px solid var(--green-500);
}

.article-body h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 2rem 0 0.75rem;
}

.article-body p {
  margin-bottom: 1.25rem;
}

.article-body blockquote {
  border-left: 4px solid var(--blue-700);
  background: var(--blue-100);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.article-body th {
  background: var(--blue-900);
  color: var(--white);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
}

.article-body td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-200);
}

.article-body tr:hover td {
  background: var(--gray-50);
}

.article-body code {
  background: var(--gray-100);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 2rem 0;
}

/* Series navigation */
.series-nav {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin: 3rem 0 2rem;
}

.series-nav h4 {
  font-size: 0.9rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.series-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.series-nav li a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--gray-700);
  transition: all 0.15s;
}

.series-nav li a:hover {
  background: var(--blue-100);
  color: var(--blue-900);
}

.series-nav li.current a {
  background: var(--blue-900);
  color: var(--white);
  font-weight: 600;
}

/* ===== Page Title ===== */
.page-title {
  background: var(--white);
  color: var(--gray-800);
  padding: 3rem 1.5rem;
  text-align: center;
  border-bottom: 3px solid var(--green-500);
}

.page-title h1 {
  font-size: 2rem;
  font-weight: 800;
  max-width: var(--max-width);
  margin: 0 auto;
  color: var(--blue-900);
}

.page-title p {
  max-width: 600px;
  margin: 0.75rem auto 0;
  color: var(--gray-600);
  font-size: 1.05rem;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.breadcrumb a { color: var(--gray-500); }
.breadcrumb a:hover { color: var(--blue-700); }
.breadcrumb span { margin: 0 0.5rem; }

/* ===== Footer ===== */
.site-footer {
  background: var(--gray-50);
  color: var(--gray-600);
  padding: 3rem 1.5rem;
  margin-top: 4rem;
  border-top: 3px solid var(--green-500);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.footer-info h3 {
  color: var(--blue-900);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.footer-info p {
  font-size: 0.9rem;
  line-height: 1.6;
}

.footer-links { list-style: none; }
.footer-links li { margin-bottom: 0.5rem; }
.footer-links a {
  color: var(--gray-600);
  font-size: 0.9rem;
}
.footer-links a:hover { color: var(--green-600); }

.footer-bottom {
  max-width: var(--max-width);
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
  text-align: center;
  font-size: 0.85rem;
}

/* ===== Placeholder page ===== */
.placeholder {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--gray-500);
}

.placeholder-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.placeholder p {
  font-size: 1.1rem;
}

/* ===== Contact ===== */
.contact-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.contact-item {
  background: var(--gray-50);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
}

.contact-item h3 {
  color: var(--blue-900);
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

/* ===== TL;DR box ===== */
.tldr {
  background: var(--blue-100);
  color: var(--gray-800);
  padding: 1.25rem 1.5rem;
  border-radius: 0 8px 8px 0;
  border-left: 4px solid var(--green-500);
  margin-bottom: 2rem;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.5;
}

.tldr strong { color: var(--blue-900); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .menu-toggle { display: block; }

  .site-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    flex-direction: column;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-top: 1px solid var(--gray-200);
  }

  .site-nav.open { display: flex; }
  .site-nav a { padding: 0.75rem 1rem; }

  .logo-img { height: 52px; }

  .hero { padding: 3rem 1.5rem; }
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 1rem; }

  .page-title h1 { font-size: 1.5rem; }

  .article-header h1 { font-size: 1.5rem; }
  .article-body h2 { font-size: 1.2rem; }

  .footer-inner { flex-direction: column; }

  .section-grid { grid-template-columns: 1fr; }
}
