/* Bảng màu: mọi màu của mẫu đều lấy từ các biến này (TLNV MA-2). */
:root, [data-palette="sage"] {
  --bg: #d6dbbf;
  --card: #c1c8af;
  --ink: #062424;
  --ink-rgb: 6, 36, 36;
  --cream: #faf6f1;
  --cream-rgb: 250, 246, 241;
  --page: #b7bf9f;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23062424' stroke-width='2'/%3E%3C/svg%3E");
}
[data-palette="hong"] {
  --bg: #ead7d1;
  --card: #dcc1b9;
  --ink: #4a2229;
  --ink-rgb: 74, 34, 41;
  --cream: #fbf6f4;
  --cream-rgb: 251, 246, 244;
  --page: #d4b2a8;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%234a2229' stroke-width='2'/%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.6;
  text-align: center;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }

.card { max-width: 480px; margin: 0 auto; background: var(--bg); overflow: hidden; box-shadow: 0 0 40px rgba(var(--ink-rgb), .18); }
.caps { text-transform: uppercase; letter-spacing: .04em; }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.script { font-family: 'Pinyon Script', cursive; font-weight: 400; line-height: 1.25; }
.names { font-size: clamp(28px, 8.4vw, 40px); text-wrap: balance; }
.title { font-size: 38px; margin: 40px 0 16px; }

/* Ảnh bìa */
.hero { position: relative; aspect-ratio: 2 / 3; }
.hero-img { width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 50% 0 0; background: linear-gradient(transparent, rgba(0, 0, 0, .5)); }
.hero-text { position: absolute; left: 0; right: 0; bottom: 8%; z-index: 1; color: #fff; text-shadow: 0 1px 8px rgba(0, 0, 0, .35); }
.hero-text .names { margin: 2px 0 4px; }
.hero-date { font-size: 18px; letter-spacing: .14em; }
.js .hero-text { opacity: 0; animation: heroRise 1s ease .2s both; }
@keyframes heroRise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* Tên khách mời (?to=) */
.guest { padding: 26px 16px 0; }
.guest .script { display: block; font-size: 34px; margin-top: 2px; }

/* Đếm ngược */
.countdown { padding: 30px 16px 34px; }
.clock { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 320px; margin: 18px auto 0; }
.clock b { display: block; font-size: 26px; font-weight: 500; line-height: 1.2; }
.clock span { font-size: 14px; }

/* Lời mời */
.invite { padding: 6px 16px 30px; }
.portrait { width: 64%; aspect-ratio: 2 / 3; object-fit: cover; margin: 0 auto 30px; box-shadow: 0 12px 30px rgba(var(--ink-rgb), .2); }
/* Mỗi dòng lời mời là một khối chia đều độ dài, để không còn một chữ rơi xuống dòng riêng */
.lines > span { display: block; text-wrap: balance; }
.invite .names { margin-top: 8px; }

/* Hai bên gia đình */
.families { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 14px; }
.families.one { grid-template-columns: minmax(0, 50%); justify-content: center; }
.family img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; margin-bottom: 10px; }
.family h3 { font-size: 15px; font-weight: 600; text-transform: uppercase; }
.family p { font-size: 14.5px; }
.family b { font-weight: 600; }
.addr { font-style: italic; margin-top: 2px; }
.divider { width: 170px; margin: 26px auto 30px; opacity: .7; }

/* Lịch cưới */
.event { background: var(--card); border-radius: 10px; padding: 26px 16px 28px; margin: 0 16px 22px; }
.event h3 { font-size: 17px; font-weight: 600; text-transform: uppercase; }
.event-date { display: inline-block; font-size: 22px; font-weight: 600; letter-spacing: .06em; border-top: 1px solid; border-bottom: 1px solid; padding: 2px 12px; margin: 12px 0 6px; }
.pin { width: 28px; height: 28px; margin: 16px auto 2px; }
.place { font-size: 30px; }
.btn-outline { display: inline-block; margin-top: 16px; padding: 6px 52px; border: 1.5px solid; border-radius: 999px; text-decoration: none; text-transform: uppercase; font-size: 13px; letter-spacing: .04em; }

/* Album */
.album { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 10px; }
.album img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; cursor: zoom-in; }
.album img.wide { grid-column: span 2; aspect-ratio: 3 / 2; }
.album img.top { object-position: center 25%; }

/* Lời chúc & xác nhận */
.rsvp { padding: 0 24px 10px; }
.rsvp form { display: grid; gap: 12px; margin-top: 18px; }
.rsvp input, .rsvp textarea, .rsvp select { width: 100%; padding: 10px 18px; border: 1.2px solid var(--ink); border-radius: 22px; background: transparent; color: var(--ink); font: inherit; font-size: 16px; }
.rsvp textarea { border-radius: 16px; resize: vertical; }
.rsvp select { appearance: none; -webkit-appearance: none; background: var(--select-arrow) no-repeat right 16px center / 16px; }
.rsvp ::placeholder { color: rgba(var(--ink-rgb), .6); }
.btn { padding: 12px; border: 0; border-radius: 22px; background: var(--ink); color: var(--cream); font: inherit; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; cursor: pointer; }
.btn:disabled { opacity: .6; }
.form-msg { min-height: 1.6em; font-style: italic; }
.wishes { margin-top: 18px; }
.wishes h3 { font-size: 30px; margin-bottom: 10px; }
.wish-list { display: grid; gap: 10px; max-height: 360px; overflow-y: auto; padding-right: 4px; text-align: left; }
.wish { background: rgba(var(--cream-rgb), .45); border-radius: 12px; padding: 10px 14px; }
.wish-name { font-size: 14px; font-weight: 600; }
.wish-name span { font-weight: 400; font-style: italic; opacity: .75; }

/* Mừng cưới */
.gift-card { display: flex; align-items: center; gap: 14px; margin: 0 22px; padding: 12px; border: 1.2px solid var(--ink); border-radius: 10px; text-align: left; }
.gift-card + .gift-card { margin-top: 14px; }
.qr { width: 46%; flex-shrink: 0; background: #fff; border-radius: 4px; }
.gift-info { font-size: 14px; }
.acc-name { font-weight: 600; padding-bottom: 6px; margin-bottom: 8px; border-bottom: 1px solid; }
.acc-no { font-weight: 600; letter-spacing: .04em; }
.btn-copy { margin: 6px 0 10px; padding: 3px 12px; border: 1px solid var(--ink); border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-size: 12px; cursor: pointer; }

/* Lời cảm ơn */
.thanks { position: relative; margin-top: 44px; }
.thanks img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
/* Chữ nằm ở đáy ảnh, nền mờ dần lên trên, để không che mặt cô dâu chú rể */
.thanks-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px 18px 22px; background: linear-gradient(rgba(var(--cream-rgb), 0), rgba(var(--cream-rgb), .78) 70px); }
.thanks.plain .thanks-text { position: static; padding: 0 24px; background: none; }
.thanks-text h2 { font-size: 40px; }
.thanks-text p { font-size: 15px; font-style: italic; }

.footer { padding: 20px 16px 20px; }
.footer .script { font-size: 30px; }
.credit { display: inline-block; margin-top: 18px; font-size: 12px; letter-spacing: .12em; text-decoration: none; opacity: .7; }

/* Nút nhạc */
.music { position: fixed; bottom: 18px; right: max(14px, calc(50% - 226px)); z-index: 10; width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--ink); color: var(--cream); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(var(--ink-rgb), .3); cursor: pointer; opacity: .75; }
.music svg { width: 22px; height: 22px; }
.music.playing { opacity: 1; }
.music.playing svg { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Hoa và trái tim rơi nhẹ */
.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: rgba(255, 255, 255, .85); font-style: normal; text-shadow: 0 0 3px rgba(var(--ink-rgb), .25); animation: fall 14s linear infinite; }
.fall i:nth-child(even) { color: rgba(234, 170, 170, .9); }
@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 lời chúc "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; }

/* Xem ảnh phóng to */
.lightbox { position: fixed; inset: 0; z-index: 20; 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 { left: 4px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 4px; top: 50%; transform: translateY(-50%); }
.lb-close { top: 6px; right: 10px; }

/* Hiện dần khi cuộn tới */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s ease, transform .9s ease; }
.js .reveal.shown { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .music.playing svg { animation: none; }
  .js .hero-text { opacity: 1; animation: none; }
  .fall { display: none; }
  .rsvp .btn { animation: none; }
  img[loading="lazy"] { filter: none; transition: none; }
}
