/* ============================================================
   李逸轩 & 任梓萱 · 婚礼请柬  —  移动端优先样式
   ============================================================ */

:root {
  --red: #8c1c24;
  --red-soft: #b4404a;
  --gold: #b78d4e;
  --gold-light: #d9bb86;
  --ink: #4a3b33;
  --ink-soft: #7d6a5f;
  --paper: #fdf8f2;
  --paper-2: #f7ece1;
  --line: rgba(183, 141, 78, .34);

  --f-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", "Source Han Serif SC", serif;
  --f-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --pad: 22px;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  font-family: var(--f-serif);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.85;
  overflow-x: hidden;
  /* 纸纹质感 */
  background-image:
    radial-gradient(circle at 12% 8%, rgba(183,141,78,.10), transparent 42%),
    radial-gradient(circle at 88% 22%, rgba(140,28,36,.07), transparent 40%),
    radial-gradient(circle at 50% 96%, rgba(183,141,78,.09), transparent 45%);
  background-attachment: fixed;
}

img { max-width: 100%; display: block; }
svg { width: 1em; height: 1em; }

/* ---------- 花瓣画布 ---------- */
#petals {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 3;
}

/* ---------- 音乐按钮 ---------- */
.music-btn {
  position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px;
  z-index: 20;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(253, 248, 242, .82);
  backdrop-filter: blur(8px);
  color: var(--red);
  cursor: pointer;
}
.music-btn .ico-note { width: 20px; height: 20px; }
.music-btn .music-ring {
  position: absolute; inset: -1px;
  border-radius: 50%;
  border: 1px solid transparent;
}
.music-btn[aria-pressed="true"] .ico-note { animation: spin 4.5s linear infinite; }
.music-btn[aria-pressed="true"] .music-ring {
  border-color: var(--gold);
  animation: pulse 1.9s ease-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%   { transform: scale(1);    opacity: .8; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* ============ 封面 ============ */
.cover {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 64px var(--pad) 96px;
  text-align: center;
  overflow: hidden;
}
.cover::before {
  /* 外层描边框 */
  content: "";
  position: absolute; inset: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  pointer-events: none;
}
.cover::after {
  content: "";
  position: absolute; inset: 22px;
  border: 1px solid rgba(183,141,78,.16);
  border-radius: 4px;
  pointer-events: none;
}

.cover-frame { position: relative; z-index: 2; width: 100%; max-width: 460px; }

/* 封面背景照（轻柔水印，不影响文字可读性） */
.cover-photo {
  position: absolute; inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(180deg, rgba(253,248,242,.93), rgba(253,248,242,.86) 46%, rgba(253,248,242,.97)),
    url("assets/photos/1.jpg");
  background-size: cover, cover;
  background-position: center, center 18%;
  background-repeat: no-repeat, no-repeat;
}

.cover-seal {
  width: 62px; height: 62px;
  margin: 0 auto 26px;
  display: grid; place-items: center;
  font-size: 30px; line-height: 1;
  color: #fff;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(140,28,36,.12), 0 8px 22px rgba(140,28,36,.24);
  animation: sealIn 1s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes sealIn {
  from { opacity: 0; transform: scale(.5) rotate(-25deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}

.cover-kicker {
  font-family: var(--f-sans);
  font-size: 11px; letter-spacing: .38em;
  color: var(--gold);
  text-indent: .38em;
  margin-bottom: 20px;
}

.names {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; flex-wrap: wrap;
}
.names .name {
  font-size: clamp(26px, 8.4vw, 40px);
  letter-spacing: .1em;
  font-weight: 600;
  color: var(--ink);
  text-indent: .1em;
  white-space: nowrap; /* 保证姓名不被拆字，空间不够时整个名字换行 */
}
.names .amp {
  font-family: var(--f-sans);
  font-size: 22px; color: var(--red-soft);
  transform: translateY(-2px);
}

.cover-rule {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin: 22px auto 24px;
  max-width: 240px;
  color: var(--gold);
}
.cover-rule i { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-light), transparent); }
.cover-rule span { font-size: 12px; }

.cover-date { display: grid; gap: 6px; }
.cd-y {
  font-family: var(--f-sans);
  font-size: 12px; letter-spacing: .5em; color: var(--ink-soft);
  text-indent: .5em;
}
.cd-md {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 40px; line-height: 1.1; color: var(--red);
}
.cd-md b { font-weight: 600; }
.cd-md i { font-style: normal; font-size: 24px; color: var(--gold); }
.cd-w { font-size: 14px; color: var(--ink-soft); letter-spacing: .14em; }

.cover-place {
  margin-top: 20px;
  font-size: 14px; color: var(--ink-soft); letter-spacing: .08em;
}

.scroll-hint {
  position: absolute; bottom: calc(30px + var(--safe-b)); left: 0; right: 0;
  z-index: 2;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 12px; letter-spacing: .22em;
  display: grid; gap: 8px; justify-items: center;
  animation: floatY 2.4s ease-in-out infinite;
}
.scroll-hint .arrow {
  width: 9px; height: 9px;
  border-right: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  transform: rotate(45deg);
}
@keyframes floatY {
  0%,100% { transform: translateY(0); opacity: .85; }
  50%     { transform: translateY(7px); opacity: 1; }
}

/* ============ 通用区块 ============ */
.sect { padding: 52px var(--pad); position: relative; z-index: 2; }

.sect-title {
  text-align: center;
  font-size: 17px; font-weight: 600;
  letter-spacing: .2em; text-indent: .2em;
  color: var(--red);
  margin-bottom: 26px;
}
.sect-title span { position: relative; padding: 0 4px; }
.sect-title span::before,
.sect-title span::after {
  content: "";
  position: absolute; top: 50%;
  width: 26px; height: 1px;
  background: var(--gold-light);
}
.sect-title span::before { right: 100%; margin-right: 12px; }
.sect-title span::after  { left: 100%;  margin-left: 12px; }

.card {
  max-width: 480px; margin: 0 auto;
  padding: 32px 24px;
  background: linear-gradient(160deg, #fffdfa, var(--paper-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 34px rgba(140, 90, 40, .10);
}

/* ---------- 请柬正文 ---------- */
.invite-text {
  text-align: center;
  font-size: 15.5px;
  color: var(--ink);
  margin-bottom: 20px;
}
.invite-text b { color: var(--red); font-weight: 600; }
.invite-sign {
  text-align: right;
  margin-top: 26px;
  font-size: 14px; color: var(--ink-soft); letter-spacing: .1em;
}

/* ---------- 新人 ---------- */
.couple-wrap {
  display: flex; align-items: flex-start; justify-content: center;
  gap: 10px;
  max-width: 480px; margin: 0 auto;
}
.person { flex: 1 1 0; min-width: 0; text-align: center; }
.avatar {
  width: min(38vw, 132px); height: min(38vw, 132px);
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--paper-2), #efdfcd);
  border: 1px solid var(--line);
  box-shadow: 0 0 0 5px rgba(255,255,255,.7), 0 8px 22px rgba(140,90,40,.14);
  overflow: hidden;
  position: relative;
}
.avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.person figcaption b {
  display: block; font-size: 18px; font-weight: 600; letter-spacing: .12em;
}
.person figcaption small {
  display: block;
  font-family: var(--f-sans);
  font-size: 10px; letter-spacing: .24em; color: var(--gold);
  margin: 4px 0 8px;
}
.person figcaption p { font-size: 13px; color: var(--ink-soft); line-height: 1.7; }

.heart {
  flex: 0 0 auto;
  margin-top: min(17vw, 56px);
  color: var(--red-soft);
  font-size: 22px;
  animation: beat 1.6s ease-in-out infinite;
}
@keyframes beat {
  0%,100% { transform: scale(1); }
  25%     { transform: scale(1.18); }
  50%     { transform: scale(1); }
}

/* ---------- 倒计时 ---------- */
.countdown {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; text-align: center;
}
.cu {
  padding: 14px 4px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.cu b {
  display: block;
  font-family: var(--f-sans);
  font-size: 25px; font-weight: 600; line-height: 1.25;
  color: var(--red);
  font-variant-numeric: tabular-nums;
}
.cu small { font-size: 11px; color: var(--ink-soft); letter-spacing: .1em; }
.count-note {
  text-align: center; margin-top: 16px;
  font-size: 13px; color: var(--ink-soft); letter-spacing: .1em;
}

/* ---------- 日程时间轴 ---------- */
.timeline {
  list-style: none;
  max-width: 480px; margin: 0 auto;
  padding-left: 8px;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute; left: 62px; top: 10px; bottom: 10px;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--gold-light) 12%, var(--gold-light) 88%, transparent);
}
.timeline li {
  display: flex; gap: 20px;
  padding: 12px 0;
  position: relative;
}
.tl-time {
  flex: 0 0 46px;
  font-family: var(--f-sans);
  font-size: 14px; font-weight: 600;
  color: var(--red);
  text-align: right;
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}
.timeline li::before {
  content: "";
  position: absolute; left: 58px; top: 12px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--red-soft);
  z-index: 1;
}
.tl-body { flex: 1 1 auto; padding-left: 8px; }
.tl-body b { font-size: 15.5px; font-weight: 600; letter-spacing: .06em; }
.tl-body p { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

.sched-tip {
  text-align: center; margin-top: 20px;
  font-size: 12px; color: var(--ink-soft); opacity: .8;
}

/* ---------- 地点 ---------- */
.place .card { text-align: center; }
.venue-name { font-size: 20px; font-weight: 600; letter-spacing: .1em; }
.venue-hall {
  font-size: 14px; color: var(--red-soft);
  letter-spacing: .16em; margin-top: 4px;
}
.venue-addr {
  font-size: 14px; color: var(--ink-soft);
  margin: 14px auto 22px; max-width: 300px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.place-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  padding: 0 20px;
  font-family: var(--f-serif);
  font-size: 14.5px; letter-spacing: .1em;
  color: var(--red);
  background: rgba(255,255,255,.8);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.965); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--red-soft), var(--red));
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(140,28,36,.26);
}

/* ---------- 相册 ---------- */
.album-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-width: 480px; margin: 0 auto;
}
.ph {
  margin: 0;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, var(--paper-2), #ecdac5);
  position: relative; overflow: hidden;
  cursor: zoom-in;
}
.ph img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.ph:active img { transform: scale(1.04); }
.ph figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 8px 8px;
  font-size: 12.5px; letter-spacing: .2em; text-indent: .2em;
  color: #fff; text-align: center;
  background: linear-gradient(180deg, transparent, rgba(74,59,51,.62));
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}

/* ---------- 页脚 ---------- */
.foot {
  position: relative; z-index: 2;
  text-align: center;
  padding: 46px var(--pad) calc(46px + var(--safe-b));
  background: linear-gradient(180deg, transparent, rgba(183,141,78,.10));
  border-top: 1px solid var(--line);
}
.foot-seal {
  width: 40px; height: 40px; margin: 0 auto 16px;
  display: grid; place-items: center;
  font-size: 19px; color: var(--red);
  border: 1px solid var(--line);
  border-radius: 50%;
}
.foot p { font-size: 16px; letter-spacing: .14em; }
.foot-sub { font-size: 12.5px !important; color: var(--ink-soft); margin-top: 8px; }
.foot-thanks {
  font-size: 13px !important; color: var(--gold);
  letter-spacing: .3em !important; text-indent: .3em;
  margin-top: 18px;
}

/* ---------- 图片查看器 ---------- */
.lightbox {
  position: fixed; inset: 0;
  z-index: 60;
  background: rgba(30, 22, 18, .94);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 12px calc(24px + var(--safe-b));
  opacity: 0;
  transition: opacity .26s ease;
}
.lightbox[hidden] { display: none; }
.lightbox.show { opacity: 1; }
.lightbox img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.lb-close {
  position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  font-size: 26px; line-height: 1;
  color: #fff;
  background: rgba(255,255,255,.14);
  border: 0; border-radius: 50%;
  cursor: pointer;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(34px + var(--safe-b));
  transform: translate(-50%, 14px);
  z-index: 50;
  max-width: 78vw;
  padding: 10px 20px;
  font-size: 14px; letter-spacing: .06em;
  color: #fff;
  background: rgba(74, 59, 51, .93);
  border-radius: 999px;
  opacity: 0; pointer-events: none;
  transition: opacity .24s ease, transform .24s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 滚动入场 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2,.8,.2,1);
  transition-delay: var(--d, 0s);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ---------- 小屏微调 ---------- */
@media (max-width: 340px) {
  :root { --pad: 16px; }
  .names .name { font-size: 25px; }
  .cd-md { font-size: 33px; }
  .cu b { font-size: 21px; }
  .timeline::before { left: 54px; }
  .timeline li::before { left: 50px; }
  .tl-time { flex-basis: 40px; }
}

/* ---------- 平板 / 桌面 ---------- */
@media (min-width: 720px) {
  :root { --pad: 32px; }
  .sect { padding: 68px var(--pad); }
  .card { padding: 42px 40px; }
  .invite-text { font-size: 16.5px; }
  .album-grid { grid-template-columns: repeat(4, 1fr); max-width: 880px; }
  .couple-wrap { gap: 28px; max-width: 620px; }
}
