/* ---------- Featured Stage 三联舞台 ----------
 * 桌面（≥769px）：3 篇一组，活动组在文档流撑开高度，非活动组绝对堆叠；
 *   卡片 stagger 进出场（.is-active 驱动，.is-prev 翻转方向）。
 * 移动端（≤768px）：全部组纵向流式、控件隐藏、无自动播放（JS 同步停用）。
 */

.featured-stage { padding-bottom: var(--space-section); }
.featured-stage .section-head {
  max-width: var(--maxw);
  margin: 0 auto 40px;
  padding: 0 var(--gutter);
}

.stage-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.stage { position: relative; outline: none; }

/* 组堆叠：非活动组绝对定位且隐藏，活动组回到文档流撑开容器高度 */
.stage-group {
  position: absolute;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 0.9s;
}
.stage-group.is-active {
  position: relative;
  inset: auto;
  z-index: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2.2vw, 30px);
  align-items: start;
}

.stage-card {
  position: relative;
  display: block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  /* 进出场：opacity + translateY，stagger 60ms（--i 由模板内联） */
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.7s var(--ease) calc(var(--i, 0) * 60ms),
    transform 0.7s var(--ease) calc(var(--i, 0) * 60ms),
    border-color 0.4s var(--ease);
}
.stage-card:hover,
.stage-card:focus-visible {
  border-color: var(--color-border-strong);
}
.stage-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}
.stage.is-prev .stage-card { transform: translateY(-24px); }
.stage-group.is-active .stage-card {
  opacity: 1;
  transform: translateY(0);
}

/* 悬停聚焦一张卡时，同组邻卡暗化（仅精确指针设备，避免触屏粘滞） */
@media (hover: hover) {
  .stage-grid:hover .stage-card:not(:hover):not(:focus-visible),
  .stage-grid:focus-within .stage-card:not(:focus-visible) {
    opacity: 0.55;
    transition: opacity 0.25s var(--ease);
  }
}

.stage-media {
  position: relative;
  aspect-ratio: 4 / 5;
  max-height: 46vh; /* 桌面：限制图片高度，保证首屏能看到控制条；移动端重置 */
  overflow: hidden;
  background: var(--color-surface);
}
.stage-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.06);
  transition: transform 1.1s var(--ease);
}
.stage-group.is-active .stage-img { transform: scale(1); }
.stage[data-hover-zoom='1'] .stage-card:hover .stage-img { transform: scale(1.05); }

/* 切换分组时活动组卡片边框特效（stage_edge_fx：glow/sweep/neon/pulse；backwards 填充，结束后不钉住 hover 样式；reduced-motion 下全局动画关停） */
/* glow：橙色描边 + 光晕亮起后淡出 */
.stage[data-edge-fx='glow'] .stage-group.is-active .stage-card {
  animation: fx-glow 0.9s var(--ease) calc(var(--i, 0) * 60ms) backwards;
}
@keyframes fx-glow {
  0% { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent), 0 0 34px -4px var(--color-accent); }
  100% { border-color: var(--color-border); box-shadow: 0 0 0 1px transparent, 0 0 34px -4px transparent; }
}
/* sweep：一道橙色高光沿卡片表面斜向扫过 */
.stage[data-edge-fx='sweep'] .stage-group.is-active .stage-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 107, 53, 0.32) 50%, transparent 70%);
  transform: translateX(-130%);
  animation: fx-sweep 1.1s var(--ease) calc(var(--i, 0) * 60ms) backwards;
}
@keyframes fx-sweep {
  to { transform: translateX(130%); }
}
/* neon：品红→紫色霓虹描边双闪 */
.stage[data-edge-fx='neon'] .stage-group.is-active .stage-card {
  animation: fx-neon 1s var(--ease) calc(var(--i, 0) * 60ms) backwards;
}
@keyframes fx-neon {
  0% { border-color: var(--neon-2); box-shadow: 0 0 0 1px var(--neon-2), 0 0 30px -4px var(--neon-2); }
  35% { box-shadow: 0 0 0 1px transparent, 0 0 30px -4px transparent; }
  70% { border-color: var(--neon-3); box-shadow: 0 0 0 1px var(--neon-3), 0 0 30px -4px var(--neon-3); }
  100% { border-color: var(--color-border); box-shadow: 0 0 0 1px transparent, 0 0 30px -4px transparent; }
}
/* pulse：橙色光圈沿边框向外扩散一波 */
.stage[data-edge-fx='pulse'] .stage-group.is-active .stage-card {
  animation: fx-pulse 0.9s var(--ease) calc(var(--i, 0) * 60ms) backwards;
}
@keyframes fx-pulse {
  0% { box-shadow: 0 0 0 0 var(--color-accent-soft); }
  60% { box-shadow: 0 0 0 12px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.stage-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.4) 0%,
    rgba(0, 0, 0, 0) 42%
  );
}
.stage-index {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}
.stage-noimg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 120% at 16% 6%, rgba(255, 122, 24, 0.5), transparent 56%),
    radial-gradient(120% 120% at 88% 96%, rgba(168, 85, 247, 0.5), transparent 56%),
    linear-gradient(160deg, #1a1522 0%, #0b0b12 100%);
}
.stage-noimg-mark {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  opacity: 0.85;
}

.stage-meta { padding: 18px 18px 20px; }
.stage-cat {
  display: block;
  min-height: 1.2em;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
}
.stage-title {
  margin: 6px 0 10px;
  font-size: clamp(1.15rem, 1.6vw, 1.5rem);
  font-weight: 700;
  line-height: 1.3;
  min-height: calc(2 * 1.3em);
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stage-desc {
  margin: 0 0 12px;
  font-size: 0.92rem;
  line-height: 1.6;
  min-height: calc(2 * 1.6em);
  color: var(--color-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stage-explore {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-text);
  transition: color 0.3s var(--ease);
}
.stage-explore-arrow {
  display: inline-block;
  transition: transform 0.3s var(--ease);
}
.stage-card:hover .stage-explore { color: var(--color-accent); }
.stage-card:hover .stage-explore-arrow { transform: translateX(5px); }

/* 控制条：计数 + 按钮一行，进度条在下；宽度与左右 gutter 由 .stage-inner 统一提供 */
.stage-controls {
  margin-top: clamp(28px, 4vw, 48px);
}
.stage-toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.stage-count {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}
.stage-count-current { color: var(--color-accent); }
.stage-buttons { display: flex; gap: 10px; }
.stage-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  opacity: 0.55;
  cursor: pointer;
  transition:
    opacity 0.3s var(--ease),
    border-color 0.3s var(--ease),
    transform 0.3s var(--ease);
}
.stage-btn:hover {
  opacity: 1;
  border-color: var(--color-border-strong);
}
.stage-prev:hover { transform: translateX(-4px); }
.stage-next:hover { transform: translateX(4px); }
.stage-btn:focus-visible {
  opacity: 1;
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}
.stage-progress {
  height: 2px;
  background: var(--color-border);
  overflow: hidden;
}
.stage-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left center;
}

/* 减弱动效：不自动播放时暂停按钮无意义（JS 侧同样停用） */
@media (prefers-reduced-motion: reduce) {
  .stage-play { display: none; }
}

/* 移动端：取消组概念，全部卡片纵向流式；控件隐藏 */
@media (max-width: 768px) {
  .stage-group {
    position: static !important;
    inset: auto !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition: none !important;
    margin-bottom: 32px;
  }
  .stage-group:last-child { margin-bottom: 0; }
  .stage-card {
    opacity: 1 !important;
    transform: none !important;
  }
  .stage-media { max-height: none; }
  .stage-img { transform: none !important; }
  .stage[data-hover-zoom='1'] .stage-card:hover .stage-img { transform: scale(1.04) !important; }
  .stage-grid,
  .stage-grid--few {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .stage-grid--few .stage-card { max-width: none; }
  .stage-controls { display: none; }
}
