/* ============================================================
   THEME TOKENS
   night = xanh navy + vàng ánh kim (giống thiệp mẫu)
   day   = kem + đỏ son (biến thể sáng)
   ============================================================ */
:root, [data-theme="day"] {
  --bg: #fdf3f6;  --bg-2: #f8e6ec;  --paper: #fffdfe;
  --accent: #c06485; --accent-strong: #99455f;
  --gold: #c59a6b; --gold-soft: #cf9f78;
  --ink: #4a343b; --ink-soft: #8d7680; --line: #f1dbe3;
  --btn: #cf7190; --btn-ink: #fff;
  --env-1: #f3cdd9; --env-2: #e6a6bb; --env-letter: #fff6f0;
  --glass: 255 255 255; --glow: 255 214 140;
  --heart: #e06187;
}
[data-theme="night"] {
  --bg: #0b1530;  --bg-2: #101d3b;  --paper: #13213f;
  --accent: #b8cdf3; --accent-strong: #e3e9f3;
  --gold: #d0b47c; --gold-soft: #e6d6b0;
  --ink: #e3e9f3; --ink-soft: #9dacc4; --line: #25355a;
  --btn: #2c5fc4; --btn-ink: #fff;
  --env-1: #1b2d55; --env-2: #060c1d; --env-letter: #b4c6e2;
  --glass: 19 33 63; --glow: 255 214 140;
  --heart: #e0405a;
}
:root {
  --f-script: "Great Vibes", cursive;
  --f-title: "Playfair Display", Georgia, serif;
  --f-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 18px;
  --maxw: 1000px;
}

/* ============================================================ BASE */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.6 var(--f-body);
  transition: background .6s, color .6s;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; height: 100vh; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px auto; width: 70%; }

.script { font-family: var(--f-script); font-weight: 400; line-height: 1.15; color: var(--accent); }
.title { font: 400 clamp(30px, 5vw, 44px)/1.2 var(--f-title); text-align: center; margin: 4px 0 6px; color: var(--accent); }
.eyebrow { text-transform: uppercase; letter-spacing: .32em; font-size: 11px; color: var(--gold); text-align: center; margin: 0 0 6px; }
.eyebrow--left { text-align: left; }
.muted { color: var(--ink-soft); }
.italic { font-family: var(--f-title); font-style: italic; }
.center { text-align: center; }
button.center-block { display: block; width: fit-content; max-width: 100%; margin: 18px auto 0; }
.big { font-size: 46px; margin: 0; }
.amp { font-family: var(--f-script); color: var(--heart); }

/* placeholder ảnh khi chưa có file */
[data-photo] { background: linear-gradient(135deg, #2a3f6e, #6d86b8 55%, #c7b2c9); background-size: cover; background-position: center; position: relative; }
[data-photo].is-empty::after {
  content: "📷 " attr(data-photo); position: absolute; inset: auto 0 12px; text-align: center;
  font-size: 11px; color: #fff; opacity: .75; letter-spacing: .05em;
}

/* ============================================================ FX LAYERS */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.fx__fireflies i {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: rgb(var(--glow)); box-shadow: 0 0 10px 3px rgb(var(--glow) / .7);
  animation: firefly var(--d, 9s) ease-in-out infinite; opacity: 0;
}
@keyframes firefly {
  0%,100% { opacity: 0; transform: translate(0,0); }
  20%,80% { opacity: .9; }
  50% { transform: translate(var(--x, 30px), var(--y, -40px)); }
}
/* nền sáng pastel: ẩn đom đóm + dây đèn (yếu tố ban đêm), giữ cánh hoa rơi */
[data-theme="day"] .fx__fireflies,
[data-theme="day"] .string-lights,
[data-theme="day"] .string-bulbs { display: none; }
.fx__petals i {
  position: absolute; top: -20px; width: 10px; height: 13px;
  border-radius: 80% 0 80% 0; background: var(--c, #f4c4cf); opacity: .85;
  animation: fall var(--d, 10s) linear infinite; animation-delay: var(--delay, 0s);
}
@keyframes fall {
  to { transform: translate(var(--drift, 80px), 110vh) rotate(540deg); }
}

/* string lights */
.string-lights { position: absolute; top: 0; left: 0; width: 100%; height: 90px; color: var(--gold-soft); opacity: .5; }
.string-bulbs { position: absolute; top: 0; left: 0; width: 100%; height: 90px; pointer-events: none; }
.string-bulbs i {
  position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #ffe6a6;
  box-shadow: 0 0 8px 3px rgb(255 214 140 / .8); animation: twinkle 2.4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .35; } to { opacity: 1; } }

.bouquet { display: block; width: 190px; height: 110px; margin: 0 auto; }
.bouquet--sm { width: 120px; height: 70px; margin: 8px auto 14px; }

/* ============================================================ 1. ENVELOPE SCREEN */
.envelope-screen {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, var(--bg-2), var(--bg) 70%);
  padding: 20px; text-align: center; transition: opacity 1s, visibility 1s;
}
.envelope-screen.is-gone { opacity: 0; visibility: hidden; }
.envelope-screen__names { font-size: clamp(34px, 6vw, 52px); margin: 0 0 18px; color: var(--gold-soft); }
.envelope-screen__guest { font-size: clamp(30px, 5vw, 42px); margin: 0; color: var(--ink); }
.envelope-screen__hint { font-size: 12px; color: var(--ink-soft); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .4; } }

.envelope {
  position: relative; width: min(420px, 86vw); aspect-ratio: 1.55; border: 0; padding: 0; margin: 10px 0 26px;
  background: none; perspective: 900px; filter: drop-shadow(0 18px 30px rgb(0 0 0 / .35));
}
.envelope__back, .envelope__front, .envelope__flap, .envelope__letter { position: absolute; inset: 0; }
.envelope__back { background: #ddd5c0; border-radius: 6px; }
.envelope__front {
  background:
    linear-gradient(to top right, #f2ecdd 49.6%, transparent 50%) left / 50.5% 100% no-repeat,
    linear-gradient(to top left, #f2ecdd 49.6%, transparent 50%) right / 50.5% 100% no-repeat,
    linear-gradient(to top, #f6f1e4 49.6%, transparent 50%) bottom / 100% 100% no-repeat;
  border-radius: 6px; z-index: 3;
}
.envelope__flap {
  background: linear-gradient(to bottom, #e9e2cf 0, #f4eee0 100%);
  clip-path: polygon(0 0, 100% 0, 50% 58%); transform-origin: top; z-index: 4;
  transition: transform .8s cubic-bezier(.6,.0,.3,1), z-index 0s .4s;
}
.envelope__letter {
  inset: 8% 6%; background: #fffaf0; color: #2c4a86; border-radius: 4px; z-index: 2; display: grid; place-items: center;
  transition: transform 1s .5s cubic-bezier(.3,.8,.3,1); font-size: 28px;
}
.envelope__seal {
  position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); z-index: 5;
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #6d93e6, #2649a3 60%, #183577);
  color: #f5e9c8; font: 500 18px var(--f-title); box-shadow: 0 4px 10px rgb(0 0 0 / .35), inset 0 0 0 4px rgb(255 255 255 / .12);
  transition: opacity .4s, transform .4s;
}
[data-theme="day"] .envelope__seal { background: radial-gradient(circle at 35% 30%, #efa6ba, #cf7190 60%, #a84f6c); }
.envelope__flowers { position: absolute; width: 140px; height: 84px; z-index: 6; pointer-events: none; }
.envelope__flowers--tl { left: -40px; top: -30px; transform: rotate(-25deg); }
.envelope__flowers--br { right: -40px; bottom: -26px; transform: rotate(155deg); }
.envelope:hover .envelope__seal { transform: translate(-50%, -50%) scale(1.06); }
.envelope.is-open .envelope__flap { transform: rotateX(180deg); z-index: 1; }
.envelope.is-open .envelope__seal { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
.envelope.is-open .envelope__letter { transform: translateY(-55%); }

/* ============================================================ 2. HERO */
.hero { position: relative; display: grid; grid-template-columns: 55% 45%; min-height: 100vh; }
.hero__photo { min-height: 100vh; -webkit-mask-image: linear-gradient(to right, #000 80%, transparent); mask-image: linear-gradient(to right, #000 80%, transparent); animation: kenburns 18s ease-in-out infinite alternate; }
@keyframes kenburns { to { background-size: 112%; } }
.hero__panel { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 100px 24px 60px; text-align: center; }
.hero__names { font-size: clamp(54px, 7vw, 86px); margin: 4px 0; display: flex; flex-direction: column; color: var(--accent); }
.hero__names .amp { font-size: .55em; color: var(--gold); }
.hero__date { letter-spacing: .4em; font-size: 20px; color: var(--ink); }
.hero__down { position: absolute; bottom: 24px; font-size: 26px; color: var(--gold); text-decoration: none; animation: bob 1.8s infinite; }
@keyframes bob { 50% { transform: translateY(6px); } }

/* ============================================================ SECTIONS */
.section { position: relative; z-index: 2; padding: 90px 20px; max-width: var(--maxw); margin: 0 auto; }
.card {
  position: relative; background: rgb(var(--glass) / .65); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 4vw, 44px);
}
.corner { position: absolute; width: 170px; height: 100px; pointer-events: none; }
.corner--tl { left: -30px; top: -26px; transform: rotate(-30deg); }
.corner--tr { right: -30px; top: -26px; transform: rotate(30deg) scaleX(-1); }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s, transform 1s; }
.reveal.is-in { opacity: 1; transform: none; }

/* 3. Invitation */
.invite__grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; align-items: center; }
.arch { aspect-ratio: 3/4; border-radius: 999px 999px 10px 10px; outline: 1px solid var(--gold); outline-offset: 7px; }
.invite__text { text-align: center; }
.invite__names { font-size: clamp(34px, 4.2vw, 48px); margin: 0; }
.invite__guest { font-size: 40px; margin: 0 0 6px; color: var(--ink); }
.invite__time { font: 400 42px var(--f-title); margin: 8px 0 0; color: var(--accent); }
.invite__venue { font-weight: 500; }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; border-top: 1px dashed var(--line); margin-top: 32px; padding-top: 32px; }
.details__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.details__list li { display: flex; gap: 14px; }
.details__list .ico { font-style: normal; width: 24px; text-align: center; }
.details__list b, .details__list span, .details__list em { display: block; }
.details__list em { color: var(--ink-soft); font-family: var(--f-title); }
.swatches { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.swatches span { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.swatches i { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); }
.dir-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dir-photos figure { margin: 0; }
.dir-photos [data-photo] { aspect-ratio: 4/3; border-radius: 12px; }
.dir-photos figcaption { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.details__dir { display: grid; align-content: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
  padding: 12px 20px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-weight: 500; transition: transform .2s, opacity .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--btn); color: var(--btn-ink); border-color: transparent; }
.btn--ghost { border-color: var(--ink-soft); }
.btn--block { width: 100%; }
.dropdown { position: relative; }
.dropdown .btn { width: 100%; }
.dropdown__menu { position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; z-index: 10; }
.dropdown__menu a, .dropdown__menu button { display: block; width: 100%; padding: 10px 14px; border: 0; background: none; text-align: left; text-decoration: none; font-size: 14px; }
.dropdown__menu a:hover, .dropdown__menu button:hover { background: var(--bg-2); }

/* 4. Couple */
.couple { display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: center; margin-top: 20px; }
.couple__item { margin: 0; text-align: center; }
.couple__item--offset { margin-top: 80px; }
.couple__item figcaption { margin-top: 22px; display: grid; gap: 2px; }
.couple__item b { font-size: 46px; }
.couple__heart { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgb(var(--glass) / .8); color: var(--heart); border: 1px solid var(--line); }

/* 5. Timeline */
.timeline { list-style: none; padding: 0; margin: 50px 0 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: linear-gradient(var(--gold), transparent); }
.timeline li { position: relative; width: 50%; padding: 0 44px 60px; }
.timeline li:nth-child(odd) { margin-right: 50%; }
.timeline li:nth-child(even) { margin-left: 50%; }
.timeline li::after { content: ""; position: absolute; top: 40%; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.timeline li:nth-child(odd)::after { right: -5px; }
.timeline li:nth-child(even)::after { left: -5px; }
.timeline .card { padding: 14px; }
.timeline [data-photo] { aspect-ratio: 4/3; border-radius: 10px; }
.timeline .year { display: inline-block; margin: 14px 0 4px; padding: 2px 10px; border-radius: 999px; background: var(--btn); color: #fff; font-size: 12px; }
.timeline h3 { font: 400 24px var(--f-title); margin: 0 0 4px; color: var(--accent); }
.timeline p { margin: 0; color: var(--ink-soft); font-size: 14px; }

/* 6. Calendar + countdown */
.calendar { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; row-gap: 14px; }
.calendar .dow { font-size: 12px; color: var(--gold); letter-spacing: .1em; }
.calendar .day { position: relative; height: 36px; display: grid; place-items: center; isolation: isolate; }
.calendar .day.is-event { color: #fff; font-weight: 600; }
.calendar .day.is-event::before {
  content: "♥"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 46px; line-height: 1;
  color: var(--heart); z-index: -1; animation: beat 1.3s infinite;
}
@keyframes beat { 15%, 45% { transform: scale(1.12); } 30% { transform: scale(1); } }
.countdown { margin-top: 50px; text-align: center; }
.countdown__grid { display: flex; justify-content: center; gap: clamp(10px, 3vw, 28px); }
.countdown__grid div { min-width: 74px; padding: 14px 8px; border: 1px solid var(--line); border-radius: 14px; background: rgb(var(--glass) / .6); }
.countdown__grid b { display: block; font: 400 36px var(--f-title); color: var(--accent); }
.countdown__grid span { font-size: 12px; color: var(--ink-soft); }

/* 7–8. Forms */
.form { max-width: 520px; margin: 26px auto 0; display: grid; gap: 16px; }
.rsvp-when { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; font-size: 14px; color: var(--ink-soft); }
.field--row { display: flex; align-items: center; justify-content: space-between; }
.field input, .field textarea {
  font: inherit; color: var(--ink); background: rgb(var(--glass) / .5); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--gold); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg input { display: none; }
.seg span { display: block; text-align: center; padding: 11px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.seg input:checked + span { background: var(--btn); color: #fff; border-color: transparent; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: none; }
.stepper output { min-width: 18px; text-align: center; color: var(--ink); font-weight: 600; }
.form-done { max-width: 520px; margin: 26px auto 0; text-align: center; }
.wishes { max-width: 720px; margin: 30px auto 0; display: grid; gap: 14px; }
.wish { padding: 16px 20px; }
.wish b { color: var(--accent); }
.wish p { margin: 6px 0 4px; font-family: var(--f-title); font-style: italic; }
.wish small { color: var(--ink-soft); }

/* 9. Album */
.album { columns: 3 220px; column-gap: 12px; margin-top: 30px; }
.album button { all: unset; display: block; width: 100%; margin-bottom: 12px; border-radius: 12px; overflow: hidden; cursor: zoom-in; }
.album [data-photo] { aspect-ratio: var(--ar, 3/4); transition: transform .5s; }
.album button:hover [data-photo] { transform: scale(1.04); }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgb(0 0 0 / .9); display: grid; place-items: center; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 8px; }
.lightbox button { position: absolute; background: none; border: 0; color: #fff; font-size: 40px; }
.lightbox__close { top: 12px; right: 20px; }
.lightbox__prev { left: 12px; } .lightbox__next { right: 12px; }

/* 10. Gifts */
.gifts { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 24px auto 0; }
.gift { width: 320px; max-width: 100%; text-align: center; display: grid; gap: 6px; justify-items: center; }
.gift [data-photo] { width: 230px; aspect-ratio: 1; border-radius: 12px; background-color: #fff; background-size: cover; background-position: center; }
.gift .acc { font: 500 22px var(--f-title); letter-spacing: .06em; }

.footer { text-align: center; padding: 60px 20px 120px; position: relative; z-index: 2; }

/* ============================================================ FAB + TOAST */
.fab { position: fixed; right: 16px; bottom: 16px; z-index: 40; display: grid; gap: 10px; justify-items: end; }
.fab__btn {
  position: relative; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line);
  background: rgb(var(--glass) / .85); backdrop-filter: blur(6px); color: var(--ink); font-size: 18px; display: grid; place-items: center;
}
.fab__label { position: absolute; right: 54px; white-space: nowrap; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: rgb(var(--glass) / .9); border: 1px solid var(--line); }
.fab__toc { position: absolute; right: 56px; bottom: 0; min-width: 200px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 8px; display: grid; }
.fab__toc a { text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.fab__toc a:hover, .fab__toc a.is-active { background: var(--bg-2); color: var(--gold); }
.fab__music { display: flex; gap: 2px; align-items: flex-end; justify-content: center; padding-bottom: 14px; }
.fab__music i { width: 3px; height: 6px; background: var(--ink); border-radius: 2px; }
.fab__music.is-playing i { animation: eq .9s ease-in-out infinite; }
.fab__music.is-playing i:nth-child(2) { animation-delay: .2s; } .fab__music.is-playing i:nth-child(3) { animation-delay: .4s; } .fab__music.is-playing i:nth-child(4) { animation-delay: .1s; }
@keyframes eq { 50% { height: 16px; } }

.toast {
  position: fixed; left: 16px; bottom: 16px; z-index: 40; max-width: 330px; display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 34px 12px 12px; border-radius: 14px; background: rgb(var(--glass) / .92); border: 1px solid var(--line);
  backdrop-filter: blur(6px); animation: toastIn .5s; font-size: 13px;
}
.toast p { margin: 4px 0 0; font-family: var(--f-title); font-style: italic; font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.toast__heart { color: var(--heart); font-size: 18px; }
.toast__close { position: absolute; top: 6px; right: 10px; border: 0; background: none; font-size: 18px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } }

/* ============================================================ RESPONSIVE */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .hero__photo { min-height: 62vh; -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent); mask-image: linear-gradient(to bottom, #000 75%, transparent); }
  .hero__panel { padding: 20px 16px 80px; margin-top: -60px; }
  .invite__grid, .details { grid-template-columns: 1fr; }
  .arch { max-width: 280px; margin: 0 auto; }
  .couple { grid-template-columns: 1fr 1fr; }
  .couple__heart { display: none; }
  .couple__item--offset { margin-top: 40px; }
  .couple__item b { font-size: 34px; }
  .timeline::before { left: 10px; }
  .timeline li, .timeline li:nth-child(odd), .timeline li:nth-child(even) { width: auto; margin: 0; padding: 0 0 40px 34px; }
  .timeline li::after, .timeline li:nth-child(odd)::after, .timeline li:nth-child(even)::after { left: 5px; right: auto; }
  .section { padding: 64px 16px; }
  .countdown__grid div { min-width: 64px; }
  .countdown__grid b { font-size: 28px; }
  .corner { width: 120px; height: 70px; }
  .toast { right: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.envelope__letter .script { color: #2c4a86; font-size: 30px; }
