/* ============================================================
   梅州慢游记 · 前台样式表（纯前端演示版 v2）
   结构：首页（3 大模块）+ 模块列表页（每页5条 + 搜索 + 分页）
   风格：精美文旅宣传风 · 米白纸色 + 深茶绿 + 衬线标题
   ============================================================ */

/* ---------- 全局变量（设计令牌） ---------- */
:root {
  --color-bg: #f7f4ee;            /* 页面米白底色 */
  --color-text: #2f2a26;          /* 主文字色 */
  --color-text-light: #8a8177;    /* 次要文字色 */
  --color-accent: #3a5a40;        /* 深茶绿（主强调色） */
  --color-card: #ffffff;          /* 卡片底色 */
  --radius: 14px;                 /* 卡片圆角 */
  --shadow: 0 2px 12px rgba(58, 46, 34, 0.06);
  --shadow-hover: 0 12px 32px rgba(58, 46, 34, 0.14);
  --font-title: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-body: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* 全局图片防拖拽/防选中：禁止拖到桌面或新标签页另存（配合 JS dragstart 拦截） */
img {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

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

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  /* 极淡纹理，增加纸质感 */
  background-image: radial-gradient(rgba(58, 90, 64, 0.035) 1px, transparent 1px);
  background-size: 22px 22px;
}

/* ============================================================
   顶部品牌区（首页 / 通用）
   ============================================================ */
.hero {
  text-align: center;
  padding: 64px 20px 44px;
}

/* 印章式「慢」字徽标 */
.hero-seal {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 30px;
  color: #fff;
  background: var(--color-accent);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(58, 90, 64, 0.28);
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.hero-title {
  font-family: var(--font-title);
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 700;
  letter-spacing: 6px;
}

/* 副标题（品牌名，如「梅州慢游记」） */
.hero-sub {
  margin-top: 10px;
  font-family: var(--font-title);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 8px;
  color: var(--color-accent);
}

.hero-slogan {
  margin-top: 12px;
  font-size: 15px;
  color: var(--color-text-light);
  letter-spacing: 2px;
}

/* 装饰分隔线 */
.hero-divider {
  width: 56px;
  height: 2px;
  margin: 20px auto 0;
  background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
}

/* ============================================================
   首页 · 三大模块入口卡片
   ============================================================ */
.module-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px 64px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* 模块大卡片：竖幅海报感，整卡可点击进入模块 */
.module-card {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 18px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.module-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

/* 封面图铺满 + 悬停缓慢放大 */
.module-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.module-card:hover img { transform: scale(1.06); }

/* 模块未上传封面时的占位背景（茶绿渐变） */
.module-ph {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #6b8f71 0%, #3a5a40 60%, #2b4530 100%);
}

/* 底部渐变遮罩，保证文字清晰可读 */
.module-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 16, 10, 0) 42%, rgba(20, 16, 10, 0.5) 80%, rgba(20, 16, 10, 0.72) 100%);
}

/* 模块文字区 */
.module-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 22px 20px;
  color: #fff;
}

.module-name {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 5px;
}

.module-desc {
  margin-top: 5px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 1px;
}

/* 「探索」入口提示 */
.module-enter {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  letter-spacing: 2px;
  color: #f0e6c8;
  border-bottom: 1px solid rgba(240, 230, 200, 0.55);
  padding-bottom: 2px;
}

/* ============================================================
   模块列表页 · 顶部（返回 + 标题 + 搜索框）
   ============================================================ */
.module-header {
  position: relative;              /* 作为返回按钮的定位基准 */
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 20px 0;
  text-align: center;
}

/* 返回首页按钮：悬浮在模块页左上角 */
.back-link {
  position: absolute;
  left: 20px;
  top: 30px;
  font-size: 13px;
  color: var(--color-accent);
  text-decoration: none;
  letter-spacing: 1px;
}
.back-link:hover { text-decoration: underline; }

.module-title {
  font-family: var(--font-title);
  font-size: clamp(26px, 4vw, 34px);
  letter-spacing: 6px;
}

.module-sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--color-text-light);
  letter-spacing: 1px;
}

/* ---------- 搜索框（模块页内） ---------- */
.search-box {
  position: relative;
  max-width: 380px;
  margin: 22px auto 0;
}

/* 放大镜图标（纯 CSS 绘制） */
.search-box::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-text-light);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}
.search-box::after {
  content: "";
  position: absolute;
  left: 27px;
  top: calc(50% + 5px);
  width: 2px;
  height: 8px;
  background: var(--color-text-light);
  transform: rotate(-45deg);
  pointer-events: none;
  z-index: 1;
}

.search-box input {
  width: 100%;
  padding: 11px 40px 11px 44px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--color-text);
  background: #fff;
  border: 1px solid #e3dccf;
  border-radius: 999px;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.search-box input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(58, 90, 64, 0.12);
}
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* 清空按钮：仅输入内容时显示 */
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: #eee7db;
  color: #8a8177;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}
.search-clear.show { display: flex; }
.search-clear:hover { background: #e3dccf; }

/* ============================================================
   模块列表页 · 帖子卡片网格
   ============================================================ */
.post-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 6px;
  /* flex 换行布局：卡片同宽、顶对齐（高度随图片比例） */
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
}

/* 搜索结果容器与普通列表共用同一种布局 */
.search-results {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
}
.search-results[hidden] { display: none; }

/* 寻味梅州（5 列）：容器加宽，卡片更占满电脑屏幕（上限 1600px） */
.post-grid.grid-cols-5,
.search-results.grid-cols-5 {
  max-width: 1600px;
}

/* 帖子卡片：整卡为 <a>，点击新标签页跳小红书 */
.post-card {
  display: block;
  width: calc((100% - 40px) / 3);   /* 兜底：默认 3 列（即使页面缺 grid-cols 类也不会竖排） */
  background: var(--color-card);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* 每行卡片数随模块（桌面/大屏）：寻味梅州 5 列 / 慢游·镜头 3 列 */
.grid-cols-3 .post-card { width: calc((100% - 40px) / 3); }   /* 3 列：2 个 20px 间距 */
.grid-cols-5 .post-card { width: calc((100% - 80px) / 5); }   /* 5 列：4 个 20px 间距 */

/* 点击弹出截图的卡片（非链接），鼠标显示可点 */
.post-card[data-popup] { cursor: pointer; }
.post-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

/* 图片容器：不固定比例，按图片自身比例显示（不裁剪），保留骨架屏 */
.post-media {
  position: relative;
  overflow: hidden;
  background: linear-gradient(110deg, #ede8de 8%, #f6f2e9 18%, #ede8de 33%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

/* 图片：宽度铺满、高度随原图比例自适应，绝不裁剪 */
.post-media img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.45s ease;
}
.post-media img.loaded { opacity: 1; }

.post-card:hover .post-media img.loaded { transform: scale(1.05); }

/* 帖子标题：最多两行 */
.post-title {
  padding: 12px 14px 14px;
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 空状态（无帖子 / 搜索无结果） */
.empty-tip {
  text-align: center;
  padding: 44px 20px 60px;
  font-size: 14px;
  color: var(--color-text-light);
  letter-spacing: 1px;
}
.empty-tip[hidden] { display: none; }
/* 空提示内容为空时完全不占位（模块有帖子时） */
.empty-tip:empty { display: none; }

/* ============================================================
   分页导航
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 24px 20px 56px;
}

.page-link {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 14px;
  color: var(--color-text);
  background: #fff;
  border: 1px solid #e3dccf;
  text-decoration: none;
  transition: all 0.2s ease;
}
.page-link:hover { border-color: var(--color-accent); color: var(--color-accent); }
.page-link.active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.page-link.disabled { opacity: 0.45; pointer-events: none; }

/* ============================================================
   截图弹窗（Lightbox）：点击卡片后放大查看截图
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.lightbox.show { visibility: visible; opacity: 1; }

/* 半透明遮罩 */
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 10, 0.8);
}

/* 弹窗内容：竖排（图片在上、提示在下），整体居中 */
.lightbox-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.lightbox-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 94vw;
}
.lightbox-img {
  max-width: 92vw;
  max-height: 80vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  object-fit: contain;
  opacity: 0;                 /* 加载完成前隐藏，避免空白/旧图闪现 */
  transition: opacity 0.3s ease;
}
.lightbox-img:not(.loading) { opacity: 1; }

/* 大图下方的小红书内容提示 */
.lightbox-hint {
  text-align: center;
  color: #f7f4ee;
  font-size: 13px;
  letter-spacing: 2px;
  line-height: 1.9;
  padding: 8px 24px;
  border: 1px solid rgba(247, 244, 238, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  white-space: nowrap;
}
.lightbox-hint p { margin: 0; }

/* 右上角关闭按钮 */
.lightbox-close {
  position: absolute;
  top: -18px;
  right: -18px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: var(--color-text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: background 0.2s ease;
}
.lightbox-close:hover { background: #eee7db; }

/* 弹窗打开时锁定背景滚动 */
body.no-scroll { overflow: hidden; }

/* ============================================================
   页脚（版权信息区）
   ============================================================ */
.footer {
  margin-top: 56px;
  padding: 34px 20px 42px;
  text-align: center;
  color: var(--color-text-light);
  letter-spacing: 1px;
  border-top: 1px solid rgba(58, 90, 64, 0.14);
  background: rgba(255, 255, 255, 0.45);
}
.footer-brand {
  font-family: var(--font-title);
  font-size: 20px;
  letter-spacing: 5px;
  color: var(--color-accent);
  margin-bottom: 6px;
}
.footer-tagline {
  font-size: 13px;
  color: var(--color-text);
  margin-bottom: 12px;
}
.footer-line {
  font-size: 13px;
  margin-bottom: 10px;
}
.footer-meta {
  font-size: 12px;
}
.footer-copy {
  font-size: 12px;
  margin-top: 8px;
  opacity: 0.8;
}
/* 备案号（链接至工信部备案系统） */
.footer-beian {
  margin-top: 8px;
  font-size: 12px;
}
.footer-beian a {
  color: var(--color-text-light);
  text-decoration: none;
  transition: color 0.2s ease;
}
.footer-beian a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}
/* 公安备案图标（徽章） */
.footer-beian img.beian-icon {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: 6px;
  border-radius: 2px;
}

/* ============================================================
   404 错误页
   ============================================================ */
.nf-box {
  text-align: center;
  padding: 110px 20px 140px;
}
.nf-title {
  margin-top: 22px;
  font-family: var(--font-title);
  font-size: 68px;
  font-weight: 700;
  letter-spacing: 12px;
  color: var(--color-accent);
}
.nf-desc {
  margin-top: 10px;
  font-size: 18px;
  letter-spacing: 3px;
}
.nf-tip {
  margin-top: 10px;
  font-size: 14px;
  color: var(--color-text-light);
  letter-spacing: 2px;
}
.nf-btn {
  display: inline-block;
  margin-top: 30px;
  padding: 12px 36px;
  background: var(--color-accent);
  color: #fff;
  font-size: 15px;
  letter-spacing: 3px;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.nf-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* ============================================================
   响应式
   ============================================================ */
/* 桌面/大屏（>960px）：寻味 5 列、慢游·镜头 3 列（见上方 grid-cols-5 / grid-cols-3 规则） */

/* 平板横屏 / 小屏（≤960px）：寻味 5 列 → 3 列，慢游·镜头 3 列 → 2 列 */
@media (max-width: 960px) {
  .module-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .module-name { font-size: 20px; letter-spacing: 3px; }
  .module-info { padding: 12px 14px 14px; }
  .post-grid, .search-results { gap: 16px; }
  .grid-cols-3 .post-card { width: calc((100% - 16px) / 2); }
  .grid-cols-5 .post-card { width: calc((100% - 32px) / 3); }
}

/* 平板竖屏（≤768px）：寻味、慢游·镜头 均 2 列横排 */
@media (max-width: 768px) {
  .post-grid, .search-results { gap: 14px; }
  .grid-cols-3 .post-card, .grid-cols-5 .post-card { width: calc((100% - 14px) / 2); }
}

/* 手机（≤560px）：2 列横排，间距收窄 */
@media (max-width: 560px) {
  .hero { padding: 48px 16px 30px; }
  /* 手机端三大模块改为竖排大卡，展示更大气 */
  .module-grid { grid-template-columns: 1fr; max-width: 420px; }
  .post-grid, .search-results { gap: 12px; }
  .grid-cols-3 .post-card, .grid-cols-5 .post-card { width: calc((100% - 12px) / 2); }
}
