/* components.css — 三页共用组件
   依赖 tokens.css，必须在 style.css 之前加载。
   包含：基础排版 / 容器 / 导航 / 按钮 / 栏目标题 / 页脚
         + 内页组件（面包屑 / 列表工具栏 / 品种卡 / 正文 / 目录 / 相关品种） */

/* ── 基础 ─────────────────────────────────────────────── */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: var(--fs-md);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 48px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--teal-deep);
  color: var(--white);
  padding: 10px 18px;
  z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ── 顶部导航 ─────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--teal);
  color: var(--white);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 92px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.logo-mark {
  width: 40px;
  height: 38px;
  background: transparent url("../images/icons/logo-rabbit.svg") center / contain no-repeat;
}

.logo-text {
  font-size: var(--fs-5xl);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 30px;
  font-size: var(--fs-lg);
  font-weight: 500;
}

.main-nav a {
  position: relative;
  padding: 6px 0;
  color: var(--on-teal);
  white-space: nowrap;
}

.main-nav a:hover { color: var(--white); }

.main-nav a[aria-current="page"] {
  color: var(--white);
  font-weight: 700;
}

.main-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 3px;
  border-radius: 2px;
  background: var(--gold);
}

.nav-toggle {
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  color: var(--white);
  font: inherit;
  font-size: var(--fs-md);
  line-height: 1.2;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

/* ── 按钮 ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 50px;
  padding: 0 28px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xl);
  font-weight: 700;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn-primary {
  background: var(--gold);
  color: var(--gold-ink);
  box-shadow: 0 6px 14px var(--gold-glow);
}

.btn-primary::after { content: "›"; font-size: 22px; line-height: 1; }

.btn-primary:hover { background: var(--gold-deep); transform: translateY(-1px); }

.btn-ghost {
  border: 1.5px solid var(--teal-outline);
  color: var(--teal-deep);
  background: rgba(255, 253, 248, 0.7);
}

.btn-ghost:hover { background: var(--white); }

/* ── 栏目标题 ─────────────────────────────────────────── */
.section-title {
  position: relative;
  padding-left: 20px;
  font-size: var(--fs-6xl);
  font-weight: 800;
  color: var(--teal-deep);
}

.section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 6px;
  border-radius: var(--radius-xs);
  background: var(--teal);
}

/* ── 页脚 ─────────────────────────────────────────────── */
.site-footer {
  background: var(--teal);
  color: var(--white);
  padding: 34px 0;
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
}

.logo-light .logo-text { color: var(--white); }

.footer-tagline {
  margin-top: 12px;
  max-width: 330px;
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--on-teal-soft);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  max-width: 640px;
  font-size: var(--fs-base2);
}

.footer-nav h2 {
  width: 100%;
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--on-teal-ghost);
}

.footer-nav a {
  color: var(--on-teal);
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  padding-bottom: 2px;
}

.footer-note {
  max-width: 260px;
  font-size: var(--fs-xs);
  line-height: 1.7;
  color: var(--on-teal-faint);
}

/* ── 内页：面包屑 ─────────────────────────────────────── */
.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 18px 0 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.crumb a { color: var(--teal-deep); }
.crumb li { list-style: none; }
.crumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; }
.crumb li + li::before { content: "/"; margin-right: 8px; color: var(--line); }
.crumb [aria-current="page"] { color: var(--muted); }

/* ── 内页：列表页头 ───────────────────────────────────── */
.page-hero {
  padding: 26px 0 10px;
}

.page-hero h1 {
  font-size: var(--fs-8xl);
  font-weight: 800;
  color: var(--teal-ink);
  letter-spacing: 0.01em;
}

.page-lede {
  margin-top: 12px;
  max-width: 760px;
  font-size: var(--fs-lg);
  line-height: 1.7;
  color: var(--hero-text);
}

.page-stat {
  margin-top: 14px;
  font-size: var(--fs-sm2);
  color: var(--muted);
}

.page-stat strong { color: var(--teal-deep); font-size: var(--fs-md); }

/* ── 内页：筛选排序 ───────────────────────────────────── */
.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 18px 0 22px;
  padding: 14px 18px;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-right: 4px;
}

.chip {
  font: inherit;
  font-size: var(--fs-sm2);
  line-height: 1.2;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--cream);
  color: var(--teal-deep);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.chip:hover { background: var(--teal-soft); }

.chip.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--white);
  font-weight: 700;
}

.chip:focus-visible,
.sort-select:focus-visible,
.btn:focus-visible,
.nav-toggle:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.sort-select {
  font: inherit;
  font-size: var(--fs-sm2);
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
}

/* ── 内页：列表卡片 ───────────────────────────────────── */
.list-note {
  margin: 0 0 16px;
  font-size: var(--fs-base2);
  color: var(--muted);
}

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

.breed-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.breed-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.breed-media {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--cream-deep);
}

.breed-media img { width: 100%; height: 100%; object-fit: cover; }

.breed-body { padding: 18px 20px 20px; }

.breed-body h2 {
  font-size: var(--fs-2xl);
  font-weight: 800;
}

.breed-body p {
  margin-top: 8px;
  font-size: var(--fs-sm2);
  line-height: 1.65;
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  font-size: var(--fs-2xs);
  line-height: 1.4;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.tag-gold { background: #fdf0d2; color: #8a6412; }

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  border-radius: var(--radius-card);
}

/* ── 内页：列表说明与相关分类 ─────────────────────────── */
.list-description {
  margin-top: 40px;
  padding: 32px 36px;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.list-description h2 {
  font-size: var(--fs-4xl);
  font-weight: 800;
  color: var(--teal-deep);
}

.list-description p {
  margin-top: 14px;
  font-size: var(--fs-lg);
  line-height: 1.85;
  color: var(--ink);
}

.related-links {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.related-links h2 {
  width: 100%;
  margin: 0 0 6px;
  font-size: var(--fs-2xl);
  color: var(--teal-deep);
  font-weight: 800;
}

.related-links a {
  font-size: var(--fs-base2);
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--teal-deep);
  background: var(--card);
}

.related-links a:hover { background: var(--teal-soft); }

/* ── 内页：详情页 ─────────────────────────────────────── */
.article-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 34px;
  align-items: center;
  padding: 22px 0 6px;
}

.article-head h1 {
  font-size: var(--fs-8xl);
  font-weight: 800;
  color: var(--teal-ink);
}

.article-lede {
  margin-top: 14px;
  font-size: var(--fs-xl);
  line-height: 1.7;
  color: var(--hero-text);
  max-width: 620px;
}

.article-figure {
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--cream-deep);
  aspect-ratio: 4 / 3;
}

.article-figure img { width: 100%; height: 100%; object-fit: cover; }

.fact-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 26px;
}

.fact {
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.fact dt {
  font-size: var(--fs-2xs);
  color: var(--muted);
  letter-spacing: 0.06em;
}

.fact dd {
  margin: 4px 0 0;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--teal-deep);
}

.toc {
  margin-top: 26px;
  padding: 16px 20px;
  background: var(--teal-soft);
  border-radius: var(--radius-card);
}

.toc h2 {
  font-size: var(--fs-sm);
  letter-spacing: 0.08em;
  color: var(--teal-deep);
}

.toc ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: var(--fs-sm2);
}

.toc a { color: var(--teal-deep); border-bottom: 1px solid var(--arrow-strong); }
.toc a:hover { color: var(--teal-ink); }

.toc-toggle { display: none; cursor: pointer; }

.detail-layout {
  margin-top: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
  align-items: start;
}

.detail-layout .toc {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  margin-top: 0;
  position: sticky;
  top: 110px;
}

.detail-layout .article-body { grid-column: 1; grid-row: 1; }

.detail-layout .toc ol { flex-direction: column; gap: 8px; padding-left: 20px; }

.article-body {
  margin-top: 0;
  padding-bottom: 10px;
}

.article-body section:first-child h2 { margin-top: 0; }

.article-body h2 {
  margin-top: 34px;
  font-size: var(--fs-5xl);
  font-weight: 800;
  color: var(--teal-deep);
  scroll-margin-top: 110px;
}

.article-body p {
  margin-top: 12px;
  font-size: var(--fs-lg);
  line-height: 1.95;
  color: var(--ink);
}

.related-breed {
  margin-top: 48px;
  padding: 28px 32px;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.related-breed h2 {
  font-size: var(--fs-4xl);
  font-weight: 800;
  color: var(--teal-deep);
}

.related-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.related-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--cream);
  border: 1px solid var(--line);
}

.related-card:hover { background: var(--teal-soft); }

.related-card img {
  width: 78px;
  height: 78px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--cream-deep);
}

.related-card strong { display: block; font-size: var(--fs-md); }
.related-card span { font-size: var(--fs-2xs); color: var(--muted); }

/* ── 响应式（共享组件） ───────────────────────────────── */
@media (max-width: 1180px) {
  .container { padding: 0 32px; }
  .main-nav { gap: 20px; font-size: var(--fs-md); }
  .article-head { grid-template-columns: minmax(0, 1fr) 360px; gap: 26px; }
}

@media (max-width: 980px) {
  .nav-toggle { display: inline-flex; }
  .main-nav {
    position: absolute;
    top: 92px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 8px 32px 18px;
    background: var(--teal);
    border-top: 1px solid var(--teal-line);
    display: none;
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 10px 0; width: 100%; }
  .main-nav a[aria-current="page"]::after { display: none; }

  .breed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-head { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; gap: 0; }
  .detail-layout .toc { position: static; grid-column: 1; grid-row: auto; }
  .detail-layout .article-body { grid-column: 1; grid-row: auto; }
  .article-figure { aspect-ratio: 16 / 10; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .container { padding: 0 20px; }
  .header-inner { height: 72px; }
  .logo-text { font-size: var(--fs-2xl); }
  .logo-mark { width: 30px; height: 28px; }
  .main-nav { top: 72px; }

  .btn { height: 46px; font-size: var(--fs-md); padding: 0 22px; }
  .section-title { font-size: var(--fs-4xl); }

  .page-hero h1, .article-head h1 { font-size: var(--fs-7xl); }
  .page-lede, .article-lede { font-size: var(--fs-lg); }
  .article-body p { font-size: var(--fs-md); line-height: 1.9; }
  .article-body h2 { font-size: var(--fs-3xl); }

  .breed-grid { grid-template-columns: 1fr; }
  .fact-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-toolbar { padding: 12px 14px; }
  .list-description { padding: 24px 20px; }
  .related-breed { padding: 22px 20px; }

  .toc-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    font: inherit;
    font-size: var(--fs-sm2);
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--teal-deep);
    cursor: pointer;
  }
  .toc { margin-top: 12px; display: none; }
  .toc.is-open { display: block; }
  .toc ol { flex-direction: column; gap: 6px; }

  .footer-inner { flex-direction: column; gap: 24px; }
  .footer-nav { max-width: none; }
  .footer-note { max-width: none; }
}

/* ── 数据对接补充（2026-11-13） ───────────────────────── */
/* 页脚备案号链接（深青底上的可点文字） */
.footer-note a { color: var(--on-teal); border-bottom: 1px solid rgba(255,255,255,0.35); }

/* 品种卡标题为长文章标题：两行截断，保证卡片等高 */
.breed-body h2 a {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.breed-body p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* 首页精选卡标题截断 */
.feature-body h3 a {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* 首页分类卡「最新条目」单行截断 */
.cat-card p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 相关条目卡片标题两行截断 */
.related-card strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* 筛选条用 <a class="chip"> 服务端跳转（无 JS 时也能用） */
a.chip { display: inline-flex; align-items: center; }

.page-hero + .list-toolbar { margin-top: 14px; }

/* 正文配图：data-content 区域内的图片 */
.article-body figure {
  margin: 22px 0 6px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--cream-deep);
}

.article-body figure img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* 列表分页 */
.pager {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-base2);
}

.pager a,
.pager .pager-current,
.pager .pager-dots {
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--teal-deep);
}

.pager a:hover { background: var(--teal-soft); }

.pager .pager-current {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--white);
  font-weight: 700;
}

.pager .pager-dots { border-color: transparent; background: transparent; color: var(--muted); }

.pager-info {
  margin-left: auto;
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* 详情页 fact-row 允许四列自适应换行 */
.fact-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

@media (max-width: 640px) {
  .fact-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager { gap: 6px; }
  .pager a, .pager .pager-current, .pager .pager-dots { min-width: 34px; height: 34px; padding: 0 10px; }
  .pager-info { width: 100%; margin-left: 0; }
}
