/* ============================================================
   components.css — 跨页复用组件
   ============================================================ */

/* ---------- reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--green-700); outline-offset: 3px; border-radius: 4px; }

.container {
  width: min(var(--container), calc(100% - var(--gutter) * 2));
  margin-inline: auto;
}
.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 99;
  padding: 10px 16px;
  background: var(--green-900);
  color: var(--white);
  border-radius: var(--r-sm);
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--green-900); flex: none; }
.logo-mark svg { width: 22px; height: 22px; }
.logo-text { font-size: 18px; font-weight: 800; letter-spacing: 0.01em; white-space: nowrap; }

/* ---------- header ---------- */
.site-header {
  position: relative;
  z-index: 20;
  height: var(--h-header);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 28px; height: 100%; }
.main-nav { display: flex; align-items: center; gap: 30px; font-size: 14.5px; color: var(--ink-2); }
.main-nav a { position: relative; padding: 6px 0; white-space: nowrap; }
.main-nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; background: var(--green-700); transform: scaleX(0); transform-origin: left; transition: transform 0.2s; }
.main-nav a:hover { color: var(--ink); }
.main-nav a:hover::after, .main-nav a[aria-current="page"]::after { transform: scaleX(1); }
.main-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: transparent;
  font-size: 14px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.18s;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: #c7ec60; }
.btn-dark { background: var(--green-800); color: var(--white); }
.btn-dark:hover { background: var(--green-700); }
.btn-ghost { border-color: var(--line-light); color: var(--white); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }
.btn-outline { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn-outline:hover { background: rgba(23, 34, 15, 0.05); }

/* ---------- section heading ---------- */
.section-title { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 800; line-height: 1.25; letter-spacing: 0.01em; }
.section-title svg { width: 24px; height: 24px; color: var(--green-600); flex: none; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }

/* ---------- cards ---------- */
.thumb { display: block; overflow: hidden; border-radius: var(--r); background: var(--green-100); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.45s ease; }
a:hover .thumb img { transform: scale(1.04); }

.breed-card { min-width: 0; }
.breed-card .thumb { aspect-ratio: 4.25 / 1; }
.breed-card h3 { margin: 8px 0 3px; font-size: 16px; font-weight: 700; line-height: 1.3; }
.breed-card p { font-size: 12.5px; line-height: 1.55; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.category-card { display: block; min-width: 0; }
.category-card .thumb { aspect-ratio: 1.55 / 1; }
.category-card h3 { margin: 11px 0 5px; font-size: 17px; font-weight: 700; }
.category-card p { font-size: 13px; line-height: 1.62; color: var(--ink-2); }

/* ---------- footer ---------- */
.site-footer { background: var(--green-900); color: #cfd9bd; padding: 56px 0 60px; }
.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "logo nav"
    "note nav"
    "about copyright";
  align-items: start;
  gap: 13px 40px;
}
.footer-logo { grid-area: logo; color: var(--white); }
.footer-logo .logo-text { color: var(--white); }
.footer-note { grid-area: note; max-width: 560px; font-size: 13px; line-height: 1.7; color: #b9c7a6; }
.footer-nav { grid-area: nav; display: flex; align-items: flex-start; gap: 34px; }
.footer-nav h3 { font-size: 12px; letter-spacing: 0.14em; color: #96a682; font-weight: 600; margin-bottom: 8px; }
.footer-nav ul { display: flex; flex-wrap: wrap; gap: 6px 18px; max-width: 620px; font-size: 13px; }
.footer-nav a:hover, .footer-about a:hover { color: var(--accent); }
.footer-about { grid-area: about; display: flex; align-items: baseline; gap: 12px; max-width: 900px; font-size: 12.5px; line-height: 1.7; color: #a9b997; }
.footer-about h3 { font-size: 12px; letter-spacing: 0.14em; color: #96a682; font-weight: 600; flex: none; }
.copyright { grid-area: copyright; font-size: 12.5px; color: #9fb18b; white-space: nowrap; }

/* ---------- utilities ---------- */
.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;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   内页公共组件：面包屑 / 筛选条 / 列表说明 / 相关阅读
   ============================================================ */

/* ---------- 面包屑 ---------- */
.crumb { padding: 18px 0 0; font-size: 12.5px; color: var(--ink-3); }
.crumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.crumb li { display: inline-flex; align-items: center; gap: 6px; }
.crumb li + li::before { content: "/"; color: var(--line-strong); }
.crumb a:hover { color: var(--ink); }
.crumb [aria-current="page"] { color: var(--ink-2); }

/* ---------- 内页标题带 ---------- */
.page-hero {
  margin-top: 16px;
  background:
    radial-gradient(900px 320px at 88% 10%, rgba(183, 224, 74, 0.14), transparent 70%),
    var(--green-900);
  color: var(--white);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.page-hero-inner { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; padding: 38px 44px; }
.page-hero h1 { font-size: 46px; line-height: 1.2; font-weight: 800; letter-spacing: 0.01em; color: #f7f8e8; }
.page-lead { max-width: 720px; margin-top: 12px; font-size: 15px; line-height: 1.8; color: #cfdab9; }
.page-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.page-tags span { padding: 4px 12px; border: 1px solid var(--line-light); border-radius: var(--r-pill); font-size: 12.5px; color: #dfe8cb; }
.page-count { flex: none; display: flex; align-items: baseline; gap: 6px; padding-bottom: 6px; color: #b9c8a5; font-size: 13px; }
.page-count b { font-size: 44px; line-height: 1; font-weight: 800; color: var(--accent); }

/* ---------- 筛选与排序 ---------- */
.toolbar { margin-top: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.toolbar-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 22px; padding: 12px 0; }
.toolbar-label { font-size: 12.5px; color: var(--ink-3); letter-spacing: 0.06em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: transparent;
  font-size: 13px;
  color: var(--ink-2);
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.chip:hover { border-color: var(--green-700); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--green-800); border-color: var(--green-800); color: var(--white); }
.toolbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: 12.5px; color: var(--ink-3); }
.toolbar-right label { cursor: pointer; }
.select {
  min-height: 34px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--bg-card);
  font-size: 13px;
  color: var(--ink);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.result-count { font-size: 13px; color: var(--ink-3); }

/* ---------- 列表说明 ---------- */
.list-description { padding: 34px 0 38px; border-top: 1px solid var(--line); }
.list-description-inner { max-width: 820px; }
.list-description h2 { font-size: 24px; font-weight: 800; }
.list-description p { margin-top: 12px; font-size: 14.5px; line-height: 1.9; color: var(--ink-2); }

/* ---------- 相关阅读 / 上下篇 ---------- */
.next-read { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 14px; padding: 0 0 44px; }
.next-card { display: block; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-card); transition: border-color 0.18s, transform 0.18s; }
.next-card:hover { border-color: var(--green-700); transform: translateY(-2px); }
.next-card span { font-size: 12px; letter-spacing: 0.12em; color: var(--ink-3); }
.next-card h3 { margin: 6px 0 4px; font-size: 20px; font-weight: 800; }
.next-card p { font-size: 13px; line-height: 1.65; color: var(--ink-2); }

/* ============================================================
   详情页公共组件：文章头 / 目录 / 正文 / 相关品种
   ============================================================ */
.article-head { padding: 22px 0 26px; border-bottom: 1px solid var(--line); }
.article-head-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 44px; align-items: end; }
.article-head h1 { font-size: 46px; line-height: 1.2; font-weight: 800; }
.article-lead { max-width: 720px; margin-top: 12px; font-size: 15.5px; line-height: 1.85; color: var(--ink-2); }
.article-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--line); }
.article-meta div { padding: 12px 14px; background: var(--bg-card); }
.article-meta dt { font-size: 11.5px; letter-spacing: 0.08em; color: var(--ink-3); }
.article-meta dd { margin-top: 3px; font-size: 13.5px; font-weight: 700; color: var(--ink); }

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 258px; gap: 56px; padding: 30px 0 46px; align-items: start; }
.article-toc { position: sticky; top: 24px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-card); }
.article-toc h2 { font-size: 12px; letter-spacing: 0.14em; color: var(--ink-3); font-weight: 600; }
.article-toc ol { counter-reset: toc; margin-top: 10px; display: grid; gap: 2px; }
.article-toc li { counter-increment: toc; }
.article-toc a { display: flex; gap: 8px; padding: 6px 0; font-size: 13.5px; color: var(--ink-2); border-bottom: 1px solid transparent; }
.article-toc a::before { content: counter(toc, decimal-leading-zero); font-size: 11px; color: var(--ink-3); line-height: 1.9; }
.article-toc a:hover, .article-toc a.is-active { color: var(--ink); }
.article-toc a.is-active { font-weight: 700; }
.article-toc a.is-active::before { color: var(--green-700); }

.article-body { max-width: 780px; }
.article-body .article-intro { font-size: 15.5px; line-height: 1.9; color: var(--ink-2); }
.article-hero { margin: 22px 0 8px; overflow: hidden; border-radius: var(--r-lg); }
.article-hero img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.article-hero figcaption { margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.article-body section { padding-top: 30px; }
.article-body h2 { font-size: 27px; line-height: 1.35; font-weight: 800; scroll-margin-top: 24px; }
.article-body h2 + p { margin-top: 12px; }
.article-body p { font-size: 15.5px; line-height: 1.95; color: #2c3a24; }
.article-body p + p { margin-top: 12px; }
.article-body .article-figure { margin: 22px 0 6px; }
.article-body .article-figure img { width: 100%; border-radius: var(--r); aspect-ratio: 16 / 9; object-fit: cover; }
.article-body .article-figure figcaption { margin-top: 8px; font-size: 12px; color: var(--ink-3); }

.related { padding: 34px 0 46px; border-top: 1px solid var(--line); }
.related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 16px; }
.related-card { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-card); transition: border-color 0.18s; }
.related-card:hover { border-color: var(--green-700); }
.related-card .thumb { width: 96px; flex: none; aspect-ratio: 1 / 1; border-radius: 8px; }
.related-card h3 { font-size: 17px; font-weight: 700; }
.related-card p { margin-top: 3px; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }

/* ---------- 服务端筛选 chip（a 标签）与分页 ---------- */
.chips a.chip { display: inline-flex; align-items: center; justify-content: center; }
.chips a.chip[aria-pressed="true"] { background: var(--green-800); border-color: var(--green-800); color: var(--white); }
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 28px 0 6px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pager a, .pager span { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); color: var(--ink-2); }
.pager a:hover { border-color: var(--green-700); color: var(--ink); }
.pager span[aria-current="page"] { background: var(--green-800); border-color: var(--green-800); color: var(--white); font-weight: 700; }
.pager a[rel="prev"], .pager a[rel="next"] { padding: 0 16px; }
.list-section { padding-top: 8px; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 12px 0 14px; }
.next-read-wrap { padding-bottom: 42px; }
.footer-icp { margin-top: 6px; }
.footer-icp a { color: #a9b997; }
.footer-icp a:hover { color: var(--accent); }
