:root {
  --red: #8b1a2b;
  --red-deep: #5a0e18;
  --red-mid: #9e2436;
  --gold: #e8c872;
  --gold-2: #f3e5ab;
  --gold-deep: #b8893a;
  --ink: #f8ead0;
  --ink-soft: rgba(248, 234, 208, 0.78);
  --serif: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--serif);
  background: var(--red-deep);
  overflow-x: hidden;
}

body.locked {
  overflow: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.brocade,
.vignette,
.page-frame,
#petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.brocade {
  z-index: 0;
  background: #9b1d2c;
}

.bg-motif {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(920px, 120vw);
  transform: translate(-50%, -50%);
  opacity: 0.14;
}

.bg-blossom {
  position: absolute;
  width: min(220px, 42vw);
  opacity: 0.72;
}

.bg-blossom.tl {
  top: 8px;
  left: 8px;
}

.bg-blossom.br {
  right: 8px;
  bottom: 8px;
  transform: rotate(180deg);
}

.vignette {
  z-index: 1;
  background: radial-gradient(ellipse at 50% 40%, transparent 62%, rgba(80, 12, 20, 0.28) 100%);
}

.page-frame {
  z-index: 24;
  margin: 10px;
  border: 1px solid rgba(232, 200, 114, 0.45);
  box-shadow:
    inset 0 0 0 6px rgba(90, 14, 24, 0.35),
    inset 0 0 0 7px rgba(232, 200, 114, 0.28);
}

.page-frame__corner {
  position: absolute;
  width: 92px;
  height: 92px;
}

.page-frame__corner.tl { top: -2px; left: -2px; }
.page-frame__corner.tr { top: -2px; right: -2px; transform: scaleX(-1); }
.page-frame__corner.bl { bottom: -2px; left: -2px; transform: scaleY(-1); }
.page-frame__corner.br { bottom: -2px; right: -2px; transform: scale(-1); }

#petals {
  z-index: 3;
}

main,
.nav,
.footer,
.hero,
.section {
  position: relative;
  z-index: 4;
}

.ornament {
  position: absolute;
  width: 68px;
  height: 68px;
  pointer-events: none;
  z-index: 2;
}

.ornament.tl { top: 4px; left: 4px; }
.ornament.tr { top: 4px; right: 4px; transform: scaleX(-1); }
.ornament.bl { bottom: 4px; left: 4px; transform: scaleY(-1); }
.ornament.br { bottom: 4px; right: 4px; transform: scale(-1); }

.divider {
  width: min(420px, 86%);
  height: auto;
  margin: 8px auto 18px;
}

.kicker {
  margin: 0 0 8px;
  text-align: center;
  letter-spacing: 0.46em;
  text-indent: 0.46em;
  text-transform: uppercase;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--gold);
}

h2 {
  margin: 0;
  text-align: center;
  font-weight: 500;
  font-size: clamp(30px, 5vw, 42px);
  letter-spacing: 0.38em;
  text-indent: 0.38em;
  color: var(--gold-2);
  text-shadow: 0 2px 0 rgba(90, 14, 24, 0.45);
}

.lead {
  margin: 0 auto 22px;
  max-width: 34em;
  text-align: center;
  color: var(--ink-soft);
  line-height: 1.9;
}

.panel {
  position: relative;
  padding: 36px 28px 32px;
  background:
    linear-gradient(180deg, rgba(142, 28, 44, 0.88), rgba(90, 14, 24, 0.92));
  border: 1px solid var(--gold);
  box-shadow:
    inset 0 0 0 7px rgba(90, 14, 24, 0.65),
    inset 0 0 0 8px rgba(232, 200, 114, 0.55),
    0 22px 60px rgba(20, 0, 4, 0.28);
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  height: 10px;
  background: url("assets/leiwen.svg") center / 48px 12px repeat-x;
  opacity: 0.42;
  pointer-events: none;
}

.panel::before { top: 12px; }
.panel::after { bottom: 12px; }

.envelope {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  transition: opacity 0.9s ease, visibility 0.9s ease;
}

.envelope.is-open {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope__silk {
  position: absolute;
  inset: 0;
  background: #9b1d2c;
}

.envelope__silk::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/dragon-phoenix.svg") 50% 42% / min(920px, 140vw) no-repeat;
  opacity: 0.14;
}

.card-blossom {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 96px;
  opacity: 0.7;
  pointer-events: none;
}

.envelope__card {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  padding: 48px 24px 36px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(155, 32, 48, 0.55), rgba(90, 14, 24, 0.72));
  border: 1px solid var(--gold);
  box-shadow:
    inset 0 0 0 8px rgba(90, 14, 24, 0.45),
    inset 0 0 0 9px rgba(232, 200, 114, 0.7),
    0 24px 70px rgba(0, 0, 0, 0.35);
}

.cloud-top {
  width: 160px;
  margin: 0 auto 6px;
  opacity: 0.85;
}

.double {
  margin: 0;
  font-size: 86px;
  line-height: 0.9;
  color: var(--gold-2);
  text-shadow:
    0 0 24px rgba(232, 200, 114, 0.35),
    0 4px 0 rgba(90, 14, 24, 0.5);
}

.envelope__names,
.hero__names,
.footer__names {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: clamp(40px, 10vw, 62px);
  font-weight: 400;
  line-height: 1.12;
  color: var(--gold-2);
}

.envelope__names i,
.hero__names em,
.footer__names em {
  font-family: "Palatino Linotype", Palatino, "Songti SC", serif;
  font-style: italic;
  font-size: 0.4em;
  color: var(--gold);
}

.envelope__date {
  margin: 0 0 28px;
  letter-spacing: 0.18em;
  color: var(--gold);
}

.seal {
  position: relative;
  width: 124px;
  height: 124px;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #d45a4c, #7d1f1f 68%);
  color: var(--gold-2);
  cursor: pointer;
  box-shadow:
    0 0 0 8px rgba(232, 200, 114, 0.2),
    0 0 0 14px rgba(90, 14, 24, 0.35),
    0 16px 36px rgba(0, 0, 0, 0.35);
}

.seal__ring {
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(243, 229, 171, 0.7);
  border-radius: 50%;
}

.seal__char {
  display: block;
  font-size: 50px;
  line-height: 124px;
}

.seal__hint {
  position: absolute;
  left: 50%;
  bottom: -32px;
  transform: translateX(-50%);
  width: max-content;
  font-size: 12px;
  letter-spacing: 0.28em;
  color: rgba(243, 229, 171, 0.8);
}

.envelope__hint {
  margin: 52px 0 0;
  letter-spacing: 0.28em;
  color: var(--gold);
}

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 7vw 12px;
  background: rgba(74, 10, 18, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(232, 200, 114, 0.22);
  opacity: 0;
  transform: translateY(-12px);
  transition: 0.45s ease;
}

body.ready .nav {
  opacity: 1;
  transform: none;
}

.nav.is-solid {
  box-shadow: 0 10px 30px rgba(20, 0, 4, 0.25);
}

.nav__brand,
.footer__mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #b43343, #6a101c);
  color: var(--gold-2);
  font-size: 22px;
}

.nav__brand {
  justify-self: start;
}

.nav__links {
  display: flex;
  justify-content: center;
  gap: 22px;
  font-size: 14px;
  letter-spacing: 0.2em;
  color: var(--gold-2);
}

.music-btn {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 12px 0 8px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: rgba(90, 14, 24, 0.55);
  color: var(--gold-2);
  cursor: pointer;
  letter-spacing: 0.08em;
}

.music-btn[hidden] {
  display: none;
}

.music-btn__icon {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
}

.music-btn__icon::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #5a0e18;
  transform: translateX(1px);
}

.music-btn.is-on .music-btn__icon::before,
.music-btn.is-on .music-btn__icon::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 2px;
  height: 10px;
  background: #5a0e18;
  border: 0;
}

.music-btn.is-on .music-btn__icon::before {
  left: 8px;
  transform: none;
}

.music-btn.is-on .music-btn__icon::after {
  right: 8px;
}

.music-btn__text {
  font-size: 12px;
}

.music-toast {
  position: fixed;
  right: 18px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 25;
  display: none;
  padding: 10px 14px;
  background: rgba(58, 12, 20, 0.92);
  color: var(--gold-2);
  font-size: 13px;
  letter-spacing: 0.08em;
  border: 1px solid rgba(232, 200, 114, 0.35);
}

.music-toast.is-show {
  display: inline-flex;
}

.hero {
  min-height: 100svh;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 36px 18px 88px;
  text-align: center;
}

.hero__cloud {
  width: 170px;
  margin: 0 auto 4px;
  opacity: 0.88;
}

.hero__names {
  margin: 0;
  font-size: clamp(48px, 12vw, 88px);
  text-shadow: 0 4px 0 rgba(90, 14, 24, 0.4);
}

.hero__cover {
  margin: 8px 0 0;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  font-size: 20px;
  color: var(--gold);
}

.hero__when,
.hero__where {
  margin: 6px 0 0;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.portrait {
  position: relative;
  width: min(360px, 86vw);
  margin: 28px auto 0;
  padding: 14px;
  border: 1px solid var(--gold);
  box-shadow:
    inset 0 0 0 7px rgba(90, 14, 24, 0.55),
    inset 0 0 0 8px rgba(232, 200, 114, 0.7);
  background: rgba(90, 14, 24, 0.45);
}

.portrait > img.shot__photo,
.portrait > #heroPhotoImg {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center 18%;
}

.scroll-hint {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--gold);
}

.scroll-hint::after {
  content: "";
  display: block;
  width: 1px;
  height: 26px;
  margin: 8px auto 0;
  background: var(--gold);
  animation: drip 1.6s ease-in-out infinite;
}

@keyframes drip {
  0%,
  100% { transform: scaleY(0.4); opacity: 0.35; }
  50% { transform: scaleY(1); opacity: 1; }
}

.section {
  width: min(880px, 88vw);
  margin: 0 auto;
  padding: 72px 0 8px;
}

.count-panel {
  padding-top: 42px;
}

.count {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.count div {
  padding: 16px 6px 12px;
  border: 1px solid rgba(232, 200, 114, 0.35);
  background: rgba(40, 6, 10, 0.28);
}

.count strong {
  display: block;
  font-size: clamp(26px, 5vw, 38px);
  font-weight: 500;
  color: var(--gold-2);
}

.count span {
  letter-spacing: 0.2em;
  font-size: 13px;
  color: var(--gold);
}

.count__done {
  margin: 16px 0 0;
  text-align: center;
  letter-spacing: 0.16em;
}

.letter {
  text-align: left;
}

.letter__to {
  margin: 0;
  letter-spacing: 0.12em;
  color: var(--gold);
}

.letter h3,
.panel > h3 {
  margin: 10px 0 14px;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--gold-2);
  text-align: center;
}

.letter__body p {
  margin: 0 0 12px;
  font-size: 17px;
  line-height: 2;
  text-align: justify;
}

.letter__couple {
  margin: 22px 0 8px;
  text-align: center;
  font-size: 20px;
  letter-spacing: 0.08em;
  color: var(--gold-2);
}

.letter__label {
  margin: 18px 0 6px;
  text-align: center;
  letter-spacing: 0.28em;
  color: var(--gold);
  font-size: 14px;
}

.letter__meta {
  margin: 0;
  text-align: center;
  line-height: 1.9;
  color: var(--gold-2);
}

.letter__close,
.letter__hosts {
  text-align: center;
}

.letter__hosts {
  margin: 28px 0 8px;
  color: var(--gold-2);
  letter-spacing: 0.12em;
}

.letter__close {
  margin: 0;
  letter-spacing: 0.42em;
  color: var(--gold);
}

.stamp {
  width: 76px;
  height: 76px;
  margin: 22px auto 0;
  display: grid;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-2);
  font-size: 38px;
  line-height: 1;
  box-shadow:
    inset 0 0 0 5px rgba(232, 200, 114, 0.28),
    0 0 0 1px rgba(232, 200, 114, 0.35);
}

.gallery__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.shot {
  position: relative;
  min-height: 260px;
  margin: 0;
  padding: 12px;
  overflow: hidden;
  cursor: zoom-in;
  border: 1px solid var(--gold);
  background: rgba(90, 14, 24, 0.5);
  box-shadow:
    inset 0 0 0 6px rgba(90, 14, 24, 0.55),
    inset 0 0 0 7px rgba(232, 200, 114, 0.55);
}

.shot:first-child {
  grid-column: 1 / -1;
  min-height: 48vh;
}

.shot__photo {
  width: 100%;
  height: 100%;
  min-height: 236px;
  object-fit: cover;
}

.shot:first-child .shot__photo {
  min-height: 44vh;
}

.shot figcaption {
  position: absolute;
  left: 22px;
  bottom: 18px;
  z-index: 3;
  letter-spacing: 0.22em;
  color: var(--gold-2);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.shot__ph {
  display: grid;
  place-items: center;
  color: var(--gold);
  letter-spacing: 0.2em;
}

.venue__city {
  margin: 0;
  letter-spacing: 0.42em;
  color: var(--gold);
  font-family: var(--sans);
  font-size: 12px;
}

.panel h3 small {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

.venue__addr {
  margin: 0;
  font-size: 18px;
}

.venue__full,
.venue__tip {
  color: var(--ink-soft);
  line-height: 1.8;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.btn-row.center {
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold-2);
  cursor: pointer;
  letter-spacing: 0.14em;
}

.btn--gold {
  background: linear-gradient(180deg, #e8c872, #c4a056);
  color: #5a0e18;
  border-color: transparent;
}

.btn--block {
  width: 100%;
  margin-top: 8px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.schedule {
  list-style: none;
  margin: 0;
  padding: 8px 4px 0;
}

.schedule li {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  padding: 16px 4px;
  border-bottom: 1px dashed rgba(232, 200, 114, 0.28);
}

.schedule li:last-child {
  border-bottom: 0;
}

.schedule time {
  font-size: 22px;
  color: var(--gold-2);
}

.schedule h3 {
  margin: 0 0 4px;
  font-size: 18px;
  letter-spacing: 0.12em;
  color: var(--gold-2);
}

.schedule p {
  margin: 0;
  color: var(--ink-soft);
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.form__split {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 12px;
}

.form label {
  display: grid;
  gap: 6px;
}

.form label span {
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--gold);
}

.form input,
.form select,
.form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(232, 200, 114, 0.4);
  background: rgba(255, 248, 232, 0.94);
  color: #4a1520;
  font-family: var(--sans);
  font-size: 16px;
}

.form textarea {
  resize: vertical;
}

.form__ok {
  margin: 0;
  text-align: center;
  color: var(--gold-2);
  letter-spacing: 0.16em;
}

.footer {
  padding: 56px 20px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--ink-soft);
  letter-spacing: 0.16em;
}

.footer__mark {
  margin: 0 auto;
  cursor: pointer;
}

.footer__names {
  margin: 16px 0 8px;
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  font-size: 22px;
}

.footer__date {
  color: var(--gold);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(28, 6, 10, 0.94);
  padding: 56px 48px 40px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox figure {
  margin: 0;
  max-width: min(92vw, 920px);
}

.lightbox img {
  max-height: 78vh;
  margin: 0 auto;
  object-fit: contain;
  border: 1px solid rgba(232, 200, 114, 0.45);
}

.lightbox figcaption {
  margin-top: 12px;
  text-align: center;
  color: var(--gold-2);
  letter-spacing: 0.24em;
}

.lightbox__close,
.lightbox__nav {
  position: absolute;
  border: 0;
  background: transparent;
  color: var(--gold-2);
  cursor: pointer;
}

.lightbox__close {
  top: 16px;
  right: 18px;
  font-size: 36px;
  line-height: 1;
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 48px;
  padding: 8px 12px;
}

.lightbox__prev { left: 8px; }
.lightbox__next { right: 8px; }

.admin {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 6, 10, 0.62);
}

.admin[hidden] {
  display: none;
}

.admin__panel {
  width: min(440px, 100%);
  max-height: min(80vh, 640px);
  overflow: auto;
  padding: 20px;
  background: #fff8ee;
  color: #4a1520;
  border: 1px solid var(--gold-deep);
}

.admin__panel h3 {
  margin: 0 0 8px;
  color: var(--red);
  letter-spacing: 0.18em;
}

.admin__panel p {
  margin: 0 0 12px;
  line-height: 1.6;
  font-size: 14px;
}

.admin__panel input {
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(139, 26, 43, 0.25);
  font-size: 16px;
}

.admin__panel pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 70;
  padding: 10px 16px;
  background: #3d1018;
  color: var(--gold-2);
  letter-spacing: 0.12em;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

@media (max-width: 640px) {
  .page-frame {
    margin: 6px;
  }

  .page-frame__corner {
    width: 64px;
    height: 64px;
  }

  .ornament {
    width: 52px;
    height: 52px;
  }

  .panel,
  .envelope__card {
    padding: 28px 16px 24px;
  }

  .nav__links {
    gap: 14px;
    font-size: 13px;
  }

  .music-btn {
    width: 42px;
    padding: 0;
    justify-content: center;
  }

  .music-btn__text {
    display: none;
  }

  .shot {
    min-height: 210px;
  }

  .shot:first-child {
    min-height: 38vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-hint::after,
  .envelope,
  .nav {
    animation: none;
    transition: none;
  }
}
