/* detail.css - 内容详情页的Q弹信封开场与拟物化布局 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Noto+Sans+SC:wght@300;400;600;800&display=swap');

:root {
  --bg-primary: #FFF0F2;
  --bg-secondary: #FFF8F9;
  --bg-container: #FFE5E9;
  --shadow-dark: #E5C2C8;
  --shadow-light: #FFFFFF;
  --shadow-flat: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
  --shadow-hover: 12px 12px 24px var(--shadow-dark), -12px -12px 24px var(--shadow-light);
  --shadow-active: inset 5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light);
  --accent-pink: #FF8BA4;
  --accent-pink-hover: #FFA3B7;
  --accent-pink-dark: #E06F89;
  --accent-gold: #FFD25A;
  --text-primary: #5A484C;          
  --text-secondary: #8B7277;
  --text-tertiary: #AFA0A4;
  --font-sans: 'Outfit', 'Noto Sans SC', sans-serif;
  --transition-bouncy: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ================= 1. 信封开场动画结构 (3D Envelope) ================= */
.scene {
  perspective: 1000px;
  width: 100%;
  max-width: 800px;
  min-height: 500px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin: 40px auto;
  transition: max-width 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scene.open {
  max-width: 1200px; /* 自适应拉宽到 1200px，提升大屏内容覆盖率，减少两旁空白 */
}

.envelope-wrapper {
  position: relative;
  width: 550px;
  height: 380px;
  background-color: #F8DFE3; /* 浅粉色信封体 */
  border-radius: 0 0 16px 16px;
  box-shadow: 0 20px 40px rgba(229,194,200,0.6);
  transform-style: preserve-3d;
  transition: width 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              background-color 0.8s ease,
              box-shadow 0.8s ease,
              transform 0.8s ease-in-out;
}

/* 信封上翻盖 */
.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  border-left: 275px solid transparent;
  border-right: 275px solid transparent;
  border-top: 190px solid #F0C4CC; /* 信封盖颜色 */
  transform-origin: top center;
  z-index: 4;
  transition: transform 0.5s ease-in-out 0.6s;
  transform: rotateX(0deg);
}

/* 信封左右与底边挡板叠层效果 */
.envelope-front {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 275px solid #F6D3D9;
  border-right: 275px solid #F6D3D9;
  border-bottom: 190px solid #F2C8D0;
  border-radius: 0 0 16px 16px;
  z-index: 3;
}

/* 拟物化樱花火漆印章 (Wax Seal) */
.wax-seal {
  position: absolute;
  top: 175px;
  left: calc(50% - 32px);
  width: 64px;
  height: 64px;
  background: radial-gradient(circle, #E04D6C 30%, #C02C4B 90%);
  border-radius: 50%;
  z-index: 5;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(0,0,0,0.25), inset 1px 1px 3px rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: #FFA3B7;
  text-shadow: 1px 2px 4px rgba(0,0,0,0.3);
  transition: var(--transition-bouncy);
}

.wax-seal:hover {
  transform: scale(1.1) rotate(10deg);
}

/* 信件/信卡主体 (Letter Card) */
.letter-card {
  position: absolute;
  top: 10px;
  width: 96%;
  left: 2%;
  height: 360px;
  background: #FFFBF6; /* 宣纸象牙白 */
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  padding: 30px;
  z-index: 2;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              width 0.8s ease-in-out, 
              height 0.8s ease-in-out, 
              top 0.8s ease-in-out;
  overflow: hidden;
  transform: translateY(0);
}

/* ================= 2. 动画播放后的展开状态 ================= */
.scene.open .envelope-flap {
  transform: rotateX(180deg);
  z-index: 1; /* 翻开后移到信件后方 */
  opacity: 0;
  visibility: hidden;
  transition: transform 0.5s ease-in-out, opacity 0.4s ease, visibility 0.4s ease;
}

.scene.open .envelope-front {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.scene.open .wax-seal {
  opacity: 0;
  transform: scale(0.5) translateY(20px);
  pointer-events: none;
}

.scene.open .letter-card {
  top: -150px;
  width: 100%;
  left: 0;
  height: auto;
  min-height: 700px;
  z-index: 10;
  transform: translateY(0);
  padding: 50px 60px; /* 调宽左右内边距，提升大屏排版舒适度 */
  overflow: visible;
  border: 1px solid var(--neumorphic-border-dark);
  box-shadow: 0 30px 60px rgba(0,0,0,0.15);
  background: var(--bg-secondary);
}

.scene.open .envelope-wrapper {
  width: 1200px; /* 从 550px 渐变过渡到 1200px，使用绝对像素单位确保过渡动画在所有浏览器生效 */
  max-width: 95%; /* 确保在小屏幕/移动端自适应收缩，不超出视口 */
  box-shadow: none;
  background: transparent;
}

/* ================= 3. 信件内页排版 ================= */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed rgba(229,194,200,0.5);
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.title-section h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent-pink-dark);
  margin-bottom: 8px;
}

.meta-info {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.meta-info span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 拟物化关闭/返回按钮 */
.close-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: var(--neumorphic-border);
  box-shadow: var(--shadow-flat);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-primary);
  transition: var(--transition-bouncy);
}

.close-btn:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: var(--shadow-hover);
  color: var(--accent-pink-dark);
}

.close-btn:active {
  transform: scale(0.95);
  box-shadow: var(--shadow-active);
}

/* 顶图横幅 */
.detail-banner {
  width: 100%;
  height: clamp(260px, 35vw, 450px); /* 响应式自适应高度，在大屏幕上展示更大格局，填补空白 */
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 10px 25px rgba(229, 194, 200, 0.4);
  margin-bottom: 30px;
}

/* 引言框 */
.quote-box {
  background: var(--bg-primary);
  border-left: 6px solid var(--accent-pink);
  padding: 20px 24px;
  border-radius: 12px;
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sunken);
  position: relative;
}

.quote-box::before {
  content: '“';
  font-size: 4rem;
  position: absolute;
  left: 8px;
  top: -15px;
  color: rgba(255, 139, 164, 0.15);
  font-family: Georgia, serif;
}

/* 正文段落 */
.detail-body {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text-secondary);
}

.detail-body p {
  margin-bottom: 24px;
}

.detail-body h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 40px 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-body h2::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 24px;
  background: var(--accent-pink);
  border-radius: 4px;
}

/* 移动端适配 */
@media (max-width: 600px) {
  .envelope-wrapper {
    width: 340px;
    height: 240px;
  }
  .envelope-flap {
    border-left-width: 170px;
    border-right-width: 170px;
    border-top-width: 120px;
  }
  .envelope-front {
    border-left-width: 170px;
    border-right-width: 170px;
    border-bottom-width: 120px;
  }
  .wax-seal {
    top: 95px;
    left: calc(50% - 24px);
    width: 48px;
    height: 48px;
    font-size: 1.6rem;
  }
  .letter-card {
    height: 220px;
  }
  .scene.open .letter-card {
    top: -80px;
    padding: 20px;
  }
  .title-section h1 {
    font-size: 1.6rem;
  }
  .detail-banner {
    height: 200px;
  }
}
