:root {
  --blue-950: #174a7d;
  --blue-800: #2d69a2;
  --blue-600: #609bd1;
  --blue-300: #b8d9f4;
  --blue-100: #e8f5ff;
  --paper: #f4faff;
  --ink: #245a8d;
  --shadow: 0 8px 24px rgba(42, 86, 130, .16);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; overflow-x: hidden; max-width: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: #f9fcff;
  font-family: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
  max-width: 100%;
}
button, input, textarea, select { font: inherit; }
input, textarea, select {
  font-size: 16px;
  touch-action: manipulation;
}
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
img { display: block; max-width: 100%; }

/* Khi kích hoạt chế độ chặn F12 & chống sao chép ảnh */
body.block-devtools,
body.block-devtools * {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body.block-devtools input,
body.block-devtools textarea,
body.block-devtools select {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}
body.block-devtools img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  pointer-events: none;
}
body.block-devtools a img,
body.block-devtools button img,
body.block-devtools .about-photo-wrap img,
body.block-devtools .portrait-wrap img {
  pointer-events: auto;
}
.script { font-family: "Great Vibes", "Charm", cursive; font-weight: 400; }
.section-pad { padding-left: 34px; padding-right: 34px; }
.section-title { margin: 4px 0 2px; text-align: center; font-family: "Cormorant Garamond", "Playfair Display", Georgia, serif; font-size: 26px; font-weight: 600; line-height: 1.25; letter-spacing: .02em; color: #1a5282; }
.section-kicker { margin: 4px 0 16px; text-align: center; font: 600 11px/1.4 "Be Vietnam Pro", sans-serif; letter-spacing: .12em; color: #3c74a6; }
.section-divider { width: 176px; height: 28px; margin: 0 auto; }
.mini-ornament { display: flex; align-items: center; justify-content: center; gap: 8px; color: #5f9fd3; }
.mini-ornament span { width: 66px; border-top: 1px solid #7db1dc; }
.mini-ornament b { flex: 0 0 18px; width: 18px; height: 18px; font-size: 0; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='rgb(126,177,216)' stroke='rgb(78,141,187)' stroke-width='.75'%3E%3Ccircle cx='12' cy='6.8' r='4.2'/%3E%3Ccircle cx='16.95' cy='10.4' r='4.2'/%3E%3Ccircle cx='15.06' cy='16.2' r='4.2'/%3E%3Ccircle cx='8.94' cy='16.2' r='4.2'/%3E%3Ccircle cx='7.05' cy='10.4' r='4.2'/%3E%3C/g%3E%3Ccircle cx='12' cy='12' r='2.2' fill='rgb(245,251,255)' stroke='rgb(78,141,187)' stroke-width='.7'/%3E%3C/svg%3E"); }
.toast {
  position: fixed;
  left: 50%;
  top: 24px;
  z-index: 999999;
  transform: translate(-50%, -20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, #1c5b96, #3682c4);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 8px 30px rgba(16, 57, 95, 0.35);
  font: 600 13.5px/1.3 "Be Vietnam Pro", sans-serif;
  text-align: center;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* Nền của màn bìa */
body.cover-visible {
  background: radial-gradient(circle at 50% 46%, #f8fcff 0 25%, #ebf5fe 55%, #d8ebf9 100%);
  min-height: 100svh;
}

.cover {
  opacity: 1;
  transition: opacity 0.45s cubic-bezier(0.2, 0.8, 0.25, 1);
}

/* Màn hình thông báo lỗi khi ID thiệp sai / Không tìm thấy thiệp */
.error-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 46%, #f8fcff 0 25%, #ebf5fe 55%, #d8ebf9 100%);
  animation: fadeIn .4s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.error-card {
  max-width: 440px;
  width: 100%;
  padding: 34px 26px 30px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid rgba(115, 167, 208, 0.45);
  box-shadow: 0 12px 36px rgba(35, 80, 125, 0.16);
  text-align: center;
  backdrop-filter: blur(10px);
}

.error-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e4f2fe, #cae4fb);
  border: 1.5px solid #82b6e1;
  color: #1e5a8f;
  margin-bottom: 12px;
}

.error-title {
  margin: 12px 0 8px;
  font-family: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  font-size: clamp(22px, 3.2vw, 26px);
  font-weight: 700;
  color: #144573;
}

.error-message {
  margin: 0 0 22px;
  font-size: 13.5px;
  line-height: 1.65;
  color: #2e5f8a;
}

.error-actions {
  display: flex;
  justify-content: center;
}

.btn-error-reload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(110deg, #3d79ad, #5e97c9);
  color: #fff;
  font: 600 13.5px/1 "Be Vietnam Pro", sans-serif;
  box-shadow: 0 4px 14px rgba(45, 89, 129, 0.25);
  cursor: pointer;
  transition: transform .2s ease, filter .2s ease;
}

.btn-error-reload:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

/* Hiệu ứng hoa rơi (theo logic chuẩn từ bên thiệp cưới) */
.petal-rain { position: fixed; inset: 0; z-index: 27; overflow: hidden; pointer-events: none; }
.particle {
  position: absolute;
  top: -40px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: particle-fall linear infinite;
  filter: drop-shadow(0 2px 4px rgba(60, 90, 120, 0.15));
  user-select: none;
  pointer-events: none;
  will-change: transform;
}
.particle svg {
  width: 100%;
  height: 100%;
  display: block;
}
@keyframes particle-fall {
  0% {
    transform: translateY(-20px) translateX(0) rotate(0deg) scale(0.8);
    opacity: 0;
  }
  15% { opacity: 0.85; }
  85% { opacity: 0.85; }
  100% {
    transform: translateY(105vh) translateX(var(--sway, 30px)) rotate(360deg) scale(1.1);
    opacity: 0;
  }
}

/* ===================================================
   Hiệu ứng cuộn tới đâu hiện chữ từ từ (Scroll Reveal Animation)
   =================================================== */

/* Khung section mặc định */
.reveal-section {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1), transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Các kiểu chuyển động chi tiết (Trái, Phải, Dưới lên, Phóng to, Nảy pop) */
.reveal-left,
.reveal-right,
.reveal-up,
.reveal-scale,
.reveal-pop {
  opacity: 0;
  transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1), transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-left { transform: translateX(-50px); }
.reveal-right { transform: translateX(50px); }
.reveal-up { transform: translateY(35px); }
.reveal-scale { transform: scale(0.88); }
.reveal-pop { transform: scale(0.8) translateY(20px); }

/* Kích hoạt khi cuộn tới từng phần tử */
.reveal-left.visible,
.reveal-right.visible,
.reveal-up.visible,
.reveal-scale.visible,
.reveal-pop.visible {
  opacity: 1 !important;
  transform: translate(0) scale(1) !important;
}

/* Lớp delay tùy chỉnh */
.delay-1 { transition-delay: 0.1s !important; }
.delay-2 { transition-delay: 0.2s !important; }
.delay-3 { transition-delay: 0.3s !important; }
.delay-4 { transition-delay: 0.4s !important; }
.delay-5 { transition-delay: 0.5s !important; }

/* Timeline: xen kẽ so le Trái / Phải kèm hiệu ứng nảy nhẹ */
.timeline-row {
  opacity: 0;
  will-change: opacity, transform;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.timeline-row:nth-child(odd) {
  transform: translateX(-40px);
}
.timeline-row:nth-child(even) {
  transform: translateX(40px);
}
.timeline-row.visible {
  opacity: 1 !important;
  transform: translateX(0) !important;
}
.timeline-row:nth-child(1) { transition-delay: 0.08s; }
.timeline-row:nth-child(2) { transition-delay: 0.18s; }
.timeline-row:nth-child(3) { transition-delay: 0.28s; }
.timeline-row:nth-child(4) { transition-delay: 0.38s; }
.timeline-row:nth-child(5) { transition-delay: 0.48s; }
.timeline-row:nth-child(6) { transition-delay: 0.58s; }
.timeline-row:nth-child(7) { transition-delay: 0.68s; }

/* Phụ kiện máy ảnh trong timeline xoay nhẹ và trượt từ phải vào */
.timeline__camera {
  opacity: 0;
  transform: translateX(40px) rotate(18deg) scale(0.85);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.35s, transform 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.35s;
}
.timeline__camera.visible,
.reveal-section.visible .timeline__camera {
  opacity: 0.85;
  transform: translateX(0) rotate(5deg) scale(1);
}

/* Chữ viết tay timeline */
.timeline__note {
  opacity: 0;
  transform: scale(0.85) rotate(-18deg);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.25s, transform 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.25s;
}
.timeline__note.visible,
.reveal-section.visible .timeline__note {
  opacity: 0.85;
  transform: scale(1) rotate(-11deg);
}

/* Đếm ngược: 4 ô số nảy lên lần lượt */
.countdown-box {
  opacity: 0;
  transform: translateY(24px) scale(0.88);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.countdown-box.visible {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}
.countdown-box:nth-child(1) { transition-delay: 0.08s; }
.countdown-box:nth-child(2) { transition-delay: 0.18s; }
.countdown-box:nth-child(3) { transition-delay: 0.28s; }
.countdown-box:nth-child(4) { transition-delay: 0.38s; }

/* Bảng màu trang phục: từng đốm màu nảy nhẹ */
.palette__item, .palette span {
  opacity: 0;
  transform: scale(0.6) translateY(12px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.palette__item.visible, .palette span.visible {
  opacity: 1 !important;
  transform: scale(1) translateY(0) !important;
}
.palette__item:nth-child(1), .palette span:nth-child(1) { transition-delay: 0.1s; }
.palette__item:nth-child(2), .palette span:nth-child(2) { transition-delay: 0.18s; }
.palette__item:nth-child(3), .palette span:nth-child(3) { transition-delay: 0.26s; }
.palette__item:nth-child(4), .palette span:nth-child(4) { transition-delay: 0.34s; }
.palette__item:nth-child(5), .palette span:nth-child(5) { transition-delay: 0.42s; }

/* Danh sách lời chúc / bình luận trượt xen kẽ trái phải */
.guest-entry {
  opacity: 0;
  will-change: opacity, transform;
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}
.guest-entry:nth-child(odd) {
  transform: translateX(-36px);
}
.guest-entry:nth-child(even) {
  transform: translateX(36px);
}
.guest-entry.visible {
  opacity: 1 !important;
  transform: translateX(0) !important;
}
.guest-entry:nth-child(1) { transition-delay: 0.06s; }
.guest-entry:nth-child(2) { transition-delay: 0.14s; }
.guest-entry:nth-child(3) { transition-delay: 0.22s; }
.guest-entry:nth-child(4) { transition-delay: 0.30s; }
.guest-entry:nth-child(5) { transition-delay: 0.38s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
}
