/* =================== RESET CƠ BẢN =================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

/* Nền tổng thể màu hồng */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #54333b;
  background: radial-gradient(circle at top, #ffe5f4 0%, #ffc7e3 40%, #ffb6d9 70%, #ffedf7 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* Các khối nội dung chính nằm trên layer hoa rơi */
.container,
.hero,
.section,
.thank-you,
.footer {
  position: relative;
  z-index: 1;
}

/* Class dùng chung */
.hidden {
  display: none !important;
}

/* =================== NÚT CHUNG =================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #ff77b3, #ff9fcb);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(221, 88, 145, 0.55);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 12px 28px rgba(221, 88, 145, 0.65);
  filter: brightness(1.03);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(221, 88, 145, 0.35);
}

.btn.wide {
  width: 100%;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.65;
  cursor: default;
  box-shadow: none;
  transform: none;
}

/* =================== COVER ENVELOPE FULL MÀN HÌNH =================== */
#envelope {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #ffe2f0 0%, #ffc0d6 40%, #ffedf4 80%);
  overflow: hidden;
}

/* Chiếm full màn hình, bỏ bo góc */
.envelope-3d .envelope-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  perspective: 1400px;
  border-radius: 0;
  box-shadow: none;
}

/* Hai cánh mở dùng CHUNG 1 ảnh, chia làm 2 nửa */
.envelope-left,
.envelope-right {
  position: absolute;
  top: 0;
  width: 50vw;
  height: 100vh;
  backface-visibility: hidden;
  transition: transform 1.4s ease-in-out;

  background-image: url("/static/media/envelope-full.jpg");
  background-repeat: no-repeat;
  background-size: 200% 100%;
  background-color: #ffd1e5;  /* màu nền dự phòng khi ảnh chưa load */
}

/* Cánh trái: hiện nửa bên trái của ảnh */
.envelope-left {
  left: 0;
  transform-origin: center left;
  background-position: left center;
}

/* Cánh phải: hiện nửa bên phải của ảnh */
.envelope-right {
  right: 0;
  transform-origin: center right;
  background-position: right center;
}

/* (Nếu cần line giữa thì mở lại)
.envelope-center-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-0.5px);
  background: linear-gradient(to bottom, transparent, #ffc3da, transparent);
  opacity: 0.8;
}
*/

/* Cụm chữ + nút trong màn mở thiệp */
.envelope-center {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vh 1rem 10vh;
  text-align: center;
  background: transparent;
  box-shadow: none;
}

/* Tiêu đề trên cùng (vd: Thiệp mời dự tiệc thành hôn) */
.envelope-title {
  font-family: "Great Vibes", "Dancing Script", cursive;
  font-size: clamp(1.8rem, 5.4vw, 2.4rem);
  color: #c0396f;
  margin-bottom: 1.2rem;
}

/* Tên cô dâu chú rể – nếu anh có dùng class này trong HTML */
.envelope-names {
  font-family: "Great Vibes","Dancing Script",cursive;
  font-size: clamp(2.2rem, 7vw, 3rem);
  color: #ff3b83;
  text-shadow:
    0 0 6px rgba(255, 137, 189, 0.55),
    0 0 12px rgba(255, 92, 155, 0.4);
  white-space: nowrap;
  margin-bottom: 1.6rem;
  animation: fadeIn 2s ease;
}

/* Nút mở thiệp – nằm hơi thấp xuống */
.cover-btn {
  margin-top: 1.6rem;
  margin-bottom: 8vh;
  padding: 1rem 2.6rem;
  font-size: 1.1rem;
  box-shadow: 0 10px 25px rgba(255, 90, 140, 0.4);
}

/* Hiệu ứng mở 2 cánh */
#envelope.open .envelope-left {
  transform: rotateY(-120deg);
}

#envelope.open .envelope-right {
  transform: rotateY(120deg);
}

/* =================== CONTAINER CHÍNH =================== */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 5.2rem 1.1rem 2.5rem;
}

/* =================== HERO (ĐẦU TRANG THIỆP) =================== */
.hero {
  text-align: center;
  padding: 1.8rem 1.1rem 2rem;
  border-radius: 28px;
  background: radial-gradient(circle at top, #ffe9f6, #ffd3ea);
  box-shadow: 0 14px 36px rgba(221, 95, 142, 0.18);
  backdrop-filter: blur(6px);
  position: relative;
  overflow: hidden;
}

/* Họa tiết mờ */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 186, 213, 0.6), transparent 65%);
  opacity: 0.5;
}

.hero::before {
  width: 160px;
  height: 160px;
  top: -50px;
  left: -40px;
}

.hero::after {
  width: 200px;
  height: 200px;
  right: -60px;
  bottom: -70px;
  opacity: 0.45;
}

.hero-title {
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a34366;
  margin-bottom: 0.3rem;
}

.hero-sub {
  font-size: 0.9rem;
  color: #6c4152;
  margin-bottom: 1.1rem;
}

/* Thông tin cô dâu chú rể */
.hero-info {
  position: relative;
  padding: 1.2rem 0.8rem 1.4rem;
  border-radius: 22px;
  background: rgba(255, 246, 250, 0.97);
  border: 1px solid rgba(255, 184, 214, 0.7);
  margin-bottom: 1.6rem;
}

.hero-info::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 193, 214, 0.7);
  pointer-events: none;
}

.names {
  position: relative;
  font-family: "Great Vibes", "Dancing Script", cursive;
  font-size: clamp(1.8rem, 6vw, 2.3rem);
  margin-bottom: 0.6rem;
  white-space: nowrap;
  text-align: center;
  letter-spacing: 0.03em;
  color: #ff3b83;
  text-shadow:
    0 0 6px rgba(255, 137, 189, 0.4),
    0 0 14px rgba(255, 92, 155, 0.35);
  animation: glowNames 2.2s ease-in-out infinite;
}

/* Gạch chạy dưới tên trong hero */
.names::before,
.names::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff4f8b, #ff9fba, #ff4f8b);
  width: 0;
  opacity: 0.9;
  animation: underlineGrow 3s ease-in-out infinite;
}

.names::before {
  bottom: -4px;
}

.names::after {
  bottom: -8px;
  opacity: 0.55;
  animation-delay: 0.4s;
}

/* KHỐI NGÀY VÀ ĐỊA CHỈ */
.when,
.addr,
.addr.small {
  display: block;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
  text-align: center;
  word-wrap: break-word;
  white-space: pre-line;
}

.when {
  font-size: 0.9rem;
  font-weight: 600;
  color: #743c53;
  margin-bottom: 0.35rem;
}

.addr {
  font-size: 0.9rem;
  color: #7e4e60;
}

.addr.small {
  font-size: 0.82rem;
  opacity: 0.95;
}

.hero-actions {
  margin-top: 1rem;
}

/* =================== COUNTDOWN =================== */
.countdown {
  margin-top: 1.2rem;
  padding: 1rem 1.1rem;
  border-radius: 20px;
  background: linear-gradient(135deg, #ffe0f2, #ffc7e5);
  color: #7b3553;
  box-shadow: 0 10px 26px rgba(214, 90, 140, 0.18);
}

.cd-title {
  font-weight: 600;
  margin-bottom: 0.7rem;
}

.cd-grid {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
}

.cd-grid > div {
  flex: 1;
  padding: 0.45rem 0.35rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 6px 14px rgba(184, 66, 112, 0.18);
}

.cd-grid span {
  display: block;
  font-weight: 700;
  font-size: 1.1rem;
}

.cd-grid small {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* =================== SECTION / BLOCK CHUNG =================== */
.section {
  margin-top: 1.6rem;
  padding: 1.4rem 1.1rem 1.6rem;
  border-radius: 24px;
  background: radial-gradient(circle at top, #fff0f9, #ffd8ec);
  box-shadow: 0 10px 28px rgba(210, 85, 135, 0.16);
}

.section h2 {
  text-align: center;
  font-size: 1.2rem;
  color: #b33d69;
  margin-bottom: 1rem;
  font-family: "Dancing Script", cursive;
}

/* =================== GALLERY CHUYÊN NGHIỆP =================== */
.gallery-section {
  position: relative;
}

.highlight-slide {
  position: relative;
  width: 100%;
  border-radius: 22px;
  overflow: hidden;
  margin-bottom: 1rem;
  background: #fbd8e6;
}

.highlight-slide img {
  display: none;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.highlight-slide img.active {
  display: block;
}

/* Lưới ảnh nhỏ */
.gallery-advanced {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.gallery-advanced img {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  cursor: pointer;
  background: #f7e8f0;
  padding: 2px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-advanced img:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 16px rgba(169, 58, 106, 0.25);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 20, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.lightbox img {
  max-width: 94vw;
  max-height: 90vh;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

/* =================== LOVE STORY / TIMELINE TÌNH YÊU =================== */
.love-story .story-timeline {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.story-item {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.story-item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  object-fit: cover;
  object-position: top center;
  max-height: none;
}

.story-text h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
  color: #af3e67;
}

.story-text p {
  font-size: 0.9rem;
  color: #5b3746;
}

/* Hiệu ứng reveal khi cuộn */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* =================== LỊCH TRÌNH NGÀY CƯỚI =================== */
.timeline {
  list-style: none;
  margin-top: 0.5rem;
  padding-left: 0.4rem;
}

.timeline li {
  position: relative;
  padding: 0.6rem 0.6rem 0.6rem 1.4rem;
  font-size: 0.9rem;
  color: #5b3644;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 0.9rem;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #ff8eb3;
}

.timeline li + li {
  border-top: 1px dashed rgba(241, 167, 201, 0.7);
}

/* =================== RSVP FORM =================== */
.form {
  margin-top: 0.5rem;
}

.form-row {
  margin-bottom: 0.85rem;
}

.form-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #6e3f51;
}

.form-row input,
.form-row textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  border: 1px solid #f1bfd7;
  font-size: 0.9rem;
  outline: none;
  background: #fffafc;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-row input:focus,
.form-row textarea:focus {
  border-color: #ff8bb6;
  background: #fffefe;
  box-shadow: 0 0 0 1px rgba(255, 139, 182, 0.5);
}

.form-row textarea {
  resize: vertical;
  min-height: 80px;
}

.attendance-options {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.attendance-options input[type="radio"] {
  margin-right: 0.3rem;
}

/* Thông báo gửi RSVP */
.msg {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  text-align: center;
  color: #b53c6f;
  background: #ffe6f1;
  border-radius: 14px;
  padding: 0.6rem 0.8rem;
}

/* =================== QR SECTION =================== */
.qr-section .center {
  text-align: center;
  margin-bottom: 0.8rem;
}

.qr-box {
  margin-top: 0.7rem;
  border-radius: 20px;
  background: #fff6fb;
  border: 1px solid #ffd1e6;
  padding: 0.9rem;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: max-height 0.4s ease, opacity 0.35s ease, transform 0.35s ease;
}

.qr-box.show {
  max-height: 600px;
  opacity: 1;
  transform: translateY(0);
}

.qr-box.dual {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.qr-item {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.qr-img {
  width: 110px;
  height: 110px;
  object-fit: contain;
  border-radius: 14px;
  padding: 0.4rem;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(163, 60, 103, 0.18);
}

.qr-info p {
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.qr-info strong {
  color: #7a3951;
}

.acc-number {
  font-family: "Courier New", monospace;
}

/* =================== HIỆU ỨNG HOA & TRÁI TIM RƠI =================== */
#falling {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.fall-item {
  position: fixed;
  top: -10%;
  animation-name: fallingItem;
  animation-timing-function: linear;
  animation-iteration-count: 1;
  opacity: 0.9;
}

@keyframes fallingItem {
  0% {
    transform: translate3d(0, 0, 0) rotateZ(0deg);
    opacity: 0.9;
  }
  50% {
    opacity: 1;
    transform: translate3d(10px, 50vh, 0) rotateZ(160deg);
  }
  100% {
    transform: translate3d(-10px, 110vh, 0) rotateZ(320deg);
    opacity: 0;
  }
}

/* =================== THANK YOU & FOOTER =================== */
.thank-you {
  margin-top: 1.8rem;
  padding: 1.4rem 1.2rem;
  border-radius: 24px;
  background: radial-gradient(circle at top, #ffeef9, #ffd4eb);
  box-shadow: 0 10px 30px rgba(208, 80, 132, 0.16);
  text-align: center;
}

.thank-you p {
  font-size: 0.9rem;
  color: #5a3645;
  margin-bottom: 0.6rem;
}

.signature {
  margin-top: 0.7rem;
  font-family: "Great Vibes", "Dancing Script", cursive;
  font-size: 1.3rem;
  color: #b63968;
}

.footer {
  margin-top: 0.9rem;
  text-align: center;
  font-size: 0.78rem;
  color: #a24b6c;
}

.footer a {
  color: #d14c7a;
  text-decoration: none;
  font-weight: 600;
}

/* =================== RESPONSIVE =================== */
@media (min-width: 600px) {
  .container {
    padding: 5.4rem 1.6rem 3rem;
  }

  .gallery-advanced {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .qr-box.dual {
    flex-direction: row;
  }

  .qr-item {
    flex: 1;
  }
}

@media (min-width: 768px) {
  .hero {
    padding: 2rem 2.2rem 2.4rem;
  }

  .hero-title {
    font-size: 1.2rem;
  }

  .names {
    font-size: 2.4rem;
  }

  .countdown {
    max-width: 420px;
    margin: 1.2rem auto 0;
  }

  .love-story .story-timeline {
    gap: 1.8rem;
  }

  .story-item {
    flex-direction: row;
    align-items: center;
  }

  .story-item.reverse {
    flex-direction: row-reverse;
  }

  .story-item img {
    max-width: 45%;
    max-height: 260px;
  }

  .story-text {
    flex: 1;
    padding: 0 0.8rem;
  }
}

@media (max-width: 360px) {
  .names {
    font-size: 1.9rem;
  }

  .hero-info {
    padding: 1rem 0.6rem 1.2rem;
  }

  .cd-grid span {
    font-size: 1rem;
  }
}

/* =================== ANIMATION TEXT =================== */
@keyframes glowNames {
  0% {
    text-shadow: 0 0 6px rgba(255, 155, 195, 0.4),
                 0 0 12px rgba(255, 126, 168, 0.35);
  }
  50% {
    text-shadow: 0 0 10px rgba(255, 155, 195, 0.8),
                 0 0 22px rgba(255, 126, 168, 0.7);
  }
  100% {
    text-shadow: 0 0 6px rgba(255, 155, 195, 0.4),
                 0 0 12px rgba(255, 126, 168, 0.35);
  }
}

@keyframes underlineGrow {
  0% {
    width: 0;
    opacity: 0;
  }
  30% {
    width: 60%;
    opacity: 1;
  }
  70% {
    width: 60%;
    opacity: 1;
  }
  100% {
    width: 0;
    opacity: 0;
  }
}

/* Gradient chạy trên chữ – nếu anh muốn dùng thêm */
@keyframes shimmerText {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Chữ nổi lên xuống nhẹ */
@keyframes floatNames {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
  100% {
    transform: translateY(0);
  }
}

/* Hiệu ứng mờ xuất hiện cho đoạn tên trên màn mở thiệp */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
