/* ============ 基础 ============ */
:root {
  --paper: #eee6d9;
  --paper-2: #e5dbcb;
  --card: #f5efe5;
  --ink: #2a2421;
  --ink-2: #554a40;
  --ink-3: #8c8075;
  --line: rgba(42, 36, 33, .32);
  --hair: rgba(42, 36, 33, .16);
  --wine: #7a1d22;
  --thread: #9a2328;
  --gold: #b39463;
  --film: #1c1815;
  --amber: #d6a35c;
  --sans: "Jost", "Helvetica Neue", "PingFang SC", Arial, sans-serif;
  --serif-en: "Cormorant Garamond", "Times New Roman", serif;
  --script: "Pinyon Script", "Snell Roundhand", "Apple Chancery", cursive;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --paper-bg: var(--paper) url("../images/paper.jpg") repeat 0 0 / 300px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* 信封内衬：米色纸 + 酒红小点 */
  --lining: radial-gradient(circle, rgba(122, 29, 34, .28) 1px, transparent 1.5px) 0 0 / 10px 10px, linear-gradient(160deg, #f1e8da, #e2d4bd);
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html.locked, html.locked body { overflow: hidden; }
body {
  font-family: var(--serif);
  color: var(--ink);
  background: #191512;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }

/* 桌面端：两侧是虚化的封面照片，中间是手机宽度的请柬 */
.backdrop {
  position: fixed; inset: -40px; z-index: -1;
  background: #2a241f center / cover;
  filter: blur(40px) brightness(.45);
}
#app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  background: var(--paper-bg);
  overflow-x: clip;
  box-shadow: 0 0 80px rgba(0, 0, 0, .5);
}

/* 通用小字 */
.kicker { font: 400 10px/1.4 var(--sans); letter-spacing: .48em; margin-right: -.48em; text-transform: uppercase; color: var(--ink-3); }
.display { font: 200 34px/1.1 var(--sans); letter-spacing: .3em; margin-right: -.3em; text-transform: uppercase; color: var(--ink); }
.sub-zh { margin-top: 10px; font-size: 13px; letter-spacing: .5em; margin-right: -.5em; color: var(--ink-2); }
.sec-head { text-align: center; margin-bottom: 40px; }

/* 封面上轻微跳动的胶片颗粒（照片本身已经带有颗粒，这一层让它像在放映） */
.grain { position: relative; overflow: hidden; }
.grain::after {
  content: ""; position: absolute; inset: -50%;
  background: var(--grain);
  opacity: .2; mix-blend-mode: overlay; pointer-events: none;
  animation: grain 1.2s steps(5) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* 手绘线条：滚动到时一笔画出 */
.draw path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 2.6s cubic-bezier(.45, .05, .25, 1); }
.draw.in path { stroke-dashoffset: 0; }

/* ============ 信封开场 ============ */
.env-screen {
  position: fixed; top: 0; bottom: 0; left: 0; right: 0; z-index: 50;
  width: 100%; max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(ellipse 70% 45% at 50% 56%, rgba(250, 245, 236, .7), rgba(250, 245, 236, 0)), var(--paper-bg);
  cursor: pointer;
  text-align: center;
  overflow: hidden;
  transition: opacity 1.1s ease, visibility 1.1s ease;
}
.env-screen.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.env-screen:focus { outline: none; }
.env-screen:focus-visible .env { outline: 1px solid var(--ink-3); outline-offset: 8px; }
.env-frame { position: absolute; inset: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); border: 1px solid var(--hair); pointer-events: none; animation: fadeIn 1.4s ease .2s both; }

.intro { animation: introUp 1s var(--ease-out) both; animation-delay: var(--d, 0s); }
@keyframes introUp { from { opacity: 0; transform: translateY(14px); } }
@keyframes fadeIn { from { opacity: 0; } }

.env-title .names { margin-top: 16px; font: 400 21px/1.4 var(--serif); letter-spacing: .2em; margin-right: -.2em; }
.env-title .names i { font: italic 400 22px var(--serif-en); color: var(--ink-3); margin: 0 .5em; }
.env-title .env-date { margin-top: 6px; font: 300 12px/1.4 var(--sans); letter-spacing: .42em; margin-right: -.42em; color: var(--ink-3); }

.env-stage { position: relative; margin: 110px 0 40px; animation: envDrop 1.2s cubic-bezier(.2, .8, .25, 1) .35s both; }
@keyframes envDrop { from { opacity: 0; transform: translateY(-36px) scale(.94) rotate(-2deg); } }
.env-float { animation: float 4.6s ease-in-out 1.6s infinite; }
@keyframes float { 50% { transform: translateY(-7px); } }
.env-shadow {
  position: absolute; left: 10%; right: 10%; bottom: -28px; height: 20px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(60, 30, 20, .3), rgba(60, 30, 20, 0));
  animation: shadow 4.6s ease-in-out 1.6s infinite;
}
@keyframes shadow { 50% { transform: scale(.88); opacity: .65; } }
.opening .env-float, .opening .env-shadow { animation-play-state: paused; }

.env { position: relative; width: min(78vw, 320px); aspect-ratio: 16 / 10.5; perspective: 1100px; }
.env svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.env-back { position: absolute; inset: 0; border-radius: 4px; background: var(--lining); box-shadow: 0 1px 2px rgba(60, 20, 10, .25); }
.env-card {
  position: absolute; left: 6%; right: 6%; top: 5%; bottom: 6%; z-index: 1;
  background: var(--card) url("../images/paper.jpg") 0 0 / 300px;
  border-radius: 2px;
  padding-top: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: 0 2px 10px rgba(40, 20, 10, .25);
  transition: transform 1.05s cubic-bezier(.22, .8, .24, 1) 1.1s;
}
.env-card::after { content: ""; position: absolute; inset: 6px; border: 1px solid var(--hair); pointer-events: none; }
.env-card .t { font: italic 300 34px/1 var(--serif-en); color: var(--ink); margin-bottom: 4px; }
.env-card .t small { display: block; font-size: 13px; line-height: 1.1; }
.env-card .d { font: 300 10px/1 var(--sans); letter-spacing: .4em; margin-right: -.4em; color: var(--ink-3); }
.env-pocket {
  position: absolute; inset: 0; z-index: 2; border-radius: 4px;
  background:
    linear-gradient(to right, rgba(30, 0, 0, .14), rgba(30, 0, 0, 0) 22%, rgba(30, 0, 0, 0) 78%, rgba(30, 0, 0, .14)),
    linear-gradient(165deg, #8f2a2e 0%, #761e23 60%, #64171b 100%);
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
}
.env-addr { position: absolute; left: 0; right: 0; bottom: 9%; font-size: 11px; letter-spacing: .36em; margin-right: -.36em; color: rgba(240, 224, 196, .85); }
.env-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 58%; z-index: 3;
  transform-origin: 50% 0; transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.5, .05, .3, 1) .45s, z-index 0s linear .9s;
}
.flap-face { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.flap-front { background: linear-gradient(180deg, #8a2629, #6a191d); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.flap-back { background: var(--lining); transform: rotateX(180deg); clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* 封蜡：点击后泛起金光，完整地缓缓升起、化开 */
.env-seal {
  position: absolute; left: 50%; top: 58%; z-index: 4;
  width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  display: grid; place-items: center;
  font: 600 25px/1 var(--serif); color: #6e1a1f;
  background: radial-gradient(circle at 35% 30%, #f3e2bd, #c9a468 55%, #957038);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .28), inset 0 0 0 4px rgba(255, 255, 255, .16), inset 0 0 0 5px rgba(110, 75, 30, .22);
  transition: transform .2s ease;
}
.env-screen:active .env-seal { transform: scale(.95); }
.env-seal::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, .5) 50%, rgba(255, 255, 255, 0) 62%) no-repeat;
  background-size: 260% 100%; background-position: 160% 0;
  animation: sheen 3.6s ease-in-out 2.2s infinite; pointer-events: none;
}
@keyframes sheen { 0% { background-position: 160% 0; } 45%, 100% { background-position: -60% 0; } }
.env-seal::before { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1.5px solid rgba(236, 210, 160, .95); opacity: 0; pointer-events: none; }
.env.open .env-seal { animation: sealLift 1.05s cubic-bezier(.3, .7, .3, 1) forwards; }
.env.open .env-seal::before { animation: ripple 1s ease-out forwards; }
.env.open .env-seal::after { opacity: 0; animation: none; }
@keyframes sealLift {
  0% { transform: none; }
  28% { transform: scale(1.12); box-shadow: 0 0 26px 8px rgba(255, 222, 160, .75), inset 0 0 0 4px rgba(255, 255, 255, .25); }
  100% { transform: translateY(-46px) scale(1.18); opacity: 0; box-shadow: 0 0 34px 14px rgba(255, 222, 160, 0); }
}
@keyframes ripple { from { opacity: .95; transform: scale(1); } to { opacity: 0; transform: scale(2.5); } }
.env.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.env.open .env-card { transform: translateY(-58%); }

.env-hint { font: 300 11px/1.4 var(--sans); letter-spacing: .4em; margin-right: -.4em; color: var(--ink-3); }
.env-hint.ok { animation: introUp 1s var(--ease-out) var(--d, 0s) both, pulse 2.4s ease-in-out 2.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* 点开之后：提示语马上淡出，键盘焦点框也收起，不抢开信封的戏 */
.opening .env-hint { animation: fadeOut .4s ease forwards; }
.env-screen.opening .env { outline: none; }
.exit .env-stage { animation: envOut 1.1s cubic-bezier(.4, 0, .2, 1) forwards; }
.exit .env-title, .exit .env-hint, .exit .env-frame { animation: fadeOut .5s ease forwards; }
@keyframes envOut { 30% { opacity: 1; } to { opacity: 0; transform: translateY(-8%) scale(1.32); } }
@keyframes fadeOut { to { opacity: 0; } }

.petals { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 56; pointer-events: none; }

/* ============ 封面（胶片照片 + 细体大字） ============ */
.cover { padding: max(14px, env(safe-area-inset-top)) 14px 0; }
.cover-photo { height: calc(100vh - 14px); height: calc(100svh - 14px); min-height: 560px; background: #2a241f; color: #fff; }
.cover-photo img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 44% 40%;
  opacity: 0; transform: scale(1.12);
  transition: opacity 1.8s ease .1s, transform 8s cubic-bezier(.2, .6, .2, 1) .1s;
}
.ready .cover-photo img { opacity: 1; transform: none; }
.cover-photo .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 14, 10, .5) 0%, rgba(20, 14, 10, .16) 21%, rgba(20, 14, 10, 0) 38%, rgba(20, 14, 10, 0) 58%, rgba(28, 19, 13, .3) 77%, rgba(28, 19, 13, .68) 100%); }
/* 照片内一圈细线，像装裱的内框 */
.cover-photo::before { content: ""; position: absolute; inset: 10px; z-index: 1; border: 1px solid rgba(255, 255, 255, .24); pointer-events: none; }

/* 标题：一行细衬线，& 用斜体；下面一行英文名，两侧短细线 */
.cover-head { position: absolute; z-index: 2; top: 8%; left: 0; right: 0; padding: 0 20px; text-align: center; text-shadow: 0 0 26px rgba(20, 12, 6, .42); }
.cover-title { font: 300 min(40px, 9.5vw)/1.12 var(--serif-en); letter-spacing: .01em; text-wrap: balance; }
.cover-title .amp { font-style: italic; font-size: 1.12em; margin: 0 .04em; }
.cover-names { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; font: 300 9px/1.6 var(--sans); letter-spacing: .5em; text-transform: uppercase; opacity: .92; }
.cover-names > span { margin-right: -.5em; }
.cover-names::before, .cover-names::after { content: ""; flex: none; width: 22px; height: 1px; background: rgba(255, 255, 255, .6); }

/* 日期：一根细线垂下来，引出日期 */
.cover-date { position: absolute; z-index: 2; left: 0; right: 0; bottom: 6.5%; text-align: center; text-shadow: 0 0 18px rgba(20, 12, 6, .5); }
.cover-date::before { content: ""; display: block; width: 1px; height: 34px; margin: 0 auto 16px; background: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, .8)); }
.cover-date .md { font: 200 30px/1 var(--sans); letter-spacing: .22em; margin-right: -.22em; }
.cover-date .sub { margin-top: 12px; font: 300 9px/1 var(--sans); letter-spacing: .48em; margin-right: -.48em; opacity: .88; }
.cover-date .sub i { display: inline-block; width: 18px; height: 1px; margin: 0 .95em 0 .45em; vertical-align: middle; background: currentColor; opacity: .7; }

/* 向下滑动提示：日期下面一个小箭头，轻轻上下浮动；开始滑动后淡出 */
.cover-cue { position: absolute; z-index: 2; left: 50%; bottom: 20px; width: 16px; margin-left: -8px; transition: opacity .6s ease; }
.cover-cue svg { display: block; width: 100%; fill: none; stroke: #fff; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.ready .cover-cue svg { animation: cueIn 1.2s ease 3s forwards, cueBob 2.4s ease-in-out 4.2s infinite; }
.scrolled .cover-cue { opacity: 0; }
@keyframes cueIn { to { opacity: .75; } }
@keyframes cueBob { 50% { transform: translateY(5px); } }
/* 封面滑出屏幕后，颗粒动画暂停，省电也更顺 */
.grain.paused::after { animation-play-state: paused; }

/* 入场：标题由虚到实 → 英文名、日期依次浮起 */
.cover-title, .cover-names, .cover-date { opacity: 0; }
.ready .cover-title { animation: soft 2.4s var(--ease-out) .6s forwards; }
.ready .cover-names { animation: rise 1.4s var(--ease-out) 1.6s forwards; }
.ready .cover-date { animation: rise 1.4s var(--ease-out) 2.1s forwards; }
@keyframes soft { from { opacity: 0; filter: blur(10px); transform: translateY(12px); } to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============ 红线 ============ */
.flow { position: relative; }
.thread { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 1; overflow: visible; pointer-events: none; }
.thread path { fill: none; stroke: var(--thread); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
/* 照片、底片条盖在红线上面，红线从它们背后穿过 */
.flow .ph, .flow .strip { position: relative; z-index: 2; }

/* ============ 致辞（手写标题 + 红线爱心） ============ */
.manifesto { padding: 60px 24px 64px; text-align: center; }
.script-title { font: 400 clamp(34px, 11vw, 46px)/1.15 var(--script); color: var(--wine); white-space: nowrap; }
.intro-en { margin-top: 12px; }
.intro-en p { font: 400 12.5px/1.65 var(--serif-en); color: var(--ink-2); }
.names-row { position: relative; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 26px; font: 400 21px/1 var(--serif); letter-spacing: .2em; }
.names-row span:last-child { margin-right: -.2em; }
.names-row i { font: italic 400 22px/1 var(--serif-en); color: var(--ink-3); margin: 0 6px; }
.bow { width: 44px; height: 44px; color: var(--thread); flex: none; overflow: visible; }
.bow path { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.manifesto .heart-photo { width: 55%; margin: 96px auto 0; aspect-ratio: 4 / 5; }
.heart-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
/* 日期：红线从心尖垂下来，一笔写出月.日（.md 里的字只在红线画不出来时显示） */
.m-date { margin-top: 96px; }
.m-date .md { height: 54px; font: 400 46px/54px var(--script); color: var(--wine); }
.threaded .m-date .md span { visibility: hidden; }
.m-date .row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.m-date .row i { width: 18px; height: 1px; background: var(--line); }
.m-date .y, .m-date .w { font: 400 15px/1 var(--serif-en); color: var(--ink-2); font-variant-numeric: lining-nums; }
.m-date .w { font-style: italic; }
.m-date .lunar { margin-top: 10px; font-size: 13px; letter-spacing: .16em; color: var(--ink-2); }
.lines { margin-top: 44px; }
.lines p { font-size: 15px; line-height: 2.2; letter-spacing: .14em; color: var(--ink); }

/* ============ 三个篇章（照片拼贴 + 文字） ============ */
.story { padding: 36px 24px 12px; }
.ch { position: relative; margin-bottom: 88px; }
.fig { position: relative; z-index: 2; margin: 0; }
.fig figcaption { margin-top: 8px; font: 400 9px/1 var(--sans); letter-spacing: .42em; color: var(--ink-3); }
.ph { position: relative; overflow: hidden; background: var(--paper-2); cursor: zoom-in; padding: 0; border: 0; display: block; width: 100%; }
.ph img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity 1.2s ease, transform 2.2s var(--ease-out); }
.ph img.loaded { opacity: 1; }
.in .ph img, .ph.in img { transform: none; }
.ph:active img { transform: scale(1.02); transition-duration: .3s; }
.fig .ph.port { aspect-ratio: 4 / 5; }
.fig .ph.tall { aspect-ratio: 3 / 4; }
.fig .ph.land { aspect-ratio: 3 / 2; }

.ch-head { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.ch-no { font: italic 400 22px/1 var(--serif-en); color: var(--wine); }
.ch-title { font: 500 19px/1.35 var(--serif); letter-spacing: .22em; white-space: nowrap; }
.ch-line { margin-top: 14px; font-size: 14px; line-height: 2; letter-spacing: .1em; color: var(--ink-2); white-space: pre-line; }
.ch-en { margin-top: 8px; font: italic 400 14px/1.5 var(--serif-en); color: var(--ink-3); text-wrap: balance; }

/* 文字一行行浮现：标题 → 正文 → 英文 */
.ch-txt > * { opacity: 0; transform: translateY(10px); transition: opacity 1s ease, transform 1s var(--ease-out); }
.ch-txt.in > * { opacity: 1; transform: none; }
.ch-txt.in > :nth-child(2) { transition-delay: .22s; }
.ch-txt.in > :nth-child(3) { transition-delay: .44s; }

/* 第一篇：左上“他”，右下“她”，一根红线把两张照片连起来；标题在右上，文字在左下 */
.ch-1 { display: flex; justify-content: space-between; margin: 0 -24px 88px; }
.ch-1 .col-l { width: 38%; }
.ch-1 .col-r { width: 52%; display: flex; flex-direction: column; align-items: flex-end; }
.ch-1 .him figcaption { padding-left: 24px; }
.ch-1 .her { width: 73.08%; margin-top: 34px; }
.ch-1 .her figcaption { text-align: right; padding-right: 24px; }
.ch-1 .ch-head { align-self: stretch; padding: 4px 24px 0 18px; }
.ch-1 .ch-txt { width: calc(160% - 20px); padding: 0 0 0 24px; margin-top: 34px; }

/* 第二篇：左边文字，右边竖图出血；下面两张竖图一样大并排，从左边出血 */
.ch-2 .top { display: flex; justify-content: space-between; align-items: center; margin-right: -24px; }
.ch-2 .top .ch-txt { width: 50%; }
.ch-2 .top .fig { width: 46%; }
.ch-2 .bottom { display: flex; gap: 10px; margin: 30px 0 0 -24px; }
.ch-2 .bottom .fig { flex: 1 1 0; min-width: 0; }
.ch-2 .ch-en { margin-top: 6px; }

/* 第三篇：和第二篇开头左右对调——左边竖图出血，右边标题和文字；下面横图从右边出血；最下面红线画出远山流水 */
.ch-3 .row { display: flex; justify-content: space-between; align-items: center; margin-left: -24px; }
.ch-3 .row .fig { width: 46%; }
.ch-3 .row .ch-txt { width: 50%; }
.ch-3 .wide { width: calc(86% + 24px); margin: 30px -24px 0 auto; }
.ch-3 .scape { height: 100px; margin: 22px -24px 0; }
.ch:last-child { margin-bottom: 36px; }

/* ============ 底片墙 ============ */
.roll { padding: 8px 0 76px; }
.roll .sec-head { margin-bottom: 40px; padding: 0 20px; }
.strip { position: relative; background: var(--film); padding: 30px 10px 34px; }
.strip::before, .strip::after {
  content: ""; position: absolute; left: 10px; right: 10px; height: 7px;
  background: repeating-linear-gradient(90deg, rgba(238, 228, 214, .82) 0 9px, transparent 9px 19px);
  border-radius: 1px;
}
.strip::before { top: 11px; }
.strip::after { bottom: 11px; }
.strip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 6px; }
.frame-item { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; text-align: left; }
.frame-item.reveal { transform: translateY(12px); }   /* 一格一格依次显影（延迟由 app.js 按列设置） */
.frame-item.reveal.in { transform: none; }
.frame-item .ph { aspect-ratio: 4 / 5; background: #2b2520; }
.frame-item .ph img { position: absolute; left: 0; top: 0; max-width: none; }   /* 放大裁切时由 app.js 改尺寸和位置 */
.frame-item .fno { display: block; margin-top: 5px; font: 400 8px/1 var(--sans); letter-spacing: .18em; color: var(--amber); opacity: .85; }
.strip-edge { display: flex; justify-content: space-between; margin: 0 2px 10px; font: 400 8px/1 var(--sans); letter-spacing: .3em; color: var(--amber); opacity: .75; }

/* ============ 请柬卡片：一张放在纸上的卡，红线在顶上打结 ============ */
.card-sec { padding: 34px 18px 76px; }
.card {
  position: relative; padding: 62px 28px 48px; text-align: center;
  background: linear-gradient(rgba(255, 252, 246, .55), rgba(255, 252, 246, .55)), var(--paper-bg);
  box-shadow: 0 1px 2px rgba(60, 35, 20, .1), 0 30px 50px -32px rgba(60, 35, 20, .55);
}
/* 双线框：外圈酒红细线，内圈墨色发丝线 */
.card::before, .card::after { content: ""; position: absolute; pointer-events: none; }
.card::before { inset: 10px; border: 1px solid rgba(122, 29, 34, .32); }
.card::after { inset: 14px; border: 1px solid var(--hair); }
.bow-end { position: absolute; left: 50%; top: -19px; margin-left: -22px; z-index: 3; }
.bow-end path { transition-duration: 1.4s; }
.bow-end path:nth-child(2) { transition-delay: .15s; }
.bow-end path:nth-child(n+3) { transition-delay: .4s; }

.card .names { display: flex; align-items: center; justify-content: center; margin-top: 18px; font: 500 26px/1.3 var(--serif); letter-spacing: .14em; }
.card .names span:last-child { margin-right: -.14em; }
.card .names i { font: italic 400 30px/1 var(--serif-en); color: var(--wine); letter-spacing: 0; margin: 0 .42em 0 .28em; }
.card .rite { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; font-size: 13px; letter-spacing: .6em; color: var(--ink-2); }
.card .rite::before, .card .rite::after { content: ""; width: 26px; height: 1px; background: var(--line); }
.card .rite::after { margin-left: -.6em; }

/* 日历 */
.cal { max-width: 300px; margin: 40px auto 0; }
.cal-m { font: 400 44px/1 var(--script); color: var(--wine); }
.cal-y { display: flex; align-items: center; gap: 14px; margin-top: 10px; font: 300 11px/1 var(--sans); letter-spacing: .42em; color: var(--ink-2); }
.cal-y::before, .cal-y::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.cal-y::after { margin-left: -.42em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 12px; }
.cal-grid span { position: relative; font: 400 16px/33px var(--serif-en); font-variant-numeric: lining-nums; color: var(--ink-2); }
.cal-grid .wk { margin-bottom: 2px; font: 400 11px/28px var(--serif); color: var(--ink-3); }
.cal-grid .on { color: var(--wine); }
.cal-grid .on svg { position: absolute; left: 50%; top: 50%; width: 44px; height: 38px; margin: -19px 0 0 -22px; overflow: visible; }
.cal-grid .on path { fill: none; stroke: var(--thread); stroke-width: 1.3; stroke-linecap: round; transition-duration: 1.2s; transition-delay: .5s; }
.card .when { margin-top: 18px; font-size: 13px; letter-spacing: .14em; color: var(--ink); }
.card .countdown { margin-top: 4px; font: 300 10.5px/1.6 var(--sans); letter-spacing: .3em; color: var(--ink-3); }
.card .countdown b { font: 400 18px/1 var(--serif-en); font-variant-numeric: lining-nums; letter-spacing: .04em; color: var(--wine); margin: 0 .3em 0 0; }

/* 分隔：两段细线中间一枚小菱形 */
.orn {
  display: block; position: relative; width: 112px; height: 7px; margin: 38px auto 34px;
  background: linear-gradient(var(--line), var(--line)) 0 50% / 44px 1px no-repeat, linear-gradient(var(--line), var(--line)) 100% 50% / 44px 1px no-repeat;
}
.orn::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -3px 0 0 -3px; border: 1px solid var(--wine); transform: rotate(45deg); }

/* 当日流程：横向时间轴，仪式那一项用酒红色 */
.sched { display: flex; margin: 0 -12px; }
.sched-item { position: relative; flex: 1 1 0; min-width: 0; }
.sched-item .ic { display: flex; align-items: flex-end; justify-content: center; height: 30px; }
.sched-item .ic svg { width: 28px; height: 28px; fill: none; stroke: var(--ink); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.sched-item .dot { display: block; position: relative; width: 7px; height: 7px; margin: 12px auto 14px; border: 1px solid var(--ink-3); border-radius: 50%; }
.sched-item.key .dot { background: var(--wine); border-color: var(--wine); }
.sched-item + .sched-item::before {
  content: ""; position: absolute; top: 45px; left: calc(-50% + 10px); right: calc(50% + 10px); height: 1px; background: var(--line);
  transform: scaleX(0); transform-origin: left; transition: transform .9s var(--ease-out) .3s;
}
.sched-item:nth-child(3)::before { transition-delay: .9s; }
.sched-item:nth-child(n+4)::before { transition-delay: 1.5s; }
.sched.in .sched-item::before { transform: none; }
.sched-item b { display: block; font: 400 20px/1 var(--serif-en); font-variant-numeric: lining-nums; letter-spacing: .04em; }
.sched-item.key b { color: var(--wine); }
.sched-item span { display: block; margin-top: 9px; font-size: 13px; letter-spacing: .18em; margin-right: -.18em; }
.sched-item em { display: block; margin-top: 6px; font: italic 400 12.5px/1 var(--serif-en); color: var(--ink-3); }
.sched.many span { font-size: 12px; letter-spacing: .06em; margin-right: -.06em; }

.feast { width: 256px; max-width: 100%; margin: 42px auto 0; overflow: visible; }
.feast path { fill: none; stroke: var(--ink); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.feast.draw path { transition-duration: 3.4s; }

.venue { margin-top: 26px; font-size: 17px; font-weight: 600; letter-spacing: .14em; }
.address { margin-top: 6px; font-size: 12.5px; letter-spacing: .1em; color: var(--ink-2); }
/* 导航 / 日历：一个按钮分成两半 */
.acts { display: flex; width: fit-content; margin: 22px auto 0; border: 1px solid var(--line); }
.act {
  display: inline-flex; align-items: center; gap: 7px; padding: 11px 18px; border: 0; background: none;
  font: 400 12.5px/1 var(--serif); letter-spacing: .2em; color: var(--ink); text-decoration: none; cursor: pointer;
  transition: background .2s, color .2s;
}
.act + .act { border-left: 1px solid var(--line); }
.act svg { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--wine); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.act:active { background: var(--ink); color: var(--card); }
.act:active svg { stroke: currentColor; }
.act { white-space: nowrap; }
.card #contact { margin-top: 12px; }
@media (max-width: 360px) {
  .card { padding-left: 20px; padding-right: 20px; }
  .act { padding: 11px 13px; letter-spacing: .14em; }
}
/* 落款：敬备喜筵 恭候光临，末尾一枚朱红小印 */
.signoff { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 38px; font-size: 12.5px; letter-spacing: .5em; color: var(--ink-2); }
.signoff .seal {
  width: 18px; height: 18px; background: #a3282d; color: #f6e8d8; border-radius: 2px;
  font: 600 11px/18px var(--serif); letter-spacing: 0; text-align: center;
  box-shadow: inset 0 0 0 1.5px #a3282d, inset 0 0 0 2.2px rgba(246, 232, 216, .55);
}
.links { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 0; background: none;
  font: 400 11px/1 var(--sans); letter-spacing: .24em; color: var(--ink); text-decoration: none; cursor: pointer;
  transition: background .2s, color .2s;
}
.link-btn:active { background: var(--ink); color: var(--card); }

/* ============ 回执 ============ */
.rsvp { padding: 30px 28px 80px; }
.rsvp .sec-head { margin-bottom: 40px; }
.form { display: grid; gap: 26px; }
.field > span { display: block; margin-bottom: 6px; font: 400 9.5px/1 var(--sans); letter-spacing: .4em; text-transform: uppercase; color: var(--ink-3); }
.field input, .field textarea {
  width: 100%; padding: 8px 0;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent;
  font-size: 15px; letter-spacing: .08em; outline: none; resize: none;
  transition: border-color .2s;
}
.field input:focus, .field textarea:focus { border-bottom-color: var(--wine); }
.field ::placeholder { color: var(--ink-3); opacity: .7; }
.choice { display: flex; gap: 28px; padding-top: 6px; }
.choice label { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; letter-spacing: .16em; color: var(--ink-3); transition: color .2s; }
.choice span::before { content: ""; width: 9px; height: 9px; border: 1px solid var(--line); border-radius: 50%; transition: all .2s; }
.choice input:checked + span { color: var(--ink); }
.choice input:checked + span::before { background: var(--wine); border-color: var(--wine); box-shadow: inset 0 0 0 2px var(--paper); }
.choice input:focus-visible + span { outline: 1px solid var(--ink-3); outline-offset: 4px; }
.count-row { display: flex; align-items: center; justify-content: space-between; transition: opacity .3s; }
.count-row > span { margin: 0; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 34px; height: 34px; border: 1px solid var(--line); background: none; font: 300 18px/1 var(--sans); color: var(--ink); cursor: pointer; }
.stepper output { min-width: 34px; text-align: center; font: 300 18px var(--sans); }
.rsvp.absent .count-row { opacity: .3; pointer-events: none; }
.submit {
  margin-top: 6px; height: 48px; border: 1px solid var(--wine); background: var(--wine); color: #f6eee3;
  font: 400 12px/1 var(--sans); letter-spacing: .4em; cursor: pointer; transition: transform .15s;
}
.submit:active { transform: scale(.98); }
.submit:disabled { opacity: .6; cursor: wait; }
.form-hint, .form-status { font-size: 12px; line-height: 1.8; color: var(--ink-3); }
.form-hint { margin-top: -12px; }
.form-status { color: var(--wine); }
.form-status:empty { display: none; }
.result { margin-top: 26px; padding: 22px 20px; border: 1px solid var(--hair); background: var(--card); animation: introUp .6s var(--ease-out); }
.result pre { white-space: pre-wrap; font: 14px/1.9 var(--serif); letter-spacing: .06em; color: var(--ink); }
.result .hint { margin: 12px 0 16px; font-size: 12.5px; color: var(--ink-3); letter-spacing: .06em; }
.result .links { justify-content: flex-start; margin-top: 0; }

/* ============ 结尾 ============ */
/* 左右留白和 .rsvp 一样（28px），照片就和“提交回复”按钮一样宽 */
.closing { padding: 10px 28px calc(56px + env(safe-area-inset-bottom)); text-align: center; }
.c-photo { aspect-ratio: 2 / 3; cursor: default; background: #2b2520; }
.c-date { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 52px; font: 400 10px/1 var(--sans); letter-spacing: .42em; color: var(--ink-3); }
.c-date span { margin-right: -.42em; }
.c-date i { width: 34px; height: 1px; background: var(--line); }
.c-title { margin-top: 26px; font: 500 30px/1.7 var(--serif); letter-spacing: .46em; margin-right: -.46em; color: var(--ink); }
.c-title span { display: block; }
.c-en { margin-top: 12px; font: italic 400 15px/1.4 var(--serif-en); letter-spacing: .04em; color: var(--ink-3); }
.c-lines { margin-top: 26px; }
.c-lines p { font-size: 13.5px; line-height: 2.1; letter-spacing: .22em; margin-right: -.22em; color: var(--ink-2); }
.c-names { margin-top: 34px; font-size: 13px; letter-spacing: .3em; margin-right: -.3em; color: var(--ink); }
.c-names small { margin-left: 1.2em; font-size: 12px; color: var(--ink-3); }
/* 朱印：滚到这里时“盖”下去 */
.c-seal { width: 78px; margin: 24px auto 0; }
.c-seal svg { display: block; width: 100%; height: auto; overflow: visible; }
.c-seal rect { fill: #a3282d; }
.c-seal .rim { fill: none; stroke: #f4e6d2; stroke-width: 1.3; }
.c-seal text { fill: #f4e6d2; font: 600 22px/1 var(--serif); text-anchor: middle; dominant-baseline: central; }
.c-seal.reveal { opacity: 0; transform: none; transition: none; }
.c-seal.reveal.in { animation: stampIn .75s cubic-bezier(.3, .6, .3, 1) .35s both; }
@keyframes stampIn {
  0% { opacity: 0; transform: scale(1.7) rotate(-6deg); }
  55% { opacity: .96; transform: scale(.93) rotate(0); }
  75% { transform: scale(1.03); }
  100% { opacity: .96; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .c-seal.reveal { opacity: .96; } }
@media (max-width: 360px) {
  .c-title { font-size: 27px; letter-spacing: .4em; margin-right: -.4em; }
  .c-lines p { font-size: 13px; letter-spacing: .14em; margin-right: -.14em; }
}
.totop {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 40px; padding: 0; border: 0; background: none;
  font: 400 10px/1 var(--sans); letter-spacing: .4em; color: var(--ink-3); cursor: pointer;
}
.totop svg { width: 12px; height: 12px; }

/* ============ 浮动元素 ============ */
.float-info {
  position: fixed; z-index: 40;
  bottom: calc(18px + env(safe-area-inset-bottom));
  right: max(16px, calc(50vw - 240px + 16px));
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 15px; border-radius: 0;
  background: rgba(42, 36, 33, .88); color: #f3ebdf;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font: 400 11px/1 var(--sans); letter-spacing: .26em; text-decoration: none;
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .4s ease, transform .4s var(--ease-out);
}
.float-info.show { opacity: 1; transform: none; pointer-events: auto; }
.float-info svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.4; }

.music {
  position: fixed; z-index: 40; top: max(14px, env(safe-area-inset-top)); right: max(14px, calc(50vw - 240px + 14px));
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .6);
  background: rgba(42, 36, 33, .45); color: #fff; display: grid; place-items: center; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.music svg { width: 17px; height: 17px; }
.music.on svg { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.lightbox {
  position: fixed; inset: 0; z-index: 60; background: rgba(18, 15, 12, .985);
  display: flex; align-items: center; justify-content: center; touch-action: none;
  opacity: 0; transition: opacity .3s ease;
}
.lightbox.show { opacity: 1; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; transition: opacity .35s ease, transform .45s var(--ease-out); }
.lb-btn { position: absolute; border: 0; background: rgba(255, 255, 255, .08); color: #fff; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.lb-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.lb-close { top: max(14px, env(safe-area-inset-top)); right: 14px; }
.lb-prev { left: 12px; top: 50%; margin-top: -22px; }
.lb-next { right: 12px; top: 50%; margin-top: -22px; }
.lb-info { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); left: 24px; right: 24px; text-align: center; color: rgba(255, 255, 255, .7); pointer-events: none; }
.lb-count { font: 300 12px var(--sans); letter-spacing: .3em; }

.toast {
  position: fixed; left: 50%; bottom: calc(40px + env(safe-area-inset-bottom)); z-index: 70;
  transform: translate(-50%, 20px); max-width: calc(100% - 48px);
  padding: 10px 18px; background: rgba(42, 36, 33, .92); color: #f3ebdf;
  font-size: 12.5px; letter-spacing: .1em; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 滚动出现 */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 1.1s ease var(--d, 0s), transform 1.1s var(--ease-out) var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .intro, .cover-title, .cover-names, .cover-date, .ch-txt > * { opacity: 1; transform: none; filter: none; }
  .cover-cue svg { opacity: .75; }
  .cover-photo img, .ph img { opacity: 1; transform: none; }
  .draw path { stroke-dashoffset: 0; }
  .sched-item::before { transform: none; }
}
/* 矮屏：标题收紧一点，别压到头纱 */
@media (max-height: 640px) {
  .cover-head { top: 5%; }
  .cover-title { font-size: min(36px, 9.5vw); }
  .cover-names { margin-top: 14px; }
  .cover-cue { display: none; }
}
@media (max-width: 360px) {
  .intro-en p { font-size: 11.5px; }
  .lines p { font-size: 14px; letter-spacing: .1em; }
  .ch-title { font-size: 18px; letter-spacing: .18em; }
  .ch-line { font-size: 13px; letter-spacing: .05em; }
}
