/* Thiệp cưới: một cột giấy ngà rộng tối đa 480px (khổ điện thoại), trên máy tính cột nằm giữa.
   Tiêu đề chữ in thưa, tên cô dâu chú rể chữ viết tay, hoa dập nổi ở góc. */
:root {
  --paper: #ECE5D9;        /* giấy ngà */
  --paper-soft: #E6DDCE;   /* dải nền xen kẽ */
  --card: #F4EFE6;         /* thẻ, phong bì */
  --ink: #40362F;          /* chữ chính, nâu đậm */
  --muted: #7A6A5D;        /* chữ phụ */
  --accent: #86654F;       /* nâu đồng: con dấu, nút, ngày chính */
  --gold: #B79E7C;         /* đường kẻ mảnh */
  --line: rgba(134, 101, 79, .28);
  --backdrop: #D8CEBF;     /* nền hai bên cột trên máy tính */

  --font-serif: "Cormorant Garamond", "Times New Roman", serif;
  --font-script: "Pinyon Script", "Dancing Script", cursive;
  --font-body: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;

  --col: 480px;
  --pad: clamp(20px, 6.4vw, 30px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--backdrop); scrollbar-width: thin; scrollbar-color: var(--gold) transparent; }
html.is-locked { overflow: hidden; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, figure, fieldset, ul { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.defs { position: absolute; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Giấy ---------- */
.paper {
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .28 0 0 0 0 .2 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(60% 40% at 20% 10%, rgba(255, 255, 255, .5), transparent 70%),
    radial-gradient(50% 35% at 85% 60%, rgba(255, 255, 255, .35), transparent 70%),
    radial-gradient(70% 40% at 30% 95%, rgba(160, 135, 105, .16), transparent 70%);
}

/* ---------- Chữ dùng chung ---------- */
.kicker {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--muted);
}
.title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(27px, 8vw, 34px);
  line-height: 1.22;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-wrap: balance;
}
.script { font-family: var(--font-script); font-weight: 400; line-height: 1.25; color: var(--accent); }
.lead { max-width: 30em; margin-inline: auto; text-wrap: pretty; }
.hint, .quote { font-family: var(--font-serif); font-style: italic; font-size: 17px; color: var(--muted); }
.quote { max-width: 18em; margin-inline: auto; font-size: 19px; line-height: 1.5; text-wrap: balance; }

.names { display: flex; align-items: center; justify-content: center; }
.names .amp { font-family: var(--font-serif); font-style: italic; color: var(--gold); }
.names-stack { flex-direction: column; gap: 2px; }
.names-stack .script { font-size: clamp(42px, 13vw, 56px); }
.names-stack .amp { font-size: 20px; line-height: 1; }
.names-line { flex-wrap: wrap; gap: 0 9px; }
.names-line .script { font-size: clamp(24px, 7.4vw, 36px); white-space: nowrap; }
.names-line .amp { font-size: 17px; }

/* Chỗ chưa có nội dung thật: tô nền vàng nhạt cho dễ thấy */
.is-todo {
  background: rgba(214, 170, 60, .2);
  box-shadow: 0 0 0 3px rgba(214, 170, 60, .2);
  border-radius: 2px;
  font-style: italic;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

/* Đường kẻ có bông hoa ở giữa */
.rule { display: flex; align-items: center; justify-content: center; gap: 12px; }
.rule::before, .rule::after { content: ""; width: 58px; height: 1px; background: var(--gold); opacity: .7; }
.rule svg { width: 22px; height: 22px; }

/* ---------- Hoa dập nổi ---------- */
.fl-petals path { fill: #F3EDE2; stroke: #C6B59B; stroke-width: 1.3; stroke-linejoin: round; }
.fl-veins path { fill: none; stroke: #D3C4AC; stroke-width: 1; stroke-linecap: round; }
.fl-heart { fill: #E2D4BC; stroke: #BFAB8C; stroke-width: 1.2; }
.fl-stem path { fill: none; stroke: #DCCFBB; stroke-width: 5; stroke-linecap: round; }
.fl-leaf path { fill: #EEE6D9; stroke: #C9B9A0; stroke-width: 1.2; }

.flower {
  position: absolute;
  width: 210px;
  height: 154px;
  pointer-events: none;
  filter: drop-shadow(2px 3px 3px rgba(96, 74, 52, .26)) drop-shadow(-1px -1px 1px rgba(255, 255, 255, .7));
}
.flower-tl { top: -22px; left: -62px; transform: scale(-1, 1) rotate(196deg); }
.flower-br { bottom: -14px; right: -30px; transform: rotate(8deg); }
.flower-bl { bottom: -14px; left: -30px; transform: scale(-1, 1) rotate(8deg); }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 28px;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: rgba(255, 255, 255, .35);
  color: var(--ink);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .24em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  transition: background .25s, color .25s;
}
.btn:hover { background: var(--accent); color: #fff; }
.btn-solid { width: 100%; background: var(--accent); color: #fff; }
.btn-solid:hover { background: var(--ink); }
.btn-small { min-height: 44px; padding: 8px 16px; font-size: 11px; letter-spacing: .18em; }

/* ---------- Trang bìa ---------- */
.cover {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  /* Màn hình quá thấp thì trang bìa cuộn được, nhưng không hiện thanh cuộn */
  overflow: hidden auto;
  scrollbar-width: none;
  background: var(--backdrop);
  transition: opacity 1.1s ease, transform 1.3s ease;
}
.cover::-webkit-scrollbar { display: none; }
.cover.is-leaving { opacity: 0; transform: scale(1.06); pointer-events: none; }
.cover-inner {
  position: relative;
  width: 100%; /* trang bìa phủ kín màn hình, kể cả trên máy tính; chỉ thân thiệp mới bó trong một cột */
  min-height: 100%;
  height: max-content;
  overflow: hidden; /* cắt phần cành hoa thò ra ngoài mép */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  gap: 18px;
  padding: max(34px, 6vh) var(--pad) max(40px, 7vh);
  text-align: center;
}
.cover-frame { position: absolute; inset: 12px; border: 1px solid var(--line); pointer-events: none; }
.cover-head { position: relative; display: grid; justify-items: center; gap: 10px; }
.monogram, .env-seal { font-family: var(--font-serif); font-style: italic; line-height: 1; }
.monogram {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin-bottom: 8px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--accent);
  font-size: 25px;
}
.monogram span:last-child, .env-seal span:last-child { margin: .34em 0 0 -.08em; }
.cover-date { font-family: var(--font-serif); font-size: 21px; letter-spacing: .3em; padding-left: .3em; }

/* Phong bì: bấm vào là mở. Lớp từ dưới lên: lưng, tấm thiệp, túi trước, nắp, con dấu */
.env {
  position: relative;
  width: min(100%, 300px);
  aspect-ratio: 3 / 2;
  flex: none;
  cursor: pointer;
  filter: drop-shadow(0 14px 18px rgba(80, 58, 36, .22));
  transition: transform 1.3s cubic-bezier(.3, 0, .2, 1);
  -webkit-tap-highlight-color: transparent;
}
.env svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.env path, .env rect { stroke: #D2C2A8; stroke-width: 1; vector-effect: non-scaling-stroke; }
.env-back { z-index: 1; }
.env-back rect { fill: #EFE8DC; }
.env-card {
  position: absolute;
  z-index: 2;
  left: 6%;
  right: 6%;
  top: 6%;
  height: 86%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 9%;
  background: #FCFAF5;
  border: 1px solid #E3D7C3;
  box-shadow: inset 0 0 0 4px #FCFAF5, inset 0 0 0 5px rgba(183, 158, 124, .5);
  transition: transform 1.5s cubic-bezier(.2, .7, .2, 1) .55s;
}
.env-card-kicker { font-size: 8.5px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.env-card-names { font-size: clamp(19px, 5.8vw, 24px); white-space: nowrap; }
.env-card-names i { font-family: var(--font-serif); font-size: .6em; color: var(--gold); }
.env-card-date { font-family: var(--font-serif); font-size: 12px; letter-spacing: .26em; }
.env-front { z-index: 3; }
.env-front path { fill: #F8F4EC; }
.env-front .env-side { fill: var(--card); }
.env-flap { z-index: 4; transform-origin: 50% 0; transition: transform 1.1s cubic-bezier(.5, 0, .2, 1) .15s; }
.env-flap path { fill: #F1EADF; }
.env-seal {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 54%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #A98569, var(--accent) 55%, #6B4E3B);
  box-shadow: 0 2px 5px rgba(60, 40, 25, .4), inset 0 0 0 3px rgba(255, 255, 255, .13);
  color: #F4E9DA;
  font-size: 19px;
  transition: opacity .5s, transform .6s;
}
.env-to { position: absolute; z-index: 5; left: 0; right: 0; bottom: 9%; display: grid; gap: 1px; padding: 0 14px; transition: opacity .5s; }
.env-to-label { font-size: 10px; letter-spacing: .28em; text-transform: uppercase; color: var(--accent); }
.env-to-name { font-family: var(--font-serif); font-style: italic; font-size: 21px; line-height: 1.2; overflow-wrap: anywhere; }
.cover-hint { position: relative; margin: -6px 0; font-family: var(--font-serif); font-style: italic; font-size: 16px; color: var(--muted); transition: opacity .6s; }
.btn-open { position: relative; min-width: 212px; }

/* Trang bìa hiện dần từng phần khi vừa tải */
.cover.is-ready .flower { animation: flower-in 2.4s ease both .1s; }
.cover.is-ready .cover-head > * { animation: fade-up 1.2s cubic-bezier(.2, .7, .2, 1) both; }
.cover.is-ready .cover-head > :nth-child(1) { animation-delay: .2s; }
.cover.is-ready .cover-head > :nth-child(2) { animation-delay: .4s; }
.cover.is-ready .cover-head > :nth-child(3) { animation-delay: .6s; }
.cover.is-ready .cover-head > :nth-child(4) { animation-delay: .9s; }
.cover.is-ready .cover-hint { animation: fade-up 1.2s ease both 1.7s; }
.cover.is-ready .btn-open { animation: fade-up 1.2s ease both 1.9s; }
/* Phong bì trượt vào, rồi bồng bềnh trong lúc chờ; con dấu toả vòng sáng mời bấm */
.cover.is-ready:not(.is-opening) .env { animation: env-in 1.5s cubic-bezier(.2, .7, .2, 1) both 1s, floaty 4.5s ease-in-out 2.6s infinite; }
.cover:not(.is-opening) .env:hover, .cover:not(.is-opening) .env:focus-visible { transform: scale(1.03); }
.cover:not(.is-opening) .env-seal::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(134, 101, 79, .45);
  animation: ring 2.6s ease-out 2.6s infinite;
}
@keyframes fade-up { from { opacity: 0; translate: 0 22px; } }
@keyframes env-in { from { opacity: 0; translate: 0 40px; scale: .92; } }
@keyframes flower-in { from { opacity: 0; scale: .9; } }
@keyframes floaty { 50% { translate: 0 -7px; } }
@keyframes ring { to { box-shadow: 0 0 0 16px rgba(134, 101, 79, 0); } }

/* Mở thiệp: con dấu bật ra, nắp lật, tấm thiệp trượt lên, phong bì nhấc lên, trang bìa tan dần */
.cover.is-opening .env { cursor: default; }
.cover.is-opening .env-seal { opacity: 0; transform: scale(1.5); }
.cover.is-opening .env-to, .cover.is-opening .cover-hint, .cover.is-opening .btn-open { opacity: 0; pointer-events: none; }
.cover.is-opening .btn-open { transition: opacity .6s; }
.cover.is-opening .env-flap { transform: perspective(700px) rotateX(-180deg); }
.cover.is-flapback .env-flap { z-index: 1; }
.cover.is-opening .env-card { transform: translateY(-64%); }
.cover.is-lift .env { transform: translateY(-5%) scale(1.14); }

/* ---------- Thân thiệp ---------- */
.page {
  position: relative;
  max-width: var(--col);
  margin: 0 auto;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(70, 50, 30, .22);
  text-align: center;
}
.sec { position: relative; padding: 64px var(--pad); display: grid; gap: 26px; justify-items: center; }
.sec > * { min-width: 0; }
.sec.soft { background: rgba(160, 135, 105, .13); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -1px 0 rgba(255, 255, 255, .5); }
.sec-head { display: grid; gap: 12px; justify-items: center; }
.sec-first { padding-top: 96px; padding-bottom: 150px; }

.card {
  position: relative;
  width: 100%;
  padding: 26px 18px;
  background: rgba(250, 247, 241, .62);
  border: 1px solid rgba(255, 255, 255, .7);
  outline: 1px solid var(--line);
  outline-offset: -6px;
  box-shadow: 0 10px 24px rgba(90, 68, 44, .1);
}

/* Hai gia đình */
.families { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.family { padding: 22px 10px 20px; display: grid; gap: 2px; align-content: start; }
.family-title {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .24em;
  text-transform: uppercase;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.family-role { margin-top: 8px; font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.family-name { font-family: var(--font-serif); font-weight: 600; font-size: 16px; line-height: 1.35; letter-spacing: .05em; text-transform: uppercase; overflow-wrap: anywhere; }
.family-addr { margin-top: 14px; font-family: var(--font-serif); font-style: italic; font-size: 15.5px; line-height: 1.45; color: var(--muted); }

/* Ảnh và ô giữ chỗ */
.ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(160deg, #DDD1BF, #CDBEA8);
  color: #6F5D4B;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 19px;
  line-height: 1.3;
  text-align: center;
}
.ph small { display: block; margin-top: 6px; font-family: var(--font-body); font-style: normal; font-size: 10.5px; letter-spacing: .04em; opacity: .85; }
.ph img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; } /* giữ phần trên ảnh, nơi thường có mặt người */
.arch, .frame { width: 100%; padding: 8px; background: var(--card); box-shadow: 0 14px 30px rgba(90, 68, 44, .18); }
.arch { max-width: 330px; aspect-ratio: 3 / 4; border-radius: 999px 999px 6px 6px; }
.arch .ph { border-radius: 999px 999px 2px 2px; overflow: hidden; }
.frame { max-width: 340px; aspect-ratio: 1; border-radius: 4px; }
.frame .ph { overflow: hidden; }

/* Buổi lễ */
.event { display: grid; gap: 4px; justify-items: center; padding: 34px 18px; }
.event-title { font-family: var(--font-serif); font-weight: 500; font-size: 27px; line-height: 1.2; letter-spacing: .14em; text-transform: uppercase; }
.event-sub, .event-weekday, .event-year, .event-place { font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase; }
.event-sub { color: var(--muted); }
.event-weekday { margin-top: 18px; }
.event-day { font-family: var(--font-serif); font-size: clamp(50px, 15.5vw, 64px); line-height: 1.05; letter-spacing: .06em; color: var(--accent); }
.event-lunar { margin-top: 10px; font-family: var(--font-serif); font-style: italic; font-size: 16.5px; color: var(--muted); }
.event-line { width: 44px; height: 1px; margin: 16px 0 12px; background: var(--gold); }
.event-time { font-family: var(--font-serif); font-weight: 600; font-size: 20px; letter-spacing: .14em; text-transform: uppercase; }
.event-place { margin-top: 10px; color: var(--muted); line-height: 1.7; }
.event-addr { font-family: var(--font-serif); font-style: italic; font-size: 17px; line-height: 1.45; }

/* Đếm ngược */
.countdown { display: grid; gap: 12px; width: 100%; }
.cd-cells { display: grid; grid-template-columns: repeat(4, 1fr); }
.cd { display: grid; gap: 2px; padding: 4px 0; border-left: 1px solid var(--line); }
.cd:first-child { border-left: 0; }
.cd b { font-family: var(--font-serif); font-weight: 500; font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums lining-nums; }
.cd small { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.countdown.is-done .cd-cells { display: none; }

/* Tờ lịch */
.cal { width: 100%; padding: 22px 14px 18px; background: rgba(250, 247, 241, .62); outline: 1px solid var(--line); outline-offset: -6px; }
.cal-month { font-family: var(--font-serif); font-size: 21px; letter-spacing: .2em; text-transform: uppercase; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 4px; margin-top: 12px; justify-items: center; }
.cal-w { font-size: 10px; letter-spacing: .1em; color: var(--muted); padding-bottom: 6px; }
.cal-d { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; font-family: var(--font-serif); font-size: 17px; font-variant-numeric: lining-nums; }
.cal-d.is-mark { box-shadow: inset 0 0 0 1px var(--accent); }
.cal-d.is-main { background: var(--accent); color: #fff; font-weight: 600; }
.cal-legend { display: grid; gap: 4px; margin-top: 14px; justify-items: start; width: max-content; max-width: 100%; margin-inline: auto; font-size: 12.5px; text-align: left; }
.cal-legend li { display: flex; align-items: center; gap: 8px; }
.cal-legend li::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--accent); }
.cal-legend li.is-main::before { background: var(--accent); }

/* Địa điểm */
.venues { display: grid; gap: 18px; width: 100%; }
.venue { display: grid; gap: 8px; justify-items: center; padding: 28px 18px 24px; }
.venue-name { font-family: var(--font-serif); font-weight: 600; font-size: 20px; line-height: 1.3; letter-spacing: .08em; text-transform: uppercase; }
.venue-addr { font-family: var(--font-serif); font-style: italic; font-size: 17px; line-height: 1.45; color: var(--muted); }
.venue-map { width: 100%; height: 190px; margin-top: 8px; border: 1px solid var(--line); background: #DDD3C3; }
.venue-map-empty { display: flex; align-items: center; justify-content: center; height: 86px; padding: 12px; font-size: 12.5px; line-height: 1.5; box-shadow: none; }
.venue-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }

/* Album */
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.tile { padding: 6px; border: 0; border-radius: 3px; background: var(--card); box-shadow: 0 8px 18px rgba(90, 68, 44, .15); aspect-ratio: 3 / 4; }
.tile-wide { grid-column: 1 / -1; aspect-ratio: 4 / 3; }
.tile .ph { overflow: hidden; }
.tile:hover img { transform: scale(1.04); }
.tile img { transition: transform .5s; }

/* Biểu mẫu */
.form { display: grid; gap: 18px; width: 100%; text-align: left; }
.field { display: grid; gap: 7px; }
.field label, .field legend { font-size: 11px; font-weight: 400; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.field legend { margin-bottom: 7px; }
.field input[type="text"], .field select, .field textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, .6);
  font-size: 16px; /* dưới 16px thì iPhone tự phóng to trang khi chạm vào ô */
  font-weight: 300;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field ::placeholder { color: #A39484; }
.choices { gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .6); cursor: pointer; }
.choice + .choice { margin-top: 8px; }
.choice input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); }
.rsvp-extra { display: grid; gap: 18px; }
.rsvp-extra:disabled { display: none; }
.form-status { padding: 14px 16px; border-left: 2px solid var(--accent); background: rgba(255, 255, 255, .55); font-size: 14px; }

/* Hộp mừng cưới */
.sec-gift { gap: 16px; }
.gift-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, .35), 0 10px 22px rgba(90, 68, 44, .16);
  color: var(--accent);
  animation: breathe 2.8s ease-in-out infinite;
}
.gift-box svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
@keyframes breathe { 50% { transform: scale(1.06); } }

.sheet { width: min(100vw - 24px, 440px); max-height: calc(100dvh - 32px); padding: 0; border: 0; background: transparent; color: var(--ink); overflow: auto; text-align: center; }
.sheet::backdrop, .lightbox::backdrop { background: rgba(40, 30, 22, .72); }
.sheet-inner { position: relative; display: grid; gap: 12px; padding: 34px 20px 24px; }
.sheet-close { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--muted); }
.accounts { display: grid; gap: 14px; margin-top: 8px; }
.account { display: grid; gap: 6px; justify-items: center; padding: 22px 16px; }
.qr { width: 172px; aspect-ratio: 1; margin: 6px 0; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px dashed var(--gold); font-family: var(--font-serif); font-style: italic; font-size: 17px; color: var(--muted); }
.qr small { display: block; font-family: var(--font-body); font-style: normal; font-size: 10.5px; }
.qr.has-photo { border-style: solid; padding: 6px; }
.qr img { width: 100%; height: 100%; object-fit: contain; }
.acct-bank { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.acct-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.acct { font-family: var(--font-serif); font-weight: 600; font-size: 23px; letter-spacing: .06em; font-variant-numeric: lining-nums; }
.acct-holder { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.copy { min-height: 36px; padding: 4px 14px; border: 1px solid var(--accent); background: none; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }

/* Lời cảm ơn */
.sec-thanks { padding-bottom: 150px; }
.thanks-lines { display: grid; gap: 12px; }

/* ---------- Nút nhạc ---------- */
.music {
  position: fixed;
  top: 14px;
  right: max(14px, calc(50vw - var(--col) / 2 + 14px));
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: rgba(244, 239, 230, .9);
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(90, 68, 44, .18);
}
.music[aria-pressed="true"] svg { animation: sway 1.6s ease-in-out infinite; }
.music[aria-pressed="false"]::after { content: ""; position: absolute; width: 26px; height: 1px; background: currentColor; transform: rotate(-45deg); }
@keyframes sway { 50% { transform: rotate(14deg) scale(1.08); } }
html.is-locked .music { display: none; }

/* ---------- Cánh hoa rơi ---------- */
.petals { position: fixed; top: 0; bottom: 0; left: 50%; width: min(100%, var(--col)); transform: translateX(-50%); z-index: 30; overflow: hidden; pointer-events: none; }
.petals i {
  position: absolute;
  top: -24px;
  border-radius: 80% 10% 80% 10%;
  background: linear-gradient(135deg, #FFFDF8, #EADFCF);
  box-shadow: 0 1px 2px rgba(90, 68, 44, .18);
  animation: fall linear infinite, drift ease-in-out infinite alternate;
}
@keyframes fall { to { top: 104%; rotate: 420deg; } }
@keyframes drift { from { translate: -18px 0; } to { translate: 22px 0; } }

/* ---------- Xem ảnh lớn ---------- */
.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; }
.lightbox[open] { display: grid; place-items: center; }
.lb-stage { width: min(92vw, 720px); height: min(78dvh, 960px); display: flex; align-items: center; justify-content: center; }
.lb-stage .ph { background: none; color: #EDE3D3; }
.lb-stage .ph.has-photo img { object-fit: contain; }
.lb-stage .ph:not(.has-photo) { background: linear-gradient(160deg, #6B5B4B, #4E4136); max-width: 420px; max-height: 560px; }
.lb-btn { position: absolute; z-index: 2; min-width: 48px; min-height: 48px; border: 0; background: rgba(0, 0, 0, .35); color: #fff; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.lb-close { top: 12px; right: 12px; padding: 0 16px; }
.lb-prev, .lb-next { top: 50%; margin-top: -24px; font-size: 30px; }
.lb-prev { left: 6px; }
.lb-next { right: 6px; }
.lb-count { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; color: #EDE3D3; font-size: 13px; letter-spacing: .2em; }

/* ---------- Hiệu ứng nhỏ trong thân thiệp ---------- */
.cd b.tick { animation: tick .6s ease; }
@keyframes tick { 30% { translate: 0 -4px; opacity: .55; } }
.cal-d.is-main { animation: beat 1.8s ease-in-out infinite; }
@keyframes beat { 12% { scale: 1.16; } 24% { scale: 1; } 36% { scale: 1.1; } 48% { scale: 1; } }
.music::before { content: ""; position: absolute; inset: -1px; border-radius: 50%; box-shadow: 0 0 0 0 rgba(183, 158, 124, .6); }
.music[aria-pressed="true"]::before { animation: ring-gold 2.8s ease-out infinite; }
@keyframes ring-gold { to { box-shadow: 0 0 0 12px rgba(183, 158, 124, 0); } }
.music { animation: fade-in 1s ease both; }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Hiện dần khi cuộn tới (chỉ khi có JavaScript) ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
.js .reveal.is-in { opacity: 1; transform: none; }
/* Các thẻ nằm cạnh nhau hiện lần lượt */
.js .families .reveal:nth-child(2), .js .gallery .reveal:nth-child(3n), .js .venues .reveal:nth-child(2) { transition-delay: .18s; }
.js .gallery .reveal:nth-child(3n + 2) { transition-delay: .08s; }
/* Tiêu đề mục: từng dòng hiện nối nhau, đường kẻ vẽ ra từ giữa */
.js .sec-head.reveal { opacity: 1; transform: none; }
.js .sec-head.reveal > * { opacity: 0; transform: translateY(20px); transition: opacity 1s ease, transform 1s cubic-bezier(.2, .7, .2, 1); }
.js .sec-head.reveal > :nth-child(2) { transition-delay: .12s; }
.js .sec-head.reveal > :nth-child(3) { transition-delay: .24s; }
.js .sec-head.reveal > :nth-child(4) { transition-delay: .36s; }
.js .sec-head.reveal.is-in > * { opacity: 1; transform: none; }
.js .reveal .rule::before, .js .reveal .rule::after, .js .rule.reveal::before, .js .rule.reveal::after { width: 0; transition: width 1.2s ease .5s; }
.js .reveal.is-in .rule::before, .js .reveal.is-in .rule::after, .js .rule.reveal.is-in::before, .js .rule.reveal.is-in::after { width: 58px; }
.js .reveal .rule svg, .js .rule.reveal svg { transform: scale(0) rotate(-90deg); transition: transform 1s cubic-bezier(.3, 1.4, .5, 1) .3s; }
.js .reveal.is-in .rule svg, .js .rule.reveal.is-in svg { transform: none; }
/* Ảnh lớn: thu nhẹ về đúng cỡ khi hiện ra */
.js .arch.reveal img, .js .frame.reveal img { transform: scale(1.12); transition: transform 2.4s cubic-bezier(.2, .6, .2, 1); }
.js .arch.reveal.is-in img, .js .frame.reveal.is-in img { transform: none; }
/* Ngày lớn của buổi lễ: chữ khép dần lại khi hiện ra */
.js .event.reveal .event-day { letter-spacing: .3em; opacity: 0; transition: letter-spacing 1.6s cubic-bezier(.2, .7, .2, 1) .3s, opacity 1.2s ease .3s; }
.js .event.reveal.is-in .event-day { letter-spacing: .06em; opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal, .js .reveal *, .js .sec-head.reveal > * { opacity: 1 !important; transform: none !important; }
  .js .rule::before, .js .rule::after { width: 58px !important; }
}

/* Màn hình rộng: hoa ở góc trang bìa to hơn cho cân với khoảng giấy lớn */
@media (min-width: 900px) {
  .cover .flower { width: 320px; height: 234px; }
  .cover .flower-tl { top: -30px; left: -90px; }
  .cover .flower-br { bottom: -20px; right: -44px; }
  .cover-frame { inset: 18px; }
}

/* Màn hình thấp (điện thoại nhỏ, xoay ngang): thu gọn trang bìa */
@media (max-height: 700px) {
  .cover-inner { gap: 12px; padding-block: 26px 30px; }
  .monogram { width: 46px; height: 46px; font-size: 20px; margin-bottom: 2px; }
  .cover .names-stack .script { font-size: 38px; }
  .env { width: min(100%, 236px); }
}
