/* ===== 福鼎白茶知识站 · 样式 ===== */
/* version 20260903a */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #2c2a26;
  --muted: #8a857c;
  --line: #ece8e0;
  --accent: #6f8f73;
  --accent-soft: #eef2ec;
  --shadow: 0 6px 22px rgba(60, 55, 45, 0.08);
  --shadow-hover: 0 12px 34px rgba(60, 55, 45, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1180px;
  /* 分类配色 */
  --c-intro: #7fae8b;
  --c-types: #5fa8a0;
  --c-craft: #d9a05b;
  --c-age: #b08a5e;
  --c-brew: #6aa0b8;
  --c-benefit: #cf8a8a;
  --c-select: #9a8ac0;
  --c-culture: #c2a878;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== 顶部 ===== */
.site-header {
  text-align: center;
  padding: 56px 20px 28px;
}
.site-header .brand {
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
}
.site-header h1 {
  font-size: clamp(26px, 4vw, 40px);
  margin: 10px 0 8px;
  letter-spacing: 2px;
  font-weight: 700;
}
.site-header p {
  color: var(--muted);
  margin: 0 auto;
  max-width: 540px;
  font-size: 15px;
}
.site-header .subtitle {
  margin-top: 6px;
  line-height: 1.95;
}
.site-header .subtitle .support {
  font-size: 12px;
  letter-spacing: 1px;
  color: #bcb6a8;
}

/* ===== 工具栏（筛选 + 搜索）===== */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 244, 239, 0.86);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.toolbar .container {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.search {
  flex: 1 1 200px;
  min-width: 160px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
}
.search input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  color: var(--ink);
}
.search-ico {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--muted);
}
.search input::placeholder {
  color: #b4afa4;
  opacity: 1;
}
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* 排序栏 */
.sortbar {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.sort {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 9px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.sort:hover { border-color: var(--accent); color: var(--accent); }
.sort.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* 收藏入口（与排序按钮统一 UI） */
.fav-sort .ico-star path { fill: none; }
.fav-sort.active .ico-star path { fill: currentColor; }
.fav-sort .fav-count {
  display: inline-block;
  min-width: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  text-align: center;
}
.fav-sort.active .fav-count { background: rgba(255, 255, 255, 0.25); color: #fff; }

/* 扁平图标 */
.ico {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  flex: none;
}
.sort .ico { margin-right: 4px; }
.card .body .meta .views .ico,
.detail .date .ico { margin-right: 3px; }

/* ===== 瀑布流 ===== */
.waterfall {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 18px;
  row-gap: 18px;
  align-items: start;
  padding: 26px 0 60px;
}
.card {
  display: block;
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  animation: rise 0.5s ease both;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.card .cover {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  position: relative;
  background: #ebe9e3;
}
.card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card .cover .cat-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.82);
  color: #4a463f;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.card .body { padding: 14px 16px 18px; }
.card .body h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}
.card .body p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .body .meta {
  margin-top: 10px;
  font-size: 12px;
  color: #b3ada1;
}
.card .body .meta .views { margin-left: 8px; }

/* 收藏视图：固定两列网格（保证一行两条，彻底覆盖瀑布流列数，避免单列占满） */
.waterfall.fav-view {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-count: initial;
  column-gap: initial;
  gap: 18px;
  align-items: start;
  padding: 26px 0 60px;
}
.waterfall.fav-view .card { margin-bottom: 0; break-inside: auto; }

/* ===== 笔记详情 ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(40, 38, 33, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.detail {
  background: var(--surface);
  width: 100%;
  max-width: 720px;
  max-height: 86vh;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.28s ease;
}
.overlay.open .detail { transform: none; }
.detail .hero {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  position: relative;
  flex: none;
  background: #ebe9e3;
}
.detail .hero img { width: 100%; height: 100%; object-fit: cover; }
.detail .close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: #4a463f;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}
.detail .scroll {
  padding: 26px 32px 34px;
  overflow-y: auto;
}
.detail h2 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: 1px;
}
.detail .tags { margin-bottom: 16px; }
.detail .tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  margin: 0 6px 6px 0;
}
.detail .content { font-size: 17px; line-height: 1.85; }
.detail .content p { margin: 0 0 16px; }
.detail .content h3 { margin: 22px 0 8px; font-size: 18px; }
.detail .content ul { padding-left: 20px; margin: 0 0 14px; }
.detail .content li { margin-bottom: 6px; }
.detail .date { color: #b3ada1; font-size: 13px; margin-top: 18px; }

/* 收藏按钮（详情页） */
.favBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.favBtn:hover { border-color: var(--accent); color: var(--accent); }
.favBtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.favBtn .ico-star { width: 15px; height: 15px; }
.favBtn .ico-star path { fill: none; }
.favBtn.on .ico-star path { fill: currentColor; }

/* 收藏菜单（筛选栏 chip） */
.fav-chip .ico { margin-right: 4px; vertical-align: -2px; }
.fav-chip .ico-star path { fill: none; }
.fav-chip.active .ico-star path { fill: currentColor; }
.fav-chip .fav-count {
  display: inline-block;
  min-width: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  text-align: center;
}
.fav-chip.active .fav-count { background: rgba(255, 255, 255, 0.25); color: #fff; }

/* ===== 后台入口按钮（已移除） ===== */

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}

/* ===== 响应式 ===== */
@media (max-width: 1200px) { .waterfall { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px)  { .waterfall { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  {
  .waterfall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card .cover { font-size: 40px; }
  .site-header { padding: 38px 16px 20px; }
  .sortbar { margin-left: 0; width: 100%; justify-content: flex-start; margin-top: 4px; }
  /* 移动端：详情改为底部抽屉 */
  .overlay { padding: 0; align-items: flex-end; }
  .detail {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
  }
  .overlay.open .detail { transform: none; }
  .detail .hero { height: 150px; }
  .detail .scroll { padding: 22px 20px 30px; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .detail, .overlay { animation: none !important; transition: none !important; }
}

/* ===== 底部备案信息 ===== */
.site-footer {
  margin-top: 10px;
  padding: 22px 0 30px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.site-footer .beian {
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.3px;
  text-decoration: none;
  transition: color 0.18s ease;
}
.site-footer .beian:hover { color: var(--accent); }
.site-footer .beian-police {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.site-footer .beian-shield {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: -2px;
}
