:root {
  --green: #3b520d;
  --green-2: #5d6b41;
  --green-dark: #213f0a;
  --rust: #a2522b;
  --paper: #f8f7f3;
  --card: #f2f1ed;
  --ink: #2f3a1c;
  --script: "Allison", cursive;
  --display: "Hepta Slab", serif;
  --body: "Hepta Slab", serif;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: var(--body);
  color: var(--ink);
  background: #d9d7cd;
  -webkit-font-smoothing: antialiased;
}
/* Khung điện thoại: luôn 1 cột ~430px, căn giữa trên desktop */
.page {
  max-width: 430px;
  margin: 0 auto;
  overflow: hidden;
  background-color: var(--paper);
  /* giấy vân nổi (grain) + nếp nhăn nhẹ (wrinkle) */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.07' numOctaves='4' seed='3' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='1' lighting-color='%23fff'%3E%3CfeDistantLight azimuth='225' elevation='55'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix values='0 0 0 0 .25  0 0 0 0 .24  0 0 0 0 .2  -.25 0 0 0 .21'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url%28%23f%29'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='700' height='700'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.004 .009' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='4' lighting-color='%23fff'%3E%3CfeDistantLight azimuth='225' elevation='55'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix values='0 0 0 0 .25  0 0 0 0 .24  0 0 0 0 .2  -.22 0 0 0 .185'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url%28%23f%29'/%3E%3C/svg%3E");
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
  position: relative;
}
section {
  position: relative;
  padding: 56px 20px;
}
img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Ảnh: nếu chưa có file thì hiện khung giữ chỗ */
.ph {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(135deg, #c9cdb8, #8f9a79);
}
.ph.missing::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font: 13px var(--body);
  letter-spacing: 0.05em;
  opacity: 0.85;
}
.ph.missing img {
  display: none;
}

.script {
  font-family: var(--script);
  font-weight: 400;
  color: var(--green);
  line-height: 1;
}
.display {
  font-family: var(--display);
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.center {
  text-align: center;
}

/* Giấy xé mép */
.torn {
  position: relative;
  isolation: isolate;
  padding: 28px 22px;
}
/* một lớp giấy duy nhất (màu đồng nhất), mép làm méo + bóng đổ bằng #torn-rim */
.torn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--card);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.015' numOctaves='4' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4  0 0 0 0 .4  0 0 0 0 .37  0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  filter: url(#torn-rim);
}

.xi {
  display: block;
  width: 62px;
  height: 62px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
}

/* Hiệu ứng hiện dần khi cuộn */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 1s ease,
    transform 1s ease;
}
.reveal.in {
  opacity: 1;
  transform: none;
}
/* hiệu ứng ảnh nhà trai / nhà gái / album */
.anim {
  opacity: 0;
  transition:
    opacity 0.9s ease,
    transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--d, 0s);
}
.anim.in {
  opacity: 1;
  transform: none;
}
.from-l {
  transform: translateX(-46px) rotate(-3deg);
}
.from-r {
  transform: translateX(46px) rotate(3deg);
}
.from-b {
  transform: translateY(26px);
}
.zoom {
  transform: scale(0.9);
}
.ph.anim img {
  transform: scale(1.2);
  transition: transform 2s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0s);
}
.ph.anim.in img {
  transform: scale(1);
}
.grid .ph.in:hover img {
  transform: scale(1.06);
  transition-delay: 0s;
  transition-duration: 0.6s;
}
.couple .amp.anim {
  transform: translateX(-50%) scale(0.4) rotate(-20deg);
}
.couple .amp.anim.in {
  transform: translateX(-50%);
}
@media (prefers-reduced-motion: reduce) {
  .anim,
  .reveal,
  .ph.anim img {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .couple .amp.anim {
    transform: translateX(-50%) !important;
  }
}

/* ===== HERO ===== */
.hero {
  padding: 0;
  padding-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  --hero-ink: #1f5132;
}
.hero .flora {
  opacity: 0.5;
  z-index: 0;
}
.hero .flora.h1 {
  width: 170px;
  left: -46px;
  top: -70px;
  transform: rotate(-24deg);
}
.hero .flora.h2 {
  width: 150px;
  right: -40px;
  top: -50px;
  transform: scaleX(-1) rotate(-18deg);
}
.hero .flora.h3 {
  width: 120px;
  left: -26px;
  bottom: 40px;
  transform: rotate(12deg);
}
.mono {
  position: relative;
  z-index: 1;
  margin-top: 13%;
  width: 180px;
  height: 124px;
  color: var(--hero-ink);
  font: 400 80px/1 var(--display);
}
.mono .m1,
.mono .m2 {
  position: absolute;
}
.mono .m1 {
  left: 18px;
  top: 0;
}
.mono .m2 {
  right: 16px;
  top: 30px;
}
.mono .swash {
  position: absolute;
  left: -10px;
  bottom: -6px;
  width: 190px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}
/* băng ảnh mép giấy xé: clip-path tạo trong main.js */
.band {
  position: relative;
  z-index: 1;
  width: 100%;
  height: min(108vw, 465px);
  margin-top: 10px;
  filter: drop-shadow(0 4px 6px rgba(40, 40, 30, 0.22));
}
.tear {
  height: 100%;
  background: #fbfbf8;
}
.tear .ph {
  height: 100%;
  border-radius: 0;
}
.tear .ph img {
  object-position: 50% 30%;
}
.hero .info {
  position: relative;
  z-index: 1;
  align-self: flex-end;
  text-align: right;
  padding: 20px 22px 0 0;
  color: var(--hero-ink);
}
.hero h1 {
  font: 400 21px/1.3 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hero .when {
  margin-top: 8px;
  font: 300 17px var(--display);
  letter-spacing: 0.08em;
}
.fam-links {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-bottom: 22px;
  display: flex;
  gap: 40px;
}
.fam-links a {
  color: var(--hero-ink);
  text-decoration: none;
  font: 400 15px var(--display);
  letter-spacing: 0.06em;
}

/* ===== COUNTDOWN ===== */
.countdown h2 {
  font-size: 58px;
  margin-bottom: 12px;
}
.count {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
}
.count div {
  text-align: center;
  min-width: 64px;
}
.count b {
  display: block;
  font: 400 38px var(--display);
  color: var(--green);
}
.count small {
  font-size: 13px;
}
.count i {
  font-style: normal;
  font-size: 22px;
  padding-top: 10px;
  color: var(--green);
}

/* ===== SAVE THE DATE ===== */
.std .box {
  position: relative;
  height: 540px;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(rgba(20, 30, 15, 0.25), rgba(20, 30, 15, 0.25)),
    url("../images/09-bg-20260607032908-oxf_q.jpg") center / cover no-repeat;
}
.std .title {
  position: absolute;
  left: 30px;
  top: 26px;
  color: #fff;
  z-index: 2;
}
.std .title .s {
  font: 80px/1 var(--script);
}
.std .title .t {
  font: 36px var(--display);
  opacity: 0.75;
  margin: -6px 0 0 48px;
}
.std .title .d {
  font: 80px/1 var(--script);
  margin-left: 60px;
}
.std .date {
  position: absolute;
  left: 128px;
  top: 232px;
  z-index: 2;
  background: var(--rust);
  color: #fbe7d3;
  border: 2px solid #f0c9a3;
  border-radius: 10px;
  padding: 6px 10px;
  text-align: center;
  font: 22px/1.3 var(--body);
}
.std .date .r {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.std .date .r span + span {
  border-left: 1px solid #f0c9a3;
  padding-left: 6px;
}
.std .p1 {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 140px;
  height: 280px;
}
.std .p2 {
  position: absolute;
  right: 162px;
  bottom: 12px;
  width: 118px;
  height: 210px;
}
.std .p3 {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 140px;
  height: 210px;
}

/* ===== INVITATION ===== */
.invite .torn {
  text-align: center;
  padding: 40px 22px 34px;
  z-index: 1;
}
/* mẫu đơn khắc gỗ 1885 (public domain, qua Old Design Shop) */
.flora {
  position: absolute;
  width: 130px;
  height: auto;
  opacity: 0.55;
  pointer-events: none;
}
.flora.tl {
  left: -30px;
  top: -60px;
  transform: rotate(-14deg);
  z-index: 0;
}
.flora.br {
  right: -28px;
  bottom: -50px;
  width: 140px;
  transform: scaleX(-1) rotate(-10deg);
  z-index: 2;
}
.invite .lead {
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
  line-height: 1.7;
}
.invite .venue {
  font-size: 26px;
  margin: 22px 0 4px;
}
.invite .addr {
  font-style: italic;
  font-size: 14px;
}
.invite .time {
  font: 20px var(--display);
  color: var(--green);
  margin: 24px 0 20px;
}
.map {
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.map iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.btn {
  display: inline-block;
  margin-top: 16px;
  padding: 9px 26px;
  border-radius: 999px;
  background: var(--green-2);
  color: #fff;
  text-decoration: none;
  font: 14px var(--display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--green-2);
  cursor: pointer;
}
.invite .welcome {
  font-size: 40px;
  margin: 22px 0 14px;
}
.invite .xi {
  margin: 0 auto;
}

/* ===== COUPLE ===== */
.couple {
  padding: 32px 14px 60px;
}
.couple .cols {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 16px;
}
.couple .col-b {
  padding-top: 80px;
  text-align: right;
}
.couple .g {
  height: 290px;
  border-radius: 18px;
}
.couple .b {
  height: 265px;
  border-radius: 18px;
}
.couple .wo {
  position: absolute;
  right: 4px;
  top: 26px;
  z-index: 2;
  font-size: 62px;
  white-space: nowrap;
}
.couple .amp {
  position: absolute;
  left: 50%;
  top: 318px;
  transform: translateX(-50%);
  font-size: 90px;
  color: #b9bcae;
  z-index: 1;
}
.couple h3 {
  font: 400 28px/1.1 var(--display);
  color: var(--green);
  margin-top: 22px;
  white-space: nowrap;
  text-transform: uppercase;
}
.fam {
  position: relative;
  margin: 12px 0 0 8px;
  padding: 6px 0 2px 18px;
  border-left: 1.5px solid var(--green);
  color: var(--green);
  font-size: 13.5px;
  line-height: 1.6;
}
.fam::before {
  content: "";
  position: absolute;
  left: -4.5px;
  top: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}
.fam .lbl {
  font-family: var(--display);
  font-size: 15px;
  margin-bottom: 10px;
}
.col-b .fam {
  margin: 12px 8px 0 0;
  padding: 6px 18px 2px 0;
  border-left: 0;
  border-right: 1.5px solid var(--green);
}
.col-b .fam::before {
  left: auto;
  right: -4.5px;
}
.col-b h3 {
  direction: rtl;
} /* tên dài tràn sang trái thay vì tràn ra mép phải */

/* ===== ALBUM ===== */
.album h2 {
  font-size: 62px;
  margin-left: 4px;
}
.album .torn {
  margin: 6px 0 14px;
  padding: 18px 18px;
  font-size: 14px;
  line-height: 1.6;
}
.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.grid .ph {
  border-radius: 12px;
  cursor: zoom-in;
  height: 150px;
}
.grid .ph:nth-child(1) {
  grid-column: span 4;
  height: 300px;
}
.grid .ph:nth-child(2) {
  grid-column: span 2;
  height: 300px;
}
.grid .ph:nth-child(3),
.grid .ph:nth-child(4),
.grid .ph:nth-child(5) {
  grid-column: span 2;
  height: 210px;
}
.grid .ph:nth-child(6) {
  grid-column: span 6;
  height: 180px;
}
.grid .ph:nth-child(7) {
  grid-column: span 2;
  height: 270px;
}
.grid .ph:nth-child(8) {
  grid-column: span 4;
  height: 270px;
}
.grid .ph:nth-child(n + 9) {
  grid-column: span 3;
  height: 200px;
}
.album .forever {
  font-size: 50px;
  text-align: right;
  margin-top: 8px;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  place-items: center;
  z-index: 50;
}
.lightbox.open {
  display: grid;
}
.lightbox img {
  max-width: 94vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}
.lightbox button {
  position: absolute;
  background: none;
  border: 0;
  color: #fff;
  font-size: 34px;
  cursor: pointer;
  padding: 14px;
}
.lightbox .x {
  top: 6px;
  right: 10px;
}
.lightbox .prev {
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
}
.lightbox .next {
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

/* ===== RSVP ===== */
.rsvp p {
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 18px;
}
.rsvp form {
  display: grid;
  gap: 10px;
}
.rsvp input,
.rsvp select,
.rsvp textarea {
  width: 100%;
  border: 1px solid var(--green);
  border-radius: 18px;
  background: transparent;
  padding: 9px 14px;
  font: 14px var(--body);
  color: var(--ink);
  appearance: none;
  outline: none;
}
.rsvp textarea {
  min-height: 96px;
  resize: vertical;
}
.rsvp select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--green) 50%),
    linear-gradient(135deg, var(--green) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.rsvp .btn {
  margin: 4px 0 0;
  width: 100%;
  font-size: 17px;
  padding: 10px;
}
.rsvp .msg {
  text-align: center;
  color: var(--green);
  font-style: italic;
  min-height: 1.4em;
  font-size: 14px;
}

/* ===== THANK YOU ===== */
.thanks {
  padding: 0;
  height: 300px;
  margin: 30px 0 60px;
  background: linear-gradient(135deg, #7c8170, var(--green-2));
}
.thanks .txt {
  position: absolute;
  inset: 0;
  z-index: 2;
  color: #fff;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 0 18px;
  font-size: 13px;
  line-height: 1.6;
}
.thanks .script {
  color: #fff;
  font-size: 60px;
  margin-top: 18px;
}

/* Nút nhạc */
.music {
  position: fixed;
  bottom: 18px;
  right: max(18px, calc(50% - 215px + 18px));
  z-index: 30;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: var(--green-2);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}
.music.on {
  animation: spin 4s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
