/* ============================================
   moments.css — 朋友圈风格的出行晒图列表
   ============================================ */

/* === 基础变量 === */
:root {
  --bg-primary: #f5f5f5;
  --bg-card: #ffffff;
  --text-primary: #333333;
  --text-secondary: #888888;
  --text-link: #576b95;
  --border-color: #e8e8e8;
  --accent: #ff6b35;
  --accent-light: #fff0eb;
  --tag-bg: #f0f7ff;
  --tag-text: #3b7dd8;
  --avatar-size: 42px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06);
  --max-width: 680px;
}

/* === Reset === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--text-link);
  text-decoration: none;
}

/* === Header === */
.site-header {
  background: linear-gradient(135deg, #ff6b35, #ff8f5e);
  color: white;
  padding: 24px 16px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(255,107,53,0.3);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: white;
  display: block;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 14px;
  opacity: 0.9;
}

/* === 主内容区 === */
.moments-feed {
  padding-bottom: 40px;
}

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

.page-title {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  padding: 20px 0 12px;
  color: var(--text-primary);
}

/* === 标签筛选栏 === */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.tag-btn {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 13px;
  background: #eee;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tag-btn:hover {
  background: #ddd;
}

.tag-btn.active {
  background: var(--accent);
  color: white;
}

/* === 朋友圈卡片 === */
.moments-list {
  display: flex;
  flex-direction: column;
}

.moment {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
  transition: opacity 0.3s, transform 0.3s;
}

.moment.hidden {
  display: none;
}

/* 头部：头像 + 昵称 + 时间 */
.moment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #eee;
}

.moment-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.nickname {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.moment-time {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 文案内容 */
.moment-text {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  margin-bottom: 10px;
  word-break: break-word;
  white-space: pre-wrap;
}

/* === 九宫格图片 === */
.img-grid {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  max-width: 100%;
}

/* 单张图片 */
.grid-single {
  grid-template-columns: 1fr;
  max-width: 280px;
}

.grid-single .grid-item img {
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* 两张 */
.grid-two {
  grid-template-columns: repeat(2, 1fr);
  max-width: 300px;
}

/* 四张 2x2 */
.grid-four {
  grid-template-columns: repeat(2, 1fr);
  max-width: 300px;
}

/* 其他 (3, 5, 6, 7, 8, 9) 三列 */
.grid-multi {
  grid-template-columns: repeat(3, 1fr);
}

.grid-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.2s;
}

.grid-item img:hover {
  opacity: 0.9;
}

/* === 目的地标签 === */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 12px;
  font-size: 12px;
  white-space: nowrap;
}

/* === 加载更多 === */
.load-more-wrap {
  text-align: center;
  padding: 24px 0;
}

.load-more-btn {
  display: inline-block;
  padding: 10px 32px;
  border: 1px solid var(--accent);
  border-radius: 20px;
  background: white;
  color: var(--accent);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.load-more-btn:hover {
  background: var(--accent);
  color: white;
}

.load-more-loading {
  padding: 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #ddd;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.load-more-end {
  color: #ccc;
  font-size: 14px;
}

/* === SEO分页导航 === */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 24px 0;
  flex-wrap: wrap;
}

.pagination a, .pagination span {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-primary);
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination .current {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.pagination .disabled {
  color: #ccc;
  cursor: not-allowed;
}

.pagination-seo {
  text-align: center;
  padding: 12px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* === Footer === */
.site-footer {
  background: #333;
  color: #aaa;
  padding: 20px 16px;
  text-align: center;
  margin-top: 20px;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.footer-links a {
  color: #ccc;
  font-size: 14px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: white;
}

.divider {
  color: #555;
}

.copyright {
  font-size: 12px;
  color: #666;
}

/* === Lightbox 图片查看 === */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 95vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.3);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-nav:hover {
  background: rgba(255,255,255,0.25);
}

.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

.lightbox-counter {
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  margin-top: 12px;
}

/* === 评论区 === */
.comments-section {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.comment-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 3px;
  opacity: 0.6;
}

.comments-list {
  flex: 1;
  min-width: 0;
}

.comment-item {
  display: flex;
  gap: 6px;
  padding: 4px 0;
  align-items: flex-start;
}

.comment-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
}

.comment-body {
  min-width: 0;
  font-size: 13px;
  line-height: 1.5;
}

.comment-nickname {
  color: var(--text-link);
  font-weight: 500;
  margin-right: 4px;
  white-space: nowrap;
}

.comment-text {
  color: var(--text-primary);
  word-break: break-word;
}

.comment-expand {
  font-size: 12px;
  color: var(--text-link);
  cursor: pointer;
  padding: 4px 0;
  text-align: center;
}

.comment-expand:hover {
  text-decoration: underline;
}

.comment-extra {
  border-top: 1px dashed #eee;
  margin-top: 4px;
  padding-top: 4px;
}

/* === 回到顶部 === */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255,107,53,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99;
  transition: opacity 0.3s, transform 0.3s;
}

.back-to-top.visible {
  display: flex;
}

/* === 响应式 === */
@media (min-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .moment {
    padding: 16px;
  }

  .avatar {
    --avatar-size: 46px;
  }
}

@media (min-width: 768px) {
  .site-header {
    padding: 28px 16px;
  }

  .logo {
    font-size: 24px;
  }

  .moment {
    padding: 18px;
    margin-bottom: 14px;
  }

  .grid-single {
    max-width: 320px;
  }

  .grid-two {
    max-width: 340px;
  }

  .grid-four {
    max-width: 340px;
  }
}
