/* ==========================================================
   Thiệp cưới online — Hữu Khương & Nguyễn Huỳnh
   Phong cách: giấy kem, hoa dại màu nước, chữ vàng script
   ========================================================== */
:root {
  --paper: #fbf8ee;
  --paper-2: #f4efe0;
  --bg: #ebe5d6;
  --ink: #3a3a3a;
  --ink-soft: #6d6d6d;
  --gold: #c9a44f;
  --gold-deep: #ad8c3b;
  --sage: #8e9b7c;
  --rose: #e2b7af;
  --red: #c0392b;
  --line: #d8d1bf;
  --script: 'Great Vibes', 'Segoe Script', cursive;
  --serif: 'Cormorant Garamond', 'Times New Roman', Times, serif;
  --display: 'Playfair Display', 'Times New Roman', Times, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 500;
}
body.locked { overflow: hidden; }
a { color: var(--gold-deep); }
b, strong { font-weight: 700; }
svg { overflow: visible; }

.page {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  background: var(--paper);
  min-height: 100vh;
  box-shadow: 0 0 60px rgba(70, 50, 10, .10);
  padding: 10px 0 110px;
}

/* ---------- chữ ---------- */
.caps {
  text-transform: uppercase;
  letter-spacing: .09em;
  font-size: 14px;
  margin: 0;
  line-height: 1.6;
}
.script-title {
  font-family: var(--script);
  font-size: 42px;
  color: var(--gold);
  margin: 0;
  line-height: 1.1;
  text-align: center;
  font-weight: 400;
}
.sub {
  color: var(--ink-soft);
  font-style: italic;
  margin: 2px 0 18px;
  text-align: center;
}
.addr { margin: 2px 0 0; font-size: 15px; }

/* ---------- đầu trang ---------- */
.head { text-align: center; padding: 18px 20px 4px; }
.head-names {
  font-family: var(--script);
  font-size: clamp(24px, 7.4vw, 34px);
  color: var(--gold);
  margin: 0;
  line-height: 1.1;
  white-space: nowrap;
}
.head-names span { font-family: var(--serif); font-size: 22px; color: var(--ink-soft); }
.head-date { margin-top: 2px; letter-spacing: .25em; font-family: var(--display); font-size: 13px; }

/* ---------- thẻ thiệp ---------- */
.card {
  position: relative;
  margin: 14px 14px;
  padding: 34px 20px 150px;
  border: 1px solid #e1b8b0;
  text-align: center;
  overflow: hidden;
  background: var(--paper);
}
.card::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid var(--line);
  pointer-events: none;
}
.card > * { position: relative; z-index: 1; }
.fl-bottom {
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  width: 100%;
  height: 150px;
  pointer-events: none;
  z-index: 0 !important;
}
.fl-corner {
  position: absolute;
  width: 165px;
  height: 165px;
  pointer-events: none;
  z-index: 0 !important;
  opacity: .95;
}
.fl-tl { left: -14px; top: -14px; transform: rotate(180deg); }
.fl-br { right: -14px; bottom: -14px; }

.card-invite { padding-top: 30px; padding-bottom: 60px; }
/* lịch nằm trong dòng chảy bố cục: tháng 5 hay 6 hàng tuần đều không đè lên chữ */
.cal-wrap { display: flex; justify-content: flex-end; margin: 0 -2px 18px 0; }

/* gia đình hai họ */
.families {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 24px;
}
.fam { flex: 1; }
.fam-title {
  font-family: var(--script);
  font-size: 23px;
  color: var(--ink-soft);
  margin: 0 0 3px;
  line-height: 1;
}
.fam p { margin: 0; }
.fam b { letter-spacing: .02em; }
.fam-addr { font-style: italic; }

.announce-intro { margin-top: 4px; }
.announce-event b { font-weight: 700; }

/* tên cô dâu chú rể */
.couple { margin: 18px 0 20px; }
.name {
  font-family: var(--script);
  font-size: clamp(28px, 8vw, 44px);   /* tên dài như "Đoàn Huỳnh Hữu Khương" giữ được một dòng trên điện thoại */
  color: var(--gold);
  margin: 0;
  line-height: 1.2;
  word-break: keep-all;
}
/* Điện thoại hẹp: hai họ xếp dọc, căn giữa, để tên cha mẹ không bị gãy dòng */
@media (max-width: 400px) {
  .card { margin: 10px; padding-left: 14px; padding-right: 14px; }
  .families { flex-direction: column; align-items: center; gap: 14px; text-align: center; }
  .fam { width: 100%; }
}
.roles {
  display: flex;
  align-items: center;
  font-style: italic;
  font-size: 15px;
  margin: 2px 14px;
}
.roles .line { flex: 1; height: 1px; background: #4a4a4a; margin: 0 10px; }
.roles .amp { font-style: normal; font-size: 18px; }

/* khối thời gian */
.when { margin: 12px 0 0; }
.date-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 6px 0;
}
.date-side {
  text-transform: uppercase;
  letter-spacing: .09em;
  font-size: 14px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 2px 6px;
}
.date-day {
  font-family: var(--display);
  font-weight: 700;
  font-size: 46px;
  line-height: 1;
  color: #222;
}
.lunar { font-style: italic; font-size: 14px; margin: 4px 0 0; }
.tbd { letter-spacing: .08em; color: var(--ink-soft); }

/* lịch tháng */
.cal {
  position: relative;
  width: 172px;
  background: rgba(255, 253, 247, .75);
  border: 1px solid var(--line);
  padding: 6px 6px 5px;
  font-size: 10px;
  text-align: center;
  z-index: 2;
  line-height: 1.2;
}
.cal-title {
  font-family: var(--script);
  color: var(--gold);
  font-size: 15px;
  margin: 0 0 3px;
  line-height: 1;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px 0; }
.cal-h { font-weight: 700; text-transform: uppercase; font-size: 8px; letter-spacing: .02em; }
.cal-d { line-height: 17px; }
.sun { color: var(--red); }
.big-day { position: relative; font-weight: 700; }
.big-day::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 17px; height: 17px;
  border: 1.2px solid var(--ink);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* dòng tên khách */
.guest-line { display: flex; align-items: center; margin: 2px 10px 10px; }
.guest-line i { flex: 1; height: 1px; background: #5a5a5a; }
.guest-line .guest {
  font-family: var(--script);
  font-size: clamp(28px, 8.5vw, 34px);
  color: var(--gold);
  padding: 0 12px;
  line-height: 1.2;
}
.venue {
  font-family: var(--script);
  font-size: clamp(34px, 10vw, 44px);
  color: var(--gold);
  margin: 8px 0 0;
  line-height: 1.15;
}
.honor { margin-top: 14px; }
.kinh-moi { font-style: italic; text-transform: uppercase; letter-spacing: .1em; font-size: 14px; margin: 10px 0 0; }

/* ---------- nút ---------- */
.btn {
  display: inline-block;
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 13px;
  padding: 10px 22px;
  border: 1px solid var(--gold);
  color: var(--gold-deep);
  background: var(--paper);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background .25s, color .25s, transform .15s;
  line-height: 1.3;
}
.btn:hover { background: var(--gold); color: #fff; }
.btn:active { transform: scale(.97); }
.btn:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 3px; }
.btn-solid { background: var(--gold); color: #fff; }
.btn-solid:hover { background: var(--gold-deep); }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* ---------- bìa thiệp ---------- */
.cover {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: opacity .9s ease, transform 1s cubic-bezier(.77, 0, .18, 1);
  overflow: auto;
}
.cover::before, .cover::after { content: ""; position: absolute; pointer-events: none; }
.cover::before { inset: 10px; border: 1px solid #e1b8b0; }
.cover::after { inset: 15px; border: 1px solid var(--line); }
.cover.open { opacity: 0; transform: translateY(-6%); pointer-events: none; }
.cover-inner { padding: 30px 20px; max-width: 420px; width: 100%; position: relative; }
.wreath-wrap { position: relative; width: min(78vw, 300px); margin: 0 auto 14px; }
.wreath { width: 100%; height: auto; display: block; }
.wreath-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 4px;
}
.std {
  font-family: var(--script);
  font-size: clamp(34px, 11vw, 46px);
  line-height: .95;
  margin: 0;
  color: #2f2f2f;
}
.std-date {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: .22em;
  margin: 8px 0 0;
  font-weight: 700;
}
.invite-label { margin-top: 12px; }
.guest-name {
  font-family: var(--script);
  font-size: 38px;
  color: var(--gold);
  margin: 2px 0 16px;
  line-height: 1.1;
}
.open-btn { padding: 12px 34px; }
.open-hint { font-size: 13px; color: var(--ink-soft); font-style: italic; margin: 10px 0 0; }

/* ---------- các khối ---------- */
.block { padding: 34px 22px 10px; text-align: center; }
.block + .block { padding-top: 26px; }
.divider {
  width: 70px; height: 1px; background: var(--gold);
  margin: 10px auto 0; opacity: .7;
}

/* đếm ngược */
.cd { display: flex; justify-content: center; gap: 10px; }
.cd div {
  min-width: 66px;
  padding: 10px 6px 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .5);
}
.cd b { display: block; font-family: var(--display); font-size: 28px; color: var(--gold-deep); line-height: 1.1; }
.cd span { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.cd-today { font-family: var(--script); font-size: 32px; color: var(--gold); margin: 0; }

/* album */
.gal { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gal figure {
  margin: 0;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-2);
  cursor: pointer;
}
.gal figure:nth-child(3n + 1) { grid-column: span 2; aspect-ratio: 4 / 3; }
.gal img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; display: block; transition: transform .6s; }
.gal figure:hover img { transform: scale(1.04); }
.gal .ph {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); font-style: italic; cursor: default;
  background: linear-gradient(135deg, #f7f2e4, #ebe4d1);
}

/* bản đồ */
.map { border: 1px solid var(--line); width: 100%; height: 260px; display: block; background: var(--paper-2); }

/* RSVP */
form { display: grid; gap: 12px; text-align: left; }
label { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; display: grid; gap: 5px; }
input, select, textarea {
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fffdf7;
  width: 100%;
  border-radius: 4px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 164, 79, .18); }
.rsvp-done {
  border: 1px solid var(--gold);
  padding: 18px;
  background: rgba(255, 255, 255, .5);
  font-style: italic;
}
.rsvp-done .btn { margin-top: 10px; font-style: normal; }
.form-foot { text-align: center; margin-top: 4px; }

/* mừng cưới */
.gift-grid { display: grid; gap: 12px; }
.gift { border: 1px solid var(--line); padding: 14px; background: rgba(255, 255, 255, .5); }
.gift img { width: 170px; height: 170px; object-fit: contain; display: block; margin: 0 auto 8px; background: #fff; }
.gift p { margin: 2px 0; }
.gift .num { font-family: var(--display); font-size: 20px; letter-spacing: .08em; }
.gift .btn { margin-top: 8px; padding: 7px 16px; font-size: 12px; }

/* cảm ơn */
.thanks p { margin: 6px 0; }
.thanks .names { font-family: var(--script); font-size: 36px; color: var(--gold); margin-top: 14px; }
.foot { text-align: center; font-size: 12px; color: var(--ink-soft); padding: 20px 20px 0; }
.foot a { color: inherit; }

/* thanh nhanh + nhạc */
.quick {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 60;
  padding: 6px;
  background: rgba(251, 248, 238, .9);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
  backdrop-filter: blur(6px);
  transition: opacity .5s;
  white-space: nowrap;
}
.quick .btn { padding: 9px 16px; font-size: 12px; white-space: nowrap; }
body.locked .quick, body.locked .music-btn { opacity: 0; pointer-events: none; }
.music-btn {
  position: fixed;
  right: 14px;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: var(--paper);
  color: var(--gold-deep);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
  transition: opacity .5s;
}
.music-btn svg { width: 20px; height: 20px; }
.music-btn.playing svg { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 560px) {
  .music-btn { right: calc(50% - 260px + 14px); }
}

/* lightbox: nền mờ dần, ảnh bay ra từ ô ảnh nhỏ */
.lb {
  position: fixed; inset: 0;
  background: rgba(24, 18, 12, .94);
  z-index: 120;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity .4s ease;
}
.lb.in { opacity: 1; }
.lb img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
  will-change: transform, opacity;
  transition: transform .5s cubic-bezier(.22, .9, .3, 1), opacity .35s ease;
}
.lb-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 28px; line-height: 1;
  cursor: pointer;
  z-index: 1;
  opacity: 0;
  transition: opacity .4s ease .15s;
}
.lb.in .lb-close { opacity: 1; }
body.lb-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .lb, .lb img, .lb-close { transition: none; }
}

/* hiệu ứng hiện dần */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .cover { transition: none; }
}

/* ---------- trang chủ (hub) ---------- */
.hub { text-align: center; padding: 30px 22px 60px; }
.hub .wreath-wrap { margin-bottom: 20px; }
.hub-names { font-family: var(--script); font-size: 40px; color: var(--gold); margin: 0; line-height: 1.1; }
.hub-names span { font-family: var(--serif); font-size: 24px; color: var(--ink-soft); }
.hub-list { display: grid; gap: 12px; margin-top: 26px; text-align: left; }
.hub-item {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid #e1b8b0;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
  background: rgba(255, 255, 255, .45);
  position: relative;
  transition: transform .2s, box-shadow .2s;
}
.hub-item::before { content: ""; position: absolute; inset: 4px; border: 1px solid var(--line); pointer-events: none; }
.hub-item:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(80, 60, 10, .12); }
.hub-day {
  font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1;
  min-width: 56px; text-align: center; color: var(--gold-deep);
}
.hub-day small { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin-top: 2px; font-weight: 400; }
.hub-item h3 { margin: 0; font-family: var(--script); font-weight: 400; font-size: 28px; color: var(--gold); line-height: 1.1; }
.hub-item p { margin: 2px 0 0; font-size: 14px; }
.hub-item .tag { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }

/* ---------- trang tạo link ---------- */
.tool { padding: 30px 22px 60px; }
.tool h1 { font-family: var(--script); font-weight: 400; color: var(--gold); font-size: 40px; margin: 0; text-align: center; }
.tool .note { font-size: 14px; color: var(--ink-soft); }
.tool textarea { min-height: 140px; }
.links { display: grid; gap: 8px; margin-top: 14px; }
.link-row { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); padding: 8px 10px; background: #fffdf7; font-size: 14px; }
.link-row .who { font-weight: 700; min-width: 90px; }
.link-row code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--ink-soft); }
.link-row .btn { padding: 5px 12px; font-size: 11px; }
