/* ============================================================
   绿生活官网 · 设计系统
   色彩：草木绿 / 深园林绿 / 雨水蓝 / 暖黄 / 米白纸 / 正文深灰
   原则：移动端优先、动效克制、尊重 prefers-reduced-motion
   ============================================================ */

:root {
  --c-green: #16A56A;
  --c-green-deep: #174D39;
  --c-blue: #77BDE8;
  --c-yellow: #F7C948;
  --c-paper: #F3EFE7;
  --c-paper-soft: #FAF7F0;
  --c-ink: #252A27;
  --c-ink-soft: #4A544E;
  --c-line: #E2DCCF;

  --maxw: 1100px;
  --gap: 1.25rem;
  --radius: 8px;

  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
  color: var(--c-ink);
  background-color: var(--c-paper);
  /* 极轻的再生纸纹理，仅用渐变，不加载图片 */
  background-image:
    radial-gradient(rgba(23, 77, 57, 0.025) 1px, transparent 1px);
  background-size: 22px 22px;
}

h1, h2, h3, h4 { line-height: 1.3; color: var(--c-green-deep); font-weight: 700; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin: 0 0 0.6em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin: 0 0 0.8em; }
h3 { font-size: 1.2rem; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
a { color: var(--c-green); }
img { max-width: 100%; height: auto; display: block; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* 跳过链接（无障碍） */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--c-green-deep);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ---------------- 顶部导航 ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 240, 0.95);
  border-bottom: 1px solid var(--c-line);
  backdrop-filter: blur(6px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--c-green-deep);
  text-decoration: none;
  letter-spacing: 0.02em;
  max-width: 70%;
}
.brand:hover { color: var(--c-green); }
.brand__logo {
  height: 64px;
  width: auto;
  display: block;
  flex: none;
}
.brand__name {
  white-space: normal;
  line-height: 1.25;
}

/* 移动端适当缩小 Logo 与标题，避免挤压导航 */
@media (max-width: 480px) {
  .brand { font-size: 1rem; gap: 0.5rem; max-width: 68%; }
  .brand__logo { height: 48px; }
}

.site-nav { display: flex; align-items: center; }
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--c-green);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  position: relative;
  flex: none;
  z-index: 70;
}
.nav-toggle::before,
.nav-toggle::after,
.nav-toggle__bar {
  content: '';
  position: absolute;
  left: 50%;
  width: 22px;
  height: 2px;
  background: var(--c-green-deep);
  border-radius: 1px;
  transform: translateX(-50%);
  transition: top 0.25s ease, transform 0.25s ease, opacity 0.15s ease;
}
.nav-toggle::before { top: 14px; }
.nav-toggle__bar { top: 21px; }
.nav-toggle::after { top: 28px; }

/* 展开时：上/下两条线汇聚到中心并旋转成 ✕，中线淡出 */
.site-nav.is-open .nav-toggle::before {
  top: 21px;
  transform: translateX(-50%) rotate(45deg);
}
.site-nav.is-open .nav-toggle__bar { opacity: 0; }
.site-nav.is-open .nav-toggle::after {
  top: 21px;
  transform: translateX(-50%) rotate(-45deg);
}
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
  gap: 0.25rem;
}
.nav-list a {
  display: block;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--c-ink-soft);
  font-size: 0.98rem;
}
.nav-list a:hover { background: rgba(22, 165, 106, 0.08); color: var(--c-green-deep); }
.nav-list a.is-active { color: var(--c-green); font-weight: 600; }

/* 移动端展开态：全屏白色菜单（无遮罩、不压暗页面） */
.site-nav.is-open .nav-list {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  background: #fff;
  padding: 1.25rem 1.5rem 2rem;
  z-index: 80;
  gap: 0.4rem;
  overflow-y: auto;
}
.site-nav__overlay { display: none; }
body:has(.site-nav.is-open) { overflow: hidden; }

/* 全屏菜单头部（品牌名 + 关闭按钮），仅移动端展开时显示 */
.nav-list__head { display: none; }
@media (max-width: 767px) {
  .site-nav.is-open .nav-list__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 1rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--c-line);
  }
}
.nav-list__brand {
  font-weight: 700;
  color: var(--c-green-deep);
  font-size: 1.05rem;
}
.nav-list__close {
  border: none;
  background: transparent;
  color: var(--c-ink-soft);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
}
.nav-list__close:hover { color: var(--c-green-deep); background: rgba(22, 165, 106, 0.08); }

/* ---------------- 通用区块 ---------------- */
.section { padding: 3rem 0; }
.section--alt { background: var(--c-paper-soft); border-top: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); }
.section-title { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--c-green);
  font-weight: 600;
  margin: 0 0 0.5rem;
}
.lead { font-size: 1.1rem; color: var(--c-ink-soft); max-width: 60ch; }
.grid { display: grid; gap: var(--gap); }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }

/* ---------------- 卡片 ---------------- */
.card {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card h3 { margin-top: 0; }
.card--link { text-decoration: none; color: inherit; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card--link:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(23, 77, 57, 0.1); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn--primary { background: var(--c-green); color: #fff; }
.btn--primary:hover { background: var(--c-green-deep); }
.btn--accent { background: var(--c-yellow); color: var(--c-green-deep); }
.btn--accent:hover { filter: brightness(0.96); }
.btn--ghost { background: transparent; color: var(--c-green-deep); border-color: var(--c-green); }
.btn--ghost:hover { background: rgba(22, 165, 106, 0.08); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }

/* ---------------- 占位图（清楚标记，不生成假照片） ---------------- */
.ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  color: var(--c-ink-soft);
  background: var(--c-paper-soft);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.9rem;
  min-height: 160px;
}
.ph::before {
  content: "";
  display: block;
  width: 42px;
  height: 42px;
  background: url("assets/img/photo-placeholder.svg") no-repeat center / contain;
  opacity: 0.7;
}
.ph--hero { min-height: 260px; aspect-ratio: 16 / 10; }
.ph--hero::before { width: 56px; height: 56px; }
.ph--cover { min-height: 180px; }

/* ---------------- Hero ---------------- */
.hero { padding: 2.5rem 0 1rem; }
.hero-grid { display: grid; gap: 1.5rem; align-items: center; }
.hero h1 { margin-top: 0; }
.hero .lead { font-size: 1.15rem; }

/* ---------------- 信任条 ---------------- */
.trust {
  background: var(--c-green-deep);
  color: var(--c-paper);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.trust .item { flex: 1 1 200px; }
.trust .num { font-size: 1.5rem; font-weight: 700; color: var(--c-yellow); display: block; }
.trust p { margin: 0; color: var(--c-paper); }

/* ---------------- 社区故事卡 ---------------- */
.story-card { background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; }
.story-card__link { text-decoration: none; color: inherit; display: block; }
.story-card__media { border-radius: 0; border: none; border-bottom: 1px solid var(--c-line); min-height: 170px; }
.story-card__body { padding: 1rem 1.1rem 1.2rem; }
.story-card__title { margin: 0 0 0.4rem; font-size: 1.1rem; }
.story-card__digest { color: var(--c-ink-soft); font-size: 0.96rem; margin: 0 0 0.6rem; }
.story-card__meta { font-size: 0.82rem; color: var(--c-green); margin: 0; }

/* ---------------- 社区故事列表（横式布局 + 分页） ---------------- */
.story-list {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  overflow: hidden;
}
.story-row {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--c-line);
  transition: background 0.12s ease;
}
.story-row:last-child { border-bottom: none; }
.story-row:hover { background: var(--c-paper-soft); }
.story-row.is-hidden { display: none; }

.story-row__thumb {
  flex: none;
  width: 110px;
  height: 76px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--c-paper-soft);
  border: 1px solid var(--c-line);
}
.story-row__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.story-row__thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-ink-soft);
  font-size: 0.78rem;
}

.story-row__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.story-row__title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--c-ink);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
}
.story-row__title a {
  color: inherit;
  text-decoration: none;
}
.story-row__title a:hover { color: var(--c-green); text-decoration: underline; }
.story-row__date {
  flex: none;
  font-size: 0.78rem;
  color: var(--c-green);
  font-weight: 400;
}
.story-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  font-size: 0.95rem;
  color: var(--c-ink-soft);
  line-height: 1.5;
}
.story-row__digest {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.55;
}

.story-row__action { flex: none; }

/* 小按钮 */
.btn--small {
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
}

/* 分页 */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.pagination__btn,
.pagination__page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.6rem;
  border: 1px solid var(--c-line);
  background: #fff;
  color: var(--c-ink);
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.pagination__btn:hover:not(:disabled),
.pagination__page:hover:not(.is-active) {
  background: var(--c-paper-soft);
  border-color: var(--c-green);
  color: var(--c-green-deep);
}
.pagination__btn:disabled,
.pagination__page.is-active {
  cursor: default;
  border-color: var(--c-green);
  background: var(--c-green);
  color: #fff;
}
.pagination__btn:disabled {
  opacity: 0.55;
}
.pagination__pages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.pagination__info {
  font-size: 0.92rem;
  color: var(--c-ink-soft);
  margin-left: 0.5rem;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .story-row {
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.7rem 0.9rem;
  }
  .story-row__thumb { width: 84px; height: 60px; }
  .story-row__title { font-size: 1rem; line-height: 1.3; gap: 0.25rem 0.45rem; }
  .story-row__meta { gap: 0.25rem 0.5rem; }
  .story-row__date { font-size: 0.75rem; }
  .story-row__digest { -webkit-line-clamp: 2; }
  .story-row__action { align-self: center; }
  .pagination { gap: 0.4rem; }
  .pagination__info { width: 100%; text-align: center; margin-left: 0; margin-top: 0.25rem; }
}

/* ---------------- 微信跳转引导 ---------------- */
.wechat-bridge {
  margin-top: 1.25rem;
  padding: 0.9rem 1.1rem;
  background: rgba(22, 165, 106, 0.08);
  border: 1px solid rgba(22, 165, 106, 0.25);
  border-radius: 10px;
}
.wechat-bridge__text { margin: 0; font-size: 0.96rem; color: var(--c-ink-soft); line-height: 1.6; }
.wechat-bridge__link {
  color: var(--c-green-deep);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.wechat-bridge__link:hover { color: var(--c-green); }

/* ---------------- 文章详情（模板） ---------------- */
.article-head { padding: 2rem 0 1rem; }
.article-cover { width: 100%; height: auto; border-radius: var(--radius); margin: 0.5rem 0 1.25rem; }
.article-source { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--c-line); }
.story-card__media img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.article-meta { color: var(--c-green); font-size: 0.9rem; margin-bottom: 0.5rem; }
.article-body { max-width: 70ch; }
.article-body h2 { margin-top: 2rem; }

/* 防止微信正文横向溢出（手机端左右滑动页面不动） */
html, body { overflow-x: hidden; }
.article-body,
.article-body * {
  max-width: 100%;
}
.article-body * {
  max-width: 100% !important;
}
.article-body img {
  height: auto !important;
}
.article-body pre,
.article-body code {
  white-space: pre-wrap;
  word-break: break-all;
}
.article-body table {
  display: block;
  overflow-x: auto;
}
.article-back {
  display: inline-flex;
  align-items: center;
  margin-bottom: 1rem;
}
.article-back--bottom {
  margin-top: 2rem;
  margin-bottom: 1rem;
}
.article-body blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 4px solid var(--c-green);
  background: var(--c-paper-soft);
  color: var(--c-ink-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ---------------- 页脚（含 ICP/公安备案） ---------------- */
.site-footer { background: #1c4a6e; color: #fff; margin-top: 3rem; padding: 2.5rem 0 2rem; }
.footer-top { display: flex; flex-wrap: wrap; gap: 2rem; justify-content: space-between; }
.footer-name { font-weight: 700; font-size: 1.1rem; margin: 0 0 0.25rem; }
.footer-tag { margin: 0; opacity: 0.85; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.footer-nav a { color: #fff; text-decoration: none; }
.footer-nav a:hover { opacity: 0.8; text-decoration: underline; }

/* 备案信息区（ICP + 公安） */
.footer-filing {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.9rem;
  line-height: 1.9;
}
.footer-filing__copyright { margin: 0 0 0.35rem; opacity: 0.92; }
.footer-filing__line { margin: 0.15rem 0; }
.footer-filing__gongan { display: inline-flex; align-items: center; gap: 0.45rem; }
.footer-filing__icon { width: 20px; height: 20px; flex: none; display: inline-block; }
.footer-filing__link {
  color: inherit;
  text-decoration: none;
  opacity: 0.9;
  transition: opacity 0.15s ease;
}
.footer-filing__link:hover { opacity: 1; text-decoration: underline; }

/* ---------------- 404 ---------------- */
.notfound { text-align: center; padding: 5rem 0; }
.notfound .code { font-size: 4rem; color: var(--c-green); font-weight: 800; margin: 0; }

/* ---------------- 工具类 ---------------- */
.empty-note { color: var(--c-ink-soft); background: var(--c-paper-soft); border: 1px dashed var(--c-line); padding: 1rem 1.25rem; border-radius: var(--radius); }
.note-inline { font-size: 0.9rem; color: var(--c-ink-soft); }
.mt-0 { margin-top: 0; }

/* ---------------- 响应式 ---------------- */
@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .nav-list { display: flex; }
  .site-nav.is-open .nav-list { position: static; flex-direction: row; background: transparent; border: none; box-shadow: none; padding: 0; min-width: 0; width: auto; height: auto; max-width: none; overflow: visible; inset: auto; gap: 0.25rem; }
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .hero-grid { grid-template-columns: 1.1fr 0.9fr; }
  .section { padding: 4rem 0; }
}

@media (min-width: 1100px) {
  .container { padding: 0 1.5rem; }
}

/* ---------------- 动效与无障碍偏好 ---------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .card--link:hover { transform: none; }
}

:focus-visible { outline: 3px solid var(--c-blue); outline-offset: 2px; }
