/* Thiệp cưới "Cánh cửa vòm": nền ngà, đỏ rượu, vàng đồng, xanh than. */

:root {
  --ivory: #f7efe1;
  --paper: #fffaf1;
  --tint: #f1e5d0;
  --wine: #6a1322;
  --wine-deep: #4b0c17;
  --wine-soft: #8a2a38;
  --gold: #b0803a;
  --gold-light: #e2c68d;
  --cream: #fbeed6;
  --navy: #1f2e4f;
  --ink: #3b2a24;
  --muted: #806a5e;

  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --script: 'Great Vibes', 'Cormorant Garamond', cursive;
  --sans: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --col: 560px;
  --arch: 999px 999px 0 0;
  /* Ô tròn nối nhau, lấy từ hoa văn cửa kính trong ảnh cưới */
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .26 0 0 0 0 .16 0 0 0 .62 -.17'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  --paper-fiber: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='200'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .55' numOctaves='2' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .3 0 0 0 0 .18 0 0 0 .4 -.17'/%3E%3C/filter%3E%3Crect width='320' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  --lattice: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none' stroke='%23e2c68d' stroke-width='1.1'%3E%3Ccircle cx='28' cy='28' r='20.5'/%3E%3Cpath d='M28 0v7.5M28 48.5V56M0 28h7.5M48.5 28H56'/%3E%3Cpath d='M28 22.5L33.5 28 28 33.5 22.5 28z'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--wine-deep);
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--lattice) center / 56px;
  opacity: .13;
  pointer-events: none;
}
.js body.is-locked, body.is-zoomed { overflow: hidden; }
img { display: block; max-width: 100%; height: auto; }
p, h1, h2, h3, figure, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

main {
  position: relative;
  max-width: var(--col);
  margin: 0 auto;
  background: var(--ivory);
  overflow: hidden;
  box-shadow: 0 0 70px rgba(0, 0, 0, .5);
}
.wrap { padding: 0 24px; }

.eyebrow {
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--gold);
}

.invite__line, .invite__closing, .invite__announce, .moment__quote, .head__title, .head__intro, .thanks__msg, .thanks__credit, .hero__tagline {
  text-wrap: balance;
}

/* Hiện dần khi cuộn tới */
.js .rv { opacity: 0; transform: translateY(20px); transition: opacity .8s ease, transform .8s ease; }
.js .rv.in { opacity: 1; transform: none; }

/* ══════════ Phong bì mở thiệp ══════════
   Bố cục: tên hai bạn ở trên, phong bì ở giữa, nút mở ở dưới.
   Trình tự: ấn dấu sáp → dấu nhấc lên và tan dần (không tách đôi) → nắp mở → thiệp trượt lên → hòa vào trang chính. */
html:not(.js) .intro { display: none; }
.intro {
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(24px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  background: radial-gradient(115% 70% at 50% 45%, #821c2c 0%, var(--wine) 48%, var(--wine-deep) 100%);
  color: var(--cream);
  transition: opacity .95s var(--ease), visibility 0s linear .95s;
}
.intro::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--lattice) center / 56px;
  opacity: .15;
  pointer-events: none;
}
.intro__bloom {
  position: absolute;
  inset: -10%;
  z-index: 2;
  background: radial-gradient(75% 60% at 50% 47%, rgba(255, 250, 241, .98) 28%, rgba(255, 250, 241, 0) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .7s var(--ease);
}

/* ---------- Tên hai bạn phía trên ---------- */
.intro__head {
  position: relative;
  z-index: 1;
  align-self: end;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-bottom: clamp(22px, 4.2vh, 44px);
  text-align: center;
}
.intro__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold-light);
}
.intro__eyebrow::before, .intro__eyebrow::after { content: ''; width: 22px; height: 1px; background: var(--gold-light); opacity: .7; }
.intro__names {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  column-gap: .26em;
  font-family: var(--script);
  font-size: clamp(2.2rem, 9.6vw, 3.3rem);
  line-height: 1.25;
  color: var(--cream);
}
.intro__names i { font-style: normal; font-size: .62em; color: var(--gold-light); }

/* ---------- Sân khấu phong bì ---------- */
.intro__stage {
  position: relative;
  z-index: 1;
  grid-row: 2;
  width: min(86vw, 460px, calc((100vh - 340px) * 1.5));
  width: min(86vw, 460px, calc((100svh - 340px) * 1.5));
  min-width: 250px;
  transform-origin: 50% 40%;
}
.env { position: relative; width: 100%; aspect-ratio: 3 / 2; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.env::before { content: none; }
/* Lòng phong bì: lót giấy đỏ rượu hoa văn ô tròn */
.env__back {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 4px;
  background: linear-gradient(180deg, #3f0912 0%, #5a101c 38%, #651321 100%);
  /* Bóng nhiều lớp: sát mép thì đậm và gọn, ra xa thì nhạt và rộng */
  box-shadow:
    0 1px 1px rgba(20, 2, 6, .45),
    0 6px 10px -3px rgba(20, 2, 6, .4),
    0 22px 34px -12px rgba(20, 2, 6, .55),
    0 44px 60px -30px rgba(20, 2, 6, .5);
}
.env__back::after, .env__flap-face--in::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--lattice) center / 26px;
  opacity: .38;
}

/* Tấm thiệp nằm trong túi phong bì */
.env__card {
  position: absolute;
  left: 5.5%;
  right: 5.5%;
  top: 5%;
  bottom: 5%;
  z-index: 2;
  display: grid;
  justify-items: center;
  align-items: start;
  padding: 8% 6% 0;
  border-radius: 2px;
  background: var(--paper-grain), linear-gradient(180deg, #fffdf8, #faf3e4);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .22), 0 12px 26px -16px rgba(0, 0, 0, .6);
  transform: translate3d(0, 0, 0);
  transition: transform 1.3s var(--ease-out);
}
.env__card::before, .env__card::after { content: ''; position: absolute; pointer-events: none; border: 1px solid rgba(176, 128, 58, .6); }
.env__card::before { inset: 6px; }
.env__card::after { inset: 9px; border-color: rgba(176, 128, 58, .28); }
.env__card-inner {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .9s var(--ease) .3s, transform 1.1s var(--ease-out) .3s;
}
.env__card-eyebrow { font-size: 9px; font-weight: 500; line-height: 1.3; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }
.env__card-names {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  column-gap: .26em;
  font-family: var(--script);
  font-size: clamp(1.45rem, 6.4vw, 2.2rem);
  line-height: 1.25;
  color: var(--wine);
}
.env__card-names i { font-style: normal; font-size: .62em; color: var(--gold); }
.env__card-date { font-family: var(--serif); font-weight: 600; font-size: 12px; line-height: 1; letter-spacing: .28em; color: var(--ink); }

/* Thiệp có tên người nhận: tên khách viết lớn bằng chữ tay, tên hai bạn lùi xuống làm dòng phụ.
   Cỡ chữ tính theo bề rộng tấm thiệp (cqw) để điện thoại và máy tính cùng tỉ lệ. */
.env__card { container-type: inline-size; }
.has-guest .env__card { padding-top: 6.500%; }
.has-guest .env__card-inner { gap: 0; }
.has-guest .env__card-eyebrow { font-size: 9.500px; font-size: 3.200cqw; }
.env__card-guest {
  max-width: 100%;
  margin-top: .04em;
  font-family: var(--script);
  font-size: 38px;
  font-size: 13.200cqw;
  line-height: 1.22;
  color: var(--wine);
  white-space: nowrap;
  /* Hiện dần từ trái sang phải như đang được viết tay */
  clip-path: inset(-25% 100% -25% -6%);
  transition: clip-path 1.25s var(--ease-in-out) .5s;
}
.intro:is([data-stage='rise'], [data-stage='exit']) .env__card-guest { clip-path: inset(-25% -6% -25% -6%); }
.env__card-lead { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 12.500px; font-size: 4.300cqw; line-height: 1.3; color: var(--muted); }
.has-guest .env__card-names { font-size: 23px; font-size: 8cqw; line-height: 1.3; clip-path: none; }
.has-guest .env__card-date { margin-top: 5px; margin-top: 1.800cqw; font-size: 11px; font-size: 3.800cqw; }
/* Thiệp có thêm chữ nên trượt lên cao hơn một chút */
.intro.has-guest:is([data-stage='rise'], [data-stage='exit']) .env__card { transform: translate3d(0, -69%, 0); }

/* Túi phong bì: hai nắp bên và nắp dưới */
.env__pocket { position: absolute; inset: 0; z-index: 3; display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 4px; pointer-events: none; }

/* Lớp phủ trên thân phong bì: vân giấy, ánh sáng từ góc trên trái, mép giấy có độ dày */
.env__grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: 4px;
  /* Chỉ phủ lên ba nắp giấy, chừa khoảng chữ V nơi nhìn thấy lòng phong bì và tấm thiệp */
  clip-path: polygon(0 0, 45.270% 49.300%, 50% 44%, 54.730% 49.300%, 100% 0, 100% 100%, 0 100%);
  background: var(--paper-grain), var(--paper-fiber);
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 246, .8),
    inset 1px 0 0 rgba(255, 253, 246, .45),
    inset 0 -1px 0 rgba(110, 80, 50, .3),
    inset -1px 0 0 rgba(110, 80, 50, .2);
  pointer-events: none;
}
.env__grain::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(120% 95% at 16% 6%, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0) 56%),
    linear-gradient(155deg, rgba(90, 60, 40, 0) 58%, rgba(90, 60, 40, .13) 100%);
}

/* Nắp trên */
.env__flap-wrap {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  width: 100%;
  height: 59%;
  pointer-events: none;
  transition: z-index 0s linear .48s;
}
.env__flap-wrap::before {
  content: '';
  position: absolute;
  inset: 7px 1.5% -8px;
  background: rgba(46, 26, 14, .34);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: blur(4px);
  transition: opacity .4s var(--ease);
}
.env__flap {
  position: absolute;
  inset: 0;
  transform-origin: 50% 0;
  transform: perspective(1100px) rotateX(0deg);
  transform-style: preserve-3d;
  transition: transform .95s var(--ease-in-out);
}
.env__flap-face {
  position: absolute;
  inset: 0;
  /* Đỉnh nắp hơi bo tròn như giấy cắt thật */
  clip-path: polygon(.5% 0, 99.5% 0, 54% 94.500%, 52% 98%, 50% 99.400%, 48% 98%, 46% 94.500%);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.env__flap-face--out {
  background:
    var(--paper-grain),
    var(--paper-fiber),
    linear-gradient(100deg, rgba(255, 255, 255, .3) 0%, rgba(255, 255, 255, 0) 46%, rgba(110, 80, 50, .09) 100%),
    linear-gradient(180deg, #eadfcb 0%, #f7efe0 7%, #fbf5e9 30%, #f4ead8 74%, #e8dac2 100%);
}
.env__flap-face--out svg { display: block; width: 100%; height: 100%; }
/* Mặt trong lật 180° quanh tâm của chính nó, nên tam giác cắt phải quay ngược
   để khi nắp mở, đáy vẫn nằm trên mép phong bì và đỉnh hướng lên trên. */
.env__flap-face--in {
  clip-path: polygon(.5% 100%, 99.500% 100%, 54% 5.500%, 52% 2%, 50% .6%, 48% 2%, 46% 5.500%);
  transform: rotateX(180deg);
  background: linear-gradient(0deg, #3f0912 0%, #5a101c 30%, #6a1422 100%);
}

/* Con dấu sáp */
.env__seal {
  position: absolute;
  left: 50%;
  top: 54%;
  z-index: 5;
  width: 26%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 1px 1px rgba(30, 4, 8, .6)) drop-shadow(1.5px 5px 6px rgba(50, 26, 14, .38));
  transition: transform .3s var(--ease);
}
.env__seal svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.seal__letter { font-family: var(--serif); font-weight: 600; font-size: 52px; }
.seal__amp { font-family: var(--script); font-size: 26px; }

/* Hạt sáng */
.env__sparkles { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.env__sparkles span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 7px;
  height: 7px;
  margin: -3.5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffaea 0%, #e8cf98 38%, rgba(232, 207, 152, 0) 70%);
  opacity: 0;
}

/* ---------- Phía dưới: tên khách và nút mở ---------- */
.intro__foot {
  position: relative;
  z-index: 1;
  align-self: start;
  display: grid;
  justify-items: center;
  gap: 14px;
  padding-top: clamp(26px, 4.6vh, 48px);
  text-align: center;
}
.intro__guest { display: grid; justify-items: center; gap: 2px; }
.intro__guest span { font-size: .66rem; font-weight: 500; letter-spacing: .3em; text-transform: uppercase; color: var(--gold-light); }
.intro__guest b {
  max-width: 88vw;
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(1.9rem, 8vw, 2.5rem);
  line-height: 1.3;
  color: var(--cream);
  overflow-wrap: anywhere;
}
.intro__open {
  min-width: 210px;
  min-height: 48px;
  padding: 0 30px;
  border: 0;
  border-radius: 999px;
  background: var(--cream);
  color: var(--wine);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .24em;
  text-transform: uppercase;
  cursor: pointer;
  animation: pulse 2.4s ease-in-out infinite;
}
.intro__open:focus-visible, .intro__skip:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 3px; }
.intro__date { font-size: .72rem; letter-spacing: .26em; text-transform: uppercase; color: var(--gold-light); }
.intro__skip {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: calc(8px + env(safe-area-inset-right, 0px));
  z-index: 5;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--gold-light);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  cursor: pointer;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 238, 214, .4); }
  50% { box-shadow: 0 0 0 11px rgba(251, 238, 214, 0); }
}

/* ---------- Xuất hiện lần đầu ---------- */
.intro__head, .intro__stage, .intro__foot { opacity: 0; transform: translateY(14px); }
.intro[data-ready='true'] .intro__head { opacity: 1; transform: none; transition: opacity 1s var(--ease) .1s, transform 1.2s var(--ease-out) .1s; }
.intro[data-ready='true'] .intro__stage { opacity: 1; transform: none; transition: opacity 1.1s var(--ease) .3s, transform 1.3s var(--ease-out) .3s; }
.intro[data-ready='true'] .intro__foot { opacity: 1; transform: none; transition: opacity 1s var(--ease) .6s, transform 1.2s var(--ease-out) .6s; }

/* ---------- Các giai đoạn mở thiệp ---------- */
.intro[data-stage='press'] .env__seal { transform: translate(-50%, -50%) scale(.9); }
/* Con dấu giữ nguyên vẹn: nhấc nhẹ lên rồi tan dần, không tách đôi */
.intro:is([data-stage='open'], [data-stage='rise'], [data-stage='exit']) .env__seal {
  opacity: 0;
  transform: translate(-50%, -66%) scale(1.14);
  transition: transform .9s var(--ease-out), opacity .65s var(--ease) .12s;
}
.intro:is([data-stage='open'], [data-stage='rise'], [data-stage='exit']) .env__flap { transform: perspective(1100px) rotateX(180deg); }
.intro:is([data-stage='open'], [data-stage='rise'], [data-stage='exit']) .env__flap-wrap { z-index: 1; }
.intro:is([data-stage='open'], [data-stage='rise'], [data-stage='exit']) .env__flap-wrap::before { opacity: 0; }
.intro:is([data-stage='rise'], [data-stage='exit']) .env__card { transform: translate3d(0, -60%, 0); }
.intro:is([data-stage='rise'], [data-stage='exit']) .env__card-inner { opacity: 1; transform: none; }
.intro[data-ready='true']:not([data-stage='idle']) .intro__foot {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .45s var(--ease), transform .6s var(--ease);
}
/* Tên phía trên lùi đi trước khi nắp phong bì mở lên chỗ của nó */
.intro[data-ready='true']:not([data-stage='idle']) .intro__head {
  opacity: 0;
  transform: translateY(-16px);
  transition: opacity .4s var(--ease), transform .8s var(--ease-out);
}
.intro:is([data-stage='rise'], [data-stage='exit']:not([data-fast])) .env__sparkles span {
  animation: env-spark var(--dur) var(--ease-out) var(--delay) forwards;
}

/* Kết thúc: tấm thiệp tiến lại gần và tan vào ánh sáng, rồi lớp phong bì mờ đi để trang chính hiện ra. */
.intro[data-stage='exit'] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .85s var(--ease) .4s, visibility 0s linear 1.25s;
}
.intro[data-ready='true'][data-stage='exit'] .intro__stage {
  opacity: 0;
  transform: scale(1.1) translateY(-4%);
  transition: transform 1.2s var(--ease-out), opacity .6s var(--ease);
}
.intro[data-stage='exit']:not([data-fast]) .intro__bloom { opacity: 1; }
.intro[data-fast][data-stage='exit'] { transition: opacity .4s var(--ease), visibility 0s linear .4s; }
.intro[data-fast][data-stage='exit'] .intro__stage { transition: opacity .3s var(--ease); }

@keyframes env-spark {
  0% { opacity: 0; transform: translate(0, 0) scale(var(--s)); }
  22% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(calc(var(--s) * .4)); }
}
@keyframes env-float {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}
@media (prefers-reduced-motion: no-preference) {
  .intro[data-ready='true'] .env { animation: env-float 6.5s var(--ease-in-out) 1.8s infinite alternate; }
}
/* Màn hình thấp (điện thoại xoay ngang) */
@media (max-height: 520px) {
  .intro { grid-template-rows: auto auto auto; align-content: center; }
  .intro__head { padding-bottom: 14px; }
  .intro__foot { padding-top: 16px; gap: 10px; }
  .intro__stage { width: min(60vw, 330px, calc((100vh - 210px) * 1.5)); }
}

/* ---------- Hiệu ứng thêm cho phong bì ---------- */
/* Bụi vàng trôi chậm phía sau, tắt dần khi bắt đầu mở */
.intro__dust { position: absolute; inset: 0; overflow: hidden; pointer-events: none; transition: opacity .6s var(--ease); }
.intro:not([data-stage='idle']) .intro__dust { opacity: 0; }
.intro__dust span {
  position: absolute;
  bottom: -12px;
  left: var(--x);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 244, 214, .95), rgba(226, 198, 141, .5) 45%, rgba(226, 198, 141, 0) 70%);
  opacity: 0;
  animation: dust var(--dur) linear var(--delay) infinite;
}
@keyframes dust {
  0% { opacity: 0; transform: translate3d(0, 0, 0); }
  12%, 85% { opacity: var(--o); }
  100% { opacity: 0; transform: translate3d(var(--drift), -108vh, 0); }
}

/* Tên hai bạn hiện dần từ trái sang phải như đang được viết ra */
.intro__names { clip-path: inset(-25% 100% -25% -6%); }
.intro[data-ready='true'] .intro__names { clip-path: inset(-25% -6% -25% -6%); transition: clip-path 1.5s var(--ease-in-out) .35s; }
.env__card-names { clip-path: inset(-25% 100% -25% -6%); transition: clip-path 1s var(--ease-in-out) .4s; }
.intro:is([data-stage='rise'], [data-stage='exit']) .env__card-names { clip-path: inset(-25% -6% -25% -6%); }

/* Nét vàng trên phong bì tự vẽ khi phong bì xuất hiện */
.env .draw { stroke-dasharray: 1; stroke-dashoffset: 1; }
.intro[data-ready='true'] .env .draw { stroke-dashoffset: 0; transition: stroke-dashoffset 1.7s var(--ease-in-out) .8s; }

/* Dấu sáp: vòng sáng lan ra mời chạm, vệt bóng lướt qua, phóng nhẹ khi rê chuột */
.env__seal::before {
  content: '';
  position: absolute;
  inset: 7%;
  border: 1.5px solid var(--gold-light);
  border-radius: 50%;
  opacity: 0;
}
.env__seal::after {
  content: '';
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  background: linear-gradient(112deg, rgba(255, 236, 214, 0) 38%, rgba(255, 236, 214, .5) 50%, rgba(255, 236, 214, 0) 62%) no-repeat;
  background-size: 260% 100%;
  background-position: 160% 0;
  mix-blend-mode: screen;
  pointer-events: none;
}
.intro[data-ready='true'][data-stage='idle'] .env__seal::before { animation: seal-ring 2.8s var(--ease-out) 2.2s infinite; }
.intro[data-ready='true'][data-stage='idle'] .env__seal::after { animation: seal-sheen 5.5s var(--ease-in-out) 2.6s infinite; }
@keyframes seal-ring {
  0% { opacity: .75; transform: scale(.9); }
  70%, 100% { opacity: 0; transform: scale(1.55); }
}
@keyframes seal-sheen {
  0% { background-position: 160% 0; }
  28%, 100% { background-position: -60% 0; }
}
@media (hover: hover) and (pointer: fine) {
  .intro[data-stage='idle'] .env:hover .env__seal { transform: translate(-50%, -50%) scale(1.06); }
}

/* Phong bì nghiêng nhẹ theo con trỏ chuột (chỉ trên máy tính) */
.intro[data-live][data-stage='idle'] .intro__stage {
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .35s ease-out;
}

/* ══════════ Trang bìa ══════════ */
.hero {
  position: relative;
  padding: 46px 20px 40px;
  text-align: center;
  background: radial-gradient(120% 55% at 50% 0%, var(--paper) 0%, var(--ivory) 75%);
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--lattice) center top / 56px;
  opacity: .55;
  -webkit-mask-image: linear-gradient(#000, transparent 46%);
  mask-image: linear-gradient(#000, transparent 46%);
  pointer-events: none;
}
.hero > * { position: relative; transition: opacity .9s ease, transform .9s ease; }
.js body:not(.is-opened) .hero > * { opacity: 0; transform: translateY(16px); }
.is-opened .hero > :nth-child(1) { transition-delay: .55s; }
.is-opened .hero > :nth-child(2) { transition-delay: .65s; }
.is-opened .hero > :nth-child(3) { transition-delay: .75s; }
.is-opened .hero > :nth-child(4) { transition-delay: 1.05s; }
.is-opened .hero > :nth-child(5) { transition-delay: 1.25s; }
.is-opened .hero > :nth-child(6) { transition-delay: 1.4s; }
.is-opened .hero > :nth-child(7) { transition-delay: 1.5s; }
.is-opened .hero > :nth-child(8) { transition-delay: 1.6s; }

.hero__guest { margin-top: 8px; font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 1.3rem; color: var(--wine); }
.hero__arch {
  width: 80%;
  max-width: 440px;
  margin: 22px auto 0;
  padding: 9px 9px 0;
  border: 1px solid var(--gold);
  border-bottom: 0;
  border-radius: var(--arch);
  -webkit-mask-image: linear-gradient(#000 68%, transparent 98%);
  mask-image: linear-gradient(#000 68%, transparent 98%);
}
.hero__arch img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--arch); background: var(--tint); }

.names {
  margin-top: -68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(3.1rem, 15vw, 4.6rem);
  line-height: 1.08;
  color: var(--wine);
  text-shadow: 0 0 6px var(--ivory), 0 0 20px var(--ivory), 0 0 34px var(--ivory);
}
.names__one--groom { transform: translateX(-11%); }
.names__one--bride { transform: translateX(11%); }
.names__amp { font-size: .5em; line-height: 1; color: var(--gold); }

.hero__tagline { margin-top: 14px; font-family: var(--serif); font-style: italic; font-size: 1.22rem; color: var(--muted); }
.hero__date {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.hero__date::before, .hero__date::after { content: ''; flex: 0 0 30px; height: 1px; background: var(--gold); }
.hero__date b { font-size: 1.3rem; letter-spacing: .12em; color: var(--wine); }
.hero__lunar { margin-top: 4px; font-size: .82rem; color: var(--muted); }
.hero__down {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-top: 22px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
}
.hero__down svg { width: 20px; height: 20px; animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }

/* ══════════ Lời mời ══════════ */
.invite {
  position: relative;
  padding-bottom: 66px;
  text-align: center;
  background: var(--wine);
  color: #f6e8d2;
}
.invite::after {
  content: '';
  position: absolute;
  inset: 45% 0 0;
  background: var(--lattice) center / 56px;
  opacity: .07;
  -webkit-mask-image: linear-gradient(transparent, #000 40%);
  mask-image: linear-gradient(transparent, #000 40%);
  pointer-events: none;
}
.invite__photo {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 91%, transparent 100%), linear-gradient(to right, transparent 0, #000 8%, #000 92%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 91%, transparent 100%), linear-gradient(to right, transparent 0, #000 8%, #000 92%, transparent 100%);
  mask-composite: intersect;
}
.invite__photo img { width: 100%; }
.invite .wrap { position: relative; z-index: 1; }
.invite__top { padding-top: 54px; }
.invite__photo { margin-top: 14px; }
.invite__body { margin-top: -20px; }
.invite__hy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  color: var(--gold-light);
  background: var(--wine);
}
.invite__hy svg { width: 27px; height: 26px; }

.families { display: grid; grid-template-columns: 1fr 1fr; margin-top: 26px; }
.family { padding: 0 12px; }
.family + .family { border-left: 1px solid rgba(226, 198, 141, .4); }
.family__label { margin-bottom: 8px; font-size: .66rem; letter-spacing: .28em; text-transform: uppercase; color: var(--gold-light); }
.family__names { display: flex; flex-direction: column; justify-content: center; min-height: calc(var(--name-rows, 1) * 1.35em); font-size: 1.14rem; }
.family__name { font-family: var(--serif); font-weight: 600; font-size: 1.14rem; line-height: 1.35; }
.family__addr { margin-top: 8px; font-size: .78rem; line-height: 1.5; opacity: .75; }
.family__addr span { display: inline-block; }

.invite__announce { margin-top: 30px; font-family: var(--serif); font-style: italic; font-size: 1.2rem; }
.invite__couple { margin-top: 16px; }
.invite__person { display: flex; flex-direction: column; }
.invite__full { font-family: var(--script); font-size: clamp(2.5rem, 11.5vw, 3.4rem); line-height: 1.3; color: var(--cream); }
.invite__title { font-size: .68rem; letter-spacing: .3em; text-transform: uppercase; color: var(--gold-light); }
.invite__amp { display: block; margin: 8px 0 0; font-family: var(--script); font-size: 1.9rem; line-height: 1; color: var(--gold-light); }
.invite__line { max-width: 30ch; margin: 30px auto 0; font-family: var(--serif); font-size: 1.2rem; line-height: 1.5; }
.invite__time { margin-top: 24px; font-size: .76rem; letter-spacing: .24em; text-transform: uppercase; color: var(--gold-light); }
.invite__time b { font-weight: 600; color: var(--cream); }
.dateblock { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 16px; margin-top: 12px; }
.dateblock__side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 10px 0;
  padding: 9px 0;
  border-top: 1px solid rgba(226, 198, 141, .6);
  border-bottom: 1px solid rgba(226, 198, 141, .6);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.3;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.dateblock__day { font-family: var(--serif); font-weight: 600; font-size: 4.6rem; line-height: 1; color: var(--gold-light); }
.invite__lunar { margin-top: 12px; font-size: .84rem; font-style: italic; opacity: .85; }
.invite__place { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 22px; }
.invite__place::before { content: ''; width: 46px; height: 1px; margin-bottom: 10px; background: rgba(226, 198, 141, .6); }
.invite__place b { font-family: var(--serif); font-weight: 600; font-size: 1.12rem; letter-spacing: .16em; text-transform: uppercase; color: var(--cream); }
.invite__place span { max-width: 30ch; font-size: .9rem; line-height: 1.55; opacity: .88; text-wrap: balance; }
.invite__closing { max-width: 32ch; margin: 28px auto 0; font-family: var(--serif); font-style: italic; font-size: 1.12rem; opacity: .92; }

/* ══════════ Khoảnh khắc ══════════ */
.zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; -webkit-appearance: none; appearance: none; }
.zoom img { width: 100%; }
.zoom:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.moment { background: var(--wine-deep); }
.moment__photo { position: relative; }
.moment__photo::before, .moment__photo::after { content: ''; position: absolute; left: 0; right: 0; pointer-events: none; }
.moment__photo::before { top: 0; height: 16%; background: linear-gradient(var(--wine), rgba(106, 19, 34, 0)); }
.moment__photo::after { bottom: 0; height: 12%; background: linear-gradient(rgba(75, 12, 23, 0), var(--wine-deep)); }
.moment__quote {
  padding: 14px 28px 48px;
  text-align: center;
  font-family: var(--script);
  font-size: clamp(1.9rem, 8.4vw, 2.5rem);
  line-height: 1.35;
  color: var(--gold-light);
}

/* ══════════ Khối nội dung chung ══════════ */
.sec { padding: 64px 0; background: var(--ivory); }
.sec--tint { background: var(--tint); }
.head { margin-bottom: 30px; text-align: center; }
.head__title {
  margin-top: 8px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.9rem, 8vw, 2.3rem);
  line-height: 1.2;
  color: var(--wine);
}
.head__intro { max-width: 34ch; margin: 12px auto 0; font-size: .93rem; color: var(--muted); }
.head__art { width: 108px; margin: 0 auto 14px; }
.orn {
  position: relative;
  display: block;
  width: 128px;
  height: 12px;
  margin: 14px auto 0;
  background:
    linear-gradient(var(--gold), var(--gold)) left center / 50px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) right center / 50px 1px no-repeat;
}
.orn::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 1px solid var(--gold);
  transform: translate(-50%, -50%) rotate(45deg);
}
.paper {
  background: var(--paper);
  border: 1px solid rgba(176, 128, 58, .35);
  border-radius: 14px;
  box-shadow: 0 12px 30px -20px rgba(75, 12, 23, .4);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--wine);
  border-radius: 999px;
  background: transparent;
  color: var(--wine);
  font-size: .86rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { background: var(--wine); color: var(--cream); }
.btn--fill { background: var(--wine); color: var(--cream); }
.btn--fill:hover { background: var(--wine-deep); }
.btn--block { width: 100%; min-height: 48px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn:focus-visible, .hero__down:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ══════════ Lịch + đếm ngược ══════════ */
.cal { max-width: 360px; margin: 0 auto; padding: 22px 18px 20px; }
.cal__title {
  margin-bottom: 12px;
  text-align: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--wine);
}
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 4px; text-align: center; }
.cal__dow { padding-bottom: 6px; font-size: .68rem; font-weight: 600; letter-spacing: .08em; color: var(--gold); }
.cal__day { width: 36px; height: 36px; margin: 0 auto; border-radius: 50%; font-family: var(--serif); font-weight: 500; font-size: 1.14rem; line-height: 36px; }
.cal__day--sun { color: var(--wine-soft); }
.cal__day--on { background: var(--wine); color: var(--cream); font-weight: 600; box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--gold); }

/* Đếm ngược: số lớn trên nền giấy, ngăn nhau bằng nét kẻ mảnh */
.count {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 344px;
  margin: 34px auto 0;
  padding: 18px 0 16px;
  border-top: 1px solid rgba(176, 128, 58, .55);
  border-bottom: 1px solid rgba(176, 128, 58, .55);
}
.count::before, .count::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 7px;
  height: 7px;
  border: 1px solid var(--gold);
  background: var(--ivory);
  transform: translate(-50%, -50%) rotate(45deg);
}
.count::before { top: -.5px; }
.count::after { top: calc(100% + .5px); }
.count__cell { display: flex; flex-direction: column; align-items: center; text-align: center; }
.count__cell + .count__cell { border-left: 1px solid rgba(176, 128, 58, .3); }
.count__cell b {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.6rem;
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--wine);
}
.count__cell span { margin-top: 8px; font-size: .6rem; font-weight: 500; letter-spacing: .26em; text-indent: .26em; text-transform: uppercase; color: var(--gold); }
.count__msg { margin-top: 26px; text-align: center; font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 1.3rem; color: var(--wine); }

/* ══════════ Lịch trình ══════════ */
.events { display: grid; gap: 18px; }
.event { padding: 24px 22px 22px; text-align: center; border-top: 3px solid var(--gold); }
.event--bride { border-top-color: var(--wine); }
.event--groom { border-top-color: var(--navy); }
.event__tag { font-size: .66rem; font-weight: 500; letter-spacing: .26em; text-transform: uppercase; color: var(--gold); }
.event--bride .event__tag { color: var(--wine); }
.event--groom .event__tag { color: var(--navy); }
.event__title { margin: 2px 0 0; font-family: var(--serif); font-weight: 600; font-size: 1.75rem; line-height: 1.25; }
.event__rows { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed rgba(176, 128, 58, .45); text-align: left; }
.event__row { display: flex; align-items: flex-start; gap: 12px; }
.event__row svg { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 2px; color: var(--gold); }
.event__row b { display: block; font-weight: 600; font-size: .95rem; }
.event__row small { display: block; font-size: .84rem; color: var(--muted); }
.event__row .event__lunar { font-style: italic; }
/* Lịch trình trong buổi: các mốc giờ dàn ngang, nối bằng đường kẻ vàng */
.timeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  margin: 16px 0 0;
  padding: 16px 0 0;
  border-top: 1px dashed rgba(176, 128, 58, .45);
  list-style: none;
  text-align: center;
}
.timeline li { position: relative; padding-top: 18px; }
.timeline li::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  z-index: 1;
  width: 9px;
  height: 9px;
  margin-left: -4.500px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: var(--paper);
}
.timeline li::after { content: ''; position: absolute; top: 6px; left: 50%; width: 100%; height: 1px; background: rgba(176, 128, 58, .55); }
.timeline li:last-child::after { display: none; }
.timeline b { display: block; font-family: var(--serif); font-weight: 600; font-size: 1.25rem; line-height: 1.2; color: var(--wine); }
.timeline span { display: block; font-size: .78rem; color: var(--muted); }
.event__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.event__actions .btn { padding: 0 8px; font-size: .84rem; }

/* ══════════ Album ══════════ */
/* Dải ảnh vuốt ngang: tấm ở giữa rõ nét, hai tấm bên cạnh ló ra, nhỏ và mờ hơn */
.reel { --w: min(76vw, 330px); }
.reel__track {
  display: flex;
  gap: 14px;
  padding: 8px calc(50% - var(--w) / 2) 30px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.reel__track::-webkit-scrollbar { display: none; }
.reel__track:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.reel__item {
  flex: 0 0 var(--w);
  width: var(--w);
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 20px 30px -20px rgba(75, 12, 23, .6);
  scroll-snap-align: center;
  transition: opacity .45s ease, transform .45s ease;
}
.js .reel__item { opacity: .45; transform: scale(.93); }
.js .reel__item.is-active { opacity: 1; transform: none; }
.reel__item img { aspect-ratio: 2 / 3; object-fit: cover; background: var(--tint); }
.reel__nav { display: flex; align-items: center; justify-content: center; gap: 20px; }
.reel__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  transition: background .2s, color .2s, opacity .2s;
}
.reel__btn svg { width: 20px; height: 20px; }
.reel__btn--prev svg { transform: rotate(90deg); }
.reel__btn--next svg { transform: rotate(-90deg); }
.reel__btn:hover:not(:disabled) { background: var(--gold); color: var(--paper); }
.reel__btn:disabled { opacity: .35; cursor: default; }
.reel__btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.reel__count {
  min-width: 78px;
  text-align: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: .18em;
  color: var(--wine);
}

/* ══════════ Lời nhắn riêng cho từng khách: mảnh giấy dán băng keo ══════════ */
.note-sec { padding-bottom: 0; }
.note-sec.is-alone { padding-bottom: 64px; }
.note {
  position: relative;
  max-width: 330px;
  margin: 0 auto;
  padding: 34px 24px 18px;
  background: linear-gradient(180deg, #fffdf6, #fbf3e2);
  box-shadow: 0 20px 28px -22px rgba(75, 12, 23, .7), 0 1px 3px rgba(75, 12, 23, .12);
  transform: rotate(-1.4deg);
}
.note::before {
  content: '';
  position: absolute;
  top: -11px;
  left: 50%;
  width: 96px;
  height: 24px;
  background: rgba(226, 198, 141, .78);
  box-shadow: 0 1px 2px rgba(75, 12, 23, .15);
  transform: translateX(-50%) rotate(2.5deg);
}
.note__to { font-size: .66rem; font-weight: 500; letter-spacing: .26em; text-transform: uppercase; color: var(--gold); overflow-wrap: anywhere; }
.note__text { margin-top: 10px; font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 1.24rem; line-height: 1.5; overflow-wrap: anywhere; }
.note__sign { margin-top: 10px; text-align: right; font-family: var(--script); font-size: 1.6rem; line-height: 1.3; word-spacing: .14em; color: var(--wine); }

/* ══════════ Xác nhận tham dự ══════════ */
.form { display: grid; gap: 18px; padding: 24px 20px; }
.form__demo { padding: 10px 12px; border-radius: 8px; background: var(--tint); font-size: .8rem; color: var(--muted); }
.field { display: block; }
.field__label { display: block; margin-bottom: 7px; padding: 0; font-size: .8rem; font-weight: 600; }
.field__input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid rgba(176, 128, 58, .55);
  border-radius: 10px;
  background: #fff;
  font-size: 1rem;
}
textarea.field__input { min-height: 104px; resize: vertical; }
.field__input:focus { outline: 2px solid var(--wine); outline-offset: 1px; border-color: var(--wine); }
.pills { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pill { position: relative; display: block; }
.pill input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pill span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 46px;
  padding: 6px 8px;
  border: 1px solid rgba(176, 128, 58, .55);
  border-radius: 10px;
  background: #fff;
  font-size: .86rem;
  line-height: 1.3;
  text-align: center;
  transition: background .2s, color .2s, border-color .2s;
}
.pill input:checked + span { background: var(--wine); border-color: var(--wine); color: var(--cream); }
.pill--navy input:checked + span { background: var(--navy); border-color: var(--navy); }
.pill input:focus-visible + span { outline: 2px solid var(--wine); outline-offset: 2px; }
.form__row { display: grid; gap: 18px; }
.form__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__error { font-size: .88rem; color: #a3182b; }
.form__deadline { text-align: center; font-size: .8rem; color: var(--muted); }
.form__done { padding: 30px 22px; text-align: center; }
.form__done img { width: 64px; margin: 0 auto 10px; }
.form__done h3 { margin: 0; font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 1.6rem; color: var(--wine); }
.form__done p { margin-top: 8px; font-size: .93rem; color: var(--muted); }

/* ══════════ Sổ lời chúc: lá thư để viết và những tấm thiệp nhỏ đã nhận ══════════ */
.letter {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 24px 22px 22px;
  border: 1px solid rgba(176, 128, 58, .5);
  border-radius: 4px;
  background: linear-gradient(180deg, #fffdf8, #faf3e4);
  box-shadow: 0 22px 34px -26px rgba(75, 12, 23, .6), 0 2px 5px -2px rgba(75, 12, 23, .2);
  transition: border-color .25s;
}
/* Vân giấy mờ nằm dưới chữ */
.letter::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--paper-grain);
  opacity: .32;
  pointer-events: none;
}
.letter::after {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(176, 128, 58, .28);
  border-radius: 2px;
  pointer-events: none;
}
.letter:focus-within { border-color: var(--wine); }
.letter > * { position: relative; }
.letter__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-height: 92px; }
.letter__to { display: flex; flex-direction: column; font-family: var(--script); font-size: 1.85rem; line-height: 1.18; color: var(--wine); }
.letter__to small { margin-bottom: 6px; font-family: var(--sans); font-size: .64rem; font-weight: 500; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }
.letter__to > span + span { padding-left: .5em; }
.letter__post { position: relative; flex: 0 0 auto; width: 122px; height: 92px; }
.letter__stamp {
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  padding: 7px 8px 9px;
  background: #fffdf8;
  outline: 1px dashed rgba(176, 128, 58, .8);
  outline-offset: -4px;
  box-shadow: 0 3px 8px -3px rgba(75, 12, 23, .45);
  transform: rotate(4deg);
}
.letter__stamp img { width: 100%; height: auto; }
.letter__mark {
  position: absolute;
  z-index: 1;
  left: 0;
  bottom: -6px;
  width: 78px;
  height: 78px;
  overflow: visible;
  color: var(--wine);
  opacity: .58;
  transform: rotate(-13deg);
}
.letter__mark circle { fill: none; stroke: currentColor; stroke-width: 1.4; }
.letter__mark path { fill: none; stroke: none; }
.letter__mark text { fill: currentColor; font-family: var(--sans); font-weight: 600; }
.letter__mark-ring { font-size: 7.6px; letter-spacing: .16em; }
.letter__mark-day { font-family: var(--serif) !important; font-size: 17px; font-weight: 700 !important; letter-spacing: .04em; }
.letter__mark-year { font-size: 9px; letter-spacing: .22em; }
.letter__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.letter__body { display: block; }
.letter__body textarea {
  display: block;
  width: 100%;
  min-height: 170px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 33px, rgba(176, 128, 58, .42) 33px, rgba(176, 128, 58, .42) 34px) local;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.22rem;
  line-height: 34px;
  color: var(--ink);
  resize: none;
}
.letter__body textarea::placeholder, .letter__sign input::placeholder { color: var(--muted); opacity: .7; }
.letter__body textarea:focus { outline: none; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 33px, rgba(106, 19, 34, .5) 33px, rgba(106, 19, 34, .5) 34px); }
.letter__sign { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.letter__sign span { font-family: var(--serif); font-style: italic; font-size: 1.05rem; color: var(--muted); }
.letter__sign input {
  width: min(100%, 230px);
  padding: 2px 4px 4px;
  border: 0;
  border-bottom: 1px solid rgba(176, 128, 58, .6);
  border-radius: 0;
  background: transparent;
  font-family: var(--script);
  font-size: 1.7rem;
  line-height: 1.3;
  word-spacing: .14em;
  text-align: right;
  color: var(--wine);
}
.letter__sign input::placeholder { font-family: var(--serif); font-style: italic; font-size: 1.05rem; }
.letter__sign input:focus { outline: none; border-bottom-color: var(--wine); box-shadow: 0 1px 0 var(--wine); }
.letter__demo { text-align: center; font-size: .76rem; color: var(--muted); }
.letter.is-sent { animation: letter-sent .7s ease; }
@keyframes letter-sent {
  0% { transform: none; }
  35% { transform: translateY(-8px) rotate(-.6deg); }
  100% { transform: none; }
}

.wishes { margin-top: 44px; }
.wishes__title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 18px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--wine);
}
.wishes__title svg { width: 12px; height: 12px; color: var(--gold); }
.wishes__list { display: grid; gap: 16px; padding: 0 4px; }
.wish {
  position: relative;
  padding: 24px 20px 14px 22px;
  border: 1px solid rgba(176, 128, 58, .32);
  border-radius: 3px;
  background: var(--paper);
  box-shadow: 0 16px 22px -20px rgba(75, 12, 23, .65);
}
.wish:nth-child(odd) { transform: rotate(-.55deg); }
.wish:nth-child(even) { transform: rotate(.5deg); }
.wish::before {
  content: '\201C';
  position: absolute;
  top: 4px;
  left: 12px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 3.4rem;
  line-height: 1;
  color: var(--gold-light);
}
.wishes__status { padding: 18px; border: 1px dashed rgba(176, 128, 58, .6); border-radius: 4px; text-align: center; font-family: var(--serif); font-style: italic; font-size: 1.08rem; color: var(--muted); }
.wish__msg { position: relative; white-space: pre-line; font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 1.14rem; line-height: 1.5; overflow-wrap: anywhere; }
.wish__name { margin-top: 8px; text-align: right; font-family: var(--script); font-size: 1.5rem; line-height: 1.3; word-spacing: .14em; color: var(--wine); overflow-wrap: anywhere; }
.wish__name::before { content: '\2014\00a0'; font-family: var(--serif); font-size: 1rem; color: var(--gold); }
.wish__tag { margin-left: 8px; padding: 1px 7px; border: 1px solid currentColor; border-radius: 99px; font-family: var(--sans); font-size: .6rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; vertical-align: middle; color: var(--muted); }
.wish.is-new { animation: wish-in .7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes wish-in {
  from { opacity: 0; transform: translateY(-18px) rotate(-2deg); }
}
.wishes__more { display: flex; margin: 22px auto 0; }

/* ══════════ Cảm ơn ══════════ */
.thanks {
  padding-bottom: calc(86px + env(safe-area-inset-bottom));
  text-align: center;
  background: var(--wine);
  color: #f6e8d2;
}
.thanks__photo { -webkit-mask-image: linear-gradient(#000 62%, transparent 100%); mask-image: linear-gradient(#000 62%, transparent 100%); }
.thanks__photo img { width: 100%; }
.thanks__script { position: relative; margin-top: -22px; font-family: var(--script); font-size: clamp(3rem, 14vw, 4rem); line-height: 1.25; color: var(--gold-light); }
.thanks__msg { max-width: 32ch; margin: 10px auto 0; font-family: var(--serif); font-size: 1.16rem; line-height: 1.5; }
.thanks__sign { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 24px; font-family: var(--script); font-size: 2.2rem; line-height: 1.3; color: var(--cream); }
.thanks__sign svg { width: 14px; height: 14px; color: var(--gold-light); }
.thanks__date { margin-top: 2px; font-family: var(--serif); font-weight: 600; font-size: .98rem; letter-spacing: .3em; color: var(--gold-light); }
.thanks__art { display: flex; align-items: flex-end; justify-content: center; gap: 16px; margin-top: 30px; }
.thanks__art img { width: 72px; height: auto; }
.thanks__credit { max-width: 34ch; margin: 12px auto 0; font-size: .74rem; opacity: .65; }

/* ══════════ Lớp nổi ══════════ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(30, 6, 10, .95);
  cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.lightbox__close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.music {
  position: fixed;
  z-index: 40;
  right: max(14px, calc(50vw - var(--col) / 2 + 14px));
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  background: var(--wine);
  color: var(--gold-light);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
  cursor: pointer;
}
.music svg { width: 20px; height: 20px; }
.music__bars { display: none; align-items: flex-end; gap: 3px; height: 16px; }
.music[aria-pressed="true"] svg { display: none; }
.music[aria-pressed="true"] .music__bars { display: flex; }
.music__bars i { width: 3px; height: 6px; border-radius: 2px; background: currentColor; animation: bars 1s ease-in-out infinite; }
.music__bars i:nth-child(2) { animation-delay: .2s; }
.music__bars i:nth-child(3) { animation-delay: .4s; }
@keyframes bars { 0%, 100% { height: 5px; } 50% { height: 16px; } }

.preview-tag {
  position: fixed;
  z-index: 40;
  left: max(10px, calc(50vw - var(--col) / 2 + 10px));
  bottom: calc(24px + env(safe-area-inset-bottom));
  padding: 5px 10px;
  border-radius: 99px;
  background: rgba(30, 6, 10, .72);
  color: #f6e8d2;
  font-size: .66rem;
  letter-spacing: .04em;
}
.toast {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom));
  max-width: min(88vw, 420px);
  padding: 10px 16px;
  border-radius: 99px;
  background: var(--ink);
  color: #fff;
  font-size: .86rem;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Máy tính: phóng cả thiệp lên 25% (cột 560px thành 700px) cho cân với màn hình rộng */
@media (min-width: 900px) {
  :root { --col: 700px; }
  main { max-width: 560px; zoom: 1.25; }
}
@media (min-width: 900px) and (min-height: 860px) {
  .intro__head, .intro__stage, .intro__foot { zoom: 1.25; }
}

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

/* ══════════ Bản "Lá thư từ Hoa Lư": con triện, tờ lịch bloc, nét vẽ Hoa Lư ══════════ */
:root { --son: #b4281c; }

/* Con triện son của hai bạn */
.trien { display: block; width: 56px; height: 56px; color: var(--son); mix-blend-mode: multiply; overflow: visible; }
.names { position: relative; }
.hero__seal { position: absolute; right: 5%; bottom: -20px; width: 42px; height: 42px; transform: rotate(-6deg); }
.note__sign .trien { display: inline-block; width: 38px; height: 38px; margin-left: 10px; vertical-align: -10px; transform: rotate(4deg); }
.thanks__seal { width: 64px; height: 64px; margin: 20px auto 0; color: var(--gold-light); mix-blend-mode: normal; }
.js .thanks__seal.rv { transform: rotate(-5deg) scale(1.25); }
.js .thanks__seal.rv.in { transform: rotate(-5deg); }

/* Vạch chia giữa các phần: ba ngọn núi thay cho hình thoi */
.orn { width: 150px; height: 14px; }
.orn::before {
  width: 34px;
  height: 14px;
  border: 0;
  transform: translate(-50%, -50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 14' fill='none' stroke='%23b0803a' stroke-width='1.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 13C4 12 5 6 8 5C10.500 4.500 11.500 9 13 11C14.500 7 15.500 1.500 18 1C20.500 .8 21.500 7 23 10.500C24.500 8 25.500 6 27.500 6C30 6.200 31 12 33 13'/%3E%3C/svg%3E") center / contain no-repeat;
}
.count::before, .count::after { content: none; }

/* Tờ lịch bloc */
.bloc { position: relative; width: 248px; margin: 6px auto 0; padding-top: 18px; }
.bloc__bind {
  position: absolute;
  z-index: 3;
  top: 0;
  left: -8px;
  right: -8px;
  height: 26px;
  border-radius: 5px 5px 3px 3px;
  background: linear-gradient(#7b1a2a, var(--wine-deep));
  box-shadow: 0 3px 6px -2px rgba(40, 6, 12, .55);
}
.bloc__bind i {
  position: absolute;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6e2b0, #b0803a 60%, #7a5622);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .4);
}
.bloc__bind i:first-child { left: 26%; }
.bloc__bind i:last-child { right: 26%; }
.bloc__page {
  position: relative;
  padding: 18px 16px 14px;
  background: var(--paper-grain), linear-gradient(#fffdf6, #fbf3e2);
  background-size: 200px 200px, auto;
  border: 1px solid rgba(176, 128, 58, .4);
  border-top: 0;
  text-align: center;
  /* Những tờ lịch còn lại xếp bên dưới */
  box-shadow:
    0 2px 0 -1px #f7edd9, 0 3px 0 -1px rgba(120, 84, 40, .35),
    0 5px 0 -2px #f7edd9, 0 6px 0 -2px rgba(120, 84, 40, .3),
    0 8px 0 -3px #f7edd9, 0 9px 0 -3px rgba(120, 84, 40, .25),
    0 26px 30px -18px rgba(75, 12, 23, .5);
}
.bloc__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 2px 8px;
  border-bottom: 1px solid rgba(176, 128, 58, .5);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--wine);
}
.bloc__num {
  margin-top: 4px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 9.4rem;
  line-height: .98;
  font-variant-numeric: lining-nums;
  letter-spacing: -.02em;
  color: var(--wine);
}
.bloc--sun .bloc__page:not(.bloc__torn) .bloc__num, .bloc--sun .bloc__page:not(.bloc__torn) .bloc__dow { color: var(--son); }
.bloc__dow { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; letter-spacing: .2em; text-indent: .2em; text-transform: uppercase; color: var(--wine); }
.bloc__say { max-width: 20ch; margin: 10px auto 0; font-family: var(--serif); font-style: italic; font-size: 1.02rem; line-height: 1.35; color: var(--muted); }
.bloc__say:empty { display: none; }
.bloc__say::before { content: '“'; }
.bloc__say::after { content: '”'; }
.bloc__foot { display: grid; grid-template-columns: 1fr 1fr; margin-top: 12px; border-top: 1px solid rgba(176, 128, 58, .5); }
.bloc__foot p { display: flex; flex-direction: column; align-items: center; padding: 9px 4px 0; }
.bloc__foot p + p { border-left: 1px solid rgba(176, 128, 58, .5); }
.bloc__foot small { font-size: .58rem; font-weight: 600; letter-spacing: .22em; text-indent: .22em; text-transform: uppercase; color: var(--gold); }
.bloc__foot b { font-family: var(--serif); font-weight: 600; font-size: 2rem; line-height: 1.15; font-variant-numeric: lining-nums; color: var(--wine); }
.bloc__foot span { font-size: .72rem; color: var(--muted); }
.bloc--plain .bloc__foot { display: none; }
.bloc__seal { position: absolute; right: 12px; top: 46px; width: 46px; height: 46px; transform: rotate(7deg); opacity: .92; }

/* Tờ hôm trước: phủ lên trên rồi rơi xuống khi cuộn tới */
.bloc__torn { position: absolute; z-index: 2; left: 0; right: 0; top: 18px; bottom: 0; display: none; transform-origin: 12% 0; box-shadow: 0 10px 18px -12px rgba(75, 12, 23, .5); }
.bloc__torn .bloc__num, .bloc__torn .bloc__dow { color: var(--ink); }
.js .bloc__torn { display: block; }
.js .bloc.in .bloc__torn { animation: bloc-tear 1.5s cubic-bezier(.5, 0, .75, .4) .9s both; }
@keyframes bloc-tear {
  0% { transform: none; opacity: 1; }
  22% { transform: rotate(-3deg) translateY(4px); opacity: 1; }
  100% { transform: rotate(16deg) translate(30px, 115%); opacity: 0; visibility: hidden; }
}
.bloc__left { margin-top: 30px; text-align: center; font-family: var(--serif); font-style: italic; font-size: 1.24rem; color: var(--muted); }
.bloc__left b { margin: 0 .12em; font-style: normal; font-weight: 600; font-size: 1.7em; line-height: 1; color: var(--wine); font-variant-numeric: lining-nums; }

/* Nét vẽ Hoa Lư */
.hoalu { display: block; width: 100%; max-width: 380px; height: auto; aspect-ratio: 560 / 170; margin: 16px auto 0; color: var(--gold); }
.hoalu__name { margin-top: 4px; font-size: .62rem; font-weight: 500; letter-spacing: .3em; text-indent: .3em; text-transform: uppercase; color: var(--gold); }
.hoalu--end { max-width: 300px; margin-top: 30px; color: var(--gold-light); opacity: .55; }

@media (prefers-reduced-motion: reduce) {
  .js .bloc__torn { display: none; }
  .js .thanks__seal.rv { transform: rotate(-5deg); }
}
