/**
 * 首页：向下滚动时背景模糊、顶栏上滑隐藏；首屏标题随页面滚动（非 fixed）
 * 依赖：导航栏.css
 *
 * 模糊加在独立层 .bg-scroll-blur 上，不要写在 body::before，避免整屏发糊。
 * 渐变模糊：底层清晰图 + ::after 同图模糊；mask 上浓下淡 → 上面偏糊、向下渐清晰。
 */

:root {
  /* JS 未跑前：略糊；与 index 里 tick 最小 8px 一致更易看出效果 */
  --hero-bg-blur: 8px;
  --hero-text-blur: 0px;
  --header-hide-ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* mask 不透明度：上为 1 显示模糊层，下为 0 露底层清晰图；可微调过渡带 */
  --bg-blur-mask-top-solid: 15%;
  --bg-blur-mask-mid: 42%;
  --bg-blur-mask-fade-end: 78%;
}

/* 首屏底色仍由 body::before 提供；大图改到 .bg-scroll-blur */
body::before {
  background-image: none;
  filter: none;
  transform: none;
}

.bg-scroll-blur {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  background-color: var(--page-bg);
  background-image: url("../../图片/garten-gg-aircraft-1756149.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  isolation: isolate;
}

.bg-scroll-blur::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../../图片/garten-gg-aircraft-1756149.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(var(--hero-bg-blur, 0px));
  transform: scale(1.08);
  transform-origin: center center;
  transition: filter 0.22s var(--header-hide-ease);
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 var(--bg-blur-mask-top-solid),
    rgba(0, 0, 0, 0.72) var(--bg-blur-mask-mid),
    rgba(0, 0, 0, 0.18) var(--bg-blur-mask-fade-end),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 var(--bg-blur-mask-top-solid),
    rgba(0, 0, 0, 0.72) var(--bg-blur-mask-mid),
    rgba(0, 0, 0, 0.18) var(--bg-blur-mask-fade-end),
    transparent 100%
  );
}

@media (prefers-reduced-motion: reduce) {
  .bg-scroll-blur::after {
    filter: none !important;
    transform: none !important;
    transition: none !important;
  }
}

/* 渐变需在模糊层之上，否则会被盖住 */
body::after {
  z-index: 2;
}

/* 首屏：占满一屏，标题随滚动离开视口 */
.hero-screen {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 88px 20px 48px;
  text-align: center;
}

.hero-screen .hero-title,
.hero-screen .hero-sub {
  filter: blur(var(--hero-text-blur, 0px));
  transition: filter 0.22s var(--header-hide-ease);
  text-shadow:
    0 2px 20px rgba(0, 0, 0, 0.5),
    0 1px 3px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .hero-screen .hero-title,
  .hero-screen .hero-sub {
    filter: none !important;
    transition: none !important;
  }
}

/* 帖子：叠在背景之上滚动 */
.posts-main {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

.posts-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.posts-section__title {
  font-family: var(--font-apple);
  font-size: clamp(1.25rem, 3.5vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}

.posts-section__more {
  font-family: var(--font-apple);
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.posts-section__more:hover {
  color: #fff;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.post-card {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(28, 28, 32, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.35);
  transition: transform 0.28s var(--header-hide-ease), box-shadow 0.28s ease;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.12),
    0 18px 48px rgba(0, 0, 0, 0.42);
}

.post-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.post-card__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, rgba(60, 60, 80, 0.9), rgba(30, 30, 45, 0.95));
  overflow: hidden;
}

.post-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 无封面图时用首字占位，与社区帖子列表一致 */
.post-card__thumb .home-post-thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: rgba(255, 255, 255, 0.92);
  background: linear-gradient(145deg, #4a5fc7 0%, #2d3a8c 100%);
}

.post-card__body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.post-card__title {
  font-family: var(--font-apple);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.96);
}

.post-card__excerpt {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.58);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
}

.post-card__author {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
}

@media (max-width: 767.98px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }
}

/* 首页底部 */
.site-footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 36px 20px 44px;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.48);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 12px;
}

.site-footer p {
  margin: 0;
}
