:root {
  --bg: #f4e8ee;
  --bg-deep: #ecdbe3;
  --card: #eadfe4;
  --env: #ecc6d0;
  --env-deep: #e2b3c0;
  --navy: #4a5988;
  --navy-soft: #7d88b3;
  --ink: #3f3d4c;
  --ink-soft: #7a7385;
  --white: #fff;
  --script: "Ephesis", "Great Vibes", cursive;
  --caps: "Oswald", "Arial Narrow", sans-serif;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --col: 520px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  background: var(--bg-deep) url("assets/floral-pattern.svg") center / 200px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.locked { overflow: hidden; height: 100vh; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
p { margin: 0; }

.script { font-family: var(--script); font-weight: 400; }
.caps {
  font-family: var(--caps); font-weight: 300;
  text-transform: uppercase; letter-spacing: .06em;
  font-size: .8rem; line-height: 1.55;
}

/* Cột nội dung như tờ thiệp, nền hồng có hoa trắng chìm */
main {
  max-width: var(--col); margin: 0 auto; position: relative; overflow: hidden;
  background: var(--bg) url("assets/floral-pattern.svg") center / 220px;
  box-shadow: 0 0 60px rgba(120, 80, 100, .12);
}
section { position: relative; padding: 3.5rem 1.4rem; }

/* ---------- nút ---------- */
.btn-line {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 0 2.4rem; margin-top: 1rem;
  border: 1.4px solid var(--navy); border-radius: 999px;
  background: transparent; color: var(--navy);
  font-family: var(--caps); font-weight: 400; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase;
  text-decoration: none; transition: background .2s, color .2s;
}
.btn-line:hover { background: var(--navy); color: var(--white); }
.btn-solid {
  display: block; width: 100%; min-height: 42px; margin-top: .7rem;
  border: 0; border-radius: 999px;
  background: var(--navy); color: var(--white);
  font-family: var(--caps); font-weight: 400; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase;
  box-shadow: 0 6px 16px -8px rgba(74, 89, 136, .8);
  transition: transform .2s, background .2s;
}
.btn-solid:hover { transform: translateY(-1px); background: #3d4b77; }
.btn-solid:disabled { opacity: .6; pointer-events: none; }

/* ================= INTRO TỰ CHẠY ================= */
.intro { position: fixed; inset: 0; z-index: 100; background: #2b2327; overflow: hidden; transition: opacity 1s ease, visibility 1s; }
.intro.is-gone { opacity: 0; visibility: hidden; }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1.1s ease; }
.slide::before { /* ảnh nền zoom chậm */
  content: ""; position: absolute; inset: 0;
  background: var(--img) center 30% / cover no-repeat;
  transform: scale(1.12); transition: transform 7s ease-out;
}
.slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,14,18,.15) 0%, rgba(20,14,18,.05) 40%, rgba(20,14,18,.55) 100%); }
.slide.on { opacity: 1; }
.slide.on::before { transform: scale(1); }
.slide-title {
  position: absolute; z-index: 1; left: 0; right: 0; bottom: 15%;
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--serif); font-weight: 500; color: #fff;
  font-size: clamp(3.3rem, 15.5vw, 5.2rem); line-height: .98; letter-spacing: .02em;
  text-shadow: 0 2px 20px rgba(0,0,0,.25);
}
.slide-title .ln { display: flex; align-items: center; gap: .28em; white-space: nowrap; }
.slide-title .w { display: inline-block; opacity: 0; transition: transform 1.6s cubic-bezier(.2,.7,.2,1), opacity 1.2s ease; }
.slide-title .wl { transform: translateX(-.6em); }
.slide-title .wr { transform: translateX(.6em); }
.slide-title .dash { display: inline-block; width: 0; height: 2px; background: #fff; transition: width 1.4s ease .5s; }
.slide.on .w { opacity: 1; transform: none; }
.slide.on .dash { width: 1.05em; }
.slide-date { font-size: .26em; letter-spacing: .35em; margin-top: 1.1em; font-weight: 400; opacity: 0; transition: opacity 1.2s ease .8s; }
.slide.on .slide-date { opacity: 1; }
.intro-foot {
  position: absolute; z-index: 2; left: 13%; right: 13%; bottom: calc(5% + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: space-between;
  font-family: var(--caps); font-weight: 400; font-size: .72rem; letter-spacing: .28em; color: rgba(255,255,255,.92);
}
.skip {
  position: absolute; z-index: 3; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px;
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .55rem 1rem .55rem 1.15rem; border: 0; border-radius: 999px;
  background: rgba(60, 55, 60, .55); backdrop-filter: blur(6px); color: #fff;
  font-family: var(--caps); font-weight: 400; font-size: .85rem; letter-spacing: .12em;
}
.skip svg { width: 26px; fill: none; stroke: #fff; stroke-width: 1.4; }
.intro.is-ending .slide { opacity: 0; }

/* ================= 1. SAVE OUR DATE ================= */
.cover { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 1.5rem; padding-bottom: 1.5rem; }
.sprig { width: 64px; margin-bottom: .2rem; position: relative; z-index: 1; }
.collage { position: relative; width: min(84vw, 380px); aspect-ratio: 1 / 1.02; margin-top: .4rem; }
.polaroid { background: #fbf8f8; padding: 6px 6px 22px; box-shadow: 0 8px 18px -8px rgba(70, 50, 60, .45); }
.polaroid img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.collage .polaroid { position: absolute; width: 47%; z-index: 2; opacity: 0; transition: transform 1.2s cubic-bezier(.25,.8,.3,1), opacity 1s ease; }
.pol-a { left: 4%; top: 12%; transform: translate(-30px, 30px) rotate(-12deg); }
.pol-b { right: 4%; top: 0; transform: translate(30px, 30px) rotate(12deg); transition-delay: .15s !important; }
.ticket {
  position: absolute; z-index: 3; left: 12%; right: 10%; top: 60%;
  display: flex; background: #efe7e6;
  box-shadow: 0 6px 14px -8px rgba(70, 50, 60, .5);
  opacity: 0; transform: translateY(40px) rotate(-3deg);
  transition: transform 1.2s cubic-bezier(.25,.8,.3,1) .35s, opacity 1s ease .35s;
}
.ticket-stub {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--caps); font-size: .55rem; letter-spacing: .12em; color: var(--ink-soft);
  padding: .5rem .35rem; border-left: 1.5px dashed #c9bcc0;
}
.ticket-body { flex: 1; display: flex; flex-direction: column; align-items: center; padding: .7rem .4rem .6rem; }
.t-small { font-family: var(--serif); font-size: .8rem; letter-spacing: .1em; color: var(--ink-soft); }
.t-date { font-family: var(--serif); font-size: 1.55rem; letter-spacing: .08em; line-height: 1.1; }
.t-sub { font-size: 1.2rem; color: var(--ink-soft); line-height: 1; }
.pocket-bouquet { position: absolute; z-index: 5; width: 40%; pointer-events: none; }
.pb-l { left: -9%; bottom: -6%; transform: rotate(-8deg); }
.pb-r { right: -9%; top: 34%; transform: rotate(10deg) scaleX(-1); width: 34%; }
body.opened .pol-a { opacity: 1; transform: rotate(-5deg); }
body.opened .pol-b { opacity: 1; transform: rotate(4deg); }
body.opened .ticket { opacity: 1; transform: rotate(-3deg); }

.couple {
  margin: 1.8rem 0 0; font-family: var(--caps); font-weight: 300;
  font-size: clamp(1.25rem, 5.4vw, 1.55rem); letter-spacing: .05em; text-align: center;
}
.couple .script { display: inline-block; font-size: 1.5em; line-height: 1; text-transform: none; margin: 0 .2em 0 0; letter-spacing: 0; transform: translateY(-.09em); }
.scroll-cue { margin-top: 1.4rem; width: 46px; animation: bob 1.8s ease-in-out infinite; }
.scroll-cue path { fill: none; stroke: var(--navy-soft); stroke-width: 2.2; stroke-linecap: round; }
@keyframes bob { 50% { transform: translateY(6px); } }

/* ================= 2. NGÀY CƯỚI ================= */
.bigdate { text-align: center; padding-top: 1rem; }
.heart { width: 64px; margin: 0 auto; display: block; }
.heart path { fill: none; stroke: var(--navy-soft); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.draw path { stroke-dasharray: 420; stroke-dashoffset: 420; transition: stroke-dashoffset 2.2s ease; }
.draw.in path { stroke-dashoffset: 0; }
.date-script { position: relative; height: 7rem; margin-top: 1rem; }
.date-script .month { position: absolute; left: 50%; top: 3.4rem; transform: translateX(-128%); font-size: 2rem; color: var(--ink-soft); }
.date-script .day { position: absolute; left: 50%; top: 0; transform: translateX(-20%); font-size: 6.5rem; line-height: 1; color: var(--ink); }
.quote { font-family: var(--caps); font-weight: 300; text-transform: uppercase; font-size: .78rem; letter-spacing: .05em; margin-top: .6rem; }
.date-photo { margin: 2rem -1.4rem 0; }
.date-photo img { width: 100%; }

/* ================= 3. LỜI MỜI ================= */
.invite { padding-top: 0; text-align: center; }
.full-photo { margin: 0 -1.4rem; }
.full-photo img { width: 100%; }
.invite-line { margin: 2rem 0 1.6rem; font-size: .88rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; align-items: start; }
.pair .polaroid { margin: 0; position: relative; }
.pair figcaption { font-family: var(--caps); font-weight: 300; font-size: .78rem; letter-spacing: .08em; padding-top: .4rem; }
.pair figcaption .script { display: block; font-size: 1.5rem; letter-spacing: 0; line-height: 1; color: var(--ink-soft); }
.pol-groom { transform: rotate(-3deg); }
.pol-bride { transform: rotate(2deg); margin-top: 1.6rem !important; }
.pair .reveal.in.pol-groom { transform: rotate(-3deg); }
.pair .reveal.in.pol-bride { transform: rotate(2deg); }
.polaroid img.calla { position: absolute; width: 46px; aspect-ratio: auto; right: -24px; bottom: -8px; transform: rotate(28deg); }

/* ================= 4. SỰ KIỆN ================= */
.events { display: grid; gap: 1.4rem; padding-top: 1rem; }
.event-card {
  background: var(--card) url("assets/paper.svg");
  padding: 1.8rem 1.2rem 1.6rem; text-align: center;
  box-shadow: 0 10px 24px -16px rgba(70, 50, 60, .5);
}
.event-card h2 { font-size: 1rem; font-weight: 400; margin: 0; letter-spacing: .12em; }
.e-time { color: var(--ink-soft); }
.e-date {
  font-family: var(--caps); font-weight: 300; font-size: 1.35rem; letter-spacing: .06em;
  margin: .5rem auto 0; padding: .25rem 0; max-width: 200px;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
}
.e-lunar { font-size: .66rem; color: var(--ink-soft); margin-top: .4rem; }
.pin { width: 22px; margin: .9rem auto .2rem; fill: var(--navy); }
.e-venue { font-size: 2rem; line-height: 1.1; }
.e-addr { font-size: .68rem; color: var(--ink-soft); margin-top: .3rem; }

/* ================= 5. CÂU CHUYỆN ================= */
.title-line {
  display: flex; align-items: baseline; gap: .6rem;
  font-size: clamp(1.8rem, 7.6vw, 2.3rem); line-height: 1.1; margin: 0 0 1rem; white-space: nowrap;
}
.title-line::after { content: ""; flex: 1; height: 1px; background: var(--ink); min-width: 30px; transform: translateY(-.3em); }
.story-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 1.2rem 0 1.4rem; }
.story-photos .polaroid { padding: 4px 4px 14px; }
.story-photos .polaroid:nth-child(1) { transform: rotate(-4deg); }
.story-photos .polaroid:nth-child(2) { transform: translateY(-8px); }
.story-photos .polaroid:nth-child(3) { transform: rotate(4deg); }
.story-photos .polaroid.reveal.in:nth-child(1) { transform: rotate(-4deg); }
.story-photos .polaroid.reveal.in:nth-child(2) { transform: translateY(-8px); }
.story-photos .polaroid.reveal.in:nth-child(3) { transform: rotate(4deg); }
.story-photos img { aspect-ratio: 2 / 3; }
.story-text { font-family: var(--serif); font-style: italic; font-size: 1.12rem; line-height: 1.6; text-align: center; }

/* ================= 6. ALBUM ================= */
.album { text-align: center; padding-top: 1.5rem; }
.album-lead { text-align: left; font-size: .72rem; margin-bottom: 1.4rem; }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.gallery button { padding: 5px; border: 0; background: #fbf8f8; box-shadow: 0 6px 14px -8px rgba(70, 50, 60, .45); cursor: zoom-in; }
.gallery img { width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; }
.gallery .is-hidden { display: none; }

/* ================= 7. RSVP ================= */
.rsvp { padding-top: 1.5rem; }
.rsvp-lead { font-size: .74rem; margin-bottom: 1rem; }
.field { display: block; margin-bottom: .6rem; }
.field input, .field textarea, .field select {
  width: 100%; font-family: var(--caps); font-weight: 300; font-size: .74rem; letter-spacing: .05em; color: var(--ink);
  background: rgba(255,255,255,.35);
  border: 1.3px solid var(--ink); border-radius: 999px;
  padding: .6rem 1.1rem; outline: none;
}
.field textarea { border-radius: 20px; resize: vertical; text-transform: none; }
.field input::placeholder, .field textarea::placeholder { color: var(--ink); opacity: .85; }
.field select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%233f3d4c' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center; background-size: 11px;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(74, 89, 136, .15); }
.field.is-invalid input, .field.is-invalid select { border-color: #c0435f; }
.form-msg { min-height: 1.2em; text-align: center; font-family: var(--caps); font-weight: 300; font-size: .82rem; margin-top: .4rem; }
.form-msg.ok { color: #4f7d5e; }
.form-msg.err { color: #c0435f; }

/* ================= 8. ĐẾM NGƯỢC ================= */
.countdown-sec { text-align: center; padding-bottom: 2.5rem; }
.cd-title { font-size: 2.4rem; text-align: left; transform: rotate(-4deg); }
.countdown { position: relative; display: flex; justify-content: center; gap: 1.6rem; margin: .8rem 0 .4rem; padding: 1.4rem 0; }
.heart--big { position: absolute; left: 50%; top: -10px; width: 120px; margin-left: -60px; opacity: .75; }
.countdown div { position: relative; display: grid; }
.countdown b { font-family: var(--caps); font-weight: 300; font-size: 1.3rem; }
.countdown span { font-family: var(--caps); font-weight: 300; font-size: .72rem; letter-spacing: .08em; color: var(--ink-soft); }
.cd-sub { font-size: 1.8rem; text-align: right; transform: rotate(-4deg); }

/* ================= 9. LỜI CẢM ƠN ================= */
.thanks { padding: 0; }
.thanks > img { width: 100%; }
.thanks-band {
  position: absolute; left: 0; right: 0; bottom: 14%;
  background: rgba(88, 104, 150, .55); backdrop-filter: blur(2px);
  color: var(--white); text-align: center; padding: .6rem 1.2rem 1rem;
}
.thanks-band .script { font-size: 2rem; line-height: 1.2; }
.thanks-band .caps { font-size: .68rem; }

/* ================= FAB ================= */
.fab-group {
  position: fixed; z-index: 50; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  right: max(14px, calc(50vw - var(--col) / 2 + 14px));
  display: flex; flex-direction: column; gap: .55rem;
}
.fab {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1.6px solid var(--ink); background: rgba(255,255,255,.85);
  display: grid; place-items: center;
}
.fab svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.fab.is-playing svg { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= MODAL ================= */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(50, 45, 60, .55); backdrop-filter: blur(3px); }
.modal-box {
  position: relative; width: min(100%, 370px); max-height: 92vh; overflow-y: auto;
  background: var(--bg) url("assets/floral-pattern.svg") center / 200px;
  border-radius: 18px; padding: 1.6rem 1.3rem 1.3rem; text-align: center;
  animation: pop .35s ease;
}
@keyframes pop { from { transform: translateY(20px) scale(.96); opacity: 0; } }
.modal-box h3 { font-size: 2.4rem; margin: 0; line-height: 1.1; }
.modal-sub { margin: .1rem 0 1rem; color: var(--ink-soft); }
.modal-close { position: absolute; top: .4rem; right: .6rem; border: 0; background: none; font-size: 1.8rem; line-height: 1; width: 40px; height: 40px; color: var(--ink-soft); }
.qr-tabs { display: flex; border: 1.3px solid var(--navy); border-radius: 999px; padding: 3px; margin-bottom: 1rem; }
.qr-tab { flex: 1; border: 0; background: none; border-radius: 999px; padding: .45rem; font-family: var(--caps); font-weight: 300; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); }
.qr-tab.is-active { background: var(--navy); color: var(--white); }
.qr-card {
  background: #fff url("assets/paper.svg"); border-radius: 16px;
  padding: 1rem 1.4rem 1.2rem; box-shadow: 0 14px 30px -18px rgba(70, 50, 60, .55);
}
.qr-role { font-size: 1.9rem; line-height: 1; margin-bottom: .6rem; }
.qr-frame { position: relative; width: min(100%, 230px); margin: 0 auto; padding: 10px; }
.qr-frame::before, .qr-frame::after { /* góc khung ngắm */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border: 2px solid var(--navy);
  clip-path: polygon(0 0, 22% 0, 22% 2px, 2px 2px, 2px 22%, 0 22%, 0 100%, 22% 100%, 22% calc(100% - 2px), 2px calc(100% - 2px), 2px 78%, 0 78%);
  border-radius: 10px;
}
.qr-frame::after { transform: scaleX(-1); }
.qr-frame img { width: 100%; height: auto; image-rendering: pixelated; }
.qr-bank { font-family: var(--caps); font-weight: 400; font-size: .72rem; letter-spacing: .3em; color: #d6202b; margin-top: .9rem; }
.qr-name { font-family: var(--caps); font-weight: 400; font-size: 1.05rem; letter-spacing: .08em; margin-top: .1rem; }
.copy {
  display: inline-flex; align-items: center; gap: .5rem; margin-top: .5rem;
  border: 1.3px solid var(--navy); background: transparent; border-radius: 999px; padding: .35rem 1rem;
  font-family: var(--caps); font-weight: 300; font-size: 1.05rem; letter-spacing: .1em; color: var(--navy);
  transition: background .2s, color .2s;
}
.copy:hover { background: var(--navy); color: #fff; }
.copy svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.copy-hint { font-family: var(--caps); font-weight: 300; font-size: .72rem; color: var(--ink-soft); margin-top: .6rem; }

/* ================= LIGHTBOX ================= */
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(28, 24, 30, .94); display: grid; place-items: center; }
.lightbox img { max-width: 94vw; max-height: 86vh; object-fit: contain; }
.lb-close, .lb-nav { position: absolute; border: 0; background: rgba(255,255,255,.12); color: var(--white); border-radius: 50%; width: 44px; height: 44px; font-size: 1.7rem; line-height: 1; }
.lb-close { top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; }
.lb-prev { left: 10px; top: 50%; margin-top: -22px; }
.lb-next { right: 10px; top: 50%; margin-top: -22px; }
.lb-count { position: absolute; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.7); font-family: var(--caps); font-size: .8rem; }

/* ================= HIỆN DẦN KHI CUỘN ================= */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s ease, transform .9s ease; }
.reveal.in { opacity: 1; transform: none; }

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