:root {
  --paper: #fbf5ea;
  --paper-2: #f4e9d6;
  --ink: #3a2a24;
  --muted: #7d6a5e;
  --red: #7a1420;
  --red-2: #a3242f;
  --gold: #b8893b;
  --gold-2: #e9cf92;
  --line: #e3cfa9;
  --serif: "Cormorant Garamond", "Noto Serif TC", Georgia, serif;
  --zh: "Noto Serif TC", "Cormorant Garamond", serif;
  --script: "Great Vibes", "Cormorant Garamond", cursive;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.6;
  background:
    radial-gradient(1200px 600px at 50% -200px, #fff8ec 0%, transparent 70%),
    repeating-linear-gradient(45deg, rgba(184,137,59,.035) 0 2px, transparent 2px 14px),
    var(--paper);
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }

/* ── 語言切換 ── */
.zh { font-family: var(--zh); }
html[data-lang="vi"] .zh { display: none !important; }
html[data-lang="zh"] .vi { display: none !important; }
html[data-lang="both"] .vi + .zh { display: block; font-size: .82em; color: var(--muted); margin-top: .15em; }
html[data-lang="both"] .section-title .vi + .zh { color: var(--gold); font-size: .5em; letter-spacing: .3em; }
html[data-lang="both"] .btn .vi + .zh,
html[data-lang="both"] small .vi + .zh { display: inline; margin: 0 0 0 .4em; color: inherit; font-size: .9em; }
html[data-lang="both"] small .vi + .zh::before,
html[data-lang="both"] .btn .vi + .zh::before { content: "· "; }
html[data-lang="both"] .kicker .vi + .zh,
html[data-lang="both"] .env-kicker .vi + .zh,
html[data-lang="both"] .env-to-label .vi + .zh { display: inline; color: inherit; font-size: 1em; }
html[data-lang="both"] .kicker .vi + .zh::before,
html[data-lang="both"] .env-kicker .vi + .zh::before,
html[data-lang="both"] .env-to-label .vi + .zh::before { content: " · "; }

.toolbar {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 40;
  display: flex; background: rgba(255,250,240,.88); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px; box-shadow: 0 4px 14px rgba(80,40,20,.08);
}
.toolbar button {
  border: 0; background: transparent; color: var(--muted); padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-family: var(--zh); letter-spacing: .03em;
}
.toolbar button.on { background: var(--red); color: #fff; }

.music-btn {
  position: fixed; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 40;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--gold);
  background: var(--red); color: var(--gold-2); font-size: 20px; box-shadow: 0 6px 18px rgba(122,20,32,.3);
}
.music-btn.playing .disc { display: inline-block; animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 信封 ── */
.envelope {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(800px 500px at 50% 30%, #9b1f2b 0%, #6a0f19 60%, #4c0a12 100%);
  transition: opacity .9s ease .6s, visibility 0s linear 1.5s;
}
.envelope::before {
  content: ""; position: absolute; inset: 0; opacity: .12;
  background-image: radial-gradient(circle at 20px 20px, #f1d79b 1.4px, transparent 1.6px);
  background-size: 40px 40px;
}
.envelope.open { opacity: 0; visibility: hidden; }
.env-inner { position: relative; text-align: center; color: var(--gold-2); width: min(420px, 100%); }
.env-kicker { letter-spacing: .35em; text-transform: uppercase; font-size: 14px; margin: 0 0 22px; }
.env-card {
  position: relative; aspect-ratio: 1.25; perspective: 900px;
  background: linear-gradient(160deg, #fff6e6, #f1e0c2); border-radius: 6px;
  box-shadow: 0 30px 60px rgba(0,0,0,.35);
}
.env-flap {
  position: absolute; inset: 0 0 auto 0; height: 48%; transform-origin: top; z-index: 2;
  background: linear-gradient(180deg, #ead6b0, #dcc193);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transition: transform .8s cubic-bezier(.6,.1,.3,1);
}
.envelope.open .env-flap { transform: rotateX(180deg); }
.env-body { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 0 20px 22px; color: var(--ink); }
.env-to-label { margin: 0; font-size: 13px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; }
.env-to { margin: 2px 0 6px; font-size: 22px; font-weight: 600; color: var(--red); }
.env-names { font-family: var(--script); font-size: 30px; color: var(--gold); line-height: 1; }
.env-names .amp { font-size: .8em; }
.seal {
  position: absolute; left: 50%; top: 48%; z-index: 3; transform: translate(-50%, -50%);
  width: 72px; height: 72px; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 35% 30%, #c43a43, #8a1520 70%);
  color: var(--gold-2); font-family: var(--zh); font-weight: 900; font-size: 34px;
  box-shadow: 0 6px 14px rgba(0,0,0,.35), inset 0 0 0 4px rgba(241,215,155,.35);
  animation: pulse 2.2s ease-in-out infinite;
  transition: transform .5s ease, opacity .4s ease;
}
.envelope.open .seal { transform: translate(-50%, -50%) scale(.4); opacity: 0; }
@keyframes pulse { 50% { box-shadow: 0 6px 14px rgba(0,0,0,.35), inset 0 0 0 4px rgba(241,215,155,.35), 0 0 0 12px rgba(241,215,155,.15); } }
.env-hint { margin-top: 22px; font-size: 15px; opacity: .85; }
html[data-lang="both"] .env-hint .vi + .zh { color: var(--gold-2); opacity: .8; }

/* ── 通用區塊 ── */
main { width: min(720px, 100%); margin: 0 auto; padding: 0 16px; }
section, footer { padding: 72px 0; text-align: center; }
.section-title {
  font-family: var(--script); font-weight: 400; color: var(--red);
  font-size: clamp(38px, 9vw, 54px); line-height: 1.1; margin: 0 0 32px;
}
.section-title .zh { font-family: var(--zh); }
html[data-lang="zh"] .section-title { font-family: var(--zh); font-size: clamp(28px, 7vw, 36px); letter-spacing: .25em; font-weight: 600; }
.muted { color: var(--muted); margin: 0 auto 28px; max-width: 34em; }
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s ease, transform 1s ease; }
.reveal.in { opacity: 1; transform: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 26px; border-radius: 999px; border: 1px solid var(--red);
  background: var(--red); color: #fff; text-decoration: none; font-size: 17px; letter-spacing: .04em;
  transition: transform .2s ease, background .2s ease;
}
.btn:hover { transform: translateY(-1px); background: var(--red-2); }
.btn.ghost { background: transparent; color: var(--red); }
.btn.ghost:hover { background: rgba(122,20,32,.06); }
.btn.small { padding: 7px 16px; font-size: 15px; }

.ornament {
  height: 26px; margin: 28px auto; width: 220px;
  background:
    linear-gradient(90deg, transparent, var(--gold) 30%, transparent 30%, transparent 70%, var(--gold) 70%, transparent) center/100% 1px no-repeat;
  position: relative;
}
.ornament::after {
  content: "❖"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%);
  color: var(--gold); font-size: 20px;
}

/* ── Hero ── */
.hero { position: relative; min-height: 100svh; display: grid; place-items: center; padding: 80px 0 60px; }
.hero-arch { position: absolute; inset: 40px 0 30px; width: 100%; height: calc(100% - 70px); }
.hero-content { position: relative; padding: 0 30px; }
.kicker { letter-spacing: .3em; text-transform: uppercase; color: var(--gold); font-size: 14px; margin: 0; }
.xi {
  font-family: var(--zh); font-weight: 900; color: var(--red); font-size: clamp(88px, 26vw, 140px); line-height: 1;
  margin: 20px 0 8px; text-shadow: 0 2px 0 rgba(184,137,59,.35);
}
.xi.small { font-size: 56px; margin: 0 0 6px; }
.names {
  font-family: var(--script); font-weight: 400; margin: 0; color: var(--ink);
  font-size: clamp(54px, 15vw, 92px); line-height: 1.05; display: flex; flex-direction: column; align-items: center;
}
.names .amp { color: var(--gold); font-size: .6em; line-height: .9; }
.hero-date { font-size: 22px; letter-spacing: .2em; margin: 22px 0 4px; color: var(--red); font-weight: 600; }
.hero-lunar { margin: 0; color: var(--muted); font-size: 16px; }
.scroll-cue { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); width: 24px; height: 38px; border: 1.5px solid var(--gold); border-radius: 14px; }
.scroll-cue span { position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px; background: var(--gold); border-radius: 2px; animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 60% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

/* ── 邀請 ── */
.families { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.family h3 { margin: 0 0 6px; color: var(--red); font-size: 20px; letter-spacing: .12em; text-transform: uppercase; }
.family p { margin: 0; }
.family .addr { color: var(--muted); font-size: 15px; margin-top: 4px; }
.invite-lead { font-size: 20px; }
.couple-line { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 26px; }
.couple-line small { display: block; color: var(--gold); letter-spacing: .2em; text-transform: uppercase; font-size: 13px; }
.couple-line strong { display: block; font-size: 22px; color: var(--red); font-weight: 600; }
html[data-lang="both"] .couple-line strong .vi + .zh { font-size: .75em; }
.couple-line em { display: block; font-style: normal; font-size: 12px; letter-spacing: .12em; white-space: nowrap; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
html[data-lang="both"] .couple-line em .vi + .zh { display: inline; font-size: 1em; color: inherit; }
html[data-lang="both"] .couple-line em .vi + .zh::before { content: " · "; }
.heart { color: var(--gold); font-size: 26px; }

/* ── 新人 ── */
.couple-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.person .photo {
  aspect-ratio: 3/4; border-radius: 160px 160px 12px 12px; overflow: hidden; margin-bottom: 14px;
  border: 1px solid var(--line); box-shadow: 0 14px 30px rgba(80,40,20,.12);
}
.person .photo img, .person .photo svg { width: 100%; height: 100%; object-fit: cover; }
.person .role { color: var(--gold); letter-spacing: .2em; font-size: 13px; text-transform: uppercase; margin: 0; }
.person h3 { font-family: var(--script); font-weight: 400; font-size: 40px; margin: 0; color: var(--red); line-height: 1.2; }
.person p { margin: 6px 0 0; font-size: 16px; }

/* ── 日曆 ── */
.calendar {
  width: min(380px, 100%); margin: 0 auto 30px; background: #fffaf1; border: 1px solid var(--line);
  border-radius: 16px; padding: 20px 16px; box-shadow: 0 14px 30px rgba(80,40,20,.08);
}
.cal-head { font-size: 22px; color: var(--red); font-weight: 600; margin-bottom: 10px; }
.cal-head small { display: block; color: var(--muted); font-size: 14px; font-weight: 400; font-family: var(--zh); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; font-size: 15px; }
.cal-grid .dow { color: var(--gold); font-size: 12px; letter-spacing: .05em; padding-bottom: 4px; }
.cal-grid .d { aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; }
.cal-grid .d.big {
  background: var(--red); color: #fff; font-weight: 600; position: relative;
  box-shadow: 0 0 0 4px rgba(122,20,32,.12);
}
.countdown { display: flex; justify-content: center; gap: 10px; margin-bottom: 28px; }
.countdown div { width: 74px; padding: 10px 0; border-radius: 12px; background: var(--red); color: #fff; }
.countdown b { display: block; font-size: 28px; line-height: 1.1; font-weight: 600; }
.countdown small { font-size: 12px; letter-spacing: .08em; opacity: .9; }
html[data-lang="both"] .countdown small .vi + .zh { display: block; margin: 0; }
html[data-lang="both"] .countdown small .vi + .zh::before { content: none; }

/* ── 儀式 ── */
.event-list { display: grid; gap: 18px; }
.event {
  background: #fffaf1; border: 1px solid var(--line); border-radius: 18px; padding: 26px 22px;
  position: relative; box-shadow: 0 10px 24px rgba(80,40,20,.06);
}
.event::before { content: ""; position: absolute; inset: 6px; border: 1px dashed rgba(184,137,59,.4); border-radius: 13px; pointer-events: none; }
.event svg { width: 44px; height: 44px; color: var(--gold); }
.event h3 { margin: 8px 0 4px; font-size: 24px; color: var(--red); letter-spacing: .04em; }
.event .at { margin: 4px 0 10px; letter-spacing: .12em; text-transform: uppercase; font-size: 15px; color: var(--muted); }
.dblock { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; max-width: 340px; margin: 0 auto 6px; }
.dblock span { display: block; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.dblock span:first-child { text-align: right; }
.dblock span:last-child { text-align: left; }
.dblock b { font-size: 44px; line-height: 1; color: var(--red); font-weight: 600; padding: 0 14px; border-left: 1px solid var(--gold); border-right: 1px solid var(--gold); }
html[data-lang="both"] .dblock .vi + .zh { font-size: .85em; }
.event .at b { color: var(--red); font-size: 20px; letter-spacing: .04em; }
html[data-lang="both"] .event .at .vi + .zh { display: inline; font-size: 1em; color: inherit; margin: 0; }
html[data-lang="both"] .event .at .vi + .zh::before { content: " · "; }
.event .yr { margin: 4px 0 0; font-size: 20px; letter-spacing: .3em; color: var(--ink); }
.event .lunar { margin: 6px 0 12px; color: var(--muted); font-size: 15px; font-style: italic; }
.event .venue { margin-top: 8px !important; }
.event .venue { margin: 0; font-weight: 600; }
.event .addr { margin: 2px 0 14px; color: var(--muted); font-size: 16px; }

/* ── 相簿 ── */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-flow: dense; gap: 8px; }
.gallery button { padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 3/4; background: var(--paper-2); }
.gallery button:nth-child(6n+1) { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
.gallery button:nth-child(6n+5) { grid-column: 2 / span 2; grid-row: span 2; aspect-ratio: auto; }
.gallery img, .gallery svg { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.gallery button:hover img, .gallery button:hover svg { transform: scale(1.04); }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(30,10,10,.92); display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; padding: 16px 6px; }
.lightbox[hidden] { display: none; }
.lb-stage { height: 100%; display: grid; place-items: center; }
.lb-stage img, .lb-stage svg { max-height: 86svh; max-width: 100%; width: auto; border-radius: 8px; }
.lb-stage svg { width: min(520px, 100%); height: auto; }
.lightbox button { background: none; border: 0; color: #fff; font-size: 40px; }
.lb-close { position: absolute; top: 10px; right: 14px; }

/* ── RSVP ── */
.rsvp-card { background: var(--red); color: #fff; border-radius: 20px; padding: 30px 22px; box-shadow: 0 20px 40px rgba(122,20,32,.25); }
.rsvp-card p { margin: 0 0 18px; }
.rsvp-card .btn { background: var(--gold-2); color: var(--red); border-color: var(--gold-2); font-weight: 600; }
.rsvp-card .contact { margin-top: 16px; font-size: 15px; opacity: .9; }
html[data-lang="both"] .rsvp-card .vi + .zh { color: #f6e3c0; }
html[data-lang="both"] .rsvp-card .btn .vi + .zh { color: inherit; }

/* ── 禮金 ── */
.gift-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gift-box {
  border: 1px solid var(--line); background: #fffaf1; border-radius: 16px; padding: 22px 12px;
}
.gift-box .env-icon { width: 54px; height: 54px; margin: 0 auto 8px; color: var(--red); }
.gift-box h3 { margin: 0 0 12px; font-size: 18px; color: var(--red); }
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(30,10,10,.6); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { position: relative; background: var(--paper); border-radius: 18px; padding: 28px 22px; width: min(360px, 100%); text-align: center; }
.modal-close { position: absolute; top: 6px; right: 12px; background: none; border: 0; font-size: 30px; color: var(--muted); }
.qr { width: 220px; height: 220px; margin: 14px auto; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.qr img { width: 100%; height: 100%; object-fit: contain; }
.acct { font-size: 22px; font-weight: 600; letter-spacing: .06em; color: var(--red); margin: 4px 0; }
.copied { color: var(--gold); font-size: 14px; min-height: 1.4em; }

/* ── 感謝 ── */
.thanks { padding-bottom: 110px; }
.thanks .script { font-family: var(--script); font-size: 52px; color: var(--red); margin: 0 0 8px; line-height: 1.1; }
.thanks .sign { font-family: var(--script); font-size: 32px; color: var(--gold); margin-top: 20px; }

@media (max-width: 420px) {
  body { font-size: 17px; }
  .families { grid-template-columns: 1fr; }
  .gift-boxes { gap: 10px; }
  .gift-box .btn .zh { display: block !important; margin: 0 !important; }
  .gift-box .btn .zh::before { content: none !important; }
  .gift-box .btn { flex-direction: column; gap: 0; padding: 7px 14px; }
  .couple-grid { gap: 14px; }
  .person h3 { font-size: 34px; }
  .countdown div { width: 66px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
