/* components.css — 跨页复用的组件：基础排版、页头、按钮、分区标题、页脚、卡片骨架 */

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

html { -webkit-text-size-adjust: 100%; }

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

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--red);
  color: #fff;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ------------------------------------------------------------------ 页头 */
.site-header {
  position: relative;
  z-index: 30;
  height: var(--header-h);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
}

.brand-name {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: .5px;
  white-space: nowrap;
}

.brand-tag {
  padding-left: 14px;
  margin-left: 2px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: .2px;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: auto;
  font-size: 15.5px;
  color: var(--ink-2);
}

.site-nav a {
  position: relative;
  padding: 6px 0;
  white-space: nowrap;
}

.site-nav a:hover { color: var(--red); }

.site-nav a[aria-current="page"] {
  color: var(--red);
  font-weight: 600;
}

.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 18px;
  height: 3px;
  margin-left: -9px;
  border-radius: 2px;
  background: var(--red);
}

.header-cta {
  flex-shrink: 0;
  padding: 9px 20px !important;
  font-size: 14px !important;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 36px;
  padding: 8px 6px;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  margin: 4px 0;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}

/* ------------------------------------------------------------------ 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

.btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { background: var(--red-dark); }

.btn-ghost-light {
  border-color: rgba(255, 255, 255, .8);
  color: #fff;
  background: transparent;
}
.btn-ghost-light:hover { background: rgba(255, 255, 255, .14); }

.btn-outline {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--paper);
}
.btn-outline:hover { border-color: var(--red); color: var(--red); }

.btn-sm {
  min-height: 36px;
  padding: 7px 16px;
  font-size: 13px;
}

/* -------------------------------------------------------------- 分区标题 */
.section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.section-title {
  position: relative;
  padding-left: 18px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: .5px;
  line-height: 1.25;
}

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

.section-head .btn { margin-left: auto; }

/* ------------------------------------------------------------------ 标签 */
.tag {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.tag-blue { background: #2f6fd0; }
.tag-orange { background: #e8892b; }
.tag-green { background: #2e8b57; }
.tag-soft {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line);
  font-weight: 500;
}

/* --------------------------------------------------------------- 面包屑 */
.crumb {
  padding-top: 22px;
  font-size: 13px;
  color: var(--muted);
}

.crumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.crumb li + li::before {
  content: "/";
  margin-right: 8px;
  color: var(--line-strong);
}

.crumb a:hover { color: var(--red); }

/* ---------------------------------------------------------------- 页脚 */
.site-footer {
  background: var(--navy);
  color: var(--on-dark);
  padding: 40px 0 24px;
}

.footer-top {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  padding-bottom: 29px;
}

.footer-brand { max-width: 380px; }

.footer-brand .brand { color: #fff; }
.footer-brand .brand-name { font-size: 19px; }

.footer-desc {
  margin-top: 14px;
  color: var(--on-dark-soft);
  font-size: 13.5px;
  line-height: 1.85;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-left: auto;
  padding-top: 6px;
  font-size: 14px;
  color: var(--on-dark-soft);
  max-width: 720px;
}

.footer-nav a:hover { color: #fff; }

.footer-bottom {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, .14);
  font-size: 12.5px;
  line-height: 1.8;
  color: rgba(255, 255, 255, .62);
}

.footer-note { max-width: 860px; }
.footer-note strong { color: rgba(255, 255, 255, .88); font-weight: 600; }
.footer-copy { margin-left: auto; white-space: nowrap; }

/* ------------------------------------------------------------ 通用卡片 */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.meta-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.meta-dot svg { flex-shrink: 0; }

/* --------------------------------------------------------- 内页：页头区 */
.page-hero {
  padding: 26px 0 30px;
  border-bottom: 1px solid var(--line);
}

.page-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 48px;
  align-items: end;
}

.eyebrow {
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}

.page-hero h1 {
  margin: 10px 0 12px;
  font-size: 38px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .5px;
}

.page-hero .lead {
  max-width: 720px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.85;
}

.page-hero-stats {
  display: flex;
  gap: 26px;
  padding-bottom: 4px;
}

.page-hero-stats div {
  padding-left: 14px;
  border-left: 2px solid var(--red-soft);
}

.page-hero-stats dt {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.page-hero-stats dd {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------------------------------------------------- 内页：筛选排序条 */
.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 26px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(140%) blur(6px);
}

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

.toolbar-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.filter-btn {
  min-height: 32px;
  padding: 5px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  transition: all .16s ease;
}

.filter-btn:hover { border-color: var(--red); color: var(--red); }

.filter-btn[aria-pressed="true"] {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.filter-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}

.filter-sort label { cursor: pointer; }

.filter-sort select {
  height: 34px;
  cursor: pointer;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
}

.toolbar-count { color: var(--muted); font-size: 12.5px; }
.toolbar-count b { color: var(--ink); }

/* --------------------------------------------------------- 内页：列表 */
.list-section { padding: 30px 0 10px; }

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

.list-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: box-shadow .18s ease, transform .18s ease;
}

.list-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(20, 24, 40, .08);
}

.list-card .thumb {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface);
}

.list-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
  flex: 1;
}

.list-card-body h2,
.list-card-body h3 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.list-card-body p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.list-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.empty-state {
  display: none;
  padding: 48px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.empty-state.is-visible { display: block; }

/* ------------------------------------------------- 内页：栏目说明区块 */
.list-description {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 40px;
  margin: 34px 0 0;
  padding: 30px 0 6px;
  border-top: 1px solid var(--line);
}

.list-description h2 {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.4;
}

.list-description p {
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.95;
}

/* ------------------------------------------------------------ 详情：正文 */
.article-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 56px;
  padding: 28px 0 34px;
  align-items: start;
}

.article-head { padding-bottom: 22px; border-bottom: 1px solid var(--line); }

.article-head h1 {
  margin: 8px 0 14px;
  font-size: 36px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: .3px;
}

.article-head .lead {
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.85;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}

.article-meta .tag { height: 24px; }

.article-body { padding-top: 8px; }

.article-body h2 {
  position: relative;
  margin: 38px 0 14px;
  padding-left: 14px;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.45;
}

.article-body h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 2px;
  background: var(--red);
}

.article-body > p,
.article-body > h2,
.article-body > ol,
.article-body > .article-tip {
  max-width: 760px;
}

.article-body p {
  margin: 0 0 16px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.95;
}

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

.article-tip {
  margin: 24px 0 0;
  padding: 16px 20px;
  border-left: 3px solid var(--red);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.85;
}

.param-table {
  width: 100%;
  max-width: 900px;
  margin: 4px 0 20px;
  border-collapse: collapse;
  font-size: 14px;
}

.param-table caption {
  text-align: left;
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.param-table th,
.param-table td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.param-table th {
  background: var(--surface);
  font-weight: 700;
  white-space: nowrap;
}

.param-table td { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.steps-list {
  counter-reset: step;
  margin: 0 0 18px;
}

.steps-list li {
  position: relative;
  padding: 2px 0 12px 38px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.9;
}

.steps-list li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}

/* -------------------------------------------------------- 详情：侧栏目录 */
.toc {
  position: sticky;
  top: 24px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.toc-title {
  font-size: 15px;
  font-weight: 800;
}

.toc-toggle {
  display: none;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: 12px;
  cursor: pointer;
}

.toc ol { counter-reset: toc; }

.toc li { counter-increment: toc; }

.toc a {
  display: block;
  padding: 7px 0 7px 24px;
  position: relative;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.6;
  border-bottom: 1px dashed transparent;
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.toc a:hover { color: var(--red); }
.toc a.is-active { color: var(--red); font-weight: 600; }

.toc-foot {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-strong);
}

.toc-foot a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
}

/* -------------------------------------------------------- 详情：相关条 */
.related {
  margin-top: 6px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.related h2 {
  margin-bottom: 16px;
  font-size: 19px;
  font-weight: 800;
}

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

.related-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  transition: border-color .18s ease;
}

.related-card:hover { border-color: var(--red); }

.related-card img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.related-card span {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--ink);
}

.related-back {
  display: inline-flex;
  margin-top: 18px;
  color: var(--red);
  font-size: 13.5px;
  font-weight: 600;
}

/* ------------------------------------------------------------ 响应式收口 */
@media (max-width: 1180px) {
  .site-nav { gap: 16px; font-size: 14px; }
  .brand-tag { display: none; }
  .list-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .article-wrap { grid-template-columns: minmax(0, 1fr) 270px; gap: 36px; }
}

@media (max-width: 980px) {
  .wrap { padding: 0 24px; }
  .site-header { height: auto; }
  .header-inner { height: auto; min-height: 60px; flex-wrap: wrap; gap: 4px 16px; padding: 8px 0 6px; }
  .site-nav {
    position: static;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    margin: 0;
    padding: 0 0 4px;
    background: transparent;
    border: 0;
    box-shadow: none;
    gap: 0 16px;
  }
  .site-nav a { padding: 4px 0; border-bottom: 0; font-size: 13.5px; }
  .site-nav a[aria-current="page"]::after { display: none; }
  .page-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; }
  .article-wrap { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .toc { position: static; }
  .toc-toggle { display: inline-block; }
  .toc.is-collapsed ol,
  .toc.is-collapsed .toc-foot { display: none; }
  .list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-description { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-top { flex-direction: column; gap: 22px; }
  .footer-nav { margin-left: 0; }
  .footer-bottom { flex-direction: column; gap: 10px; }
  .footer-copy { margin-left: 0; }
}

@media (max-width: 620px) {
  .wrap { padding: 0 18px; }
  .page-hero h1 { font-size: 28px; }
  .article-head h1 { font-size: 25px; }
  .article-body h2 { font-size: 20px; }
  .article-body p,
  .steps-list li { font-size: 15px; }
  .section-title { font-size: 21px; }
  .page-hero-stats { flex-wrap: wrap; gap: 16px; }
  .list-grid { grid-template-columns: minmax(0, 1fr); }
  .related-grid { grid-template-columns: minmax(0, 1fr); }
  .filter-toolbar { position: static; }
  .filter-sort { margin-left: 0; width: 100%; }
  .filter-sort select { flex: 1; }
  .param-table { font-size: 13px; }
  .param-table th, .param-table td { padding: 8px; }
}

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

/* 分页 */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; font-size: 13px; color: var(--muted); }
.pager a, .pager .current { min-width: 30px; padding: 3px 9px; text-align: center; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--paper); }
.pager a:hover { border-color: var(--red); color: var(--red); }
.pager .current { background: var(--red); border-color: var(--red); color: #fff; }
/* 无目录时的单栏详情 */
.article-wrap--single { grid-template-columns: minmax(0, 1fr); }

/* 详情正文配图 */
.article-figure { margin: 20px 0; }
.article-figure img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); }
/* 无图占位 */
.related-card .thumb-ph { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--radius-sm); background: var(--surface); font-size: 24px; flex-shrink: 0; }

/* 无数据库图时的占位（主题图为消防题素材，不用于宠物站） */
.list-card .thumb .thumb-ph { display: grid; place-items: center; width: 100%; height: 100%; font-size: 44px; background: var(--surface); }
.article-figure .figure-ph { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; font-size: 64px; background: var(--surface); border-radius: var(--radius); }
