:root {
  --navy: #0b1f3a;
  --navy-2: #13305a;
  --navy-3: #1c3a66;
  --gold: #d4af37;
  --gold-light: #f1d98a;
  --cream: #f8f4e8;
  --ink: #1a2238;
  --muted: #5a6478;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--navy);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.locked { overflow: hidden; }

img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Ngôn ngữ ---------- */
.lang-switch {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  border: 1px solid var(--gold);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(11, 31, 58, .75);
  backdrop-filter: blur(6px);
}
.lang-switch button {
  font: 600 13px/1 var(--sans);
  letter-spacing: .08em;
  color: var(--gold-light);
  background: transparent;
  border: 0;
  padding: 9px 14px;
  cursor: pointer;
  transition: background .25s, color .25s;
}
.lang-switch button[aria-pressed="true"] {
  background: var(--gold);
  color: var(--navy);
}

#main { transition: opacity .25s ease; }
#main.lang-fade { opacity: 0; }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 600 15px/1 var(--sans);
  padding: 14px 26px;
  border-radius: 999px;
  border: 1.5px solid var(--gold);
  text-decoration: none;
  cursor: pointer;
  transition: transform .25s, box-shadow .3s, background .3s, color .3s;
}
.btn:hover, .btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, .2), 0 0 24px rgba(212, 175, 55, .55);
  outline: none;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold) 60%, #b8902a);
  color: var(--navy);
}
.btn-navy { background: var(--navy); color: var(--gold-light); }
.btn-navy:hover { background: var(--navy-2); }

/* ---------- Màn phong bì ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(ellipse at 50% 30%, var(--navy-3), transparent 60%),
    var(--navy);
  transition: opacity .8s ease, transform .8s ease;
}
.no-js .intro { display: none; }
.intro.hide { opacity: 0; transform: scale(1.08); pointer-events: none; }

.intro-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  text-align: center;
}
.intro-to {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(18px, 4.5vw, 24px);
  color: var(--gold-light);
  min-height: 1.6em;
  animation: fadeUp 1s ease both;
}

.envelope {
  position: relative;
  width: min(340px, 80vw);
  aspect-ratio: 3 / 2;
  perspective: 900px;
  cursor: pointer;
  animation: floaty 3.5s ease-in-out infinite;
}
.envelope > div { position: absolute; }
.env-back {
  inset: 0;
  background: #0e2748;
  border: 1.5px solid var(--gold);
  border-radius: 6px;
}
.env-letter {
  left: 7%; right: 7%; top: 7%; height: 86%;
  z-index: 2;
  background: var(--cream);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 14%;
  gap: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
  transition: transform 1s cubic-bezier(.2, .8, .2, 1) .55s;
}
.env-letter-title {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--navy);
  font-size: clamp(15px, 4vw, 20px);
}
.env-letter-line { width: 40%; height: 2px; background: var(--gold); }
.env-front {
  inset: 0;
  z-index: 3;
  background: linear-gradient(180deg, #123058, #0c2343);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
  border-radius: 6px;
}
.env-flap {
  left: 0; right: 0; top: 0; height: 60%;
  z-index: 4;
  background: linear-gradient(180deg, #1a3c6b, #12305a);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform .7s ease, z-index 0s linear .35s;
}
.env-seal {
  z-index: 5;
  left: 50%; top: 60%;
  width: 52px; height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold) 55%, #9c7a22);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
  display: grid;
  place-items: center;
  transition: opacity .3s, transform .3s;
}
.env-seal svg { width: 30px; height: 30px; }

.intro.opening .envelope { animation: none; }
.intro.opening .env-seal { opacity: 0; transform: scale(.4); }
.intro.opening .env-flap { transform: rotateX(180deg); z-index: 1; }
.intro.opening .env-letter { transform: translateY(-58%); }
.intro.opening #openBtn { opacity: 0; pointer-events: none; }
#openBtn { transition: opacity .3s, transform .25s, box-shadow .3s; animation: pulse 2.2s ease-in-out infinite; }

/* ---------- Confetti ---------- */
#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 950;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 88px 16px 48px;
  text-align: center;
  color: var(--cream);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, .16), transparent 55%),
    radial-gradient(ellipse at 50% 100%, var(--navy-3), transparent 60%),
    var(--navy);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(212, 175, 55, .45);
  border-radius: 14px;
  pointer-events: none;
}
.hero-content { position: relative; z-index: 2; max-width: 720px; }

.cap {
  width: clamp(120px, 30vw, 170px);
  margin: 0 auto 8px;
  overflow: visible;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .4));
}
.tassel {
  transform-origin: 100px 58px;
  animation: swing 3s ease-in-out infinite;
}
.opened .cap { animation: toss 1.8s cubic-bezier(.3, .7, .4, 1) .3s both; }

.eyebrow {
  margin: 0;
  font-size: 13px;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--gold);
}
.title {
  margin: 10px 0 18px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(36px, 9vw, 68px);
  line-height: 1.1;
  color: var(--cream);
}
.greeting {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(20px, 5vw, 28px);
  color: var(--gold-light);
}
.celebrate { margin: 6px 0 22px; color: rgba(248, 244, 232, .8); }

.photo-wrap {
  width: 140px;
  height: 140px;
  margin: 0 auto 18px;
  border-radius: 50%;
  padding: 4px;
  background: conic-gradient(var(--gold), var(--gold-light), var(--gold), #9c7a22, var(--gold));
  animation: spinRing 8s linear infinite;
}
.photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--navy);
  animation: spinRing 8s linear infinite reverse;
}

.grad-name {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(30px, 7.5vw, 54px);
  line-height: 1.15;
  color: var(--gold);
}
.grad-name .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(24px) rotate(6deg);
}
.opened .grad-name .ch {
  animation: letterIn .6s cubic-bezier(.2, .8, .2, 1) forwards;
  animation-delay: calc(1.2s + var(--i) * 55ms);
}
.grad-name.shimmer {
  background: linear-gradient(100deg, var(--gold) 0%, var(--gold) 40%, #fff6d5 50%, var(--gold) 60%, var(--gold) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 4s linear infinite;
}

.grad-meta { margin: 0; font-size: clamp(16px, 4vw, 19px); font-weight: 500; }
.grad-school { margin: 4px 0 0; color: rgba(248, 244, 232, .75); }

.scroll-hint {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 40px;
  color: var(--gold-light);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.chevron {
  width: 14px; height: 14px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(45deg);
  animation: bounce 1.8s ease-in-out infinite;
}

/* Hiện lần lượt các phần trong hero sau khi mở thiệp */
.stagger { transition: opacity .9s ease, transform .9s cubic-bezier(.2, .8, .2, 1); }
.js:not(.opened) .stagger { opacity: 0; transform: translateY(26px); }
.hero-content > .stagger:nth-child(2) { transition-delay: .5s; }
.hero-content > .stagger:nth-child(3) { transition-delay: .65s; }
.hero-content > .stagger:nth-child(4) { transition-delay: .85s; }
.hero-content > .stagger:nth-child(5) { transition-delay: 1s; }
.hero-content > .stagger:nth-child(6) { transition-delay: 1.1s; }
.hero-content > .stagger:nth-child(7) { transition-delay: 1.1s; }
.hero-content > .stagger:nth-child(8) { transition-delay: 1.9s; }
.hero-content > .stagger:nth-child(9) { transition-delay: 2.05s; }
.hero-content > .stagger:nth-child(10) { transition-delay: 2.4s; }

/* Hạt lấp lánh */
.sparkles { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.sparkle {
  position: absolute;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 8px 2px rgba(241, 217, 138, .6);
  opacity: 0;
  animation: twinkle var(--dur) ease-in-out var(--delay) infinite;
}

/* ---------- Sections ---------- */
.section { padding: 72px 0; text-align: center; }
.section-light { background: var(--cream); }
.section-dark {
  background:
    radial-gradient(ellipse at 50% 50%, var(--navy-3), transparent 70%),
    var(--navy);
  color: var(--cream);
}
.section-details { padding-top: 0; }
.section-title {
  margin: 0 0 28px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(26px, 6vw, 38px);
  color: var(--navy);
}
.section-dark .section-title { color: var(--gold); }

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--gold);
  margin-bottom: 16px;
  font-size: 18px;
}
.ornament span { width: 64px; height: 1px; background: var(--gold); }

.message {
  max-width: 620px;
  margin: 0 auto;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(18px, 4.4vw, 22px);
  line-height: 1.7;
  color: var(--navy-2);
}

/* Thẻ thời gian / địa điểm */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.card {
  position: relative;
  background: #fff;
  border: 1px solid rgba(212, 175, 55, .55);
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 10px 30px rgba(11, 31, 58, .08);
  transition: transform .35s, box-shadow .35s;
}
.card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(11, 31, 58, .15); }
.card-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--navy);
}
.card-icon svg {
  width: 26px; height: 26px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--gold);
}
.card-big { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 21px; color: var(--navy); }
.card-sub { margin: 6px 0 0; color: var(--muted); }
.card-note { margin: 10px 0 0; font-size: 14px; font-style: italic; color: var(--muted); }
.card-note:empty { display: none; }

/* Đếm ngược */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 3vw, 20px);
  max-width: 600px;
  margin: 0 auto;
}
.cd-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: clamp(14px, 4vw, 24px) 4px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  border: 1px solid rgba(212, 175, 55, .5);
  perspective: 400px;
}
.cd-num {
  display: inline-block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(30px, 9vw, 52px);
  line-height: 1;
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
}
.cd-num.flip { animation: flip .55s cubic-bezier(.3, .7, .4, 1); }
.cd-label {
  font-size: clamp(11px, 2.8vw, 13px);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(248, 244, 232, .75);
}
.cd-status {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(22px, 5.5vw, 30px);
  color: var(--gold-light);
}

/* Bản đồ */
.map-frame {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 14px 36px rgba(11, 31, 58, .15);
  aspect-ratio: 16 / 10;
  background: #e8e2cf;
}
.map-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 26px;
}

/* Footer */
.footer {
  padding: 64px 0 56px;
  text-align: center;
  color: var(--cream);
  background: var(--navy);
}
.thanks { margin: 0; font-family: var(--serif); font-style: italic; font-size: clamp(20px, 5vw, 26px); color: var(--gold-light); }
.signature { margin: 8px 0 18px; font-family: var(--serif); font-weight: 700; font-size: 22px; color: var(--gold); }
.contact { margin: 0; color: rgba(248, 244, 232, .7); font-size: 15px; }
.contact a { color: var(--gold-light); text-decoration: none; border-bottom: 1px dashed var(--gold); }

/* Hiện khi cuộn tới */
.reveal {
  transition: opacity .9s ease var(--delay, 0s), transform .9s cubic-bezier(.2, .8, .2, 1) var(--delay, 0s);
}
.js .reveal:not(.in) { opacity: 0; transform: translateY(44px); }

/* ---------- Keyframes ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-10px) rotate(1deg); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, .5); } 50% { box-shadow: 0 0 0 12px rgba(212, 175, 55, 0); } }
@keyframes swing { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(8deg); } }
@keyframes toss {
  0% { transform: translateY(0) rotate(0); }
  35% { transform: translateY(-110px) rotate(-200deg); }
  65% { transform: translateY(-40px) rotate(-340deg); }
  85% { transform: translateY(6px) rotate(-362deg); }
  100% { transform: translateY(0) rotate(-360deg); }
}
@keyframes letterIn { to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@keyframes spinRing { to { transform: rotate(360deg); } }
@keyframes bounce { 0%, 100% { transform: translateY(0) rotate(45deg); } 50% { transform: translateY(6px) rotate(45deg); } }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: translateY(0) scale(.4); }
  50% { opacity: .9; transform: translateY(-30px) scale(1); }
}
@keyframes flip {
  0% { transform: rotateX(-90deg); opacity: .2; }
  100% { transform: rotateX(0); opacity: 1; }
}

/* ---------- Giảm chuyển động ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
  .sparkles { display: none; }
}

@media (max-width: 480px) {
  .hero::before { inset: 8px; }
  .lang-switch { top: 12px; right: 12px; }
  .section { padding: 56px 0; }
  .section-details { padding-top: 0; }
  .actions .btn { width: 100%; }
}
