/* ============================================================
   cover.css · 动态光点封面图系统
   Project: The Puppy Gear Lab (puppy-search.com)
   封面图类别：C11（宠物）
   十一层结构 + 光点闪烁 + 产品光晕 + 三级降级
   ============================================================ */

/* ---------- 封面容器（全站统一 16:9） ---------- */
.cover-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--cover-bg, var(--color-neutral-100));
}

.cover-container img,
.cover-container svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- HSL 变量（publish.php 动态注入） ---------- */
:root {
  --cover-bg-h: 120;
  --cover-bg-s: 35%;
  --cover-bg-l: 90%;
  --cover-accent-h: 15;
  --cover-accent-s: 65%;
  --cover-accent-l: 45%;

  --cover-bg:     hsl(var(--cover-bg-h), var(--cover-bg-s), var(--cover-bg-l));
  --cover-accent: hsl(var(--cover-accent-h), var(--cover-accent-s), var(--cover-accent-l));
}

/* ---------- 产品主体光晕 ---------- */
.cover-container .product-glow {
  filter: drop-shadow(0 0 30px rgba(255, 200, 100, 0.5));
}

/* ---------- 光点闪烁 ---------- */
.cover-container .light-dot {
  animation: lightDotPulse var(--dot-duration, 3s) ease-in-out infinite;
  opacity: 0.6;
}

.cover-container .light-dot:nth-child(2)  { animation-delay: 0.4s; }
.cover-container .light-dot:nth-child(3)  { animation-delay: 1.2s; }
.cover-container .light-dot:nth-child(4)  { animation-delay: 0.8s; }
.cover-container .light-dot:nth-child(5)  { animation-delay: 1.6s; }
.cover-container .light-dot:nth-child(6)  { animation-delay: 0.2s; }
.cover-container .light-dot:nth-child(7)  { animation-delay: 2.0s; }
.cover-container .light-dot:nth-child(8)  { animation-delay: 1.0s; }

@keyframes lightDotPulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* ---------- 三级降级机制 ---------- */
.cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: var(--cover-bg);
  color: var(--color-text-primary);
  text-align: center;
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  line-height: var(--leading-snug);
}

/* ---------- 列表页/聚合页封面缩略 ---------- */
.card-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
  margin-bottom: var(--space-3);
}

.card-cover img,
.card-cover svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- L3 页面封面专属（更稀有） ---------- */
.cover-container.l3-cover {
  border: 1px solid var(--color-l3-border);
  box-shadow: var(--shadow-lg);
}

.cover-container.l3-cover .light-dot {
  --dot-duration: 4s;
}

/* ---------- 移动端优化 ---------- */
@media (max-width: 768px) {
  .cover-container .light-dot:nth-child(n+5) {
    display: none; /* 光点数量减半 */
  }

  .cover-container .light-dot {
    animation-duration: 2.5s;
  }

  .cover-fallback {
    font-size: var(--text-base);
    padding: var(--space-3);
  }
}

/* ---------- 减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  .cover-container .light-dot {
    animation: none;
    opacity: 0.5;
  }
}
