:root {
  --red: #7a1517;
  --red-dark: #5a0e10;
  --red-deep: #3f0809;
  --gold: #d6b46c;
  --gold-soft: rgba(214, 180, 108, .45);
  --gold-line: rgba(214, 180, 108, .5);
  --cream: #fbf4e6;
  --cream-2: #f3e7cf;
  --ink: #4a1a12;
  --ink-soft: #6e3a2c;
  --col: 480px;
  --display: "Cinzel", "Times New Roman", serif;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --script: "Great Vibes", cursive;
  --han: "Noto Serif SC", "Microsoft YaHei", "PingFang SC", serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  /* subtle lattice pattern on red */
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cg fill='none' stroke='%23d6b46c' stroke-opacity='.09' stroke-width='1'%3E%3Cpath d='M0 24h48M24 0v48'/%3E%3Ccircle cx='24' cy='24' r='9'/%3E%3Ccircle cx='0' cy='0' r='9'/%3E%3Ccircle cx='48' cy='0' r='9'/%3E%3Ccircle cx='0' cy='48' r='9'/%3E%3Ccircle cx='48' cy='48' r='9'/%3E%3C/g%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100svh; color: var(--cream);
  background: var(--red-deep) var(--pattern);
  font-family: var(--serif); font-size: 18px; line-height: 1.6; font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; height: 100svh; }
body.locked main { visibility: hidden; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

main { width: 100%; max-width: var(--col); margin: 0 auto; box-shadow: 0 0 60px rgba(0, 0, 0, .45); }

/* ---------- Shared ---------- */
.xi { font-family: var(--han); font-weight: 700; font-size: 64px; line-height: 1; color: var(--gold); margin: 0 0 10px; text-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.xi--lg { font-size: 84px; }
.eyebrow { font-family: var(--display); font-size: 14px; font-weight: 600; letter-spacing: .4em; text-transform: uppercase; color: var(--gold); margin: 0 0 8px; padding-left: .4em; }
.names { font-family: var(--script); font-weight: 400; font-size: clamp(46px, 13vw, 58px); line-height: 1.15; margin: 0; color: var(--cream); }
.names span { color: var(--gold); font-size: .8em; margin: 0 .08em; }
.names--sm { font-size: 44px; }
.title { font-family: var(--display); font-weight: 500; font-size: 26px; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 22px; color: var(--gold); }
.lead { max-width: 350px; margin: 0 auto 24px; font-size: 18.5px; }
.cloud { width: 150px; height: auto; margin: 14px auto 18px; }
.rule { width: 60px; height: 1px; background: var(--gold); margin: 18px auto; opacity: .8; }

/* Double gold frame inside red panels */
.frame { position: absolute; inset: 14px; border: 1px solid var(--gold-line); pointer-events: none; }
.frame::before { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(214, 180, 108, .25); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  padding: 13px 26px; border: 1px solid var(--gold); border-radius: 999px; text-decoration: none;
  background: linear-gradient(180deg, #e3c582, #b98f3e); color: var(--red-deep);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: filter .2s, transform .2s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn--sm { font-size: 12px; padding: 10px 20px; }
.btn--block { width: 100%; }
.link { background: none; border: 0; color: var(--gold); font-size: 16px; text-decoration: underline; text-underline-offset: 4px; padding: 6px; }

/* ---------- Cover ---------- */
.cover {
  position: fixed; top: 0; bottom: 0; left: 50%; width: 100%; max-width: var(--col); transform: translateX(-50%);
  z-index: 50; overflow: hidden; background: var(--red) var(--pattern);
  transition: transform 1.1s var(--ease), opacity 1.1s var(--ease);
}
.cover.gone { transform: translate(-50%, -100%); opacity: .4; pointer-events: none; }
.cover__photo { position: absolute; inset: 0; background-position: center 30%; background-size: cover; }
.cover__photo.has-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(63, 8, 9, .55), rgba(63, 8, 9, .35) 40%, rgba(63, 8, 9, .9)); }
.cover__inner {
  position: relative; z-index: 2; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: max(48px, env(safe-area-inset-top)) 32px max(48px, env(safe-area-inset-bottom));
}
.cover .xi { font-size: 76px; }
.cover__date { font-family: var(--display); font-size: 15px; letter-spacing: .3em; color: var(--gold); margin: 12px 0 0; }
.cover__guest { margin: 0 0 22px; }
.cover__to { font-size: 15px; margin: 0 0 4px; color: rgba(251, 244, 230, .8); }
.cover__name { font-size: 24px; font-weight: 600; margin: 0; line-height: 1.3; }
.cover__inner > * { opacity: 0; transform: translateY(12px); animation: rise 1s var(--ease) forwards; }
.cover__inner > :nth-child(2) { animation-delay: .12s; }
.cover__inner > :nth-child(3) { animation-delay: .24s; }
.cover__inner > :nth-child(4) { animation-delay: .36s; }
.cover__inner > :nth-child(5) { animation-delay: .48s; }
.cover__inner > :nth-child(6) { animation-delay: .6s; }
.cover__inner > :nth-child(7) { animation-delay: .72s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- Sections ---------- */
.sec { position: relative; padding: 76px 30px; text-align: center; }
.sec--red { background: var(--red) var(--pattern); }
.sec--cream { background: var(--cream); color: var(--ink); }
.sec--cream .title { color: var(--red); }
.sec--cream .lead { color: var(--ink-soft); }
.hero { min-height: 92svh; display: flex; flex-direction: column; justify-content: center; }

/* Couple */
.portrait {
  width: 168px; aspect-ratio: 3 / 4; margin: 0 auto 18px; border-radius: 999px 999px 10px 10px;
  border: 2px solid var(--gold); outline: 1px solid var(--gold-soft); outline-offset: 5px;
  background: linear-gradient(160deg, var(--cream-2), #e6d3ae) center 30% / cover no-repeat;
  display: grid; place-items: center;
}
.portrait span { font-family: var(--display); font-size: 12px; letter-spacing: .3em; color: rgba(122, 21, 23, .45); }
.portrait.has-img span { display: none; }
.person__name { font-family: var(--script); font-weight: 400; font-size: 42px; line-height: 1.2; margin: 0 0 6px; color: var(--red); }
.person__of { font-size: 16px; margin: 0; color: var(--ink-soft); }
.person__parents { font-size: 19px; font-weight: 600; margin: 0; }
.couple__amp { font-family: var(--script); font-size: 54px; line-height: 1; color: #b98f3e; margin: 26px 0; }

/* Event card */
.card { position: relative; padding: 28px 22px; border-radius: 16px; text-align: left; }
.card--gold { text-align: center; background: rgba(63, 8, 9, .45); border: 1px solid var(--gold-line); margin-bottom: 34px; }
.event__day { font-family: var(--display); font-size: 20px; letter-spacing: .25em; text-transform: uppercase; margin: 6px 0 0; padding-left: .25em; }
.event__date { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 6px 0; font-family: var(--display); font-size: 15px; letter-spacing: .14em; text-transform: uppercase; }
.event__date b { font-size: 62px; font-weight: 500; line-height: 1; color: var(--gold); padding: 0 16px; border-left: 1px solid var(--gold-line); border-right: 1px solid var(--gold-line); }
.event__time { font-size: 19px; font-weight: 600; margin: 8px 0 0; }
.event__venue { font-family: var(--display); font-size: 20px; letter-spacing: .06em; margin: 0 0 18px; }

/* Countdown */
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 340px; margin: 0 auto; }
.countdown div { padding: 12px 2px 9px; border: 1px solid var(--gold-line); border-radius: 12px; background: rgba(63, 8, 9, .35); }
.countdown span { display: block; font-family: var(--display); font-size: 28px; line-height: 1; color: var(--gold); font-variant-numeric: lining-nums tabular-nums; }
.countdown small { display: block; margin-top: 6px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.countdown__done { font-family: var(--script); font-size: 38px; margin: 0; color: var(--gold); }

/* Dress code */
.dress { font-family: var(--display); font-size: 40px; letter-spacing: .2em; margin: -6px 0 18px; padding-left: .2em; background: linear-gradient(180deg, #e9cf8f, #a77b2c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.swatches { display: flex; justify-content: center; gap: 12px; }
.swatches span { width: 44px; height: 44px; border-radius: 50%; background: var(--c); box-shadow: inset 0 2px 4px rgba(255, 255, 255, .35), 0 3px 8px rgba(74, 26, 18, .25); }

/* Forms */
.form { display: grid; gap: 18px; background: rgba(63, 8, 9, .45); border: 1px solid var(--gold-line); }
.field { display: grid; gap: 7px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { font-family: var(--display); font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); padding: 0; margin-bottom: 7px; }
.field em { font-family: var(--serif); text-transform: none; letter-spacing: 0; font-size: 14px; color: rgba(251, 244, 230, .7); }
.field input[type=text], .field textarea {
  width: 100%; font: 500 18px/1.4 var(--serif); color: var(--ink);
  background: var(--cream); border: 1px solid var(--gold); border-radius: 10px; padding: 11px 14px; resize: vertical;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border: 1px solid var(--gold-line); border-radius: 10px; font-size: 17px; font-weight: 600; transition: background .25s, border-color .25s; }
.choice span::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--gold); flex: none; }
.choice input:checked + span { border-color: var(--gold); background: rgba(214, 180, 108, .18); }
.choice input:checked + span::before { background: var(--gold); box-shadow: inset 0 0 0 3px var(--red-dark); }
.choice input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form__msg { margin: -4px 0; font-size: 15px; font-weight: 600; color: #ffd2b8; }
.form__msg:empty { display: none; }
.thanks { text-align: center; background: rgba(63, 8, 9, .45); border: 1px solid var(--gold-line); }
.thanks__title { font-family: var(--script); font-size: 46px; line-height: 1.1; margin: 0; color: var(--gold); }
.thanks__text { margin: 6px 0 10px; }

/* Wishes */
.wishes__count { font-family: var(--display); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin: 34px 0 12px; }
.wishes__count:empty { display: none; }
.wishes { list-style: none; margin: 0; padding: 0 4px 0 0; max-height: 460px; overflow-y: auto; text-align: left; display: grid; gap: 10px; scrollbar-width: thin; }
.wishes li { background: var(--cream); color: var(--ink); border-radius: 12px; padding: 12px 16px; border-left: 3px solid var(--gold); }
.w__name { font-weight: 700; font-size: 18px; margin: 0; color: var(--red); }
.w__time { font-size: 13px; color: var(--ink-soft); margin: 0 0 3px; }
.w__msg { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.wishes li.fresh { animation: rise .8s var(--ease) both; }

/* Gallery */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid > * { padding: 0; border: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 3 / 4; background: linear-gradient(160deg, var(--cream-2), #e6d3ae); }
.grid > :nth-child(5n + 1) { grid-column: span 2; aspect-ratio: 16 / 11; }
.grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.grid button:hover img { transform: scale(1.04); }
.grid .ph { display: grid; place-items: center; font-family: var(--display); font-size: 12px; letter-spacing: .3em; color: rgba(122, 21, 23, .45); border: 1px dashed rgba(122, 21, 23, .25); }

/* Closing */
.closing { padding-bottom: max(90px, calc(env(safe-area-inset-bottom) + 70px)); }
.closing .xi { margin-top: 10px; }
.closing__fam { font-size: 16px; color: var(--gold); margin: 10px auto 0; max-width: 300px; }

/* ---------- Lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 100; background: rgba(30, 5, 5, .95); display: grid; place-items: center; }
.lb__img { max-width: 94vw; max-height: 84vh; object-fit: contain; border-radius: 4px; user-select: none; }
.lb__close, .lb__nav { position: absolute; background: none; border: 0; color: var(--cream); line-height: 1; padding: 12px; }
.lb__close { top: max(10px, env(safe-area-inset-top)); right: 12px; font-size: 38px; }
.lb__nav { top: 50%; transform: translateY(-50%); font-size: 52px; opacity: .8; }
.lb__prev { left: 4px; }
.lb__next { right: 4px; }
.lb__count { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); margin: 0; font-size: 13px; letter-spacing: .2em; color: rgba(251, 244, 230, .6); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 120; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--gold); color: var(--red-deep); font-size: 15px; font-weight: 700; padding: 9px 18px; border-radius: 999px;
  transition: opacity .3s, transform .3s var(--ease); white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Scroll reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(20px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .cover__inner > * { opacity: 1; transform: none; }
  .js .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
