/* ============================================================
   Global design tokens + component styles
   对应 favicon 配色：森林绿 #3d7a52 / 奶油底 #fffaf2 / 山棕 #c4a574
   ============================================================ */
:root {
  --color-brand: #3d7a52;
  --color-brand-strong: #2c5e3e;
  --color-brand-soft: #e7f0ea;
  --color-accent: #94682a; /* 金：WCAG AA 4.73:1（原 #c4a574 仅 2.25:1）*/
  --color-bg: #fffaf2;
  --color-surface: #ffffff;
  --color-text: #24312a;
  --color-text-muted: #5c6b62;
  --color-border: #a8997d;
  --font-display: Georgia, 'Times New Roman', 'Noto Serif', serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius: 10px;
  --shadow-card: 0 1px 3px rgba(36, 49, 42, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.25; margin: 0 0 0.6rem; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
a { color: var(--color-brand-strong); text-decoration-thickness: 1px; text-underline-offset: 3px; }
img { max-width: 100%; }
code { background: var(--color-brand-soft); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.9em; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 1.1rem; }
.site-main { padding: 1.8rem 0 3rem; min-height: 60vh; }

/* ---------- Header ---------- */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 20;
}
.header-inner {
  max-width: 1080px; margin: 0 auto; padding: 0.7rem 1.1rem;
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
}
.logo { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; color: var(--color-brand-strong); text-decoration: none; padding: 0.35rem 0; }
.logo em { font-style: normal; color: var(--color-accent); }
.main-nav { display: flex; gap: 0.9rem; flex: 1; flex-wrap: wrap; }
.main-nav a { color: var(--color-text); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.main-nav a:hover { color: var(--color-brand-strong); }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle:focus-visible ~ .nav-toggle-label {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
  border-radius: 6px;
}
.nav-toggle-label { display: none; cursor: pointer; user-select: none; }
/* 桌面端 nav-toggle 无作用：彻底移出 Tab 序列，消除键盘死焦点 */
@media (min-width: 641px) {
  .nav-toggle { display: none; }
}
.lang-switcher select {
  font: inherit; padding: 0.3rem 0.5rem; border: 1px solid var(--color-border);
  border-radius: 6px; background: var(--color-surface); color: var(--color-text);
}
/* LangSwitcher dropdown (details) —— 默认收起，open 才展开；右对齐防移动端超界 */
.lang-switch { position: relative; }
.lang-switch summary { cursor: pointer; font-weight: 600; font-size: 0.92rem; color: var(--color-text); padding: 0.5rem 0.2rem; }
.lang-switch ul {
  display: none; list-style: none; margin: 0; padding: 0.35rem 0;
  position: absolute; right: 0; top: calc(100% + 0.5rem);
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 8px; box-shadow: 0 6px 14px rgba(36, 49, 42, 0.12);
  z-index: 30; min-width: 140px;
}
.lang-switch[open] ul { display: block; }
.lang-switch li a {
  display: block; padding: 0.35rem 0.8rem; font-size: 0.9rem;
  color: var(--color-text); text-decoration: none; white-space: nowrap;
}
.lang-switch li a:hover { background: var(--color-brand-soft); }
.lang-switch li a.active { font-weight: 700; color: var(--color-brand-strong); }
.lang-switch summary::after { content: ' ▾'; font-size: 0.8em; color: var(--color-muted); }
.main-nav a.active { color: var(--color-brand-strong) !important; text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; /* 触控目标 ≥44px（WCAG 2.5.5 / Apple HIG） */
  background: var(--color-brand); color: #fff !important;
  padding: 0.65rem 1.2rem; border-radius: 8px; text-decoration: none;
  font-weight: 700; font-size: 0.95rem;
}
.btn:hover { background: var(--color-brand-strong); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 3rem 0 2.4rem;
  overflow: hidden;
}
.hero::before {
  /* 地形感：山丘起伏 + 远处光晕（纯 CSS，契合 walk 主题） */
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(55% 110% at 88% 15%, rgba(196, 165, 116, 0.16), transparent 62%),
    radial-gradient(48% 95% at 8% 30%, rgba(61, 122, 82, 0.13), transparent 66%),
    linear-gradient(180deg, transparent 55%, rgba(61, 122, 82, 0.07) 100%);
  pointer-events: none;
}
.hero::after {
  /* 路径/等高线微纹理 */
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -35deg,
    transparent 0 30px,
    rgba(61, 122, 82, 0.045) 30px 31px
  );
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero a, .container section a { display: inline-block; padding: 0.3rem 0; }
.kicker {
  text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700;
  font-size: 0.78rem; color: var(--color-accent); margin: 0 0 0.4rem;
}

/* ---------- Accessibility helpers ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Focus visibility (WCAG 2.4.7) ---------- */
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Skip link (WCAG 2.4.1) ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: #fff; color: var(--color-brand-strong);
  padding: 0.6rem 1rem; border-radius: 0 0 8px 0;
  z-index: 1000; font-weight: 600;
}
.skip-link:focus-visible {
  left: 0; outline: 2px solid var(--color-brand); outline-offset: 0;
}

/* ---------- Cards / grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; margin: 0.8rem 0 1.4rem; }
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 1rem 1.1rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(36, 49, 42, 0.09);
  border-color: rgba(61, 122, 82, 0.35);
}
.card h3 { font-size: 1.05rem; margin-bottom: 0.3rem; }
.card p { margin: 0; font-size: 0.92rem; color: var(--color-text-muted); }


/* ---------- 视觉图（hero 大图 / 文章横幅 / 正文图） ---------- */
.hero-visual {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  max-width: 960px;
  margin: 0 auto 1.75rem;
  aspect-ratio: 16/9;
  height: auto;
  object-fit: cover;
  border-radius: 1.25rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}
.article-hero {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 1rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  margin: 0 0 1.4rem;
}
.prose img {
  display: block;
  margin: 1.5rem auto;
  max-width: 100%;
  height: auto;
  border-radius: 0.9rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}

/* ---------- Prose (markdown content) ---------- */
.prose h2 { font-size: 1.5rem; margin-top: 1.8rem; }
.prose h3 { font-size: 1.2rem; margin-top: 1.4rem; }
.prose p { margin: 0.7rem 0; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose blockquote {
  margin: 1rem 0; padding: 0.7rem 1rem; border-left: 3px solid var(--color-accent);
  background: var(--color-brand-soft); border-radius: 0 8px 8px 0;
  font-size: 0.92rem;
}
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.prose th, .prose td { border: 1px solid var(--color-border); padding: 0.5rem 0.7rem; text-align: left; }
.prose th { background: var(--color-brand-soft); }
a { overflow-wrap: anywhere; }

/* ---------- Meta / timeline / faq ---------- */
.meta-line { font-size: 0.85rem; color: var(--color-text-muted); }
.timeline { list-style: none; padding: 0; margin: 0.8rem 0; }
.timeline li {
  padding: 0.8rem 1rem; margin-bottom: 0.6rem;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
}
details.faq {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); margin-bottom: 0.6rem; padding: 0.6rem 1rem;
}
details.faq summary { cursor: pointer; font-weight: 700; color: var(--color-brand-strong); padding: 0.5rem 0; }
.faq-a { padding-top: 0.5rem; color: var(--color-text); font-size: 1rem; }

/* ---------- Evidence badge ---------- */
.evidence-badge {
  display: inline-block; font-size: 0.75rem; font-weight: 700;
  padding: 0.18rem 0.55rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em;
}
.evidence-official { background: #dcefe3; color: #1f5c38; }
.evidence-build    { background: #f3e9d2; color: #7a5c1f; }
.evidence-tested   { background: #e3ecf7; color: #2b4f7a; }

/* EvidenceBadge.astro 实际输出类名（evidence--type），补齐样式 */
.evidence {
  display: inline-block; font-size: 0.75rem; font-weight: 700;
  padding: 0.18rem 0.55rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
  line-height: 1.35;
}
.evidence--official  { background: #dcefe3; color: #1f5c38; }
.evidence--build     { background: #f3e9d2; color: #7a5c1f; }
.evidence--tested    { background: #e3ecf7; color: #2b4f7a; }
.evidence--community { background: #f0e6f6; color: #6b3f8f; }
.evidence.compact { font-size: 0.68rem; padding: 0.12rem 0.45rem; }

/* ---------- Search ---------- */
.search-input {
  width: 100%; max-width: 640px; font: inherit; font-size: 1.05rem;
  padding: 0.7rem 1rem; border: 1.5px solid var(--color-border); border-radius: 10px;
  background: var(--color-surface); color: var(--color-text);
}
.search-input:focus { outline: 2px solid var(--color-brand); }
.search-results { list-style: none; padding: 0; margin: 1rem 0; max-width: 720px; }
.search-results li { margin-bottom: 0.7rem; }

/* ---------- Ad slot ---------- */
.ad-slot {
  max-width: 1080px; margin: 0.4rem auto 0; padding: 0 1.1rem;
}
.ad-slot-inner {
  min-height: 90px; border: 1px dashed var(--color-border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted); font-size: 0.8rem; letter-spacing: 0.08em;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border); background: var(--color-surface);
  padding: 1.6rem 0 2.2rem; margin-top: 2rem; font-size: 0.9rem; color: var(--color-text-muted);
}
.site-footer .footer-inner { max-width: 1080px; margin: 0 auto; padding: 0 1.1rem; display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: center; }
.site-footer a { color: var(--color-brand-strong); display: inline-block; padding: 0.55rem 0.25rem; }
.footer-disclaimer { width: 100%; font-size: 0.8rem; opacity: 0.85; }

@media (min-width: 641px) and (max-width: 900px) {
  .header-inner { gap: 0.8rem; padding: 0.7rem 0.9rem; }
  .main-nav { gap: 0.55rem; }
  .main-nav a { font-size: 0.88rem; }
}

@media (max-width: 640px) {
  .header-inner { position: relative; flex-wrap: nowrap; gap: 0.6rem; }
  .main-nav {
    display: none;
    position: absolute;
    top: calc(100% + 0.7rem);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 8px 16px rgba(36, 49, 42, 0.1);
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 1.1rem 0.9rem;
    z-index: 30;
  }
  .main-nav a { padding: 0.45rem 0; font-size: 1rem; }
  .nav-toggle-label {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; margin-left: auto;
  }
  .nav-toggle-icon,
  .nav-toggle-icon::before,
  .nav-toggle-icon::after {
    display: block; width: 20px; height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform 0.18s ease, opacity 0.18s ease;
  }
  .nav-toggle-icon { position: relative; }
  .nav-toggle-icon::before,
  .nav-toggle-icon::after { content: ""; position: absolute; left: 0; }
  .nav-toggle-icon::before { top: -6px; }
  .nav-toggle-icon::after { top: 6px; }
  .nav-toggle:checked ~ .nav-toggle-label .nav-toggle-icon { background: transparent; }
  .nav-toggle:checked ~ .nav-toggle-label .nav-toggle-icon::before { top: 0; transform: rotate(45deg); }
  .nav-toggle:checked ~ .nav-toggle-label .nav-toggle-icon::after { top: 0; transform: rotate(-45deg); }
  .nav-toggle:checked ~ .main-nav { display: flex; }
  .prose table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hero { padding: 1.6rem 0 1.2rem; }
  h1 { font-size: clamp(1.7rem, 6vw, 2.2rem); }
  .btn { padding: 0.7rem 1rem; font-size: 0.9rem; }
  .site-main { padding: 1.2rem 0 2.2rem; }
}

/* ============================================================
   Visual Upgrade (2026-08-06): dark hero overlay, screenshot
   gallery, thumbnail cards — added after original styles
   ============================================================ */

/* ---------- Dark hero with full-bleed key art ---------- */
.hero--dark {
  position: relative;
  padding: 0;
  background: #101a14;
  color: #fff;
}
.hero-bg {
  display: block;
  width: 100%;
  height: clamp(320px, 52vw, 560px);
  object-fit: cover;
  object-position: center 30%;
  border: 0;
  border-radius: 0;
  margin: 0;
  opacity: 0.95;
  filter: brightness(1.06) saturate(1.04);
}
.hero-inner {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2.2rem 1.2rem 2.6rem;
  background: linear-gradient(180deg, rgba(9, 17, 12, 0) 0%, rgba(9, 17, 12, 0.72) 62%, rgba(9, 17, 12, 0.94) 100%);
}
.hero-inner h1 {
  color: #fff;
  font-size: clamp(2.1rem, 5.4vw, 3.4rem);
  margin-bottom: 0.4rem;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}
.hero-inner .kicker { color: #ffd9a0; margin-bottom: 0.3rem; }
.hero-sub {
  color: #e8f0ea;
  max-width: 760px;
  margin: 0 0 1rem;
  font-size: clamp(0.98rem, 2vw, 1.12rem);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}
.hero-cta { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.hero--dark .btn { background: #ffd9a0; color: #1c2b22 !important; border: none; }
.hero--dark .btn:hover { background: #ffe6bd; }
.hero--dark .btn-ghost {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  border: 1.5px solid rgba(255, 255, 255, 0.65) !important;
  backdrop-filter: blur(4px);
}
.hero--dark .btn-ghost:hover { background: rgba(255, 255, 255, 0.22) !important; }
.hero--dark a[data-promo-banner], .hero--dark .promo-line { color: #ffe6bd !important; }

/* ---------- Screenshot gallery ---------- */
.gallery { margin: 1.4rem 0 0.4rem; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1rem;
}
.gallery-item {
  display: block;
  border-radius: 0.9rem;
  overflow: hidden;
  border: 1px solid rgba(61, 122, 82, 0.25);
  box-shadow: 0 2px 10px rgba(36, 49, 42, 0.10);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.gallery-item:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(36, 49, 42, 0.16); }
.gallery-item img { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; }

/* ---------- Cards with thumbnail ---------- */
.card--thumb {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-bottom: 1px solid rgba(61, 122, 82, 0.18);
}
.card-body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.card-body h3 { font-size: 1rem; margin: 0.1rem 0 0; }
.card-title { font-size: 0.98rem; line-height: 1.35; }
.card-desc {
  font-size: 0.86rem;
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-body .meta-line { font-size: 0.78rem; margin-top: 0.15rem; }
/* Hub badge：彩色分类徽章（配合 hubMeta 内联色） */
.hub-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: 0.1rem;
}

@media (max-width: 640px) {
  .hero-inner { padding: 1.4rem 1rem 1.8rem; }
}
