﻿/* Bảng màu: mọi màu của mẫu đều lấy từ các biến này. */
:root, [data-palette="reu"] {
  --moss: #415e34;
  --moss-rgb: 65, 94, 52;
  --deep: #22371a;
  --soft: #4d5c45;
  --wine: #490817;
  --red: #a00101;
  --guest: #9c0505;
  --strip-line: #dcc4c3;
  --paper: #f7f6f2;
  --page: #dfe3da;
  --ink: #333;
  --line: #2f2f2f;
  --tape: rgba(236, 226, 208, .9);
  --fall: rgba(255, 255, 255, .9);
  --fall-heart: rgba(255, 222, 228, .95);
  --shade: rgba(0, 0, 0, .18);
  /* Vân giấy: nhiễu rất nhẹ vẽ bằng SVG */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .3 0 0 0 0 .27 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  line-height: 1.5;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.script { font-family: 'Ms Madi', cursive; font-weight: 400; }

.card { position: relative; max-width: 480px; margin: 0 auto; overflow: hidden; background: var(--paper); box-shadow: 0 0 40px var(--shade); }
.paper { background-color: var(--paper); background-image: var(--grain); }
.lily { position: absolute; z-index: 2; pointer-events: none; }

/* 1. Ảnh bìa */
.hero { position: relative; aspect-ratio: 420 / 640; overflow: hidden; background: var(--moss); color: #fff; }
.hero-img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.hero::after { content: ""; position: absolute; inset: 38% 0 0; background: linear-gradient(rgba(var(--moss-rgb), 0), var(--moss) 86%); }
.lily-hero { top: -24px; right: -44px; width: 66%; transform: rotate(6deg); }
.hero-names { position: absolute; left: 0; right: 0; bottom: 7%; z-index: 3; font: 400 clamp(44px, 13.6vw, 62px)/1 'Ms Madi', cursive; }
.hero-names span { display: block; white-space: nowrap; transform: rotate(-20deg); }
.n1 { margin-left: 7%; }
.n2 { margin: .55em 6% 0 0; text-align: right; }
.hero-heart { display: inline-block; width: 1.2em; margin: -.25em 0 0 .1em; vertical-align: top; }

/* 2. Save the date */
.std { position: relative; padding: 26px 14px 170px; background: var(--moss); color: #fff; text-align: center; }
.std-title { font: 400 clamp(30px, 9.4vw, 41px)/1.1 'Tinos', serif; text-transform: uppercase; }
.std-month { margin-top: 4px; font-size: clamp(32px, 9.6vw, 42px); line-height: 1.1; }
.cal { width: 100%; max-width: 400px; margin: 14px auto 0; border-collapse: collapse; table-layout: fixed; font: 400 17px 'Tinos', serif; }
.cal th { padding: 6px 0 12px; font-size: 16px; font-weight: 400; }
.cal td { position: relative; height: 46px; }
.cal-heart { position: absolute; top: 50%; left: 50%; width: 52px; transform: translate(-50%, -36%); }
.countdown { display: flex; justify-content: center; gap: 22px; margin-top: 18px; font: 400 13px 'Quicksand', sans-serif; }
.countdown b { display: block; font: 400 26px/1.1 'Tinos', serif; }
.countdown-title { margin-top: 22px; font: 400 14px 'Quicksand', sans-serif; letter-spacing: .04em; text-transform: uppercase; opacity: .9; }
.std-day { position: absolute; right: 10%; bottom: 34px; font-size: clamp(30px, 9vw, 40px); line-height: 1; }
.lily-std { bottom: -46px; left: -48px; width: 60%; transform: rotate(180deg); }

/* 3. Chú rể, cô dâu */
.couple { position: relative; padding: 118px 0 8px; }
.brush { position: absolute; top: -1px; left: 0; width: 100%; height: 80px; }
.lily-couple { top: -30px; left: -40px; width: 58%; transform: scaleX(-1); }
.person { position: relative; width: 84%; aspect-ratio: 3 / 4; margin: 0 auto 26px; overflow: hidden; border-radius: 26px; background: var(--moss); box-shadow: 0 6px 18px var(--shade); }
.person img { width: 100%; height: 100%; object-fit: cover; }
.person::after { content: ""; position: absolute; inset: 52% 0 0; background: linear-gradient(rgba(var(--moss-rgb), 0), rgba(var(--moss-rgb), .7)); }
.person-text { position: absolute; left: 0; right: 0; bottom: 5%; z-index: 1; color: #fff; text-align: center; }
.person-text .script { font-size: clamp(32px, 10vw, 42px); line-height: 1; }
.person-name { font: 400 clamp(21px, 6.4vw, 28px)/1.2 'Tinos', serif; text-transform: uppercase; }
.person.noimg { aspect-ratio: auto; padding: 22px 0; }
.person.noimg::after { display: none; }
.person.noimg .person-text { position: static; }

/* 4. Lời mời */
.invite { padding: 4px 16px 16px; color: var(--moss); text-align: center; }
.invite .caps { font: 500 14px/1.6 'Lora', serif; text-transform: uppercase; letter-spacing: .02em; }
.guest { display: inline-block; min-width: 46%; margin: 0 auto 6px; padding: 0 14px 2px; border-bottom: 1.5px dotted var(--guest); color: var(--guest); font-size: clamp(32px, 9.6vw, 42px); line-height: 1.2; }

/* 5. Gia đình */
.families { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 10px 22px; text-align: center; }
.families.one { grid-template-columns: minmax(0, 72%); justify-content: center; }
.fam h3 { margin-bottom: 6px; color: var(--moss); font: 400 16px 'Tinos', serif; text-transform: uppercase; }
.parent { color: var(--deep); font: 500 13.5px/1.5 'Oswald', sans-serif; text-transform: uppercase; }
.fam-addr { margin-top: 6px; color: var(--soft); font: 400 12.5px/1.5 'Quicksand', sans-serif; }

/* 6. Dải ngày */
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 10px 22px; }
.strip-cell { position: relative; aspect-ratio: 2 / 3; overflow: hidden; border: 2px solid var(--strip-line); background: var(--wine); }
.strip-cell img { width: 100%; height: 100%; object-fit: cover; }
.strip-cell::after { content: ""; position: absolute; inset: 42% 0 0; background: linear-gradient(rgba(253, 251, 251, 0), var(--wine)); }
.strip-cell span { position: absolute; left: 0; right: 0; bottom: 7%; z-index: 1; color: #fff; font: 400 clamp(26px, 8.2vw, 36px) 'Tinos', serif; text-align: center; }

/* 7. Thẻ lễ */
.events { padding: 0 14px 30px; }
.event { padding: 22px 14px 24px; border-radius: 30px; background: rgba(var(--moss-rgb), .12); color: var(--moss); text-align: center; }
.event + .event { margin-top: 18px; }
.event h3 { font: 700 clamp(19px, 5.6vw, 23px) 'Tinos', serif; text-transform: uppercase; }
.ev-time { margin-top: 8px; font: 400 clamp(13px, 3.8vw, 16px) 'Tinos', serif; text-transform: uppercase; }
.ev-date { margin-top: 2px; font: 700 clamp(20px, 6vw, 25px) 'Tinos', serif; }
.ev-lunar { margin-top: 4px; color: var(--soft); font: italic 400 13px 'Quicksand', sans-serif; }
.ev-place { margin-top: 12px; font: 700 clamp(17px, 5vw, 21px) 'Tinos', serif; text-transform: uppercase; }
.ev-addr { margin-top: 2px; color: var(--soft); font: 400 13px/1.5 'Quicksand', sans-serif; }
.btn { display: inline-block; margin-top: 14px; padding: 7px 42px; border: 0; border-radius: 999px; background: var(--moss); color: #fff; font: 700 15px 'Tinos', serif; text-decoration: none; text-transform: uppercase; cursor: pointer; }
.btn:disabled { opacity: .6; }

/* 8. Ảnh polaroid */
.polaroid-wrap { padding: 24px 0 34px; }
.polaroid { position: relative; width: 92%; margin: 0 auto; padding: 12px; background: #fff; box-shadow: 0 8px 22px var(--shade); }
/* Khung ngang mà ảnh thường chụp dọc: lấy phần trên của ảnh để không cắt mất đầu */
.polaroid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: center 18%; }
.tape { position: absolute; top: -15px; left: 50%; z-index: 1; width: 124px; height: 32px; transform: translateX(-50%) rotate(-2deg); background: var(--tape); box-shadow: 0 1px 3px var(--shade);
  clip-path: polygon(0 10%, 3% 0, 6% 8%, 9% 0, 91% 0, 94% 9%, 97% 0, 100% 12%, 100% 88%, 97% 100%, 94% 90%, 91% 100%, 9% 100%, 6% 91%, 3% 100%, 0 90%); }

/* 9. Xác nhận tham dự, sổ lời chúc */
.rsvp { padding: 6px 26px 32px; color: var(--moss); text-align: center; }
.title { color: var(--moss); font-size: clamp(34px, 10.6vw, 50px); line-height: 1.15; white-space: nowrap; -webkit-text-stroke: .6px var(--moss); }
.rsvp-text { max-width: 340px; margin: 6px auto 18px; font: 400 15px/1.6 'Lora', serif; }
.rsvp form { display: grid; gap: 12px; text-align: left; }
.rsvp input[name="name"], .rsvp input[name="guests"], .rsvp textarea, .attend { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: 400 14px 'Lora', serif; }
.rsvp textarea { resize: vertical; }
.rsvp ::placeholder { color: #666; }
.attend { display: grid; gap: 6px; }
.attend label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.attend input { accent-color: var(--moss); width: 16px; height: 16px; }
.rsvp .btn { justify-self: center; margin-top: 4px; padding: 10px 46px; }
.form-msg { min-height: 1.5em; color: var(--moss); font-style: italic; text-align: center; }
.wishes { margin-top: 20px; text-align: left; }
.wishes h3 { margin-bottom: 8px; font-size: 38px; line-height: 1.1; text-align: center; }
.wish-list { display: grid; gap: 10px; max-height: 380px; overflow-y: auto; padding-right: 4px; }
.wish { padding: 10px 14px; border: 1px solid rgba(var(--moss-rgb), .25); border-radius: 12px; background: #fff; color: var(--ink); }
.wish-name { color: var(--moss); font: 600 14px 'Quicksand', sans-serif; }
.wish-name span { color: var(--soft); font-weight: 400; }

/* 10. Mừng cưới */
.gift { padding: 4px 0 38px; text-align: center; }
.wreath { position: relative; width: 240px; height: 240px; margin: 0 auto 16px; }
.wreath-photo { position: absolute; top: 22px; left: 22px; width: 196px; height: 196px; border-radius: 50%; object-fit: cover; }
.wreath-leaves { position: absolute; inset: 0; width: 100%; height: 100%; }
.btn-gift { display: inline-flex; align-items: center; gap: 10px; padding: 9px 30px; font-size: 14px; }
.btn-gift svg { width: 22px; height: 22px; }
.gift-box { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .6); }
.gift-panel { position: relative; width: min(100%, 380px); max-height: 90vh; overflow-y: auto; padding: 18px 18px 22px; border-radius: 18px; background: var(--paper); color: var(--moss); text-align: center; }
.gift-panel h3 { font-size: 42px; line-height: 1.2; }
.gift-close { position: absolute; top: 4px; right: 12px; border: 0; background: none; color: var(--moss); font-size: 34px; line-height: 1; cursor: pointer; }
.gift-card + .gift-card { margin-top: 18px; padding-top: 18px; border-top: 1px dashed rgba(var(--moss-rgb), .4); }
.qr { width: 200px; margin: 8px auto 10px; padding: 6px; border-radius: 8px; background: #fff; }
.acc-name { font: 700 16px 'Tinos', serif; text-transform: uppercase; }
.acc-bank { font: 400 14px 'Quicksand', sans-serif; }
.acc-no { font: 700 19px 'Tinos', serif; letter-spacing: .04em; }
.btn-copy { margin-top: 8px; padding: 5px 16px; border: 1px solid var(--moss); border-radius: 999px; background: transparent; color: var(--moss); font: 500 13px 'Quicksand', sans-serif; cursor: pointer; }

/* 11. Album */
.album-title { display: flex; flex-direction: column; padding: 14px 26px 10px; background: var(--moss); color: #fff; font: 500 clamp(40px, 12.4vw, 56px)/1.05 'Cormorant Upright', serif; text-transform: uppercase; }
.album-title span:last-child { align-self: flex-end; }
.album-title i { font-size: .82em; font-style: normal; text-transform: none; }
.album { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 6px 6px 8px; background-color: var(--paper); background-image: var(--grain); }
.album img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border: 2px solid #fff; cursor: zoom-in; }
.album img.wide { grid-column: span 2; aspect-ratio: 3 / 2; }
.album img.top { object-position: center 25%; }

/* 12. Lời cảm ơn */
.thanks { position: relative; background: var(--red); color: #fff; text-align: center; }
.thanks img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.thanks::after { content: ""; position: absolute; inset: 44% 0 0; background: linear-gradient(rgba(253, 251, 251, 0), var(--red) 88%); }
.thanks-text { position: absolute; left: 0; right: 0; bottom: 5%; z-index: 1; padding: 0 26px; }
.thanks h2 { font-size: clamp(56px, 17vw, 74px); line-height: 1; }
.thanks p { font: 400 15px/1.6 'Lora', serif; }
.thanks.plain { padding: 34px 0 30px; }
.thanks.plain::after { display: none; }
.thanks.plain .thanks-text { position: static; }

.footer { padding: 16px 16px 20px; text-align: center; }
.credit { color: var(--moss); font: 500 12px 'Quicksand', sans-serif; letter-spacing: .14em; text-decoration: none; opacity: .75; }

/* Nút nhạc: góc dưới bên trái */
.music { position: fixed; bottom: 18px; left: max(14px, calc(50% - 226px)); z-index: 20; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(40, 40, 40, .72); color: #fff; box-shadow: 0 3px 10px var(--shade); cursor: pointer; }
.music svg { width: 22px; height: 22px; }
.music .ico-on, .music.playing .ico-off { display: none; }
.music.playing .ico-on { display: block; }

/* Xem ảnh phóng to */
.lightbox { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .92); }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox button { position: absolute; padding: 12px; border: 0; background: none; color: #fff; font-size: 42px; line-height: 1; cursor: pointer; }
.lb-prev { top: 50%; left: 4px; transform: translateY(-50%); }
.lb-next { top: 50%; right: 4px; transform: translateY(-50%); }
.lb-close { top: 6px; right: 10px; }

/* Bông tuyết và trái tim rơi */
.fall { position: fixed; top: 0; bottom: 0; left: 50%; z-index: 15; width: min(100%, 480px); overflow: hidden; transform: translateX(-50%); pointer-events: none; }
.fall i { position: absolute; top: -30px; color: var(--fall); font-family: 'Segoe UI Symbol', 'DejaVu Sans', sans-serif; font-size: 15px; font-style: normal; text-shadow: 0 0 3px var(--shade); animation: fall 14s linear infinite; }
.fall i:nth-child(even) { color: var(--fall-heart); }
@keyframes fall {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(18px, 54vh) rotate(180deg); }
  100% { transform: translate(-8px, 108vh) rotate(360deg); }
}

/* Nút gửi xác nhận "thở" nhẹ để mời bấm */
.rsvp .btn { animation: pulse 2.6s ease-in-out infinite; }
.rsvp .btn:hover, .rsvp .btn:disabled { animation-play-state: paused; }
@keyframes pulse { 50% { transform: scale(1.04); } }

/* Ảnh mờ nhẹ rồi nét dần khi tải xong, che độ trễ mạng chậm */
img[loading="lazy"] { filter: blur(10px); transition: filter .5s ease; }
img[loading="lazy"].loaded { filter: none; }

/* Hiện dần khi cuộn tới; tên trên ảnh bìa hiện khi mở trang */
.js .reveal, .js .reveal-left, .js .reveal-right, .js .zoom { opacity: 0; transition: opacity 1s ease, transform 1s ease; }
.js .reveal { transform: translateY(26px); }
.js .reveal-left { transform: translateX(-40px); }
.js .reveal-right { transform: translateX(40px); }
.js .zoom { transform: scale(.9); }
.js .shown { opacity: 1; transform: none; }
.hero-names span, .hero-heart { animation: rise 1.6s ease both; }
.hero-heart { animation-delay: .4s; }
.n2 { animation-delay: .7s; }
@keyframes rise { from { opacity: 0; translate: 0 24px; } to { opacity: 1; translate: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .fall { display: none; }
  .js .reveal, .js .reveal-left, .js .reveal-right, .js .zoom { opacity: 1; transform: none; transition: none; }
  .hero-names span, .hero-heart { animation: none; }
  .rsvp .btn { animation: none; }
  img[loading="lazy"] { filter: none; transition: none; }
}
