/* components.css — 三页共用组件（首页 / 分类页 / 详情页） */

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

.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;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-small);
  text-decoration: none;
  transition: top .18s ease;
}
.skip-link:focus { top: 12px; }

/* ---------- 容器 ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- 头部 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg-header);
}
.header-inner {
  display: flex;
  align-items: center;
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}
.brand-mark { display: inline-flex; color: var(--accent); }
.brand-name {
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: .4px;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: auto;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  font-size: 15px;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  position: relative;
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--ink-2);
  text-decoration: none;
  padding: 26px 0;
  transition: color .18s ease;
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  transition: width .18s ease;
}
.main-nav a:hover,
.main-nav a:focus-visible { color: var(--accent); }
.main-nav a:hover::after,
.main-nav a:focus-visible::after { width: 22px; }
.main-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.main-nav a[aria-current="page"]::after { width: 28px; }

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: var(--ink);
  transition: transform .18s ease, opacity .18s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.btn svg { flex: 0 0 auto; }
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover,
.btn-primary:focus-visible { background: var(--accent-dark); }
.btn-ghost {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent-dark);
}
.btn-ghost:hover,
.btn-ghost:focus-visible { background: rgba(120, 72, 35, .08); }
.btn-sm { height: 42px; padding: 0 20px; font-size: 14px; }

/* ---------- 章节标题 ---------- */
.sec-head {
  display: flex;
  align-items: baseline;
  gap: 26px;
}
.sec-title {
  position: relative;
  margin: 0;
  padding-left: 16px;
  font-family: var(--font-serif);
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
}
.sec-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: .18em;
  width: 4px;
  height: 1.05em;
  border-radius: 2px;
  background: var(--accent);
}
.sec-intro {
  margin: 0;
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--muted);
}
.sec-link {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
}
.sec-link:hover,
.sec-link:focus-visible { text-decoration: underline; }

/* ---------- 卡片图片 ---------- */
.thumb {
  position: relative;
  overflow: hidden;
  background: var(--card-2);
  border-radius: var(--radius-img);
}
.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
a:hover > .thumb img,
a:focus-visible > .thumb img { transform: scale(1.03); }

/* ---------- 焦点可见 ---------- */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* ---------- 页脚 ---------- */
.site-footer {
  background: var(--footer);
  color: var(--footer-ink);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px 36px;
  padding: 38px 0 30px;
}
.footer-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 180px;
  min-width: 150px;
  font-size: 13px;
}
.footer-col--brand { flex: 1 1 240px; }
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--footer-ink);
  text-decoration: none;
}
.footer-brand .brand-mark { color: var(--footer-ink); }
.footer-brand .brand-name { font-size: 22px; }
.footer-tagline {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--footer-muted);
}
.footer-label {
  color: var(--footer-ink);
  font-size: 12px;
  letter-spacing: .5px;
}
.footer-col a {
  color: var(--footer-ink);
  text-decoration: none;
}
.footer-col a:hover,
.footer-col a:focus-visible { text-decoration: underline; }
.footer-col--about p {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--footer-muted);
}
.footer-copy { white-space: normal; overflow-wrap: anywhere; }
.footer-copy a { color: var(--footer-muted); }

/* ---------- 响应式：头部 / 页脚 ---------- */
@media (max-width: 1180px) {
  .main-nav { gap: 20px; }
  .brand-name { font-size: 22px; }
}
@media (max-width: 980px) {
  .header-inner { height: auto; min-height: var(--header-h); flex-wrap: wrap; row-gap: 0; padding-top: 8px; padding-bottom: 8px; }
  .main-nav {
    flex: 1 1 100%;
    margin-left: 0;
    padding-bottom: 4px;
    border-top: 1px solid var(--line-soft);
  }
  .main-nav a { padding: 12px 0; }
  .main-nav a::after { bottom: 6px; }
  .footer-inner { gap: 22px 28px; }
  .footer-col { flex: 1 1 150px; }
  .footer-col--brand { flex: 1 1 100%; }
}
@media (max-width: 560px) {
  .brand-name { font-size: 20px; }
  .footer-inner { gap: 18px; }
  .footer-col { flex: 1 1 120px; }
}
