/* =========================================================
   CardCMS - Z-BlogPHP 主题
   顶部搜索框 + 多级分类导航 + 双排图片卡片
   ========================================================= */

:root {
  --accent: #ff6b1a;
  --ink: #16181c;
  --ink-2: #55595f;
  --ink-3: #9aa0a6;
  --bg: #f4f5f7;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(17, 20, 26, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ============ 页头：搜索框 ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 99;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}
.header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 14px;
}
.logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
  color: var(--ink);
}
.searchbar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f2f4;
  border-radius: 999px;
  padding: 2px 3px 2px 12px;
  transition: box-shadow 0.2s;
}
.searchbar:focus-within { box-shadow: 0 0 0 2px rgba(255, 107, 26, 0.35); }
.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
  padding: 6px 0;
}
.searchbar input::placeholder { color: var(--ink-3); }
.searchbar button {
  border: 0;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  padding: 7px 16px;
  transition: opacity 0.2s;
}
.searchbar button:active { opacity: 0.75; }

/* ============ 页头：城市选择 + 搜索 ============ */
.city-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  flex: 0 0 auto;
  padding: 2px 0;
}
.city-btn b { font-size: 15px; font-weight: 800; max-width: 5.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.city-btn svg { flex: 0 0 auto; color: var(--ink); }
.tri {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #b9bdc3;
  display: inline-block;
  margin-left: 2px;
  transition: transform 0.2s;
}
.city-btn.open .tri, .f-tab.open .tri { transform: rotate(180deg); }
.header-top { gap: 10px; }
.searchbar { min-width: 0; }

/* ============ 筛选行（区域 / 清除） ============ */
.filter-row {
  display: flex;
  align-items: center;
  gap: 26px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 4px 16px 9px;
}
.f-tab {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 2px 0;
}
.f-tab.open { color: var(--accent); }
.f-tab.open .tri { border-top-color: var(--accent); }
.f-clear {
  margin-left: auto;
  font-size: 14px;
  color: var(--ink-3);
  background: #f1f2f4;
  border-radius: 999px;
  padding: 4px 13px;
}
.f-clear:hover { color: var(--ink-2); }

/* ============ 城市选择底部弹层 ============ */
.city-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 20, 26, 0.45);
  z-index: 198;
}
.city-mask.show { display: block; }
.city-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 199;
  background: #fff;
  border-radius: 16px 16px 0 0;
  transform: translateY(105%);
  transition: transform 0.25s ease;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
}
.city-sheet.show { transform: translateY(0); }
.cs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f2;
  font-size: 16px;
}
.cs-head b { font-weight: 700; }
.cs-cancel { border: 0; background: transparent; color: var(--ink-3); font-size: 15px; padding: 0; }
.cs-ok { color: var(--accent); font-weight: 700; font-size: 15px; cursor: pointer; }
.cs-body {
  position: relative;
  display: flex;
  height: 238px;
  overflow: hidden;
}
/* 双列滚轮：上下滑动选择，中间一行 = 选中项 */
.cs-wheel {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cs-wheel::-webkit-scrollbar { display: none; }
.cs-wheel ul {
  list-style: none;
  margin: 0;
  padding: 95px 0;
}
.cs-wheel li {
  height: 48px;
  line-height: 48px;
  text-align: center;
  font-size: 15px;
  color: #b9bec6;
  padding: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  scroll-snap-align: center;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
}
.cs-wheel li.on {
  color: var(--ink);
  font-weight: 700;
  transform: scale(1.05);
}
.cs-band {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: 48px;
  transform: translateY(-50%);
  border-top: 1px solid #eceef1;
  border-bottom: 1px solid #eceef1;
  pointer-events: none;
}
.cs-body::before, .cs-body::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 95px;
  pointer-events: none;
  z-index: 2;
}
.cs-body::before { top: 0; background: linear-gradient(to bottom, #fff 10%, rgba(255,255,255,0)); }
.cs-body::after { bottom: 0; background: linear-gradient(to top, #fff 10%, rgba(255,255,255,0)); }

/* ============ 页头：筛选式分类导航（点箭头展开通栏面板 · 竖排可滚动 · 选中✓） ============ */
.catnav {
  position: relative;
  border-bottom: 1px solid #f0f0f2;
  background: #fff;
}
.cat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 9px 14px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cat-row::-webkit-scrollbar { display: none; }

.cat-node { display: flex; align-items: center; flex: 0 0 auto; }
.cat-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 15px;
  border-radius: 999px;
  background: #f1f2f4;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.cat-pill:hover { background: #e7e8ea; color: var(--ink); }
.cat-pill.home { color: var(--ink); }
.cat-pill.home.cur { background: var(--accent); color: #fff; }
.cat-node.cur > .cat-pill { color: var(--accent); background: #fff3ea; }
.cat-node.open > .cat-pill { background: var(--accent); color: #fff; }

.cat-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: -5px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  transition: color 0.15s;
}
.cat-node.open > .cat-arrow { color: var(--accent); }
.cat-arrow svg { display: block; transition: transform 0.2s; }
.cat-node.open > .cat-arrow svg { transform: rotate(180deg); }

/* 通栏下拉面板 */
.cat-panel {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: #fff;
  box-shadow: 0 14px 28px rgba(17, 20, 26, 0.12);
  z-index: 100;
}
.cat-panel.open { display: block; }
.cat-panel-list {
  max-width: 1080px;
  margin: 0 auto;
  max-height: 58vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 14px 10px;
}
.cat-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #f2f3f5;
}
.cat-opt:last-child { border-bottom: 0; }
.cat-opt > a {
  flex: 1;
  padding: 13px 2px;
  font-size: 15px;
  color: var(--ink);
}
.cat-opt.sel > a { color: var(--accent); font-weight: 700; }
.cat-opt .ck { color: var(--accent); font-style: normal; font-weight: 700; font-size: 15px; }
.opt-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #c1c4c9;
}
.opt-arrow svg { transition: transform 0.2s; }
.opt-arrow.up svg { transform: rotate(180deg); }
/* 三级：缩进手风琴 */
.cat-sub { display: none; }
.cat-sub.show { display: block; }
.cat-opt3 {
  display: block;
  padding: 11px 2px 11px 18px;
  font-size: 14px;
  color: var(--ink-2);
  border-bottom: 1px dashed #f2f3f5;
}
.cat-opt3:last-child { border-bottom: 0; }
.cat-opt3.sel { color: var(--accent); font-weight: 700; }

/* ============ 主体：双排卡片 ============ */
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px;
  min-height: 55vh;
}
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 10px;
}
/* 整张卡片：图片与下方文字/标签包进同一个白色圆角容器，成为一个整体区域 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(17, 20, 26, 0.06);
  padding-bottom: 10px;
}
.card-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  border-radius: 0;   /* 四角由 .card 统一裁切，图片底部直角与文字区连成一体 */
  overflow: hidden;
  background: #ececef;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.card:hover .card-media img { transform: scale(1.05); }
.badge-cat {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(17, 20, 26, 0.62);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 7px;
  backdrop-filter: blur(4px);
}
/* 左上角：精选（红色椭圆标签，白字，字号与下方标签一致；紧凑贴合两个字） */
.badge-pick {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  background: #e8342a;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25;
  padding: 2px 7px;
  border-radius: 999px;
  box-shadow: 0 2px 5px rgba(232, 52, 42, 0.28);
}
.badge-top {
  position: absolute;
  top: 12px;
  left: -34px;
  transform: rotate(-45deg);
  background: linear-gradient(90deg, #ffa02e, #ff540f);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 5px 40px;
  box-shadow: 0 2px 8px rgba(255, 84, 15, 0.4);
}
.card-title {
  margin: 8px 2px 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 第一行：正文开头一行文字（单行省略） */
.card-excerpt {
  margin: 5px 2px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 标签上方一行：文章第三行信息（橙色椭圆）+ 固定「已认证」；字号与下方标签一致 */
.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 5px;
  margin: 4px 2px 0;
}
.card-meta-tag {
  flex: 0 1 auto;
  max-width: 100%;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta-orange { background: #f97316; }
.card-meta-verified { background: #16a34a; }
/* 标签行：白色/浅底 + 红绿蓝紫彩字标签，字间空格；字号略小于第一行、不加粗，全部换行显示完 */
/* 行距收紧：标签上下更贴合，整体更紧凑精致 */
.card-chips {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 2px 5px;
  margin: 4px 2px 0;
}
.card-chip {
  flex: 0 1 auto;
  max-width: 100%;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  white-space: normal;
  word-break: break-all;
}
/* 文字区统一左右内边距，与图片同处一张卡片内，不再像散落的独立块 */
.card-title, .card-excerpt, .card-meta, .card-chips {
  margin-left: 10px;
  margin-right: 10px;
}
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--accent); }

/* ============ 分页 ============ */
.pagebar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 12px 0 6px;
  /* 常驻显示：不被卡片浮层遮挡；底部留白收紧，避免翻页条下方大片空白 */
  position: relative;
  z-index: 2;
  clear: both;
  margin-bottom: 8px;
}
.pg-btn {
  min-width: 26px;
  text-align: center;
  padding: 5px 9px;
  background: #fff;
  border: 1px solid #e7e8ea;
  border-radius: 7px;
  /* 字号 13px，按钮收紧后手机端仍可在一行内放下 */
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-2);
  transition: all 0.15s;
}
.pg-btn:hover { border-color: var(--ink); color: var(--ink); }
.pg-btn.now {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 700;
}
/* 第一页 / 最后一页时置灰占位，翻页条不消失 */
.pg-btn.disabled {
  color: var(--ink-3);
  background: #f5f6f8;
  border-color: #eceef1;
  cursor: default;
  opacity: 0.7;
}
.pg-btn.disabled:hover { border-color: #eceef1; color: var(--ink-3); }

/* ============ 空状态 ============ */
.empty { text-align: center; padding: 90px 0; color: var(--ink-3); }
.empty-ico { font-size: 44px; margin-bottom: 10px; }
.empty-title { font-size: 34px; color: var(--ink-2); }
.back-home {
  display: inline-block;
  margin-top: 16px;
  background: var(--ink);
  color: #fff;
  padding: 10px 26px;
  border-radius: 999px;
  font-weight: 600;
}

/* ============ 文章页 ============ */
.post {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 20px;
}
.post-title { font-size: 22px; line-height: 1.5; }
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--ink-3);
  font-size: 13px;
  margin: 12px 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f0f0f2;
}
.pm-cat { color: var(--accent); font-weight: 600; }
.post-content { font-size: 16px; line-height: 1.9; color: #2a2d31; word-break: break-word; }
.post-content img { border-radius: 10px; height: auto; }
.post-content p { margin: 0.6em 0; }
/* 文章正文第二行：彩色方块标签（红绿蓝紫浅彩底 + 深彩字），字号与正文一致不变 */
.post-chips {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px 8px;
  margin: 8px 0;
}
.post-chip {
  font-size: inherit;      /* 跟随正文 16px，不放大也不缩小 */
  font-weight: 400;
  line-height: 1.5;
  padding: 2px 10px;
  border-radius: 6px;      /* 方块圆角，非胶囊 */
  white-space: nowrap;
}
.post-content h1, .post-content h2, .post-content h3 { margin: 1em 0 0.5em; }
.post-content blockquote {
  margin: 0.8em 0;
  padding: 8px 14px;
  border-left: 4px solid var(--accent);
  background: #faf7f4;
  border-radius: 0 8px 8px 0;
  color: var(--ink-2);
}
.post-content pre {
  background: #f6f7f9;
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  font-size: 14px;
}

/* ============ 评论区 ============ */
.comments {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 14px;
}
.cmt-title { font-size: 17px; margin-bottom: 14px; }
.cmt-title em { font-style: normal; color: var(--accent); }
.cmt-list li.cmt {
  padding: 12px 0;
  border-bottom: 1px dashed #f0f0f2;
}
.cmt-head b { font-size: 14px; }
.cmt-body { margin-top: 6px; color: var(--ink-2); font-size: 15px; }
.cmt-empty { padding: 26px 0; text-align: center; color: var(--ink-3); }
.cmt-form { margin-top: 16px; }
.cmt-form input, .cmt-form textarea {
  width: 100%;
  border: 1px solid #e7e8ea;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  background: #fafbfc;
  transition: border-color 0.15s;
}
.cmt-form input:focus, .cmt-form textarea:focus { border-color: var(--ink); }
.cmt-row { display: flex; gap: 10px; }
.cmt-row input { flex: 1; }
.cmt-form .cmt-email { margin-top: 10px; }
.cmt-form textarea { margin-top: 10px; resize: vertical; }
.cmt-form button {
  margin-top: 12px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border-radius: 999px;
  padding: 10px 30px;
}
.cmt-form button:active { opacity: 0.8; }

/* ============ 页脚 ============ */
.site-footer {
  background: #fff;
  border-top: 1px solid #f0f0f2;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  padding: 28px 14px;
  margin-top: 22px;
}
.f-name { color: var(--ink-2); font-weight: 600; margin-bottom: 4px; }
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--accent); }

/* ============ 响应式：平板 3 列 / 桌面 4 列 ============ */
@media (min-width: 700px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 14px; }
}
@media (min-width: 1000px) {
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 16px; }
  .logo { font-size: 20px; }
}

/* 手机端：分类子级横滑条更紧凑 */
@media (max-width: 700px) {
  .cat-pill { padding: 6px 13px; font-size: 14px; }
}

/* ============ 文章正文页（极简：仅标题+正文） ============ */
.single-page { background: #fff; }
.single-wrap { max-width: 760px; margin: 0 auto; padding: 18px 16px 40px; }
.single-wrap .post-title { margin: 6px 0 18px; font-size: 24px; line-height: 1.35; color: var(--ink); text-align: center; }
.single-wrap .back-home { margin-top: 36px; }
.back-home a { color: #fff; font-size: 14px; }
.back-home a:active { color: var(--accent, #ff5f00); }

/* 文章页：顶部左上角「返回」（蓝色文字 + 箭头，无背景框） */
.back-top {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #2f6bff;
  font-size: 16px;
  line-height: 1.4;
  padding: 2px 0;
  margin: 0 0 10px;
}
.back-top .bt-arrow { font-size: 24px; line-height: 1; margin-top: -2px; }
.back-top:active { opacity: 0.65; }

/* 文章页右下角悬浮按钮组：回到顶部（蓝，左） + 复制编号（红，右） */
.fab-group {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 50;
}
.fab-top {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: #3b7bf0;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(59, 123, 240, 0.4);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.9);
  transition: opacity 0.22s, transform 0.22s;
}
.fab-top svg { display: block; }
.fab-top.show { opacity: 1; pointer-events: auto; transform: none; }
.fab-copy {
  width: 46px;             /* 再缩一档，与蓝色回到顶部按钮同尺寸 */
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: #e8342a;
  color: #fff;
  font-family: inherit;
  line-height: 1.02;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  box-shadow: 0 3px 10px rgba(232, 52, 42, 0.42);
  cursor: pointer;
  transition: transform 0.15s;
}
.fab-copy:active { transform: scale(0.94); }
.fab-copy .fab-l1 { font-size: 8px; opacity: 0.92; }
.fab-copy .fab-l2 {
  font-size: 11px;
  font-weight: 700;
  color: #ffd84a;          /* 编号数字：黄色，其余文字仍为白色 */
  max-width: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fab-copy .fab-l3 { font-size: 8px; opacity: 0.95; }

/* 复制结果提示 */
.cc-toast {
  position: fixed;
  left: 50%;
  bottom: 116px;
  transform: translateX(-50%) translateY(8px);
  background: rgba(17, 20, 26, 0.85);
  color: #fff;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  white-space: nowrap;
}
.cc-toast.show { opacity: 1; transform: translateX(-50%); }
