:root {
  color-scheme: light;
  --bg: #f6f3ea;
  --ink: #161712;
  --text: #3f4138;
  --muted: #737568;
  --line: #d9d2c0;
  --panel: #fffdf6;
  --accent: #1e6f5c;
  --accent-2: #a14531;
  --gold: #b58b3d;
  --font-sans: ui-sans-serif, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-serif: Georgia, "Songti SC", "Noto Serif CJK SC", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    linear-gradient(115deg, rgba(30, 111, 92, 0.12), transparent 38%),
    linear-gradient(180deg, var(--bg), #ece5d4);
  color: var(--ink);
  font-family: var(--font-sans);
}

a { color: var(--accent); text-underline-offset: 0.18em; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.skip-link:focus { transform: translateY(0); }

.page {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.topbar,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.92rem;
  font-weight: 800;
}

.nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}

.hero {
  padding: 54px 0 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  max-width: 820px;
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 6vw, 5rem);
  line-height: 1;
}

.lead {
  max-width: 760px;
  margin: 20px 0 0;
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.9;
}

.content {
  display: grid;
  gap: 22px;
  padding-top: 28px;
}

.section {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.section h2 {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: 1.55rem;
}

.section p,
.section li {
  color: var(--text);
  line-height: 1.82;
}

.section p:last-child { margin-bottom: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.note {
  border-left: 4px solid var(--gold);
}

.footer {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 28px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.compact-hero { padding-bottom: 18px; }

.article-heading { padding-top: 40px; }

.article-meta,
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.article-meta span,
.article-meta time {
  border: 1px solid var(--line);
  padding: 7px 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.share-actions button,
.search-form button {
  min-height: 44px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0 15px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.share-actions button + button { background: transparent; color: var(--accent); }

.article-content { max-width: 900px; margin: 0 auto; }

.article-content h2 { scroll-margin-top: 22px; }

.article-content ol,
.article-content ul { padding-left: 1.35rem; }

.article-content li + li { margin-top: 9px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); }

table { width: 100%; min-width: 720px; border-collapse: collapse; background: #fff; }

th,
td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.65; }

th { background: #eef3e9; color: var(--ink); }

tr:last-child td { border-bottom: 0; }

.formula {
  display: grid;
  gap: 8px;
  margin: 20px 0;
  padding: 20px;
  border-left: 5px solid var(--accent);
  background: #eef6f1;
}

.formula strong { font-family: var(--font-serif); font-size: 1.18rem; }

.formula span,
.source-note { color: var(--muted); }

.checklist { margin-top: 20px; padding: 18px; background: #f5f1e6; border: 1px solid var(--line); }

.checklist h3 { margin-top: 0; }

.related {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 24px;
  border: 1px solid var(--line);
  background: #15221e;
  color: #fff;
}

.related h2 { grid-column: 1 / -1; margin: 0 0 4px; }

.related a { min-height: 44px; padding: 12px; background: rgba(255, 255, 255, 0.08); color: #e9f4ef; font-weight: 800; }

.topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.topic-card,
.action-card { color: inherit; text-decoration: none; transition: transform 160ms ease, border-color 160ms ease; }

.topic-card:hover,
.action-card:hover { transform: translateY(-3px); border-color: var(--accent); }

.topic-card span { color: var(--accent-2); font-size: 0.78rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }

.hub-note { margin-top: 24px; }

.alphabet-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 0 0;
}

.alphabet-nav a { min-height: 44px; padding: 11px 13px; border: 1px solid var(--line); background: var(--panel); font-weight: 800; }

.glossary dl { margin: 0; }

.glossary dl div { scroll-margin-top: 18px; padding: 16px 0; border-top: 1px solid var(--line); }

.glossary dl div:first-child { border-top: 0; }

.glossary dt { color: var(--ink); font-weight: 900; }

.glossary dd { margin: 7px 0 0; color: var(--text); line-height: 1.78; }

.search-form { padding: 22px; background: var(--panel); border: 1px solid var(--line); }

.search-form label { display: block; margin-bottom: 9px; font-weight: 900; }

.search-form div { display: flex; gap: 8px; }

.search-form input { width: 100%; min-height: 46px; border: 1px solid var(--line); background: #fff; padding: 0 13px; font: inherit; }

.search-status { color: var(--muted); font-weight: 800; }

.search-results { display: grid; gap: 12px; }

.search-result { padding: 20px; background: var(--panel); border: 1px solid var(--line); }

.search-result h2 { margin: 4px 0 8px; font-size: 1.25rem; }

.search-result p { margin: 0; }

.search-result-meta { color: var(--accent-2) !important; font-size: 0.82rem; font-weight: 900; }

.error-page { min-height: 100vh; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

@media (max-width: 760px) {
  .topbar,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid,
  .topic-grid,
  .related { grid-template-columns: 1fr; }

  .related h2 { grid-column: 1; }

  .search-form div { align-items: stretch; flex-direction: column; }
}
