/* ============================================================
   cover.css - 封面图系统
   rvworldtrader.com
   类别：C3（户外/生活）
   十一层结构 · 光点动画 · 产品光晕 · 三级降级
   ============================================================ */

/* ===== HSL 变量默认值（由 publish.php 按 Mood 动态覆盖） ===== */
:root {
  --cover-bg-h: 145;
  --cover-bg-s: 30%;
  --cover-bg-l: 88%;

  --cover-accent-h: 25;
  --cover-accent-s: 70%;
  --cover-accent-l: 55%;
}

/* ===== 封面容器 ===== */
.cover-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background-color: hsl(var(--cover-bg-h), var(--cover-bg-s), var(--cover-bg-l));
  isolation: isolate;
}

/* ===== SVG 层 ===== */
.cover-wrapper img,
.cover-wrapper svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== 产品主体光晕（第十层） ===== */
.cover-subject {
  position: relative;
  z-index: 10;
  filter: drop-shadow(0 0 24px hsl(var(--cover-accent-h), var(--cover-accent-s), var(--cover-accent-l)));
}

/* ===== 光点容器（第十一层） ===== */
.cover-lights {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

/* 光点基础样式 */
.cover-light {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: hsl(var(--cover-accent-h), var(--cover-accent-s), 90%);
  box-shadow: 0 0 12px 2px hsl(var(--cover-accent-h), var(--cover-accent-s), 70%);
  animation: light-twinkle 3s ease-in-out infinite;
  opacity: 0.6;
}

/* 不同位置的光点 */
.cover-light:nth-child(1) {
  top: 20%;
  left: 15%;
  animation-duration: 2.8s;
  animation-delay: 0s;
}

.cover-light:nth-child(2) {
  top: 35%;
  right: 20%;
  animation-duration: 3.4s;
  animation-delay: 0.5s;
}

.cover-light:nth-child(3) {
  bottom: 25%;
  left: 25%;
  animation-duration: 2.4s;
  animation-delay: 1s;
}

.cover-light:nth-child(4) {
  top: 60%;
  right: 12%;
  animation-duration: 3.6s;
  animation-delay: 1.5s;
}

.cover-light:nth-child(5) {
  bottom: 18%;
  right: 30%;
  animation-duration: 3.0s;
  animation-delay: 2s;
}

.cover-light:nth-child(6) {
  top: 15%;
  right: 40%;
  animation-duration: 2.6s;
  animation-delay: 0.8s;
}

.cover-light:nth-child(7) {
  bottom: 40%;
  left: 8%;
  animation-duration: 3.2s;
  animation-delay: 1.2s;
}

.cover-light:nth-child(8) {
  top: 45%;
  left: 50%;
  animation-duration: 2.9s;
  animation-delay: 1.8s;
}

/* ===== 光点闪烁动画（只用 opacity） ===== */
@keyframes light-twinkle {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

/* ===== 封面叠加渐变（提升可读性） ===== */
.cover-wrapper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.15) 100%);
  pointer-events: none;
  z-index: 15;
}

/* ===== 封面内文字（如有） ===== */
.cover-wrapper .cover-title {
  position: absolute;
  bottom: var(--space-5);
  left: var(--space-5);
  right: var(--space-5);
  z-index: 25;
  color: var(--color-neutral-50);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-snug);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* ===== 三级降级机制 ===== */
/* 第 1 级：外部图片（默认） */
/* 第 2 级：SVG 封面图 */
.cover-wrapper.fallback-svg {
  background-color: hsl(var(--cover-bg-h), var(--cover-bg-s), var(--cover-bg-l));
}

/* 第 3 级：纯色 + 标题 */
.cover-wrapper.fallback-solid {
  background: linear-gradient(
    135deg,
    hsl(var(--cover-bg-h), var(--cover-bg-s), var(--cover-bg-l)),
    hsl(var(--cover-accent-h), var(--cover-accent-s), 75%)
  );
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-wrapper.fallback-solid .cover-title {
  position: static;
  text-align: center;
  padding: var(--space-5);
  font-size: var(--text-lg);
}

/* ===== 列表页/卡片中的小封面 ===== */
.article-card .cover-wrapper,
.pick-card .cover-wrapper {
  margin-bottom: var(--space-4);
}

/* ===== 首页精选区大封面 ===== */
.featured-grid .cover-wrapper {
  aspect-ratio: 16 / 9;
}

/* ===== 文章详情页横幅封面 ===== */
.article-hero-cover {
  max-width: 1200px;
  margin: 0 auto var(--rhythm-breath);
  padding: 0 var(--gutter);
}

.article-hero-cover .cover-wrapper {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

/* ===== 移动端优化 ===== */
@media (max-width: 768px) {
  .cover-wrapper {
    border-radius: var(--radius-md);
  }

  /* 移动端光点数量减半 */
  .cover-light:nth-child(n+5) {
    display: none;
  }

  /* 光点动画略快 */
  .cover-light {
    animation-duration: 2.4s;
  }

  .cover-wrapper .cover-title {
    font-size: var(--text-base);
    bottom: var(--space-3);
    left: var(--space-3);
    right: var(--space-3);
  }

  .article-hero-cover .cover-wrapper {
    border-radius: var(--radius-md);
    box-shadow: none;
  }
}

/* ===== prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  .cover-light {
    animation: none;
    opacity: 0.6;
  }
}
