/* =========================================================
 * Bố cục theo mẫu mới – dùng lại màu & font của bản cũ
 *   --color-primary   #BF9376  (nâu vàng)
 *   --color-secondary #5C4739  (nâu đậm)
 *   --color-base      #FFFDFD  / --color-base-200 #F1EBE4
 *   font-title (MRCH NewYork) · font-script (SVN Rushtick) · font-primary (Questrial)
 * ========================================================= */

/* ---------- Bố cục trang: cột giữa + nền hai bên ---------- */
.tm-body {
  margin: 0;
  background: var(--color-base-200);
}
.tm-backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  display: none;
}
.tm-backdrop img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.1);
  filter: blur(40px);
  opacity: .3;
}
.tm-backdrop::after {
  content: "";
  position: absolute; inset: 0;
  background: color-mix(in oklab, var(--color-secondary) 45%, transparent);
}
.tm-shell {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100svh;
  background: var(--color-base);
  overflow: hidden;
}
@media (min-width: 768px) {
  .tm-backdrop { display: block; }
  .tm-shell {
    margin: 2rem auto;
    min-height: calc(100svh - 4rem);
    box-shadow: 0 24px 80px rgba(42, 25, 18, .32);
  }
}

/* ---------- Màn hình trước khi mở thiệp ---------- */
.tm-cover {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  color: #fff;
  text-align: center;
  transition: opacity .9s ease, filter .9s ease, transform .9s ease;
}
@media (min-width: 768px) {
  .tm-cover { min-height: calc(100svh - 4rem); }
}
.tm-cover-bg { position: absolute; inset: 0; }
.tm-cover-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  filter: blur(6px);
}
/* Đường kẻ giữa như hai cánh cửa */
.tm-cover-bg::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 1px;
  background: rgba(255, 255, 255, .45);
}
.tm-cover-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 330px;
  padding: 48px 24px;
  border-radius: 30px;
  background: color-mix(in oklab, var(--color-secondary) 50%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.tm-cover-names { font-size: 2.6rem; line-height: 1.2; margin: 2.25rem 0 2rem; }
.tm-cover-names p { margin: 0; }
.tm-cover-date {
  border-top: 1px solid rgba(255, 255, 255, .85);
  border-bottom: 1px solid rgba(255, 255, 255, .85);
  padding: 12px 0;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: .3em;
}
.tm-cover-invite { font-style: italic; margin: 1.5rem 0 0; }
.tm-open-btn {
  margin-top: 2rem;
  min-height: 48px;
  padding: 0 32px;
  border: 0;
  border-radius: 9999px;
  background: #fff;
  color: var(--color-secondary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  animation: tm-glow 2.4s ease-in-out infinite;
}
.tm-open-btn:disabled { cursor: wait; }
@keyframes tm-glow {
  0%, 100% { box-shadow: 0 10px 25px rgba(0, 0, 0, .15), 0 0 0 0 color-mix(in oklab, var(--color-primary) 70%, transparent); }
  50%      { box-shadow: 0 10px 25px rgba(0, 0, 0, .15), 0 0 26px 6px color-mix(in oklab, var(--color-primary) 55%, transparent); }
}
/* Khi bấm mở: màn chờ nổi lên trên, nội dung nằm sẵn bên dưới */
.tm-cover.is-overlay { position: absolute; top: 0; left: 0; right: 0; z-index: 50; }
/* Trạng thái đang mở: mờ dần + nhoè */
.tm-cover.is-opening { opacity: 0; filter: blur(10px); transform: scale(1.03); }

/* Trái tim bay lên khi mở thiệp */
.tm-heart {
  position: absolute;
  z-index: 3;
  bottom: 30%;
  color: #fff;
  font-size: 18px;
  pointer-events: none;
  animation: tm-heart-up 1.4s ease-out forwards;
}
@keyframes tm-heart-up {
  0%   { opacity: 0; transform: translateY(0) scale(.6) rotate(0); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-260px) scale(1.1) rotate(var(--tm-rot, 20deg)); }
}

/* Nút nhạc / cuộn tự động: góc dưới bên phải (như thiệp mẫu) */
.module-music.fixed-top { top: auto; bottom: 16px; right: 24px; z-index: 90; }
/* Màn hình rộng: nằm ngay ngoài mép phải của cột nội dung (cột rộng 480px) */
@media (min-width: 768px) {
  .module-music.fixed-top { right: calc(50% - 284px); }
}

/* ---------- Khung chung ---------- */
.tm-section {
  padding: 56px 20px;
  text-align: center;
  color: var(--color-secondary);
}
.tm-section > * { max-width: 560px; margin-left: auto; margin-right: auto; }
.tm-section p { margin: 0 0 .35rem; }
.tm-bg-base { background: var(--color-base); }
.tm-bg-alt  { background: var(--color-base-200); }
.tm-bg-dark { background: var(--color-secondary); color: #fff; }

.tm-heading {
  font-size: 2.6rem;
  line-height: 1.2;
  margin: 0 0 .75rem;
  color: var(--color-primary);
  font-weight: 400;
}
.tm-bg-dark .tm-heading { color: #fff; }
.tm-subheading {
  font-size: 2rem;
  font-weight: 400;
  color: var(--color-primary);
  margin: 1.75rem 0 .5rem;
}
.tm-eyebrow {
  text-transform: uppercase;
  letter-spacing: .25em;
  font-size: .8rem;
  font-weight: 700;
}
.tm-eyebrow.tm-dark { color: var(--color-secondary); }
.tm-rule {
  border: 0;
  border-top: 1px solid color-mix(in oklab, var(--color-primary) 60%, transparent);
  margin: 1.75rem auto;
}
.tm-lunar { font-style: italic; font-size: .9rem; opacity: .85; }

/* ---------- 1. Hero ---------- */
.tm-hero {
  position: relative;
  min-height: 100svh;
  padding: 40px 24px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  text-align: center;
}
.tm-hero-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.06);
  transition: transform 6s ease-out;
}
.tm-hero.is-revealed .tm-hero-bg { transform: scale(1); }
.tm-hero-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  border-radius: 24px;
  padding: 48px 24px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: color-mix(in oklab, var(--color-secondary) 22%, transparent);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .12);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55), 0 2px 16px rgba(0, 0, 0, .55);
}
.tm-hero-card .tm-eyebrow { font-size: 1.2rem; letter-spacing: .22em; }

/* Mở thiệp: ảnh hiện rõ trước, sau đó khung thư mời và từng dòng chữ hiện dần */
.tm-hero-card,
.tm-hero-card > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1s ease, transform 1s ease;
}
.tm-hero.is-revealed .tm-hero-card { opacity: 1; transform: none; transition-delay: 1s; }
.tm-hero.is-revealed .tm-hero-card > * { opacity: 1; transform: none; }
.tm-hero.is-revealed .tm-hero-card > :nth-child(1) { transition-delay: 1.6s; }
.tm-hero.is-revealed .tm-hero-card > :nth-child(2) { transition-delay: 2s; }
.tm-hero.is-revealed .tm-hero-card > :nth-child(3) { transition-delay: 2.4s; }
.tm-hero-names { font-size: 2.6rem; line-height: 1.2; margin-top: 2rem; }
.tm-hero-names p { margin: 0; }
.tm-amp { font-size: 2.4rem; color: var(--color-base-200); }
.tm-hero-date {
  border-top: 1px solid rgba(255, 255, 255, .8);
  border-bottom: 1px solid rgba(255, 255, 255, .8);
  padding: 14px 0;
}
.tm-hero-time { font-weight: 700; font-size: 1.1rem; margin-bottom: 4px; }
.tm-hero-day { font-weight: 700; font-size: 1.35rem; letter-spacing: .3em; }

/* ---------- 2. Save the date + ngoắc tay ---------- */
#save-the-date { padding-top: 32px; padding-bottom: 28px; }
.tm-std {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .15em;
  margin: 0 0 .75rem;
  color: var(--color-primary);
  font-weight: 400;
  line-height: 1;
}
.tm-std-word { font-size: 2.2rem; text-transform: uppercase; letter-spacing: .02em; }
.tm-std-the { font-size: 2.8rem; margin: 0 .05em; transform: translateY(.12em); }
.tm-pinky { display: block; width: 36%; max-width: 150px; height: auto; margin: 0 auto; }

/* ---------- 3. Hai gia đình ---------- */
.tm-family {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.tm-family-col { display: flex; flex-direction: column; align-items: center; }
.tm-parents { min-height: 3.6em; margin: 14px 0 18px; }
.tm-parents p { margin: 0 0 .3rem; }
.tm-arch {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 9999px 9999px 0 0;
}
.tm-person { font-size: 1.35rem; line-height: 1.25; margin-top: 16px; color: var(--color-primary); }
.tm-role { text-transform: uppercase; letter-spacing: .2em; font-size: .75rem; margin-top: 6px; }

/* ---------- 4. Thư mời ---------- */
.tm-bigdate { font-size: 2.8rem; color: var(--color-primary); margin: .5rem 0; }
.tm-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 1.25rem;
  padding: 12px 26px;
  border: 1px solid var(--color-secondary);
  border-radius: 9999px;
  color: var(--color-secondary);
  font-weight: 700;
  font-size: .9rem;
  text-decoration: none;
  transition: background .3s, color .3s;
}
.tm-btn-outline:hover { background: var(--color-secondary); color: #fff; }

/* ---------- 5. Album ---------- */
.tm-album-section { padding-left: 12px; padding-right: 12px; }
.tm-album {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 1rem;
}
.tm-album a { display: block; overflow: hidden; aspect-ratio: 4 / 5; }
.tm-album a.tm-wide { grid-column: span 2; aspect-ratio: 4 / 3; }
.tm-album img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.tm-album a.tm-wide img { object-position: 50% 20%; } /* ảnh dọc trong ô ngang: giữ phần mặt */
.tm-album a:hover img { transform: scale(1.04); }

/* ---------- 6. Đếm ngược ---------- */
#countdown { padding-top: 16px; }
.tm-countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 1.5rem;
}
.tm-countdown > div > span { display: block; font-size: 2.4rem; line-height: 1.1; color: var(--color-secondary); }
.tm-countdown > div > span span { display: inline; } /* UIkit bọc mỗi chữ số trong 1 span */
.tm-countdown small { display: block; text-transform: uppercase; letter-spacing: .2em; font-size: .75rem; opacity: .7; margin-top: 4px; }

/* ---------- 7 & 8. Form ---------- */
.tm-icon { font-size: 1.75rem; display: inline-block; margin-bottom: .5rem; }
.tm-form { display: flex; flex-direction: column; text-align: left; margin-top: 1rem; }
.tm-form label { font-weight: 700; font-size: .95rem; margin: 14px 0 8px; }
.tm-form input,
.tm-form select,
.tm-form textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--color-secondary);
  background: #fff;
  border: 1px solid color-mix(in oklab, var(--color-primary) 45%, transparent);
  border-radius: 2px;
  outline: none;
}
.tm-form input:focus,
.tm-form select:focus,
.tm-form textarea:focus { border-color: var(--color-primary); box-shadow: 0 0 0 2px color-mix(in oklab, var(--color-primary) 30%, transparent); }
.tm-form .is-invalid { border-color: #dc2626; }
.tm-form .error-message { color: #dc2626; font-size: 12px; margin-top: 4px; }
.tm-bg-dark .tm-form .error-message { color: #fca5a5; }
.tm-btn {
  margin-top: 18px;
  padding: 14px;
  border: 0;
  border-radius: 2px;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: opacity .3s;
}
.tm-btn:disabled { opacity: .6; cursor: wait; }
.tm-btn-light { background: #fff; color: var(--color-secondary); }
.tm-btn-primary { background: var(--color-primary); color: #fff; }
.tm-form-message { margin-top: 14px; padding: 12px; text-align: center; font-style: italic; border-radius: 4px; background: rgba(255, 255, 255, .15); }
.tm-bg-alt .tm-form-message { background: rgba(191, 147, 118, .15); }


/* ---------- 9. Mừng cưới ---------- */
.tm-gift-hint { font-size: .9rem; opacity: .85; }
.tm-gift { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 1.25rem; }
.tm-gift-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px 10px 14px;
  border: 1px solid color-mix(in oklab, var(--color-primary) 45%, transparent);
  border-radius: 12px;
  background: #fff;
  font-size: .85rem;
}
.tm-gift-card .tm-eyebrow { font-size: .75rem; margin-bottom: 8px; color: var(--color-primary); }
.tm-gift-card > a { display: block; width: 100%; max-width: 170px; }
.tm-qr { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 6px; }
.tm-gift-card strong { margin-top: 10px; font-size: .8rem; letter-spacing: .02em; }
.tm-bank { font-weight: 700; color: var(--color-primary); margin-bottom: 10px; }
.tm-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto; /* đẩy nút xuống đáy thẻ để 2 thẻ thẳng hàng */
  padding: 6px 12px;
  border: 1px solid var(--color-primary);
  border-radius: 9999px;
  background: transparent;
  color: var(--color-secondary);
  font: inherit;
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .03em;
  cursor: pointer;
  transition: background .25s, color .25s;
}
.tm-copy:hover,
.tm-copy.is-copied { background: var(--color-primary); color: #fff; }

/* ---------- Nút cuộn tự động + nút nhạc: xếp ngang, nút nhạc ở ngoài cùng bên phải ---------- */
.module-music {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 8px;
}
.btn-autoscroll {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  color: #fff;
  font-size: 1rem;
  background: linear-gradient(to bottom right, var(--color-primary), var(--color-secondary));
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  opacity: .75;
  transition: opacity .3s, transform .3s;
}
.btn-autoscroll:hover,
.btn-autoscroll.is-active { opacity: 1; }
.btn-autoscroll.is-active { transform: scale(1.05); }

@media (min-width: 768px) {
  .btn-autoscroll { width: 2.5rem; height: 2.5rem; font-size: 1.25rem; }
  .tm-hero { min-height: calc(100svh - 4rem); }
}

@media (prefers-reduced-motion: reduce) {
  .btn-autoscroll, .tm-album img { transition: none; }
  .tm-hero-bg, .tm-hero-card, .tm-hero-card > * { transition: none !important; transform: none !important; }
}

/* Lời cảm ơn: làm tối ảnh để chữ trắng dễ đọc */
#thankyou > .cover {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, .55) 62%, rgba(0, 0, 0, .8) 100%);
}
/* Đặt chữ ở phần dưới ảnh để không che mặt */
#thankyou .container > div { justify-content: flex-end; }
#thankyou h2, #thankyou p { text-shadow: 0 2px 12px rgba(0, 0, 0, .5); }

/* ---------- Form gộp: xác nhận + lời chúc ---------- */
.tm-if-attending { display: flex; flex-direction: column; }
.tm-if-attending[hidden] { display: none; }
.tm-transport {
  display: flex;
  gap: 8px;
  margin: 14px 0 0 !important;
  padding: 12px 14px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .12);
  border: 1px dashed rgba(255, 255, 255, .45);
  font-size: .9rem;
  line-height: 1.5;
}
.tm-transport[hidden] { display: none; }
.tm-transport i { font-size: 1.15rem; line-height: 1.3; flex-shrink: 0; }
.tm-transport a { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
/* Ô bẫy chống bot: ẩn khỏi người dùng */
.tm-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.tm-form-message.is-error { background: rgba(220, 38, 38, .25); }

