/* ============================================================
   homepage.css — 首页
   全局暖黄底 + 蝴蝶动画 Hero + 克制排版
   ============================================================ */

:root {
  --hp-bg:       #f5f2eb;
  --hp-surface:  #ffffff;
  --hp-text:     #1a1a1a;
  --hp-subtle:   #5a5a5a;
  --hp-meta:     #8a8a8a;
  --hp-accent:   #2d5a3d;
  --hp-accent-subtle: #e8efe9;
  --hp-border:   #e4e6e2;
  --hp-border-light: #eff0ed;
  --hp-transition: 0.2s ease;
  --hp-transition-slow: 0.35s ease;
  --hp-radius: 4px;
}

/* 全局暖黄背景 */
body { background: var(--hp-bg); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  width: 100%;
  height: 92vh;
  min-height: 520px;
  overflow: hidden;
  background: transparent;
}

/* 蝴蝶 Three.js 容器 */
#butterfly-container {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 0; overflow: hidden;
  will-change: transform;
  pointer-events: none;            /* 容器不拦截点击 */
}
#butterfly-container canvas {
  display: block;
  position: absolute; top: 0; left: 0;
  pointer-events: none;            /* 不拦截滚动/点击，交互走 eventsEl */
}

/* 内容叠加层（浮于蝴蝶之上） */
.hero-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  justify-content: center; align-items: flex-start;
  height: 100%; max-width: 680px;
  margin: 0 auto; padding: 0 2rem;
  pointer-events: none;
}
.hero-content > * { pointer-events: auto; }

.hero-tag {
  font-family: 'Bungee Shade', cursive;
  font-size: 16px; font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--hp-accent); margin-bottom: 1.2rem;
  opacity: 0; animation: heroFadeIn 0.7s 0.1s ease forwards;
}
.hero-greeting {
  font-family: 'ZCOOL KuaiLe', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  font-weight: 400; line-height: 1.1;
  color: #111; margin-bottom: 0.8rem;
  letter-spacing: 0.04em;
  opacity: 0; animation: heroFadeIn 0.7s 0.25s ease forwards;
}
.hero-subtitle {
  font-family: 'ZCOOL KuaiLe', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 400; line-height: 1.5;
  color: #333; margin-bottom: 0.6rem; max-width: 520px;
  opacity: 0; animation: heroFadeIn 0.7s 0.4s ease forwards;
}
/* 花体英文 — 从左向右展开 */
.hero-love {
  font-family: 'Alex Brush', cursive;
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 400;
  color: var(--hp-accent);
  opacity: 0;
  margin-bottom: 1.8rem;
  letter-spacing: 0.01em;
  animation: loveReveal 1s 0.55s ease forwards;
  display: inline-block;
}
@keyframes loveReveal {
  from {
    opacity: 0;
    transform: translateX(-24px);
    clip-path: inset(0 100% 0 0);
  }
  to {
    opacity: 1;
    transform: translateX(0);
    clip-path: inset(0 0 0 0);
  }
}
.hero-cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.9rem; font-weight: 500;
  color: var(--hp-accent); text-decoration: none;
  padding-bottom: 2px; border-bottom: 1px solid transparent;
  transition: border-color 0.2s, gap 0.2s;
  cursor: pointer; background: none;
  border-top: none; border-left: none; border-right: none;
  opacity: 0; animation: heroFadeIn 0.7s 0.7s ease forwards;
}
.hero-cta:hover { border-bottom-color: var(--hp-accent); gap: 0.75rem; }
.hero-cta .arrow { display: inline-block; transition: transform 0.2s; }
.hero-cta:hover .arrow { transform: translateX(3px); }
.hero-time {
  font-size: 0.78rem; color: var(--hp-meta);
  margin-top: 1.5rem; display: flex; align-items: center; gap: 0.4rem;
  opacity: 0; animation: heroFadeIn 0.7s 0.75s ease forwards;
}
@keyframes heroFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   滚动提示（可点击）
   ============================================================ */
.scroll-hint {
  position: absolute; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%); z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  opacity: 0.65; cursor: pointer; user-select: none;
  will-change: opacity; transition: opacity 0.3s;
}
.scroll-hint:hover { opacity: 0.9; }
.scroll-hint-text {
  font-size: 12px; font-weight: 500; letter-spacing: 0.06em;
  color: var(--hp-meta);
}
.scroll-hint-arrow {
  font-size: 16px; color: var(--hp-meta);
  animation: arrowBob 1.6s ease-in-out infinite;
}
@keyframes arrowBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* ============================================================
   发布表单
   ============================================================ */
.post-form-panel {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
}
.post-form-panel.open {
  max-height: none;
  overflow: visible;
  opacity: 1;
  margin-top: 1.5rem;
}


/* 发布入口按钮（独立悬浮，脱离 hero） */
/* Flash 消息不劫持交互 */
.flash-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  pointer-events: none;
  max-width: 600px;
  width: auto;
  min-width: 320px;
}
.flash-container .alert {
  pointer-events: auto;
  margin-bottom: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  padding: 0.9rem 2.5rem 0.9rem 1.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.flash-container .alert .btn-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.post-toggle-bar {
  position: relative;
  z-index: 100;
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 2rem;
  pointer-events: auto;
}
.post-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-family: 'Bungee Shade', cursive;
  font-size: 1rem;
  font-weight: 400;
  color: var(--hp-accent);
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  z-index: 999;
  letter-spacing: 0.04em;
}
/* 下划线从左往右划入 */
.post-toggle-btn::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--hp-accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s ease;
}
.post-toggle-btn:hover::after {
  transform: scaleX(1);
}
.post-toggle-btn:hover {
  background: var(--hp-accent);
  color: #fff;
  border-radius: 4px;
  padding: 6px 14px;
}
.post-toggle-btn .arrow { transition: transform 0.2s; }
.post-toggle-btn:hover .arrow { transform: translateX(3px); }
.post-form-panel .card {
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius);
  background: rgba(255,255,255,0.9);
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.post-form-panel .card-header {
  background: #fafaf7;
  border-bottom: 1px solid var(--hp-border-light);
  font-size: 0.85rem; font-weight: 500; color: var(--hp-text);
}

/* ============================================================
   Feed 工具栏卡片
   ============================================================ */
.feed-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 14px 20px; margin-bottom: 1.5rem;
  flex-wrap: wrap;
  position: sticky; top: 72px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border: 1px solid #e8e4dd;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  z-index: 10;
}
.feed-tabs { display: flex; gap: 4px; }
.feed-tab {
  padding: 5px 14px; font-size: 0.84rem; font-weight: 500;
  color: var(--hp-meta); text-decoration: none;
  border-radius: 6px; border: none; background: transparent;
  cursor: pointer; font-family: inherit;
  transition: all 0.2s;
}
.feed-tab:hover { color: var(--hp-text); background: rgba(0,0,0,0.03); }
.feed-tab.active { color: var(--hp-accent); background: rgba(45,90,61,0.08); font-weight: 600; }
.feed-search {
  display: flex; align-items: center; gap: 0;
  position: relative;
}
.feed-search input {
  width: 200px; height: 48px;
  padding: 8px 44px 8px 16px;
  font-size: 0.9rem;
  font-family: 'ZCOOL KuaiLe', 'PingFang SC', 'Microsoft YaHei', monospace;
  color: #1a1a1a;
  background: #fff;
  border: 3px solid var(--hp-accent);
  border-radius: 0;
  outline: none;
  transition: all 0.3s ease;
  box-shadow: 5px 5px 0 rgba(45,90,61,0.25);
}
.feed-search input::placeholder {
  color: #999;
  font-family: 'ZCOOL KuaiLe', 'PingFang SC', sans-serif;
  font-size: 0.85rem;
}
.feed-search input:hover {
  transform: translate(-3px, -3px);
  box-shadow: 8px 8px 0 rgba(45,90,61,0.3);
}
.feed-search input:focus {
  background: var(--hp-accent);
  color: #fff;
  border-color: var(--hp-accent);
  box-shadow: 8px 8px 0 rgba(201,184,150,0.4);
  animation: inputShake 0.5s ease-in-out;
}
.feed-search input:focus::placeholder { color: rgba(255,255,255,0.6); }
.feed-search button {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--hp-meta);
  cursor: pointer; padding: 4px; transition: color 0.2s;
  display: flex; align-items: center;
}
.feed-search input:focus ~ button { color: #fff; }
.feed-search button:hover { color: var(--hp-accent); }
@keyframes inputShake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-3deg); }
  50% { transform: translateX(4px) rotate(3deg); }
  75% { transform: translateX(-4px) rotate(-3deg); }
  100% { transform: translateX(0); }
}

/* ============================================================
   文章卡片
   ============================================================ */
.post-card {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1rem 1rem 1rem 0.75rem;
  background: rgba(255,255,255,0.8);
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  margin-bottom: 0;
  transition: background 0.2s, border-left-color 0.2s;
  text-decoration: none; color: inherit;
}
.post-card + .post-card { border-top: 1px solid var(--hp-border-light); }
.post-card:hover { background: rgba(255,255,255,0.95); border-left-color: var(--hp-accent); }
.post-card-avatar { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; margin-top: 2px; }
.post-card-body { flex: 1; min-width: 0; }
.post-card-body a { color: inherit; text-decoration: none; }
.post-card-title {
  font-size: 0.95rem; font-weight: 500; color: var(--hp-text);
  margin-bottom: 2px; display: flex; align-items: center; gap: 0.5rem; line-height: 1.3;
}
.post-card-title a:hover { color: var(--hp-accent); }
.project-badge {
  font-size: 10px; font-weight: 500; color: var(--hp-meta);
  background: var(--hp-border-light); padding: 1px 6px; border-radius: 2px; white-space: nowrap;
}
.post-card-meta { font-size: 0.8rem; color: var(--hp-meta); display: flex; align-items: center; gap: 0.5rem; }
.post-card-meta .author { color: var(--hp-subtle); font-weight: 500; }
.post-card-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; margin-left: auto; }
.action-btn {
  display: inline-flex; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  font-size: 0.82rem; color: var(--hp-meta); padding: 2px 4px; transition: color 0.2s;
}
.action-btn:hover { color: var(--hp-accent); }
.action-btn.liked, .action-btn.liked:hover { color: #c0392b; }
.action-btn.collected, .action-btn.collected:hover { color: #b8860b; }
.action-btn .count { font-size: 0.72rem; }
@keyframes likePop {
  0% { transform: scale(1); } 30% { transform: scale(1.3); }
  60% { transform: scale(0.9); } 100% { transform: scale(1); }
}
.action-btn.popping { animation: likePop 0.35s ease; }

/* ============================================================
   分页
   ============================================================ */
.pagination-wrapper { display: flex; justify-content: center; padding: 2rem 0 1.5rem; }
.pagination { display: flex; gap: 0.25rem; list-style: none; padding: 0; margin: 0; }
.pagination li a, .pagination li span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 0.5rem;
  font-size: 0.82rem; color: var(--hp-meta); text-decoration: none;
  border-radius: var(--hp-radius); transition: color 0.2s, background 0.2s;
}
.pagination li a:hover { color: var(--hp-accent); background: var(--hp-accent-subtle); }
.pagination li.active a, .pagination li.active span {
  color: var(--hp-accent); font-weight: 500;
  border-bottom: 2px solid var(--hp-accent); border-radius: 0;
}
.pagination li.disabled a, .pagination li.disabled span { color: #ccc; pointer-events: none; }

/* ============================================================
   空状态
   ============================================================ */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--hp-meta); }
.empty-state h3 { font-weight: 400; font-size: 1rem; margin-bottom: 0.5rem; color: var(--hp-subtle); }
.empty-state p { font-size: 0.85rem; }

/* ============================================================
   入场动画
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-entry { }
.anim-entry.visible { animation: fadeInUp 0.5s ease forwards; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
  .hero { height: 80vh; min-height: 420px; }
  .hero-content { max-width: 100%; padding: 0 1.5rem; }
  .hero-greeting { font-size: 1.5rem; }
  .hero-subtitle { font-size: 0.9rem; max-width: 100%; }
  .feed-card { flex-direction: column; align-items: stretch; gap: 10px; }
  .feed-search { width: 100%; }
  .feed-search input { width: 100%; box-shadow: 4px 4px 0 rgba(45,90,61,0.25); }
  .feed-search input:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 rgba(45,90,61,0.3); }
  .post-card { padding: 0.75rem 0.75rem 0.75rem 0.5rem; }
  .post-card-actions { gap: 0.5rem; }
}
@media (max-width: 480px) {
  .hero { height: 75vh; min-height: 360px; }
  .hero-content { padding: 0 1rem; }
  .post-card { flex-wrap: wrap; }
  .post-card-actions { width: 100%; justify-content: flex-end; margin-top: 0.25rem; }
}

/* ============================================================
   prefers-reduced-motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .anim-entry, .anim-entry.visible { opacity: 1; transform: none; animation: none; transition: none; }
  .action-btn.popping { animation: none; }
  #butterfly-container { display: none; }
  .hero-tag,.hero-greeting,.hero-subtitle,.hero-cta,.hero-time { opacity: 1; animation: none; }
}
