/* ===============================================================
   公共组件：站点头部、按钮、标签、清单抽屉、页脚
   =============================================================== */

/* ------------------------------------------------------------- header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(232, 246, 255, .96);
  border-bottom: 1px solid rgba(34, 97, 156, .14);
  backdrop-filter: blur(8px);
}

.site-header.is-scrolled { box-shadow: 0 6px 18px rgba(18, 58, 92, .1); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 56px;
  padding-top: 4px;
  padding-bottom: 4px;
}

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

.brand-mark { width: 26px; height: 26px; color: var(--brand); }

.brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
  white-space: nowrap;
}

.site-logo-text {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}

.nav-item { position: relative; }

.site-nav a {
  display: inline-block;
  padding: 6px 7px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: color .14s ease, background .14s ease;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 40;
  min-width: 168px;
  max-height: 360px;
  overflow-y: auto;
  margin: 4px 0 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.nav-item:hover .dropdown-menu { display: block; }

.dropdown-menu a {
  display: block;
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.dropdown-menu a:hover { background: rgba(34, 97, 156, .07); color: var(--brand); }

.site-nav a:hover { color: var(--brand); background: rgba(34, 97, 156, .07); }

.site-nav a[aria-current="page"] {
  color: var(--brand);
  font-weight: 700;
  background: rgba(34, 97, 156, .1);
}

.header-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}

.icon-btn:hover { border-color: var(--brand-soft); background: var(--surface-soft); }

.icon-btn svg { width: 16px; height: 16px; }

.cart-count {
  min-width: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.nav-toggle span { display: block; height: 2px; background: var(--brand); border-radius: 2px; }

/* ------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(252, 137, 42, .28);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(252, 137, 42, .34); }

.btn-ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--brand);
}

.btn-ghost:hover { border-color: var(--brand-soft); background: var(--surface-soft); }

.btn-sm { padding: 8px 14px; font-size: 12px; }

/* ------------------------------------------------------------- 标签 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(34, 97, 156, .1);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}

.hero-tags li {
  padding: 4px 11px;
  border: 1px solid rgba(34, 97, 156, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  color: var(--brand);
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: 11px;
  font-weight: 600;
}

/* --------------------------------------------------- 分区标题（左列） */
.section-heading h2 { font-size: 24px; line-height: 1.3; }
.section-heading p { margin-top: 8px; font-size: var(--fs-xs); color: var(--ink-mute); line-height: 1.7; }

/* ------------------------------------------------------------- 抽屉 */
.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.cart-drawer[open] { display: block; }

.cart-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 38, 60, .42);
  border: 0;
  cursor: pointer;
}

.cart-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(360px, 92vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  box-shadow: -12px 0 32px rgba(18, 58, 92, .18);
}

.cart-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.cart-panel header h2 { font-size: 16px; }

.cart-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.cart-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 18px; }

.cart-empty { font-size: 13px; color: var(--ink-mute); line-height: 1.8; }

.cart-list { display: grid; gap: 10px; }

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.cart-item strong { font-size: 13px; color: var(--ink-strong); }

.cart-item button {
  align-self: start;
  border: 0;
  background: none;
  color: var(--ink-mute);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.cart-item .cart-meta { font-size: 11px; color: var(--ink-mute); }

.cart-panel footer {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.7;
}

/* ------------------------------------------------------------- 页脚 */
/* 页脚样式由 style.css 末尾的 v3 结构负责（.footer-navband + .footer-row）。
   这里只保留深色底的兜底声明，避免内页漏引 style.css 时白底白字。 */
.site-footer { background: var(--deep); color: var(--ink-invert-soft); }

/* ------------------------------------------------------------- 响应式 */
@media (max-width: 1180px) {
  .site-nav { gap: 0; }
  .site-nav a { padding: 6px 5px; font-size: 12px; }
}

@media (max-width: 960px) {
  .site-nav {
    gap: 2px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .site-nav a { padding: 6px 6px; font-size: 13px; }
  .dropdown-menu {
    position: static;
    display: none;
    max-height: none;
    overflow: visible;
    margin: 2px 0 4px;
    box-shadow: none;
  }
  .nav-item:hover .dropdown-menu { display: block; }
}

@media (max-width: 640px) {
  .header-inner { gap: 10px; flex-wrap: wrap; }
  .brand-name,
  .site-logo-text { font-size: 15px; }
  .site-nav { flex: 1 1 100%; order: 3; }
  .dropdown-menu {
    position: static;
    min-width: 0;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: none;
  }
}

/* ===============================================================
   内页新增组件（分类页 / 详情页）—— 只用 tokens.css 的语义变量
   =============================================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------- 分类页 */
.list-section { padding: 22px 0 4px; }

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

.result-count { margin-left: 0; }

/* 卡片右下角的「加入清单」圆钮（与首页 .product-add 同一手法，尺寸略小） */
.card-body { position: relative; }

.card-add {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--brand);
  cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}

.card-add svg { width: 14px; height: 14px; }

.card-add:hover { background: var(--brand); border-color: var(--brand); color: var(--ink-invert); }

.card-add.is-added,
.card-add[aria-pressed="true"] { background: var(--bg-deep); border-color: var(--brand-soft); color: var(--ink-strong); }

.card-meta { padding-right: 36px; }

/* ------------------------------------------------------------- 详情页 */
.article-intro {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--brand-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  line-height: 1.85;
}

.aside-note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-mute);
}

@media (max-width: 640px) {
  .list-section { padding: 18px 0 2px; }
  .card-add { right: 10px; bottom: 10px; }
}

.list-note {
  margin: 4px 0 0;
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  line-height: 1.7;
}

.sort-group label { cursor: pointer; }

/* [hidden] 必须压过 .card / .empty-state 的 display —— 否则筛选后卡片仍然可见 */
.card[hidden],
.card-grid [hidden] { display: none; }

/* 分类锚点索引（分类页内，提供 8 个分类锚点） */
.cat-index { padding: 4px 0 26px; }

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

.cat-index-grid a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.cat-index-grid a:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.cat-index-grid a[aria-current="page"] { border-color: var(--brand-soft); background: var(--surface-soft); }
.cat-index-grid span { font-size: 14px; font-weight: 800; color: var(--ink-strong); }
.cat-index-grid em { font-style: normal; font-size: var(--fs-xs); color: var(--ink-mute); line-height: 1.6; }

@media (max-width: 960px) {
  .cat-index-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .cat-index-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}
