/* ============================================================
   婚禮網站（賓客端）樣式：牛皮紙米色＋金色葉子，仿電子喜帖
   ============================================================ */
:root {
  color-scheme: light;
  --paper: #f1ebdf;
  --paper-deep: #e7ddcb;
  --card: #f8f3ea;
  --line: #dccfb8;
  --gold: #b29467;
  --gold-deep: #8a6d44;
  --ink: #4a3a2a;
  --ink-soft: #7b6a55;
  --butter: #f4e28f;
  --danger: #a5483a;
  --ok: #5f7a4f;
  --serif: 'Noto Serif TC', 'Songti TC', 'PMingLiU', serif;
  --latin: 'Cormorant Garamond', 'Noto Serif TC', serif;
  --script: 'Great Vibes', cursive;
  --radius: 14px;
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .42  0 0 0 0 .33  0 0 0 0 .22  0 0 0 .1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper) var(--noise);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: .04em;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--gold-deep); }
h2, h3 { font-weight: 600; letter-spacing: .12em; }

.page { max-width: 560px; margin: 0 auto; padding-bottom: 32px; }

/* ---------- 橫幅 ---------- */
.demo-banner, #err-banner {
  position: sticky; top: 0; z-index: 50;
  padding: 8px 16px; font-size: 14px; text-align: center; letter-spacing: .02em;
}
.demo-banner { background: #e9dcc0; color: var(--gold-deep); border-bottom: 1px solid var(--line); }
#err-banner { background: var(--danger); color: #fff; }

/* ---------- 首圖 ---------- */
.hero { position: relative; background: #3b3028; }
.hero img { width: 100%; height: auto; aspect-ratio: 1240 / 1748; object-fit: cover; }
.fab-rsvp {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 40;
  transform: translate(-50%, 0); transition: opacity .25s, transform .25s;
  padding: 12px 28px; border-radius: 999px; white-space: nowrap;
  background: var(--gold-deep); color: #fffaf0; text-decoration: none;
  letter-spacing: .15em; font-size: 16px; box-shadow: 0 10px 24px -10px rgba(60, 44, 26, .7);
}
.fab-rsvp.away { opacity: 0; transform: translate(-50%, 24px); pointer-events: none; }

/* ---------- 紙卡 ---------- */
.paper-card {
  position: relative;
  background: var(--card) var(--noise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 10px 30px -18px rgba(74, 58, 42, .45);
}
.paper-note {
  background: #f6efdf; border: 1px dashed var(--gold); border-radius: 12px;
  padding: 12px 16px; margin: 0 0 16px; font-size: 15px;
}
.paper-note p { margin: 0 0 4px; }
.paper-note a { display: block; padding: 4px 0; font-weight: 600; }

/* ---------- 喜帖資訊 ---------- */
.invite {
  margin: 20px 16px 0; padding: 48px 22px 36px;
  text-align: center; overflow: hidden;
}
.sprig { position: absolute; width: 150px; height: 150px; color: var(--gold); opacity: .85; pointer-events: none; }
.sprig.tl { top: -18px; left: -26px; transform: rotate(-8deg); }
.sprig.br { bottom: -22px; right: -26px; transform: rotate(172deg); }
.xi { font-size: 56px; line-height: 1; color: var(--gold); font-weight: 700; margin-bottom: 18px; }
.lead { letter-spacing: .3em; color: var(--ink-soft); margin: 0 0 26px; font-size: 16px; }
.couple { display: flex; align-items: flex-end; justify-content: center; gap: 18px; margin-bottom: 22px; }
.couple strong { display: block; font-size: 28px; font-weight: 700; letter-spacing: .14em; }
.role { display: block; font-size: 14px; color: var(--ink-soft); letter-spacing: .3em; }
.amp { font-family: var(--latin); font-size: 24px; color: var(--gold-deep); padding-bottom: 6px; }
.parents { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 16px; letter-spacing: .12em; margin-bottom: 20px; }
.jing { letter-spacing: .4em; margin: 0 0 14px; color: var(--ink-soft); }
.date { font-size: 20px; font-weight: 600; letter-spacing: .12em; margin: 0; }
.time { font-size: 17px; font-weight: 600; letter-spacing: .2em; margin: 2px 0 16px; }
.venue { font-weight: 600; letter-spacing: .2em; margin: 0; font-size: 18px; }
.addr { font-size: 14px; color: var(--ink-soft); margin: 0 0 18px; letter-spacing: .06em; }
.row-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.countdown { margin: 22px 0 0; color: var(--ink-soft); font-size: 15px; letter-spacing: .15em; }
.countdown b { font-family: var(--latin); font-size: 30px; color: var(--gold-deep); font-weight: 600; padding: 0 4px; }

/* ---------- 區塊 ---------- */
.block { padding: 48px 16px 0; }
.block h2 { text-align: center; margin: 0 0 8px; font-size: 22px; }
.block h2 .en { display: block; font-family: var(--script); font-weight: 400; font-size: 38px; color: var(--gold); letter-spacing: 0; line-height: 1.1; }
.intro { text-align: center; color: var(--ink-soft); font-size: 15px; margin: 0 0 20px; }

.gallery, .invites { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gallery.single { grid-template-columns: 1fr; max-width: 260px; margin: 0 auto; }
.invites { grid-template-columns: 1fr 1fr; gap: 12px; }
.thumb {
  padding: 0; border: 0; background: var(--paper-deep); cursor: zoom-in;
  border-radius: 8px; overflow: hidden; aspect-ratio: 1; display: block;
}
.invites .thumb { aspect-ratio: 1240 / 1748; border: 1px solid var(--line); box-shadow: 0 6px 18px -12px rgba(74, 58, 42, .6); }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; transition: transform .4s; }
.gallery.collapsed .thumb:nth-child(n+10) { display: none; }
.more-photos { display: flex; margin: 16px auto 0; }
.thumb:hover img { transform: scale(1.04); }
.thumb:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 15px; letter-spacing: .12em;
  padding: 9px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--gold); background: transparent; color: var(--gold-deep);
  text-decoration: none; min-height: 44px;
}
.btn:hover { background: rgba(178, 148, 103, .1); }
.btn.primary { background: var(--gold-deep); border-color: var(--gold-deep); color: #fffaf0; }
.btn.primary:hover { background: #765b35; }
.btn.light { background: #fffaf0; color: var(--ink); border-color: #fffaf0; }
.btn.big { width: 100%; font-size: 17px; padding: 13px 20px; min-height: 52px; }
.btn.small { padding: 6px 14px; min-height: 40px; font-size: 14px; }
.btn.link { border: 0; text-decoration: underline; text-underline-offset: 4px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.loading::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 表單 ---------- */
.form-card { padding: 26px 18px 22px; }
.field { margin-bottom: 22px; border: 0; padding: 0; }
.label { display: block; font-weight: 600; margin-bottom: 8px; letter-spacing: .08em; }
.label em { color: var(--danger); font-style: normal; }
.hint { font-size: 14px; color: var(--ink-soft); margin: -4px 0 8px; line-height: 1.6; }
input:not([type=radio]), textarea {
  width: 100%; font: inherit; font-size: 17px; color: var(--ink);
  padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: #fffdf8;
  letter-spacing: .03em;
}
input:not([type=radio]) + input, .sub { margin-top: 8px; }
input:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(178, 148, 103, .22); }
textarea { resize: vertical; line-height: 1.6; }
::placeholder { color: #b0a28c; }
.field.invalid input:not([type=radio]), .field.invalid .choice span { border-color: var(--danger); }
.err { color: var(--danger); font-size: 14px; margin: 6px 0 0; min-height: 0; }
.err:empty { display: none; }

.choices { display: grid; gap: 8px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choices.three { grid-template-columns: repeat(3, 1fr); }
.choices.chips { display: flex; flex-wrap: wrap; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 48px; padding: 8px 10px; border-radius: 10px; text-align: center;
  border: 1px solid var(--line); background: #fffdf8; transition: .15s; line-height: 1.35;
}
.chips .choice span { min-height: 42px; padding: 6px 16px; border-radius: 999px; }
.choice small { font-size: 13px; color: var(--ink-soft); }
.choice input:checked + span { background: var(--gold-deep); border-color: var(--gold-deep); color: #fffaf0; }
.choice input:checked + span small { color: #f0e3c8; }
.choice input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

.attend-only { background: #f3ecdf; border-radius: 12px; padding: 6px 14px; }
.stepper { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.stepper:last-of-type { border-bottom: 0; }
.stepper-label { font-weight: 600; }
.stepper-label small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-soft); }
.stepper-ctl { display: flex; align-items: center; gap: 4px; }
.stepper-ctl button {
  width: 44px; height: 44px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer;
  border: 1px solid var(--gold); background: #fffdf8; color: var(--gold-deep);
}
.stepper-ctl button:disabled { opacity: .35; cursor: default; }
.stepper-ctl output { min-width: 40px; text-align: center; font-family: var(--latin); font-size: 26px; font-weight: 600; }
.maybe-hint { margin: 8px 0 6px; }

.form-msg { font-size: 15px; margin: 0 0 12px; }
.form-msg:empty { display: none; }
.form-msg.error { color: var(--danger); }
.form-msg.ok { color: var(--ok); }
.form-msg.info { color: var(--gold-deep); }

/* ---------- 送出後 ---------- */
.thanks { text-align: center; }
.thanks h3 { margin: 6px 0 6px; font-size: 20px; }
.check {
  width: 64px; height: 64px; margin: 0 auto; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold-deep); color: #fffaf0; animation: pop .5s ease-out;
}
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
.t-body { color: var(--ink-soft); margin: 0 0 20px; }
.mylink { text-align: left; background: #f3ecdf; border-radius: 12px; padding: 14px; }
.mylink .label { margin-bottom: 4px; }
.mylink .hint { margin: 0 0 10px; }
.link-row { display: flex; gap: 8px; }
.link-row input { font-size: 14px; padding: 8px 10px; min-width: 0; }
.link-row .btn { flex-shrink: 0; white-space: nowrap; }
.divider { margin: 26px auto 10px; width: 70px; height: 70px; color: var(--gold); }
.divider svg { width: 100%; height: 100%; transform: rotate(-40deg); }
.thanks .bless { text-align: left; }
.another { margin-top: 14px; }

/* ---------- 祝福 ---------- */
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  font: inherit; font-size: 14px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fffdf8; color: var(--ink-soft); min-height: 36px;
}
.chip:hover { border-color: var(--gold); color: var(--gold-deep); }
.counter { text-align: right; font-size: 13px; color: var(--ink-soft); margin: 4px 0 0; }
.bless-sent { display: grid; gap: 10px; margin-top: 14px; }
.bless-card {
  background: #fffdf8; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
}
.bless-card p { margin: 0 0 4px; white-space: pre-wrap; }
.bless-card span { color: var(--ink-soft); font-size: 14px; }
.bless-card.pop { animation: pop .45s ease-out; }

/* ---------- 專屬頁 ---------- */
.me-head { text-align: center; padding: 40px 16px 8px; }
.me-head .script { font-family: var(--script); font-size: 46px; color: var(--gold); line-height: 1; margin: 0; }
.me-head p { margin: 2px 0 0; color: var(--ink-soft); letter-spacing: .15em; }
.me-card { margin: 18px 16px 0; padding: 24px 20px; }
.me-card h3 { margin: 0 0 12px; font-size: 18px; }
.me-card .kv + .hint { margin: 12px 0; }
.seat { text-align: center; }
.seat .table-no { font-size: 44px; font-weight: 700; color: var(--gold-deep); letter-spacing: .1em; line-height: 1.2; margin: 6px 0; }
.seat .pending { color: var(--ink-soft); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 16px; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.status-yes { color: var(--ok); font-weight: 600; }
.status-no { color: var(--danger); font-weight: 600; }
.status-maybe { color: var(--gold-deep); font-weight: 600; }
.skeleton { height: 120px; border-radius: 12px; background: linear-gradient(90deg, #ece4d5 25%, #f4eee3 50%, #ece4d5 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 頁尾 ---------- */
.foot { text-align: center; padding: 56px 16px 16px; color: var(--ink-soft); }
.foot p { margin: 0; }
.foot .script { font-family: var(--script); font-size: 40px; color: var(--gold); line-height: 1.2; }
.foot .ver { font-size: 12px; margin-top: 14px; opacity: .7; letter-spacing: .05em; }

/* ---------- 提示 ---------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: rgba(60, 46, 32, .92); color: #fffaf0; padding: 10px 20px; border-radius: 999px;
  font-size: 15px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 照片檢視器 ---------- */
.viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(28, 22, 16, .96); color: #fff;
}
.viewer::backdrop { background: rgba(28, 22, 16, .9); }
.viewer[open] { display: flex; align-items: center; justify-content: center; }
.viewer figure { margin: 0; display: flex; flex-direction: column; align-items: center; max-width: 100%; }
.viewer img { max-width: 100vw; max-height: calc(100dvh - 120px); object-fit: contain; -webkit-touch-callout: default; }
.viewer figcaption { font-size: 14px; color: #e8dcc4; margin-top: 8px; letter-spacing: .1em; }
.viewer button {
  position: absolute; background: rgba(255, 255, 255, .12); color: #fff; border: 0; cursor: pointer;
  width: 46px; height: 46px; border-radius: 50%; font-size: 26px; line-height: 1;
}
.v-close { top: max(14px, env(safe-area-inset-top)); right: 14px; font-size: 20px !important; }
.v-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.v-next { right: 10px; top: 50%; transform: translateY(-50%); }
.v-foot { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 16px; }
.v-count { font-family: var(--latin); font-size: 16px; color: #e8dcc4; }
.v-count:empty { display: none; }
[hidden] { display: none !important; }

@media (max-width: 380px) {
  .couple strong { font-size: 24px; }
  .parents { font-size: 14px; letter-spacing: .06em; }
  .choices.three { grid-template-columns: 1fr 1fr 1fr; font-size: 15px; }
}
@media (min-width: 600px) {
  .page { padding-top: 24px; }
  .hero { border-radius: 16px; overflow: hidden; margin: 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.check svg { width: 30px; height: 30px; }
