:root {
  --paper: #fff8ea;
  --paper-deep: #f0e3ce;
  --ink: #1c211d;
  --muted: #5f675f;
  --line: #d8cbb6;
  --line-dark: #282b27;
  --red: #d71920;
  --green: #00843d;
  --orange: #f28c28;
  --teal: #145a5f;
  --white: #fffdf8;
  --max: 1180px;
  --serif: "Noto Serif TC", "Source Han Serif TC", "PMingLiU", Georgia, serif;
  --sans: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(28, 33, 29, .04) 1px, transparent 1px) 0 0 / 40px 40px,
    var(--paper-deep);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.88;
  letter-spacing: 0;
}
a { color: var(--teal); text-underline-offset: .18em; }
img { display: block; max-width: 100%; height: auto; }
.progress { position: fixed; inset: 0 0 auto 0; height: 5px; z-index: 100; background: rgba(28,33,29,.12); }
.progress span { display: block; width: 0; height: 100%; background: var(--red); }
.sitebar {
  position: sticky; top: 5px; z-index: 50;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px max(18px, calc((100vw - var(--max)) / 2));
  background: rgba(255, 248, 234, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  font-family: var(--sans);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; text-decoration: none; min-width: 220px; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--red); color: var(--white); font: 800 14px/1 var(--sans); }
.nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .print-btn, .download-strip a {
  min-height: 36px;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(28,33,29,.26);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--white);
  color: var(--ink);
  font: 700 14px/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.nav a:hover, .print-btn:hover, .download-strip a:hover { background: var(--green); color: var(--white); }
.hero, .home-hero {
  width: min(var(--max), calc(100% - 36px));
  margin: 34px auto 28px;
  display: grid;
  grid-template-columns: minmax(0, .94fr) minmax(320px, .92fr);
  gap: 28px;
  align-items: end;
}
.home-hero { grid-template-columns: minmax(0, .92fr) minmax(360px, 1.08fr); }
.hero-copy, .home-copy {
  min-width: 0;
  padding: 20px 0 10px;
}
.kicker {
  display: block;
  margin-bottom: 14px;
  color: var(--red);
  font: 800 13px/1.3 var(--sans);
}
h1, h2, h3, h4 { margin: 0; letter-spacing: 0; line-height: 1.25; }
h1 {
  font-family: var(--serif);
  font-size: clamp(3rem, 4.6vw, 4.05rem);
  line-height: 1.08;
  max-width: 12ch;
  overflow-wrap: anywhere;
}
.home-hero h1 { font-size: clamp(3.2rem, 5.4vw, 4.3rem); }
.subtitle {
  margin: 20px 0 0;
  max-width: 680px;
  color: var(--muted);
  font: 600 1.1rem/1.8 var(--sans);
}
.hero-figure {
  margin: 0;
  border: 2px solid var(--line-dark);
  background: var(--white);
}
.hero-figure figcaption, .figure-caption {
  padding: 8px 10px;
  border-top: 1px solid var(--line-dark);
  color: var(--muted);
  font: 13px/1.5 var(--sans);
}
.quick-grid {
  width: min(var(--max), calc(100% - 36px));
  margin: 0 auto 34px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.quick-tile {
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: var(--white);
  padding: 18px;
  min-height: 190px;
  text-decoration: none;
  color: var(--ink);
}
.quick-tile:hover { border-color: var(--red); }
.quick-tile b { display: block; color: var(--red); font: 800 13px/1.3 var(--sans); }
.quick-tile strong { display: block; margin: 14px 0 8px; font: 800 22px/1.35 var(--serif); }
.quick-tile span { display: block; color: var(--muted); font: 15px/1.65 var(--sans); }
.feature-band {
  width: min(var(--max), calc(100% - 36px));
  margin: 24px auto 60px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 22px;
}
.feature-band figure { grid-column: span 7; margin: 0; border: 1px solid var(--line-dark); background: var(--white); }
.feature-copy { grid-column: span 5; padding: 10px 0; }
.feature-copy h2 { font-size: 2.25rem; margin-bottom: 14px; }
.feature-copy p { color: var(--muted); font: 17px/1.85 var(--sans); }
.article-shell {
  width: min(var(--max), calc(100% - 36px));
  margin: 0 auto 70px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 34px;
}
.article-shell.no-toc {
  grid-template-columns: minmax(0, 900px);
  justify-content: center;
}
.toc {
  position: sticky;
  top: 86px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line-dark);
  background: rgba(255, 253, 248, .82);
  font-family: var(--sans);
}
.toc strong { display: block; margin-bottom: 10px; font-size: 14px; color: var(--red); }
.toc a { display: block; padding: 6px 0; color: var(--ink); text-decoration: none; font-size: 14px; line-height: 1.5; border-top: 1px solid rgba(28,33,29,.08); }
.toc a[data-level="3"] { padding-left: 14px; color: var(--muted); }
.toc a.is-active { color: var(--green); font-weight: 800; }
.article-card {
  min-width: 0;
  border: 1px solid var(--line-dark);
  background: var(--white);
  padding: 44px 52px 56px;
}
.download-strip {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
}
.prose h2 {
  margin: 48px 0 18px;
  padding-top: 20px;
  border-top: 2px solid var(--ink);
  color: var(--ink);
  font-size: 2rem;
}
.prose h3 { margin: 32px 0 12px; color: var(--green); font: 800 1.35rem/1.35 var(--sans); }
.prose h4 { margin: 24px 0 8px; color: var(--teal); font: 800 1.1rem/1.35 var(--sans); }
.prose p { margin: 0 0 1.05em; }
.prose blockquote {
  margin: 30px 0;
  padding: 20px 24px;
  border-left: 6px solid var(--red);
  background: #f6eedf;
  font-size: 1.22rem;
  line-height: 1.7;
}
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li { margin: 0 0 .42em; }
.table-wrap { overflow-x: auto; margin: 24px 0; border: 1px solid var(--line-dark); }
table { width: 100%; border-collapse: collapse; background: var(--white); font-family: var(--sans); font-size: 15px; line-height: 1.6; }
th, td { border: 1px solid var(--line); padding: 10px 12px; vertical-align: top; }
th { background: var(--green); color: var(--white); text-align: left; }
tr:nth-child(even) td { background: #fbf3e5; }
hr { border: 0; border-top: 1px solid var(--line-dark); margin: 30px 0; }
.footer {
  width: min(var(--max), calc(100% - 36px));
  margin: 0 auto 50px;
  padding-top: 20px;
  border-top: 1px solid var(--line-dark);
  color: var(--muted);
  font: 14px/1.7 var(--sans);
}
@media (max-width: 920px) {
  .sitebar { align-items: flex-start; flex-direction: column; }
  .hero, .home-hero { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-band figure, .feature-copy { grid-column: 1 / -1; }
  .article-shell { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; }
  h1 { font-size: 3.1rem; }
}
@media (max-width: 560px) {
  body { font-size: 17px; }
  h1 { font-size: 2.45rem; }
  .quick-grid { grid-template-columns: 1fr; }
  .article-card { padding: 28px 20px 36px; }
  .nav a, .print-btn { font-size: 13px; }
  .table-wrap { overflow: visible; border: 0; }
  table, thead, tbody, tr, th, td { display: block; width: 100%; }
  thead { display: none; }
  tr {
    margin: 0 0 12px;
    border: 1px solid var(--line-dark);
    background: var(--white);
  }
  td {
    display: grid;
    grid-template-columns: minmax(86px, 32%) minmax(0, 1fr);
    gap: 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    word-break: break-word;
  }
  td:last-child { border-bottom: 0; }
  td::before {
    content: attr(data-label);
    color: var(--green);
    font-weight: 800;
  }
}
@media print {
  body { background: #fff; font-size: 12pt; }
  .progress, .sitebar, .toc, .download-strip { display: none !important; }
  .hero, .article-shell { width: 100%; margin: 0; display: block; }
  .hero-figure { page-break-inside: avoid; margin: 14pt 0; }
  .article-card { border: 0; padding: 0; }
  a { color: inherit; text-decoration: none; }
  h1 { font-size: 28pt; max-width: none; }
  .prose h2 { page-break-after: avoid; }
  .table-wrap { overflow: visible; }
}
