/* ═══════════════════════════════════════════════
   婚礼邀请函 · 样式
   设计：现代简约 · 米白 + 玫瑰金
   ═══════════════════════════════════════════════ */

:root {
  /* 色板 */
  --bg: #faf7f2;
  --bg-soft: #f3ede4;
  --ink: #2b2723;
  --ink-soft: #6f655c;
  --gold: #c08a5e;
  --gold-deep: #a9714a;
  --gold-soft: rgba(192, 138, 94, 0.14);
  --line: rgba(43, 39, 35, 0.12);

  /* 字体 */
  --font-serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-script: "Great Vibes", cursive;

  /* 动效 */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur: 0.7s;

  /* 尺寸 */
  --radius: 18px;
  --max-w: 1080px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-weight: 300;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.8;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

/* 滚动渐入基础状态（JS 负责加 .in 类） */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  filter: blur(6px);
  transition:
    opacity var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out),
    filter var(--dur) var(--ease-out);
  will-change: opacity, transform, filter;
}
.reveal.in {
  opacity: 1;
  transform: none;
  filter: none;
}
/* 交错延迟工具类 */
.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }
.reveal.d4 { transition-delay: 0.32s; }

.container {
  width: min(var(--max-w), 100% - 2.5rem);
  margin-inline: auto;
}
.container--narrow { --max-w: 760px; }

/* 章节通用 */
.section { padding: clamp(4rem, 10vw, 7.5rem) 0; position: relative; }

.section__tag {
  font-family: var(--font-script);
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.08em;
}

.section__title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  text-align: center;
  margin: 0.35rem 0 1.1rem;
  letter-spacing: 0.12em;
}

.section__sub {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-bottom: 2.5rem;
}

/* ═══════════ 全局飘落粒子 ═══════════ */
#petals {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}

/* ═══════════ 封面 ═══════════ */
.hero {
  position: relative;
  min-height: 100svh;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 柔和渐变背景 + 光晕 */
.hero__bg {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(42% 42% at 22% 18%, rgba(192, 138, 94, 0.16), transparent 70%),
    radial-gradient(38% 38% at 82% 82%, rgba(192, 138, 94, 0.12), transparent 70%),
    linear-gradient(160deg, #fdfbf7 0%, #f6efe6 55%, #efe5d6 100%);
  animation: heroBreathe 9s ease-in-out infinite;
}
@keyframes heroBreathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.045); }
}

/* ─── 信封 ─── */
.envelope {
  position: relative;
  width: min(320px, 74vw);
  aspect-ratio: 10 / 6.6;
  cursor: pointer;
  z-index: 3;
  transition: opacity 0.6s ease, transform 0.6s ease;
  animation: envelopeFloat 3.4s ease-in-out infinite;
}
@keyframes envelopeFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}
.envelope:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; border-radius: 14px; }

.envelope__body {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, #fdfaf5, #f2e8da);
  box-shadow: 0 24px 60px -18px rgba(43, 39, 35, 0.35);
  border: 1px solid rgba(192, 138, 94, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  overflow: hidden;
}
/* 信封翻盖 */
.envelope__flap {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  background: linear-gradient(180deg, #f6ecdd, #ead9c2);
  border-radius: 14px;
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 0.85s var(--ease-out);
  z-index: 2;
}
.envelope--open .envelope__flap { transform: rotateX(180deg); }

.envelope__seal {
  position: relative;
  z-index: 3;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #d9a878, var(--gold) 62%, var(--gold-deep));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 22px -6px rgba(192, 138, 94, 0.75), inset 0 2px 4px rgba(255, 255, 255, 0.4);
  transition: transform 0.5s var(--ease-spring), opacity 0.4s ease;
}
.envelope__seal svg { fill: #fff; }
.envelope--open .envelope__seal { transform: scale(0.4) rotate(18deg); opacity: 0; }

.envelope__hint {
  position: relative;
  z-index: 3;
  font-size: 0.85rem;
  color: var(--ink-soft);
  letter-spacing: 0.22em;
  animation: hintPulse 1.8s ease-in-out infinite;
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
.envelope--open { animation: none; opacity: 0; transform: translateY(-26px) scale(0.94); pointer-events: none; }

/* ─── 主视觉 ─── */
.hero__inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96);
  transition: opacity 0.9s ease 0.15s, transform 0.9s var(--ease-out) 0.15s, visibility 0s linear 0.15s;
}
.hero__inner.show { opacity: 1; visibility: visible; transform: none; }

.hero__eyebrow {
  font-family: var(--font-script);
  font-size: clamp(1.3rem, 4vw, 1.9rem);
  color: var(--gold);
  letter-spacing: 0.06em;
  margin-bottom: 0.9rem;
}

.hero__names {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2.1rem, 9vw, 3.9rem);
  letter-spacing: 0.14em;
  line-height: 1.3;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.35em 0.6em;
}
/* 名字逐字浮现 */
.hero__name { display: inline-block; white-space: nowrap; }
.hero__name .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.6em) rotate(6deg);
  filter: blur(6px);
  animation: chIn 0.7s var(--ease-spring) forwards;
}
@keyframes chIn {
  to { opacity: 1; transform: none; filter: none; }
}
.hero__amp {
  font-family: var(--font-script);
  color: var(--gold);
  font-weight: 400;
  font-size: 0.9em;
  opacity: 0;
  animation: ampIn 0.8s ease 0.7s forwards;
}
@keyframes ampIn { to { opacity: 1; } }

.hero__divider {
  margin: 1.1rem 0 0.9rem;
  color: var(--gold);
  stroke: var(--gold);
}
.hero__divider svg { overflow: visible; }
.hero__divider line { stroke: currentColor; stroke-width: 1; stroke-dasharray: 60; stroke-dashoffset: 60; }
.hero__divider path { fill: currentColor; transform-origin: center; scale: 0; opacity: 0; }
.hero__inner.show .hero__divider line { animation: draw 1.1s var(--ease-out) 0.5s forwards; }
.hero__inner.show .hero__divider path { animation: diamondIn 0.5s var(--ease-spring) 1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes diamondIn { to { scale: 1; opacity: 1; } }

.hero__date {
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 3vw, 1.1rem);
  letter-spacing: 0.3em;
  margin-bottom: 1.8rem;
  opacity: 0;
  transition: opacity 0.8s ease 1.15s;
}
.hero__inner.show .hero__date { opacity: 1; }

.hero__cta { opacity: 0; transition: opacity 0.6s ease 1.35s, transform 0.35s ease, box-shadow 0.35s ease; }
.hero__inner.show .hero__cta { opacity: 1; }

/* ═══════════ 按钮 ═══════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 2.3rem;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-decoration: none;
  cursor: pointer;
  border: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s ease;
}
.btn:hover { transform: translateY(-3px); }
.btn:active { transform: translateY(-1px) scale(0.98); }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn--ghost:hover { border-color: var(--gold); color: var(--gold-deep); box-shadow: 0 10px 24px -14px rgba(192, 138, 94, 0.6); }

/* ═══════════ 邀请语 ═══════════ */
.invite { text-align: center; }
.invite__text {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 3.4vw, 1.35rem);
  line-height: 2.3;
  color: var(--ink);
  margin: 1.6rem 0 2.2rem;
}
.invite__names {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.3rem, 4.5vw, 1.8rem);
  letter-spacing: 0.2em;
}
.invite__heart {
  color: var(--gold);
  font-size: 1.1em;
  animation: heartbeat 1.6s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14%      { transform: scale(1.28); }
  28%      { transform: scale(1); }
  42%      { transform: scale(1.22); }
  56%      { transform: scale(1); }
}
.invite__date {
  margin-top: 1.4rem;
  color: var(--ink-soft);
  letter-spacing: 0.32em;
  font-size: 0.95rem;
}

/* ═══════════ 新人 ═══════════ */
.couple__grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.5rem, 5vw, 3.5rem);
  flex-wrap: wrap;
  margin-top: 2.2rem;
}
.couple__card {
  text-align: center;
  width: min(240px, 70vw);
}
.couple__photo {
  position: relative;
  width: min(200px, 60vw);
  aspect-ratio: 1;
  margin-inline: auto;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid transparent;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    linear-gradient(135deg, #e8cdaa, var(--gold), #e8cdaa) border-box;
  box-shadow: 0 18px 40px -18px rgba(43, 39, 35, 0.3);
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s ease;
}
.couple__photo:hover { transform: translateY(-8px) scale(1.03); box-shadow: 0 26px 50px -20px rgba(192, 138, 94, 0.5); }
.couple__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* 图片缺失时的占位 */
.couple__photo img[data-missing="1"] { display: none; }
.couple__photo:has(img[data-missing="1"]) .couple__initial { display: grid; }
.couple__initial {
  display: none;
  place-items: center;
  position: absolute;
  inset: 0;
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 700;
  color: var(--gold-deep);
  background:
    radial-gradient(circle at 30% 25%, rgba(192, 138, 94, 0.22), transparent 65%),
    var(--bg-soft);
}
.couple__name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.2em;
  margin: 1.1rem 0 0.2rem;
}
.couple__desc { color: var(--ink-soft); font-size: 0.9rem; }

.couple__symbol {
  color: var(--gold);
  filter: drop-shadow(0 6px 14px rgba(192, 138, 94, 0.4));
  animation: heartbeat 1.9s ease-in-out infinite;
}
.couple__symbol svg { fill: var(--gold); }

/* ═══════════ 时间地点 ═══════════ */
.info__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}
.info__card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2.4rem 1.8rem;
  text-align: center;
  overflow: hidden;
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s ease;
}
/* 悬浮光晕跟随鼠标（JS 设置 --mx / --my） */
.info__card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(192, 138, 94, 0.14), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.info__card:hover { transform: translateY(-8px); box-shadow: 0 24px 50px -22px rgba(43, 39, 35, 0.25); }
.info__card:hover::before { opacity: 1; }

.info__icon {
  width: 66px;
  height: 66px;
  margin: 0 auto 1.1rem;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold-deep);
  display: grid;
  place-items: center;
}
.info__card h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0.22em;
  font-size: 1.05rem;
  color: var(--ink-soft);
}
.info__big {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.5rem, 5vw, 2rem);
  letter-spacing: 0.1em;
  margin: 0.6rem 0;
  color: var(--ink);
}
.info__card p { color: var(--ink-soft); font-size: 0.92rem; }
.info__link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--gold-deep);
  text-decoration: none;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  border-bottom: 1px dashed var(--gold);
  padding-bottom: 2px;
  transition: letter-spacing 0.3s ease;
}
.info__link:hover { letter-spacing: 0.16em; }

/* ═══════════ 倒计时 ═══════════ */
.countdown {
  background:
    radial-gradient(60% 90% at 50% 0%, rgba(192, 138, 94, 0.12), transparent 70%),
    var(--bg-soft);
}
.countdown__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.6rem, 3vw, 1.4rem);
  max-width: 560px;
  margin: 2.4rem auto 0;
}
.countdown__cell {
  text-align: center;
  padding: 1.2rem 0.4rem 1rem;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px -18px rgba(43, 39, 35, 0.28);
}
.countdown__num {
  display: block;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2rem, 9vw, 3rem);
  color: var(--gold-deep);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  transition: transform 0.4s var(--ease-out);
}
/* 数字跳动（JS 切换 class） */
.countdown__num.tick { transform: translateY(-5px) scale(1.08); }

.countdown__label {
  display: block;
  margin-top: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
  letter-spacing: 0.3em;
}

/* ═══════════ 相册 ═══════════ */
.gallery__strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(300px, 78vw);
  gap: 1.1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0.8rem 1rem 1.4rem;
  margin-inline: -1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
  cursor: grab;
}
.gallery__strip:active { cursor: grabbing; }
.gallery__strip::-webkit-scrollbar { height: 6px; }
.gallery__strip::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 99px; }

.gallery__item {
  scroll-snap-align: center;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(192, 138, 94, 0.06) 12px, rgba(192, 138, 94, 0.06) 24px),
    #fff;
  border: 1.5px dashed rgba(192, 138, 94, 0.5);
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s ease;
}
.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease-out);
}
.gallery__item:hover { transform: translateY(-6px) scale(1.015); box-shadow: 0 22px 44px -20px rgba(43, 39, 35, 0.35); }
.gallery__item:hover img { transform: scale(1.08); }

/* 图片缺失时的占位 */
.gallery__item img[data-missing="1"] { display: none; }
.gallery__item:has(img[data-missing="1"])::after {
  content: "照片占位";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.3em;
}

/* ═══════════ 流程时间线 ═══════════ */
.timeline__list {
  list-style: none;
  position: relative;
  margin-top: 2.4rem;
  padding-left: 0;
}
/* 竖线描边动画 */
.timeline__list::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 6px;
  bottom: 6px;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, var(--gold) 12%, var(--gold) 88%, transparent);
  opacity: 0;
  transition: opacity 0.6s ease;
}
.timeline.in .timeline__list::before { opacity: 1; }

.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  align-items: start;
  gap: 1rem;
  padding: 1.4rem 0;
}
.timeline__item time {
  text-align: right;
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--gold-deep);
  letter-spacing: 0.12em;
  padding-top: 0.15rem;
}
.timeline__item time::after { content: ""; } /* 移动端隐藏时间的占位 */

.timeline__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--gold);
  justify-self: center;
  margin-top: 0.3rem;
  box-shadow: 0 0 0 0 rgba(192, 138, 94, 0.5);
  animation: dotPulse 2.4s ease-out infinite;
}
@keyframes dotPulse {
  0%   { box-shadow: 0 0 0 0 rgba(192, 138, 94, 0.45); }
  70%  { box-shadow: 0 0 0 12px rgba(192, 138, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 138, 94, 0); }
}

.timeline__body h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
}
.timeline__body p { color: var(--ink-soft); font-size: 0.9rem; }

/* 奇数项内容在左，偶数项在右 */
.timeline__item:nth-child(odd) .timeline__body { grid-column: 3; }
.timeline__item:nth-child(odd) time { grid-column: 1; grid-row: 1; }
.timeline__item:nth-child(even) .timeline__body { grid-column: 1; grid-row: 1; }
.timeline__item:nth-child(even) time { grid-column: 3; grid-row: 1; text-align: left; }
.timeline__item .timeline__dot { grid-column: 2; grid-row: 1; }

/* ═══════════ 结尾 ═══════════ */
.footer {
  text-align: center;
  padding: clamp(4rem, 9vw, 6rem) 0;
  background:
    radial-gradient(50% 80% at 50% 110%, rgba(192, 138, 94, 0.18), transparent 70%),
    var(--bg);
}
.footer__heart {
  color: var(--gold);
  font-size: 1.6rem;
  margin-bottom: 1rem;
  animation: heartbeat 1.7s ease-in-out infinite;
}
.footer__text {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  letter-spacing: 0.2em;
  margin-bottom: 0.6rem;
}
.footer__names {
  font-family: var(--font-script);
  font-size: clamp(1.6rem, 6vw, 2.3rem);
  color: var(--gold);
  letter-spacing: 0.08em;
}
.footer__meta {
  margin-top: 0.8rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  letter-spacing: 0.3em;
}

/* ═══════════════════════════════════════════════
   响应式
   ═══════════════════════════════════════════════ */

@media (max-width: 640px) {
  .gallery__strip { grid-auto-columns: min(260px, 74vw); }
  .timeline__item { grid-template-columns: 1fr 32px 1fr; gap: 0.7rem; }
  .hero__names { gap: 0.2em 0.5em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; filter: none; }
  #petals { display: none; }
  .envelope { animation: none; }
}
