/* 绵竹市慈善会 - 柏龄鸟信息管理系统 手机端主题 */

:root {
  --brand: #C8161D;
  --brand-dark: #A11217;
  --gold: #D4AF37;
  --bg: #FAFAF7;
  --card-bg: #FFFFFF;
  --text: #333333;
  --text-2: #666666;
  --text-3: #999999;
  --line: #EEEEEE;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-img: 8px;
  --tab-h: 56px;
  --pad: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; padding: 0; margin: 0; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; }

.container { max-width: 480px; margin: 0 auto; background: var(--bg); min-height: 100vh; position: relative; }
@media (min-width: 768px) { .container { box-shadow: 0 0 20px rgba(0,0,0,0.05); } }

/* 顶部 Header */
.site-header {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 12px var(--pad);
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.site-header .site-brand {
  display: inline-flex; align-items: center;
  text-decoration: none;
}
.site-header .site-name {
  font-size: 17px; font-weight: 600; color: var(--text);
  letter-spacing: 0.5px;
}

/* 轮播 */
.hero-swiper { width: 100%; position: relative; }
.hero-swiper .swiper-slide { position: relative; aspect-ratio: 16/9; overflow: hidden; background: #000; }
.hero-swiper .swiper-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-swiper .slide-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 12px 14px 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
  color: #fff; font-size: 14px; line-height: 1.4;
}
.hero-swiper .swiper-pagination-bullet { background: #fff; opacity: 0.6; }
.hero-swiper .swiper-pagination-bullet-active { background: var(--brand); opacity: 1; }

/* 四宫格快捷入口 */
/* ───────── 默认样式：≤4 项时为 2 列大卡片 ───────── */
.quick-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 14px var(--pad);
  background: #fff; border-bottom: 1px solid var(--line);
}
.quick-grid a {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 12px;
  background: var(--bg); border-radius: var(--radius-card);
  min-height: 64px;
  text-decoration: none;
}
.quick-grid .qi-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.quick-grid .qi-icon svg { width: 22px; height: 22px; }
.quick-grid .qi-icon img { width: 100%; height: 100%; object-fit: cover; }
.quick-grid .qi-icon.qi-icon-img { background: transparent; }
.quick-grid .qi-text {
  font-size: 15px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}

/* 渐变颜色循环（最多兜底 9 种，足够 9 宫格） */
.quick-grid a:nth-child(2) .qi-icon  { background: linear-gradient(135deg, #D4AF37, #B8951F); }
.quick-grid a:nth-child(3) .qi-icon  { background: linear-gradient(135deg, #E57373, #C8161D); }
.quick-grid a:nth-child(4) .qi-icon  { background: linear-gradient(135deg, #7AA876, #5C8A58); }
.quick-grid a:nth-child(5) .qi-icon  { background: linear-gradient(135deg, #5BA3D9, #2E7BB8); }
.quick-grid a:nth-child(6) .qi-icon  { background: linear-gradient(135deg, #BB7CD8, #8A4FC1); }
.quick-grid a:nth-child(7) .qi-icon  { background: linear-gradient(135deg, #FFA94D, #E67E22); }
.quick-grid a:nth-child(8) .qi-icon  { background: linear-gradient(135deg, #4ECDC4, #2BAEA5); }
.quick-grid a:nth-child(9) .qi-icon  { background: linear-gradient(135deg, #FF6B9D, #E91E63); }
.quick-grid a:nth-child(n+10) .qi-icon { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }
/* 上传了图片的栏目，去掉渐变背景 */
.quick-grid a .qi-icon.qi-icon-img,
.quick-grid.grid-3col a .qi-icon.qi-icon-img { background: transparent; }

/* ───────── 切换样式：≥5 项时变 3 列九宫格（图标在上、文字在下） ───────── */
.quick-grid.grid-3col {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 6px;
  padding: 14px var(--pad);
}
.quick-grid.grid-3col a {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 4px;
  min-height: 88px;
  background: transparent;
}
.quick-grid.grid-3col .qi-icon { width: 46px; height: 46px; }
.quick-grid.grid-3col .qi-icon svg { width: 24px; height: 24px; }
.quick-grid.grid-3col .qi-text {
  font-size: 13px; line-height: 1.3;
  text-align: center;
  max-width: 100%;
}

/* 区块 */
.section { margin-top: 10px; background: #fff; padding: 14px var(--pad); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title {
  font-size: 18px; font-weight: 600; color: var(--text);
  padding-left: 10px; position: relative;
}
.section-title::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px;
  background: var(--brand); border-radius: 2px;
}
.section-more { font-size: 13px; color: var(--text-3); }

/* 卡片列表 */
.card-list { display: flex; flex-direction: column; gap: 12px; }
.card-item {
  display: flex; gap: 12px;
  padding: 10px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}
.card-item .c-thumb {
  width: 110px; height: 80px; flex-shrink: 0;
  border-radius: var(--radius-img); overflow: hidden; background: #f5f5f5;
}
.card-item .c-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-item .c-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.card-item .c-title {
  font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-item .c-desc {
  font-size: 13px; color: var(--text-2); line-height: 1.5; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-item .c-meta { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* 人物卡 */
.person-list { display: flex; flex-direction: column; gap: 12px; }
.person-item {
  display: flex; gap: 12px; padding: 12px;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-card); box-shadow: var(--shadow);
}
.person-item .p-avatar {
  width: 70px; height: 70px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0; border: 2px solid var(--gold);
}
.person-item .p-body { flex: 1; min-width: 0; }
.person-item .p-name { font-size: 16px; font-weight: 600; color: var(--text); }
.person-item .p-story {
  font-size: 13px; color: var(--text-2); line-height: 1.5; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* 页脚 */
.site-footer {
  padding: 20px var(--pad) 30px;
  text-align: center; font-size: 12px; color: var(--text-3);
  background: #fff; border-top: 1px solid var(--line); margin-top: 10px;
}
.site-footer a { color: var(--text-2); }
.site-footer p { margin: 4px 0; }

/* 底部 Tab */
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: #fff;
  border-top: 1px solid var(--line);
}
.tab-bar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-3); font-size: 11px;
  min-height: 44px; min-width: 0;
}
.tab-bar a span {
  max-width: 100%; padding: 0 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tab-bar a svg { width: 22px; height: 22px; }
.tab-bar a.active { color: var(--brand); }
.tab-bar .tab-ico { display: inline-flex; align-items: center; justify-content: center; }
.tab-bar .tab-ico svg { width: 22px; height: 22px; }
.tab-bar .tab-ico.tab-ico-img img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }

/* 抽屉 */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 110;
  opacity: 0; visibility: hidden; transition: 0.2s;
}
.drawer-mask.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 120;
  background: #fff; border-radius: 16px 16px 0 0;
  padding: 10px 0 calc(12px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.2s;
}
.drawer.open { transform: translateY(0); }
.drawer-handle { width: 36px; height: 4px; background: var(--line); border-radius: 2px; margin: 6px auto 12px; }
.drawer h4 { text-align: center; font-size: 15px; margin-bottom: 8px; color: var(--text-2); font-weight: 500; }
.drawer ul li { border-top: 1px solid var(--line); }
.drawer ul li a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--pad); font-size: 16px; color: var(--text);
  min-height: 48px;
}
.drawer ul li a::after { content: '›'; color: var(--text-3); font-size: 20px; }
.drawer .drawer-close {
  display: block; text-align: center; margin: 8px var(--pad) 0;
  padding: 12px; background: var(--bg); border-radius: var(--radius-btn);
  font-size: 15px; color: var(--text-2);
}

/* 子栏目横向滚动 */
.sort-nav {
  display: flex; gap: 6px; padding: 10px var(--pad);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: #fff; border-bottom: 1px solid var(--line);
}
.sort-nav::-webkit-scrollbar { display: none; }
.sort-nav a {
  flex-shrink: 0; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 20px;
  font-size: 14px; color: var(--text-2); background: var(--bg);
}
.sort-nav a.cur { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 面包屑 */
.breadcrumb {
  padding: 8px var(--pad); font-size: 12px; color: var(--text-3);
  background: #fff;
}
.breadcrumb a { color: var(--text-2); }

/* 分页 */
.pagination {
  display: flex; justify-content: center; gap: 6px;
  padding: 20px var(--pad); flex-wrap: wrap;
}
.pagination a, .pagination span {
  min-width: 44px; height: 44px; line-height: 42px; padding: 0 10px;
  text-align: center; border-radius: var(--radius-btn);
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  font-size: 14px;
}
.pagination .pagination_current {
  background: var(--brand); color: #fff; border-color: var(--brand);
}

/* 详情页 */
.detail-header {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; gap: 10px;
  padding: 10px var(--pad);
  background: #fff; border-bottom: 1px solid var(--line);
}
.detail-back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text); font-size: 22px;
}
.detail-title-bar {
  font-size: 16px; font-weight: 500; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.article {
  background: #fff; padding: 18px var(--pad);
}
.article h1.a-title {
  font-size: 22px; font-weight: 700; line-height: 1.4; color: var(--text);
  margin-bottom: 10px;
}
.article .a-meta {
  font-size: 12px; color: var(--text-3);
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.article .a-meta span { margin-right: 14px; }
.article .a-body {
  font-size: 16px; line-height: 1.8; color: var(--text);
}
.article .a-body p { margin: 0 0 14px; }
.article .a-body img { max-width: 100%; height: auto; border-radius: var(--radius-img); margin: 10px 0; }
.article .a-body h1, .article .a-body h2, .article .a-body h3 { margin: 20px 0 10px; }

.article-nav {
  padding: 16px var(--pad);
  background: #fff; margin-top: 10px;
  border-top: 1px solid var(--line);
}
.article-nav p { margin: 6px 0; font-size: 14px; color: var(--text-2); }
.article-nav p a { color: var(--text); }
.article-nav p strong { color: var(--brand); margin-right: 6px; }
.share-tip {
  text-align: center; padding: 16px; font-size: 13px; color: var(--text-3);
}

/* 搜索 */
.search-bar { padding: 14px var(--pad); background: #fff; }
.search-bar form { display: flex; gap: 8px; }
.search-bar input[type=text] {
  flex: 1; height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius-btn);
  font-size: 15px; background: var(--bg);
}
.search-bar button {
  height: 44px; padding: 0 20px;
  background: var(--brand); color: #fff; border: 0;
  border-radius: var(--radius-btn); font-size: 15px;
}

/* 空态 */
.empty-tip {
  text-align: center; padding: 40px var(--pad); color: var(--text-3); font-size: 14px;
}

/* 单页 */
.single-body {
  background: #fff; padding: 18px var(--pad);
  font-size: 16px; line-height: 1.8; color: var(--text);
}
.single-body img { max-width: 100%; height: auto; border-radius: var(--radius-img); margin: 10px 0; }

/* 成为会员 */
.join-hero {
  margin: 0;
  padding: 28px var(--pad) 24px;
  background: linear-gradient(135deg, #C8161D 0%, #A11217 62%, #D4AF37 100%);
  color: #fff;
}
.join-badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 999px;
  font-size: 12px;
  margin-bottom: 12px;
}
.join-hero h1 {
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
}
.join-hero p {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255,255,255,0.9);
}
.join-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}
.join-stats span {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  border-radius: var(--radius-btn);
  background: rgba(255,255,255,0.14);
  font-size: 12px;
  line-height: 1.35;
}
.join-section {
  margin-top: 10px;
  padding: 18px var(--pad);
  background: #fff;
}
.join-section h2 {
  font-size: 19px;
  line-height: 1.4;
  color: var(--text);
}
.join-section-sub {
  margin: 4px 0 14px;
  font-size: 13px;
  color: var(--text-3);
}
.join-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.join-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.join-form label span {
  font-size: 14px;
  color: var(--text-2);
}
.join-form input,
.join-form select,
.join-form textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  outline: none;
}
.join-form textarea {
  min-height: 104px;
  resize: vertical;
}
.join-form input:focus,
.join-form select:focus,
.join-form textarea:focus {
  border-color: var(--brand);
  background: #fff;
}
.join-form button {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}
.join-guide ul {
  margin: 12px 0 0;
  padding: 0;
}
.join-guide li {
  position: relative;
  padding: 10px 0 10px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--text-2);
}
.join-guide li:last-child { border-bottom: 0; }
.join-guide li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 19px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}
