/* =====================================================================
   background.css —— 首页动态背景
   红旗飘动 / 星光粒子 / 天安门 / 红色绸带
   ===================================================================== */

/* 背景容器：铺满整屏，置于内容之下 */
.bg2 {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  /* 底色：深红渐变，模拟旗面受光不均 */
  /* 旗面：多层斜向褶皱模拟飘动的五星红旗 */
  background:
    /* 左上受光区 */
    radial-gradient(60% 46% at 14% 12%, rgba(255, 130, 90, .55) 0%, transparent 62%),
    /* 右上暖光 */
    radial-gradient(52% 42% at 84% 8%, rgba(255, 110, 70, .38) 0%, transparent 66%),
    /* 旗面褶皱：斜向明暗带 */
    linear-gradient(118deg,
      rgba(255, 120, 80, .28) 0%,
      rgba(160, 26, 16, .35) 12%,
      rgba(255, 150, 110, .3) 22%,
      rgba(150, 22, 14, .4) 34%,
      rgba(255, 140, 100, .26) 46%,
      rgba(140, 20, 12, .42) 58%,
      rgba(255, 130, 90, .22) 70%,
      rgba(130, 18, 10, .45) 84%,
      rgba(255, 120, 80, .2) 100%),
    /* 底色 */
    radial-gradient(130% 95% at 50% -12%, #ef4a2a 0%, #d12c14 22%, #b01f10 44%, #8a160c 66%, #5c0d08 84%, #3a0605 100%);
  isolation: isolate;
}

/* ---------------------------------------------------------------------
   旗面褶皱：几条高光带缓慢横移，形成"旗帜飘动"
   --------------------------------------------------------------------- */
.bg2-fold {
  position: absolute;
  left: -30%;
  width: 170%;
  height: 34%;
  background: linear-gradient(100deg,
    transparent 0%,
    rgba(255, 150, 110, .16) 18%,
    rgba(255, 190, 150, .3) 34%,
    rgba(255, 150, 100, .14) 50%,
    transparent 68%);
  filter: blur(26px);
  mix-blend-mode: screen;
  will-change: transform;
}
.bg2-fold.f1 { top: 4%;  animation: fold-drift 19s ease-in-out infinite alternate; }
.bg2-fold.f2 {
  top: 26%;
  height: 38%;
  opacity: .8;
  animation: fold-drift 24s ease-in-out infinite alternate-reverse;
}
.bg2-fold.f3 {
  top: 52%;
  height: 30%;
  opacity: .62;
  animation: fold-drift 27s ease-in-out infinite alternate;
  animation-delay: -6s;
}
.bg2-fold.f4 {
  top: 72%;
  height: 34%;
  opacity: .5;
  animation: fold-drift 31s ease-in-out infinite alternate-reverse;
  animation-delay: -11s;
}
@keyframes fold-drift {
  0%   { transform: translate3d(-6%, 0, 0) skewY(-2.2deg) scaleY(1); }
  50%  { transform: translate3d(3%, 1.2%, 0) skewY(1.6deg) scaleY(1.08); }
  100% { transform: translate3d(7%, -1%, 0) skewY(2.4deg) scaleY(.96); }
}

/* 两道大范围光晕，模拟旗帜受光面 */
.bg2-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  mix-blend-mode: screen;
  will-change: transform, opacity;
}
.bg2-glow.g1 {
  left: 6%;
  top: 2%;
  width: 52%;
  height: 46%;
  background: radial-gradient(circle, rgba(255, 120, 70, .2), transparent 68%);
  animation: glow-breathe 13s ease-in-out infinite alternate;
}
.bg2-glow.g2 {
  right: 2%;
  top: 8%;
  width: 44%;
  height: 40%;
  background: radial-gradient(circle, rgba(255, 160, 100, .15), transparent 70%);
  animation: glow-breathe 17s ease-in-out infinite alternate-reverse;
}
@keyframes glow-breathe {
  from { opacity: .5; transform: translate3d(0, 0, 0) scale(1); }
  to   { opacity: .95; transform: translate3d(3%, 2%, 0) scale(1.12); }
}

/* ---------------------------------------------------------------------
   左上角五角星（国旗构图）
   --------------------------------------------------------------------- */
.bg2-stars {
  position: absolute;
  left: 1%;
  top: 2%;
  width: 30%;
  max-width: 480px;
  opacity: .62;
  filter: drop-shadow(0 0 26px rgba(255, 210, 120, .5));
  animation: stars-flicker 9s ease-in-out infinite alternate;
}
@keyframes stars-flicker {
  from { opacity: .36; }
  to   { opacity: .58; }
}

/* ---------------------------------------------------------------------
   底部飘带
   --------------------------------------------------------------------- */
.bg2-ribbon {
  position: absolute;
  left: -6%;
  right: -6%;
  bottom: -12%;
  height: 40%;
  background:
    radial-gradient(60% 100% at 16% 100%, rgba(140, 22, 16, .95), transparent 72%),
    radial-gradient(64% 100% at 62% 100%, rgba(168, 34, 24, .9), transparent 70%),
    radial-gradient(70% 100% at 92% 100%, rgba(110, 16, 12, .95), transparent 74%),
    linear-gradient(180deg, transparent 0%, rgba(90, 14, 11, .75) 52%, rgba(60, 8, 6, .95) 100%);
  filter: blur(6px);
  animation: ribbon-sway 22s ease-in-out infinite alternate;
}
@keyframes ribbon-sway {
  from { transform: translate3d(-1.5%, 1%, 0) scaleY(1); }
  to   { transform: translate3d(1.5%, -1%, 0) scaleY(1.08); }
}

/* ---------------------------------------------------------------------
   天安门
   --------------------------------------------------------------------- */
.bg2-gate {
  position: absolute;
  right: -1%;
  bottom: 1%;
  width: min(32%, 580px);
  min-width: 300px;
  filter: drop-shadow(-18px 0 44px rgba(40, 4, 3, .7));
  animation: gate-rise 2.4s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes gate-rise {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: none; }
}
/* 城楼上方的红旗轻摆 */
.bg2-flaglet {
  transform-origin: 472px 150px;
  animation: flaglet-wave 5.5s ease-in-out infinite alternate;
}
@keyframes flaglet-wave {
  from { transform: skewY(-2.5deg) scaleX(.98); }
  to   { transform: skewY(2.5deg) scaleX(1.02); }
}

/* ---------------------------------------------------------------------
   星光粒子画布
   --------------------------------------------------------------------- */
.bg2-particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------------------------------------------------------------------
   无障碍：尊重"减少动态效果"
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .bg2-fold, .bg2-glow, .bg2-stars, .bg2-ribbon, .bg2-gate, .bg2-flaglet {
    animation: none !important;
  }
}

/* 粒子整体压暗，避免像水泡 */
.bg2-particles { opacity: .75; }


/* =====================================================================
   满屏五星红旗飘扬层
   ===================================================================== */
.flag-layer {
  position: fixed;
  inset: 0;
  z-index: 2;              /* 压在 .bg2 褶皱层之上、内容之下 */
  overflow: hidden;
  pointer-events: none;    /* 不拦截任何交互 */
}
.flag-canvas {
  display: block;
  width: 100%;
  height: 100%;
  /* CSS 层叠加轻微的整体起伏，增强「飘」的观感 */
  animation: flag-breathe 6.5s ease-in-out infinite;
  /* 正常叠加，保持国旗本色；靠画布内部暗角与衬底融合 */
  mix-blend-mode: normal;
  opacity: .9;
}

@keyframes flag-breathe {
  0%   { transform: scale(1.015) translate(0, 0)       skewY(0deg); }
  25%  { transform: scale(1.02)  translate(-0.5%, -0.4%) skewY(-0.25deg); }
  50%  { transform: scale(1.015) translate(0, 0.3%)     skewY(0deg); }
  75%  { transform: scale(1.02)  translate(0.5%, -0.3%) skewY(0.25deg); }
  100% { transform: scale(1.015) translate(0, 0)       skewY(0deg); }
}

/* 内容层压在红旗之上 */
.site-main { position: relative; z-index: 3; }

/* 衬底褶皱层在红旗之下 */
.bg2 { z-index: 1; }


/* =====================================================================
   地标图层：天安门 + 人民大会堂
   ---------------------------------------------------------------------
   层级：红旗(2) < 地标(2.5) < 内容(3)
   照片通过遮罩羽化 + 色彩融合，避免硬边「贴图感」
   ===================================================================== */
.landmark-layer {
  position: fixed;
  inset: 0;
  z-index: 2;                 /* 与红旗同层，DOM 顺序在后 → 显示在红旗之上 */
  overflow: hidden;
  pointer-events: none;
}

.landmark {
  position: absolute;
  will-change: transform;
}
.landmark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 色彩统一：降低饱和、偏暖，与红金主题融合 */
  filter: saturate(.7) contrast(1.05) brightness(.86) sepia(.32) hue-rotate(-8deg);
}

/* ---- 天安门：右下角 ---- */
.landmark-tiananmen {
  right: -1vw;
  bottom: -4vh;
  width: min(42vw, 660px);
  aspect-ratio: 1435 / 998;
  /* 左侧与顶部羽化，让照片边缘融进红旗 */
  -webkit-mask-image:
    linear-gradient(to left,
      #000 0%, #000 30%,
      rgba(0,0,0,.92) 46%, rgba(0,0,0,.72) 60%,
      rgba(0,0,0,.44) 72%, rgba(0,0,0,.18) 84%,
      rgba(0,0,0,.04) 93%, transparent 100%),
    linear-gradient(to top,
      #000 0%, #000 52%,
      rgba(0,0,0,.86) 66%, rgba(0,0,0,.5) 80%,
      rgba(0,0,0,.14) 92%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to left,
      #000 0%, #000 30%,
      rgba(0,0,0,.92) 46%, rgba(0,0,0,.72) 60%,
      rgba(0,0,0,.44) 72%, rgba(0,0,0,.18) 84%,
      rgba(0,0,0,.04) 93%, transparent 100%),
    linear-gradient(to top,
      #000 0%, #000 52%,
      rgba(0,0,0,.86) 66%, rgba(0,0,0,.5) 80%,
      rgba(0,0,0,.14) 92%, transparent 100%);
  mask-composite: intersect;
  opacity: .74;
  mix-blend-mode: luminosity;
  animation: landmark-float 9s ease-in-out infinite;
}

/* ---- 人民大会堂：右上角 ---- */
.landmark-hall {
  left: -1vw;
  bottom: -4vh;
  width: min(26vw, 400px);
  aspect-ratio: 1000 / 1258;
  /* 左下角：右侧与顶部羽化融入红旗 */
  /* 右侧与顶部：超长渐变过渡，杜绝硬切线 */
  -webkit-mask-image:
    linear-gradient(to right,
      #000 0%, #000 30%,
      rgba(0,0,0,.92) 46%, rgba(0,0,0,.72) 60%,
      rgba(0,0,0,.44) 72%, rgba(0,0,0,.18) 84%,
      rgba(0,0,0,.04) 93%, transparent 100%),
    linear-gradient(to top,
      #000 0%, #000 52%,
      rgba(0,0,0,.86) 66%, rgba(0,0,0,.5) 80%,
      rgba(0,0,0,.14) 92%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right,
      #000 0%, #000 30%,
      rgba(0,0,0,.92) 46%, rgba(0,0,0,.72) 60%,
      rgba(0,0,0,.44) 72%, rgba(0,0,0,.18) 84%,
      rgba(0,0,0,.04) 93%, transparent 100%),
    linear-gradient(to top,
      #000 0%, #000 52%,
      rgba(0,0,0,.86) 66%, rgba(0,0,0,.5) 80%,
      rgba(0,0,0,.14) 92%, transparent 100%);
  mask-composite: intersect;
  opacity: .68;
  mix-blend-mode: luminosity;
  animation: landmark-float 11s ease-in-out infinite reverse;
}

/* 缓慢起伏，与红旗飘动呼应，避免照片「死板」 */
@keyframes landmark-float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(0, -0.8%, 0) scale(1.012); }
}

/* ---- 融合光晕：整体压暗四周 + 暖色叠加 ---- */
.landmark-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    /* 右下角暖红（天安门） */
    radial-gradient(85% 75% at 100% 100%, rgba(206, 44, 30, .46) 0%, rgba(206, 44, 30, 0) 56%),
    /* 左下角暖红（人民大会堂） */
    radial-gradient(70% 70% at 0% 100%, rgba(196, 40, 28, .42) 0%, rgba(196, 40, 28, 0) 58%),
    /* 底部整体过渡，让两个下角自然衔接 */
    linear-gradient(to top, rgba(150, 24, 16, .26) 0%, rgba(150, 24, 16, 0) 34%),
    linear-gradient(180deg, rgba(160, 26, 18, .10), rgba(160, 26, 18, .10));
  mix-blend-mode: multiply;
}

/* 内容层压在两个图层之上 */
.site-main { z-index: 3; }

/* 小屏时缩小或隐藏，避免挡住入口 */
@media (max-width: 1180px) {
  .landmark-tiananmen { width: 38vw; opacity: .66; }
  .landmark-hall { width: 23vw; opacity: .62; }
}
@media (max-width: 860px) {
  .landmark-hall { width: 30vw; opacity: .46; left: -4vw; }
  .landmark-tiananmen { width: 40vw; opacity: .46; right: -4vw; }
}
@media (prefers-reduced-motion: reduce) {
  .landmark-tiananmen, .landmark-hall { animation: none; }
}
