/* ================================================================
 * 色彩展示独立样式 - 从 module4 提取的三个模块专用CSS
 * 模块: 故宫色彩体系 | 色彩分布热力图 | 三大彩画等级
 * ================================================================ */

/* ========== 基础布局覆盖（原 .page-module-4 规则） ========== */
.page-module-4 .color-spectrum-section {
  padding: clamp(2.8rem, 4.4vw, 4rem) 0 calc(clamp(2.8rem, 4.4vw, 4rem) + 100px);
}

.page-module-4 .color-spectrum-section .container {
  display: grid;
  gap: clamp(3.8rem, 5.6vw, 5.4rem);
}

.page-module-4 .color-spectrum-subsection {
  position: relative;
  z-index: 1;
}

.page-module-4 .color-spectrum-subsection--swatches,
.page-module-4 .color-spectrum-subsection--ring {
  display: grid;
  gap: clamp(1.55rem, 2.8vw, 2.2rem);
}

.page-module-4 .color-spectrum-subsection + .color-spectrum-subsection {
  margin-top: 0;
  padding-top: clamp(2.4rem, 4vw, 3.2rem);
  border-top: 1px solid rgba(184, 29, 37, 0.14);
}

.page-module-4 #section-color-system .section-title,
.page-module-4 #section-color-system .section-subtitle {
  margin-bottom: 1.75rem;
}

.page-module-4 #section-color-system .section-subtitle {
  margin-top: -1rem;
  margin-bottom: 0;
}

/* ========== 故宫色彩体系：色块网格 ========== */
.color-swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
}

.color-swatch-grid .color-swatch.animate-on-scroll {
  transform-origin: 50% 50%;
  --reveal-scale: 0.82;
  transition:
    opacity 1.1s var(--ease-smooth) var(--reveal-delay),
    transform 1.1s var(--ease-spring) var(--reveal-delay),
    box-shadow 0.5s var(--ease-smooth),
    border-color 0.35s ease,
    background 0.35s ease;
}

.color-swatch {
  background: var(--color-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease;
}
.color-swatch:hover { transform: translateY(-4px); }

.color-swatch-block {
  height: 90px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0.5rem;
}

.color-swatch-block span {
  font-size: 0.75rem;
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  background: rgba(33,33,33,0.6);
  color: rgba(255,255,255,0.95);
  text-shadow: none;
  font-family: var(--font-sans);
}

.color-swatch-body {
  padding: 0.75rem 1rem;
}

.color-swatch-body h4 {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  color: var(--color-ink);
}

.color-swatch-body p {
  font-size: 0.82rem;
  color: var(--color-gray);
  line-height: 1.5;
}

/* ========== 三大彩画等级：卡片列表 ========== */
.painting-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.painting-cards .painting-card.paint-reveal {
  opacity: 0;
  transform: translate3d(0, 96px, 0) scale(0.88);
  transition:
    opacity 0.95s var(--ease-smooth),
    transform 1s var(--ease-spring),
    box-shadow 0.5s var(--ease-smooth),
    border-color 0.35s ease,
    background 0.35s ease;
  will-change: transform, opacity;
}

.painting-cards .painting-card.paint-reveal.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.painting-card {
  background: var(--color-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: stretch;
}

.painting-card-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  min-height: 140px;
}

.painting-card-visual--image {
  position: relative;
  overflow: hidden;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 1rem;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  isolation: isolate;
}

.painting-card-visual--image::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(15, 10, 8, 0.08) 0%, rgba(15, 10, 8, 0.22) 42%, rgba(15, 10, 8, 0.62) 100%),
    linear-gradient(135deg, rgba(200, 16, 46, 0.16), rgba(212, 166, 58, 0.12));
  z-index: -1;
}

.painting-card-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 248, 230, 0.9);
  color: var(--color-zitan);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

.painting-card-body {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.painting-card-body h4 {
  font-size: 1.1rem;
  color: var(--color-red);
  margin-bottom: 0.3rem;
}

.painting-card-body .painting-rank {
  font-size: 0.82rem;
  color: var(--color-gold-deep);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.painting-card-body p {
  font-size: 0.9rem;
  color: var(--color-gray);
  line-height: 1.65;
}

/* ========== 热力图区域占位 ========== */
.color-spectrum-subsection--heatmap {
  padding: clamp(1.5rem, 3vw, 2.5rem) 0;
  background: none;
  border-radius: 0;
  box-shadow: none;
}

#color-distribution-map {
  min-height: 0;
  display: block;
}

/* ========== 入场动画补充 ========== */
#section-c .section-title.animate-on-scroll,
#section-c .section-subtitle.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-smooth), transform 0.8s var(--ease-spring);
}

#section-c .section-title.animate-on-scroll.is-visible,
#section-c .section-subtitle.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== 响应式适配 ========== */
@media (max-width: 768px) {
  .page-module-4 .color-spectrum-section .container {
    gap: 2.9rem;
  }

  .page-module-4 .color-spectrum-subsection + .color-spectrum-subsection {
    padding-top: 2rem;
  }

  .page-module-4 #section-color-system .color-swatch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .painting-cards .painting-card.paint-reveal {
    transform: translate3d(0, 72px, 0) scale(0.9);
  }
  .painting-card { grid-template-columns: 1fr; }
  .painting-card-visual { min-height: 100px; }
}

@media (max-width: 480px) {
  .color-swatch-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
}

/* ========== 三大彩画等级 · 组合卡片 ========== */
.painting-combined-grid {
  display: grid;
  gap: 3rem;
  margin-top: 2rem;
}
.painting-combined-item {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 2rem;
  background: #FFF;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.painting-combined-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.painting-combined-visual {
  position: relative;
  min-height: 300px;
  background-size: cover;
  background-position: center;
}
.painting-combined-chip {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.4rem 0.9rem;
  background: rgba(255,255,255,0.95);
  border-radius: 20px;
  font-size: 0.8rem;
  color: #666;
  font-weight: 500;
  backdrop-filter: blur(8px);
}
.painting-combined-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.painting-combined-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.painting-combined-color {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  flex-shrink: 0;
}
.painting-combined-info {
  flex: 1;
}
.painting-combined-info h4 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  color: #333;
}
.painting-combined-level {
  font-size: 0.85rem;
  color: #C8102E;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.painting-combined-percentage {
  font-size: 2rem;
  font-weight: 700;
  color: #333;
}
.painting-combined-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #666;
  margin-bottom: 0.75rem;
}
.painting-combined-detail {
  font-size: 1rem;
  line-height: 1.7;
  color: #555;
  margin-bottom: 1.25rem;
}
.painting-combined-stats {
  display: flex;
  gap: 3rem;
  margin-bottom: 1rem;
}
.painting-combined-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.painting-combined-stat strong {
  font-size: 1.5rem;
  color: #333;
  font-weight: 700;
}
.painting-combined-stat span {
  font-size: 0.85rem;
  color: #999;
}
.painting-combined-bar-track {
  height: 10px;
  background: #F5F0E8;
  border-radius: 5px;
  overflow: hidden;
}
.painting-combined-bar {
  height: 100%;
  border-radius: 5px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.painting-combined-note {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: #999;
  text-align: center;
  font-style: italic;
}

@media (max-width: 1024px) {
  .painting-combined-item {
    grid-template-columns: 1fr;
  }
  .painting-combined-visual {
    min-height: 250px;
  }
}
@media (max-width: 768px) {
  .painting-combined-visual {
    min-height: 200px;
  }
  .painting-combined-content {
    padding: 1.5rem;
  }
  .painting-combined-stats {
    gap: 2rem;
  }
}

/* ========== 六大模块入场动效（各不相同） ========== */

/* 通用：模块入场前隐藏 */
.page-module-4 .section-reveal {
  opacity: 0;
  will-change: transform, opacity, filter;
}
.page-module-4 .section-reveal.section-entered {
  opacity: 1;
}

/* 1. 色谱解码 · 色彩基因图谱 — 缩放浮现 */
.page-module-4 #section-ring.section-reveal {
  transform: scale(0.82);
  transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1), transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.page-module-4 #section-ring.section-entered {
  transform: scale(1);
}

/* 2. 核心数据一览 — 从底部滑入 */
.page-module-4 #section-a.section-reveal {
  transform: translateY(90px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.page-module-4 #section-a.section-entered {
  transform: translateY(0);
}

/* 3. 故宫色彩体系 — 从左侧滑入 */
.page-module-4 #section-color-system.section-reveal {
  transform: translateX(-80px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.page-module-4 #section-color-system.section-entered {
  transform: translateX(0);
}

/* 4. 色彩使用比例分析 — 旋转淡入 */
.page-module-4 #section-pie.section-reveal {
  transform: perspective(800px) rotateY(-8deg);
  transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1), transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.page-module-4 #section-pie.section-entered {
  transform: perspective(800px) rotateY(0);
}

/* 5. 色彩分布热力图 — 模糊渐清 */
.page-module-4 #section-heatmap.section-reveal {
  filter: blur(12px);
  transform: translateY(40px);
  transition: opacity 0.9s ease, filter 1.2s cubic-bezier(0.22, 1, 0.36, 1), transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.page-module-4 #section-heatmap.section-entered {
  filter: blur(0);
  transform: translateY(0);
}

/* 6. 三大彩画等级 — 从右侧滑入（section 级别） */
.page-module-4 #section-painting-chart.section-reveal {
  transform: translateX(80px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.page-module-4 #section-painting-chart.section-entered {
  transform: translateX(0);
}

/* 三大彩画卡片入场动效（复用石纹交错上浮） */
.painting-combined-item.painting-reveal {
  opacity: 0;
  transform: translate3d(0, 80px, 0) scale(0.92);
  transition:
    opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s ease;
  will-change: transform, opacity;
}
.painting-combined-item.painting-reveal.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}
.painting-combined-item.painting-reveal:nth-child(1) { transition-delay: 0ms; }
.painting-combined-item.painting-reveal:nth-child(2) { transition-delay: 120ms; }
.painting-combined-item.painting-reveal:nth-child(3) { transition-delay: 240ms; }

.painting-combined-item.painting-reveal.is-visible:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
