/* ========== Màn mở thiệp: thiệp cánh cổng (gatefold) mở sang hai bên ========== */
.intro {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; padding: 24px 16px; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(217, 184, 106, .16), transparent 60%),
    radial-gradient(ellipse at center, #33261a 0%, #140e09 80%);
  transition: opacity 1.1s ease, visibility 1.1s;
}
.intro.gone { opacity: 0; visibility: hidden; }
.intro::before { /* bụi vàng lấp lánh */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, #f1dca0, transparent), radial-gradient(1px 1px at 82% 14%, #f1dca0, transparent),
    radial-gradient(1.5px 1.5px at 70% 78%, #f1dca0, transparent), radial-gradient(1px 1px at 22% 84%, #f1dca0, transparent),
    radial-gradient(1px 1px at 48% 8%, #f1dca0, transparent), radial-gradient(1.5px 1.5px at 92% 52%, #f1dca0, transparent),
    radial-gradient(1px 1px at 6% 58%, #f1dca0, transparent), radial-gradient(1px 1px at 38% 94%, #f1dca0, transparent);
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: .15; } }

.gate-to { margin: 0; text-align: center; color: var(--gold-2); font-size: .7rem; letter-spacing: .4em; text-transform: uppercase; transition: opacity .6s; }
.gate-to b {
  display: block; margin-top: 4px; padding: 0 .2em; letter-spacing: 0; text-transform: none;
  font-family: var(--serif); font-weight: 600; font-size: clamp(1.9rem, 8.5vw, 2.6rem); line-height: 1.2;
  background: linear-gradient(180deg, #fff8e4 0%, #f6e7b8 45%, #d9b86a 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(217, 184, 106, .45)) drop-shadow(0 2px 2px rgba(0, 0, 0, .6));
}
.gate-to::after { content: ''; display: block; width: 90px; height: 1px; margin: 10px auto 0; background: linear-gradient(90deg, transparent, var(--gold-2), transparent); }
.gate-hint { margin: 0; color: var(--gold-2); font-size: .72rem; letter-spacing: .35em; text-transform: uppercase; animation: breathe 2s ease-in-out infinite; transition: opacity .5s; }
@keyframes breathe { 50% { opacity: .35; } }
.intro.opened .gate-to, .intro.opened .gate-hint { opacity: 0; pointer-events: none; animation: none; }

/* ----- Khung thiệp ----- */
.gate {
  --gw: min(340px, 78vw, 58svh);
  position: relative; width: var(--gw); height: calc(var(--gw) * 1.42);
  perspective: 1800px; cursor: pointer; flex: none;
  filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .55));
  transition: transform 1.2s cubic-bezier(.6, 0, .2, 1);
  animation: floaty 5s ease-in-out infinite;
}
@keyframes floaty { 50% { transform: translateY(-6px); } }
.intro.opened .gate { animation: none; }

/* ----- Ruột thiệp (lộ ra khi mở) ----- */
.gate-inside {
  position: absolute; inset: 0; border-radius: 4px; overflow: hidden; text-align: center; color: var(--ink);
  background:
    repeating-linear-gradient(45deg, rgba(184, 145, 58, .025) 0 2px, transparent 2px 5px),
    radial-gradient(ellipse at 50% 30%, #fffdf7, #f6ecd8 80%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 9% 9% 8%;
}
.gate-inside .frame { position: absolute; inset: 9px; border: 1px solid rgba(184, 145, 58, .7); pointer-events: none; }
.gate-inside .frame::after { content: ''; position: absolute; inset: 4px; border: .5px solid rgba(184, 145, 58, .45); }
.in-kicker { font-size: .62rem; letter-spacing: .35em; text-transform: uppercase; color: var(--gold); margin: 0; }
.in-guest { font-family: var(--serif); font-weight: 600; color: var(--wine); font-size: calc(var(--gw) * .058); margin: 2px 0 8px; line-height: 1.2; }
.in-photo { width: 52%; aspect-ratio: 3 / 4; border-radius: 999px 999px 6px 6px; overflow: hidden; padding: 4px; border: 1px solid var(--gold); background: #fff; flex: none; }
.in-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; border-radius: 999px 999px 4px 4px; }
.in-names { font-family: var(--script); font-size: calc(var(--gw) * .088); line-height: 1.2; margin: 6px 0 2px; word-spacing: .1em; white-space: nowrap; padding: 0 .1em;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.in-date { margin: 0; font-size: .7rem; letter-spacing: .22em; text-transform: uppercase; }
.in-lunar { margin: 2px 0 0; font-family: var(--serif); font-style: italic; font-size: .72rem; color: var(--muted); }
.in-btn { margin-top: 10px; padding: .55em 1.3em; font-size: .78rem; opacity: 0; transform: translateY(6px); transition: opacity .6s 2s, transform .6s 2s; }
.intro.opened .in-btn { opacity: 1; transform: none; }

/* ----- Hai cánh cửa ----- */
.door { position: absolute; top: 0; bottom: 0; width: 50%; transform-style: preserve-3d; z-index: 2;
  transition: transform 1.9s cubic-bezier(.6, .02, .2, 1) .45s; }
.door.l { left: 0; transform-origin: left center; }
.door.r { right: 0; transform-origin: right center; }
.intro.opened .door.l { transform: rotateY(-168deg); }
.intro.opened .door.r { transform: rotateY(168deg); }
.door .face, .door .back { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.door.l .face { border-radius: 4px 0 0 4px; box-shadow: inset -10px 0 18px -12px rgba(60, 40, 10, .55); }
.door.r .face { border-radius: 0 4px 4px 0; box-shadow: inset 10px 0 18px -12px rgba(60, 40, 10, .55); }
.door .back { transform: rotateY(180deg);
  background: repeating-linear-gradient(-45deg, rgba(184, 145, 58, .06) 0 1px, transparent 1px 9px), linear-gradient(#f4e9d2, #eadbb9); }
.door .back::after { content: ''; position: absolute; inset: 9px; border: 1px solid rgba(184, 145, 58, .55); }

/* Mặt trước hai cánh dùng chung một hình rộng gấp đôi để hoa văn liền mạch qua đường gập */
.art { position: absolute; top: 0; bottom: 0; width: 200%; }
.door.l .art { left: 0; }
.door.r .art { left: -100%; }
.art {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(-45deg, rgba(120, 85, 30, .04) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 50% 38%, #f8eed6 0%, #ead7ad 62%, #d8bf8c 100%);
}
.art .frame { position: absolute; inset: 11px; border: 1.5px solid transparent;
  border-image: linear-gradient(135deg, #8a6a24, #f6e7b8, #b8913a, #f6e7b8, #8a6a24) 1; }
.art .frame::after { content: ''; position: absolute; inset: 5px; border: .5px solid rgba(138, 106, 36, .55); }
.art .corner { position: absolute; width: 22%; aspect-ratio: 1; }
.art .corner.tl { top: 6px; left: 6px; }
.art .corner.tr { top: 6px; right: 6px; transform: scaleX(-1); }
.art .corner.bl { bottom: 6px; left: 6px; transform: scaleY(-1); }
.art .corner.br { bottom: 6px; right: 6px; transform: scale(-1, -1); }
.foil { background: var(--gold-grad); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: foil 5s linear infinite; }
@keyframes foil { to { background-position: -200% 0; } }
/* Nhũ vàng đậm cho chữ trên nền giấy sáng (để không bị chìm) */
.art .foil {
  background: linear-gradient(100deg, #5e430f 0%, #8a6a24 30%, #c9a24e 48%, #8a6a24 62%, #5e430f 100%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 rgba(255, 250, 235, .9));
}
.art .kicker2 { position: absolute; top: 15%; left: 0; right: 0; text-align: center; font-family: var(--serif); letter-spacing: .5em; font-size: calc(var(--gw) * .036); text-transform: uppercase; }
.art .kicker2 small { display: block; letter-spacing: .3em; font-size: .7em; margin-top: 4px; font-family: var(--sans); }
.art .ribbon { position: absolute; left: 0; right: 0; top: 50%; height: 15%; transform: translateY(-50%);
  background: linear-gradient(to bottom, #4d0f19, #8f2638 30%, #a8344a 50%, #8f2638 70%, #4d0f19);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .35); }
.art .ribbon::before, .art .ribbon::after { content: ''; position: absolute; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, #8a6a24, #f6e7b8, #b8913a, #f6e7b8, #8a6a24); }
.art .ribbon::before { top: 4px; } .art .ribbon::after { bottom: 4px; }
.art .names2 { position: absolute; top: 68%; left: 0; right: 0; text-align: center; font-family: var(--script); font-size: calc(var(--gw) * .085); line-height: 1.3; word-spacing: .1em; white-space: nowrap; }
.art .date2 { position: absolute; top: 79%; left: 0; right: 0; text-align: center; letter-spacing: .4em; font-size: calc(var(--gw) * .042); font-weight: 600; font-family: var(--serif); }

/* ----- Huy hiệu chữ lồng (con dấu) ở giữa ----- */
.medal {
  position: absolute; z-index: 3; left: 50%; top: 50%; width: 36%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 0; padding: 0; border-radius: 50%; background: none; transition: transform .6s cubic-bezier(.5, -0.4, .6, 1), opacity .5s .1s;
}
.medal svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45)); }
.medal::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 1.5px solid rgba(241, 220, 160, .9); animation: ring 2.2s ease-out infinite; }
@keyframes ring { from { transform: scale(.9); opacity: .9; } to { transform: scale(1.35); opacity: 0; } }
.intro.opened .medal { transform: translate(-50%, -50%) scale(1.6); opacity: 0; pointer-events: none; }
.intro.opened .medal::after { animation: none; opacity: 0; }

/* Phóng to ruột thiệp rồi vào trang */
.intro.entering .gate { transform: scale(1.12); }

@media (prefers-reduced-motion: reduce) {
  .door { transition-duration: .01ms !important; }
}
