/* ============================================================
   导游资料库 · 现代简约设计系统
   中性黑白灰 + 极小面积信号色，无衬线，细线，留白
   ============================================================ */

:root {
  color-scheme: light;

  /* 中性色板 */
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --surface-3: #ebebe9;

  --text: #111113;
  --text-soft: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;

  --border: #e8e8e6;
  --border-2: #d4d4d1;

  /* 信号色：仅用于极小面积点缀 */
  --signal: #d9502f;

  --accent: #111113;
  --accent-ink: #ffffff;
  --ring: rgba(17, 17, 19, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.08);

  /* 圆角 */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --max: 1160px;
  --header-h: 64px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b0b0c;
  --bg-subtle: #101012;
  --surface: #141416;
  --surface-2: #1b1b1e;
  --surface-3: #262629;

  --text: #f4f4f5;
  --text-soft: #d4d4d8;
  --muted: #a1a1aa;
  --faint: #71717a;

  --border: #262629;
  --border-2: #3f3f46;

  --signal: #ff6a49;

  --accent: #fafafa;
  --accent-ink: #0b0b0c;
  --ring: rgba(255, 255, 255, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

/* ---------- reset / base ---------- */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--text); color: var(--bg); }

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }

button, input { font-family: inherit; }

button { cursor: pointer; }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 3px;
}

.container {
  width: min(var(--max), calc(100% - 64px));
  margin: 0 auto;
}

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 1.12rem;
  font-weight: 750;
  letter-spacing: -0.035em;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}
.brand:hover { opacity: 0.65; }
.brand-dot { color: var(--signal); }

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

.nav a {
  position: relative;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 13px;
  border-radius: var(--radius-xs);
  transition: color 0.18s ease, background 0.18s ease;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 650; }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--signal);
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-link,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: var(--radius-xs);
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.icon-link:hover,
.theme-toggle:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
  color: var(--text);
}

#fav-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- main / footer ---------- */

main.container { min-height: 60vh; padding: 64px 0 100px; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 30px 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.footer-brand { font-weight: 650; color: var(--text-soft); letter-spacing: -0.02em; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--muted); transition: color 0.18s ease; }
.footer-links a:hover { color: var(--text); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 20px;
  border-radius: var(--radius-xs);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease,
    color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text); }
.btn-arrow { transition: transform 0.18s ease; }
.btn:hover .btn-arrow { transform: translateX(3px); }

/* ---------- hero ---------- */

.hero {
  padding: 64px 0 60px;
  border-bottom: 1px solid var(--border);
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}
.signal-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--signal);
  flex: none;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.15rem);
  font-weight: 780;
  line-height: 1.13;
  letter-spacing: -0.05em;
  margin: 0;
  color: var(--text);
}
.hero-accent { position: relative; white-space: nowrap; }
.hero-accent::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: -6px;
  width: 76px;
  height: 4px;
  border-radius: 3px;
  background: var(--signal);
}

.hero p {
  max-width: 640px;
  font-size: 1.0625rem;
  color: var(--muted);
  line-height: 1.85;
  margin: 28px 0 0;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 56px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.stat-num {
  font-size: 1.9rem;
  font-weight: 750;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label { margin-top: 8px; font-size: 0.8rem; color: var(--muted); }

/* ---------- sections / cards ---------- */

.section { margin: 72px 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 26px;
}
.section-head h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
}
.section-head a,
.section-head span {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}
.section-head a { transition: color 0.18s ease; }
.section-head a:hover { color: var(--text); }
.section-head a .arrow { display: inline-block; transition: transform 0.18s ease; }
.section-head a:hover .arrow { transform: translateX(3px); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  min-height: 196px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}
.card-link { display: flex; flex-direction: column; height: 100%; }
.card-index {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.35;
  margin: 20px 0 8px;
}
.card p {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.7;
  margin: 0 0 20px;
  flex: 1;
}
.card .tag-row { position: relative; z-index: 1; }
.card::after {
  content: "↗";
  position: absolute;
  top: 24px;
  right: 26px;
  color: var(--faint);
  font-size: 1rem;
  line-height: 1;
  transition: color 0.2s ease, transform 0.2s ease;
}
.card:hover::after { color: var(--signal); transform: translate(2px, -2px); }

/* ---------- tags ---------- */

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius-xs);
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--muted);
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
a.tag:hover { border-color: var(--border-2); color: var(--text); background: var(--surface-2); }

.tag-cloud { gap: 10px; }
.tag-lg { font-size: 0.82rem; padding: 7px 14px; gap: 6px; }
.tag-lg .tag-count { color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- page title ---------- */

.page-title {
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 1.16;
  margin: 0 0 14px;
}
.page-lead {
  color: var(--muted);
  max-width: 680px;
  font-size: 1rem;
  line-height: 1.8;
  margin: 0 0 44px;
}

/* ---------- doc list ---------- */

.doc-list { display: grid; }

.doc-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 20px 4px;
  border-bottom: 1px solid var(--border);
  transition: background 0.18s ease;
}
.doc-row:hover { background: var(--bg-subtle); }
.doc-row time {
  color: var(--faint);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.doc-row h3 {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.5;
  margin: 0 0 5px;
  transition: color 0.18s ease;
}
.doc-row:hover h3 { color: var(--signal); }
.doc-row p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.65;
  margin: 0;
}

/* ---------- doc page ---------- */

.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 64px;
  align-items: start;
}

.prose { max-width: 760px; min-width: 0; }
.prose h1,
.prose h2,
.prose h3 { letter-spacing: -0.03em; }
.prose h1 { font-size: 2.05rem; font-weight: 780; letter-spacing: -0.045em; margin: 12px 0 20px; }
.prose h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 2.4em;
  padding-top: 0.2em;
}
.prose h3 { font-size: 1.1rem; font-weight: 700; margin-top: 2em; }
.prose p,
.prose li { font-size: 1rem; line-height: 1.9; color: var(--text-soft); }
.prose strong { color: var(--text); font-weight: 700; }
.prose a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-2);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.18s ease;
}
.prose a:hover { text-decoration-color: var(--signal); }
.prose ul,
.prose ol { padding-left: 1.4em; }
.prose li { margin: 6px 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 44px 0; }
.prose blockquote {
  margin: 28px 0;
  padding: 16px 22px;
  border-left: 3px solid var(--text);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
}
.prose blockquote p { margin: 0; }
.prose code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--text);
}
.prose pre {
  background: var(--surface-2);
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.prose pre code { background: none; padding: 0; }

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  font-size: 0.85rem;
  color: var(--muted);
}
.sidebar h2 {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 14px;
}
.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0 0 34px;
  border-left: 1px solid var(--border);
}
.sidebar li { margin: 0; }
.sidebar li a {
  display: block;
  padding: 5px 0 5px 14px;
  color: var(--muted);
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.sidebar li a:hover { color: var(--text); border-left-color: var(--signal); }
.sidebar p { margin: 0; }
.sidebar p a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--border-2);
  text-underline-offset: 3px;
}
.sidebar p a:hover { text-decoration-color: var(--signal); }
.sidebar h2.sidebar-title-spaced { margin-top: 28px; }

/* ---------- share bar ---------- */

.share-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.share-bar button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-weight: 500;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.share-bar button:hover { border-color: var(--border-2); background: var(--surface-2); color: var(--text); }
.share-feedback { color: var(--muted); font-size: 0.8rem; }

/* ---------- notice / search / results ---------- */

.notice {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin: 36px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}
.notice-label {
  display: inline-block;
  margin-right: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 650;
}

.search-box {
  width: 100%;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 1rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.search-box::placeholder { color: var(--faint); }
.search-box:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 4px var(--ring);
}

.hint { color: var(--faint); font-size: 0.78rem; margin: 16px 0 24px; }

.result-list { display: grid; }
.result-item { border-bottom: 1px solid var(--border); padding: 20px 4px; }
.result-item h3 {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}
.result-item h3 a { transition: color 0.18s ease; }
.result-item h3 a:hover { color: var(--signal); }
.result-item p { margin: 0; color: var(--muted); font-size: 0.875rem; line-height: 1.65; }
.result-item mark {
  background: var(--surface-3);
  color: var(--text);
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 650;
}

.fav-remove {
  margin-top: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--radius-xs);
  padding: 5px 12px;
  font-size: 0.76rem;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.fav-remove:hover { border-color: var(--border-2); color: var(--text); }

.empty { color: var(--muted); padding: 40px 0; font-size: 0.9rem; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; gap: 40px; }
  .sidebar { position: static; }
  .sidebar ul { max-width: 520px; }
}

@media (max-width: 680px) {
  .container { width: calc(100% - 36px); }
  main.container { padding: 44px 0 72px; }

  .header-inner { flex-wrap: wrap; gap: 10px; padding: 10px 0; }
  .nav { order: 3; width: 100%; overflow-x: auto; gap: 0; padding-bottom: 2px; }
  .nav a { padding: 7px 10px; white-space: nowrap; }

  .hero { padding: 48px 0 44px; }
  .hero h1 { letter-spacing: -0.04em; }
  .hero p { font-size: 1rem; margin-top: 22px; }
  .hero-stats { gap: 32px; margin-top: 44px; }
  .stat-num { font-size: 1.6rem; }

  .section { margin: 56px 0; }
  .grid { grid-template-columns: 1fr; }

  .doc-row { grid-template-columns: 1fr; gap: 6px; padding: 18px 2px; }
  .doc-row time { order: -1; }
  .doc-row .tag { justify-self: start; }

  .page-lead { margin-bottom: 32px; }
  .prose h1 { font-size: 1.7rem; }

  .footer-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
}

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