:root {
  --night: #09192c;
  --ink: #14232f;
  --berry: #503143;
  --paper: #fff9ef;
  --pearl: #f8f0df;
  --gold: #f6cb80;
  --line: rgba(255, 249, 239, 0.18);
  --font-body: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --font-display: "STSong", "Songti SC", "Noto Serif CJK SC", serif;
  --font-hand: "STKaiti", "KaiTi", "Kaiti SC", "DFKai-SB", serif;
}

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

html {
  scroll-behavior: smooth;
  background: var(--night);
}

body {
  margin: 0;
  color: var(--paper);
  background: transparent;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 5px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: -5rem;
  left: 1rem;
  padding: 0.7rem 1rem;
  color: var(--night);
  background: var(--paper);
}

.skip-link:focus {
  top: 1rem;
}

.bg-layer {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background: var(--night) url("assets/motion-background-16-poster.jpg") 52% 38% / cover no-repeat;
}

.bg-layer__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 52% 38%;
  pointer-events: none;
}

.bg-layer.is-still .bg-layer__video,
.bg-layer.is-fallback .bg-layer__video,
.bg-layer.is-blocked .bg-layer__video {
  display: none;
}

.bg-layer.is-blocked {
  background-color: #08162a;
  background-image:
    radial-gradient(ellipse 55% 28% at 55% 75%, rgba(123, 152, 146, 0.16), transparent),
    linear-gradient(180deg, #051023, #173452 70%, #132b33);
}

.bg-layer.is-blocked::before {
  position: absolute;
  inset: -8%;
  content: "";
  pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 8% 14%, #fff9e9 85%, transparent),
    radial-gradient(2px 2px at 19% 37%, #b6dbe9 85%, transparent),
    radial-gradient(3px 3px at 32% 11%, #fff9e9 85%, transparent),
    radial-gradient(2px 2px at 44% 29%, #b6dbe9 85%, transparent),
    radial-gradient(2px 2px at 57% 9%, #fff9e9 85%, transparent),
    radial-gradient(3px 3px at 68% 43%, #ffedd1 85%, transparent),
    radial-gradient(2px 2px at 83% 16%, #b6dbe9 85%, transparent),
    radial-gradient(2px 2px at 94% 35%, #fff9e9 85%, transparent),
    radial-gradient(2px 2px at 14% 61%, #b6dbe9 85%, transparent),
    radial-gradient(3px 3px at 39% 55%, #fff9e9 85%, transparent),
    radial-gradient(2px 2px at 74% 65%, #ffedd1 85%, transparent),
    radial-gradient(2px 2px at 89% 78%, #b6dbe9 85%, transparent);
  opacity: 0.66;
  animation: starlight 16s ease-in-out infinite alternate;
}

.bg-layer.is-blocked::after {
  position: absolute;
  left: -20%;
  bottom: -21%;
  width: 140%;
  height: 42%;
  border-radius: 50% 50% 0 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(145deg, #274033, #0b1d2a 70%);
  box-shadow: 0 -15px 55px rgba(100, 143, 150, 0.13);
  transform: rotate(-4deg);
}

@keyframes starlight {
  from { opacity: 0.38; transform: translateY(0); }
  to { opacity: 0.8; transform: translateY(12px); }
}

.music-toggle {
  position: fixed;
  z-index: 10;
  top: 1.2rem;
  right: 1.3rem;
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  border: 1px solid rgba(255, 249, 239, 0.5);
  border-radius: 50%;
  background: rgba(5, 17, 30, 0.2);
  color: var(--paper);
  font-family: Georgia, serif;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 220ms ease, border-color 220ms ease, transform 220ms ease;
}

.music-toggle:hover,
.music-toggle.is-playing {
  border-color: var(--gold);
  background: rgba(246, 203, 128, 0.28);
}

.music-toggle.is-playing span {
  animation: music-pulse 1.4s ease-in-out infinite;
}

@keyframes music-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px) rotate(5deg); }
}

.page {
  position: relative;
  z-index: 1;
}

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 91vh;
  min-height: 91svh;
  padding: 7rem max(6vw, 1.5rem) 8.5rem;
  overflow: hidden;
}

.hero__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(4, 17, 32, 0.92), rgba(4, 17, 32, 0.42) 58%, transparent),
    linear-gradient(0deg, rgba(4, 17, 32, 0.55), transparent 62%);
}

.hero__content {
  position: relative;
  max-width: 44rem;
}

.hero__eyebrow {
  margin: 0 0 1.7rem;
  color: #f7dca7;
  font-family: var(--font-hand);
  font-size: 1.3rem;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  text-shadow: 0 2px 22px rgba(1, 8, 20, 0.38);
}

.hero__wish {
  margin: 1.4rem 0 2.5rem;
  color: #fff0d7;
  font-size: 1.13rem;
  line-height: 1.8;
}

.hero__next {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 44px;
  color: #fff5e9;
  font-size: 0.95rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 245, 233, 0.65);
}

.hero__next span {
  font-size: 1.4rem;
}

@media (prefers-reduced-motion: no-preference) {
  .hero__content > * {
    animation: arrive 0.75s both;
  }

  .hero__content > :nth-child(2) { animation-delay: 0.14s; }
  .hero__content > :nth-child(3) { animation-delay: 0.28s; }
  .hero__content > :nth-child(4) { animation-delay: 0.42s; }
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.gifts {
  position: relative;
  background: transparent;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.gifts::before,
.letter-section::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}

.gifts::before {
  background:
    radial-gradient(ellipse 76% 62% at 31% 46%, rgba(5, 17, 30, 0.64), transparent),
    linear-gradient(90deg, rgba(5, 17, 30, 0.52), rgba(5, 17, 30, 0.16));
}

.section-inner,
.letter-section__inner {
  position: relative;
  width: min(100% - 3rem, 72rem);
  margin-inline: auto;
}

.section-inner {
  padding-block: 7rem 8rem;
}

.section-kicker {
  margin: 0 0 0.9rem;
  color: #f3c988;
  font-family: var(--font-hand);
  font-size: 1.15rem;
}

.gifts h2,
.letter-section h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2.7rem;
  font-weight: 600;
  line-height: 1.35;
}

.gift-list {
  margin-top: 4rem;
}

.gift {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 1.4rem;
  min-height: 12.5rem;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
}

.gift:last-child {
  border-bottom: 1px solid var(--line);
}

.gift__count {
  align-self: start;
  color: var(--gift-color);
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
}

.gift h3 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
}

.gift p {
  margin: 0;
  color: #cbd9dc;
  font-size: 0.96rem;
  line-height: 1.75;
}

.gift__button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
  width: 12.6rem;
  min-height: 3.5rem;
  padding: 0.8rem 1.2rem;
  border: 0;
  border-radius: 4px;
  background: var(--gift-color);
  color: var(--gift-ink);
  font-weight: 700;
  cursor: pointer;
  transition: transform 250ms ease, filter 250ms ease;
}

.gift__button:hover {
  transform: translateY(-3px);
  filter: brightness(1.07);
}

.gift__button span {
  font-size: 1.4rem;
  line-height: 1;
}

.has-observer .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.75, 0.2, 1);
}

.has-observer .reveal.is-visible {
  opacity: 1;
  transform: none;
}

.letter-section {
  position: relative;
  overflow: hidden;
  background: transparent;
}

.letter-section::before {
  background:
    radial-gradient(ellipse 65% 26% at 50% 17%, rgba(49, 25, 45, 0.78), transparent),
    linear-gradient(90deg, rgba(21, 18, 34, 0.48), rgba(21, 18, 34, 0.26));
}

.letter-section__inner {
  padding-block: 7rem 8rem;
  text-align: center;
}

.letter-section .section-kicker {
  color: #ffdbab;
}

.star-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  width: 10rem;
  min-height: 10rem;
  margin: 3rem auto 1.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff1d7;
  cursor: pointer;
}

.star-button__star {
  display: block;
  font-size: 6rem;
  line-height: 1;
  color: #ffd674;
  text-shadow: 0 8px 24px rgba(24, 10, 16, 0.35), 0 0 24px rgba(255, 220, 130, 0.35);
  transition: transform 300ms ease, filter 300ms ease;
}

.star-button:hover .star-button__star {
  transform: rotate(-10deg) scale(1.08);
  filter: brightness(1.12);
}

.star-button__label {
  font-size: 0.92rem;
}

@media (prefers-reduced-motion: no-preference) {
  .has-observer .star-button:not(.is-visible) .star-button__star {
    opacity: 0;
    transform: translateY(-140px) rotate(-26deg) scale(0.5);
  }

  .has-observer .star-button.is-visible .star-button__star {
    animation: star-fall 1.3s cubic-bezier(0.22, 0.8, 0.25, 1) both;
  }
}

@keyframes star-fall {
  0% { opacity: 0; transform: translateY(-140px) rotate(-26deg) scale(0.5); }
  65% { opacity: 1; transform: translateY(8px) rotate(9deg) scale(1.07); }
  82% { transform: translateY(-5px) rotate(-4deg) scale(0.97); }
  100% { transform: none; }
}

.envelope {
  position: relative;
  width: min(18rem, 70vw);
  height: 10rem;
  margin: 0 auto;
  perspective: 700px;
  filter: drop-shadow(0 18px 22px rgba(30, 15, 23, 0.22));
}

.envelope__back,
.envelope__front,
.envelope__flap {
  position: absolute;
  inset: 0;
}

.envelope__back {
  background: #e4b7a5;
  border-radius: 4px;
}

.envelope__front {
  z-index: 2;
  background: #f4d7c1;
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
  border-radius: 4px;
}

.envelope__flap {
  z-index: 3;
  background: #ffead4;
  clip-path: polygon(0 0, 100% 0, 50% 56%);
  transform-origin: top center;
  backface-visibility: hidden;
  transition: transform 0.8s cubic-bezier(0.25, 0.7, 0.2, 1);
}

.envelope__seal {
  position: absolute;
  z-index: 4;
  top: 43%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #ca7780;
  color: #fff7e5;
  transform: translate(-50%, -50%);
  transition: opacity 250ms ease;
}

.is-open .envelope__flap {
  transform: rotateX(180deg);
}

.is-open .envelope__seal {
  opacity: 0;
}

.letter-reveal {
  display: grid;
  grid-template-rows: 0fr;
  width: min(100%, 50rem);
  margin: 0 auto;
  text-align: left;
  transition: grid-template-rows 1.1s cubic-bezier(0.2, 0.7, 0.25, 1), margin-top 1.1s ease;
}

.is-open .letter-reveal {
  grid-template-rows: 1fr;
  margin-top: 2rem;
}

.letter-paper {
  min-height: 0;
  overflow: hidden;
  background: var(--paper);
  color: #3e3940;
  border: 1px solid #eadac6;
  border-radius: 3px;
  box-shadow: 0 22px 48px rgba(24, 12, 20, 0.2);
  opacity: 0;
  transform: translateY(-30px) scaleY(0.96);
  transform-origin: top center;
  transition: opacity 600ms ease 350ms, transform 950ms cubic-bezier(0.18, 0.75, 0.22, 1) 200ms;
}

.is-open .letter-paper {
  opacity: 1;
  transform: none;
}

.letter-paper__body {
  padding: 3.5rem 4.5rem 2rem;
  font-family: var(--font-hand);
  font-size: 1.32rem;
  line-height: 2.2;
}

.letter-paper__body p {
  margin: 0 0 1.15rem;
}

.letter-paper__to {
  color: #995a66;
  font-size: 1.55rem;
}

.letter-paper__signature {
  padding-top: 1rem;
  color: #975c69;
  text-align: right;
}

.letter-paper__photo {
  margin: 0;
  padding: 0 1.5rem 1.8rem;
}

.letter-paper__photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.letter-paper__photo figcaption {
  padding-top: 0.8rem;
  color: #8e6671;
  font-family: var(--font-hand);
  font-size: 1.15rem;
  text-align: center;
}

.finale {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 68vh;
  min-height: 68svh;
  padding: 7rem max(6vw, 1.5rem) 2rem;
  background: linear-gradient(0deg, rgba(5, 17, 30, 0.92), rgba(5, 17, 30, 0.55) 58%, transparent);
}

.finale__content p {
  margin: 0 0 1.4rem;
  font-family: var(--font-display);
  font-size: 2.8rem;
  line-height: 1.5;
}

.finale__content a {
  color: var(--paper);
  font-size: 0.94rem;
  text-decoration-color: #f6cb80;
  text-underline-offset: 0.3em;
}

.photo-dialog {
  width: min(95vw, 45rem);
  max-width: none;
  max-height: 96dvh;
  padding: 0;
  overflow: auto;
  border: 0;
  background: transparent;
  color: var(--paper);
}

.photo-dialog::backdrop {
  background: rgba(5, 12, 23, 0.3);
}

.photo-dialog[open] {
  animation: photo-appear 0.52s cubic-bezier(0.16, 0.75, 0.2, 1) both;
}

@keyframes photo-appear {
  from { opacity: 0; transform: translateY(24px) scale(0.94); }
  to { opacity: 1; transform: none; }
}

.photo-dialog__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.7rem;
  padding: 0.2rem 0 0.7rem;
  text-shadow: 0 2px 9px rgba(0, 0, 0, 0.85);
}

.photo-dialog__toolbar h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 500;
}

.photo-dialog__close {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--paper);
  font-size: 1.9rem;
  line-height: 1;
  cursor: pointer;
}

.photo-dialog__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.photo-dialog__image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(96dvh - 5rem);
  margin: auto;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

@media (max-width: 700px) {
  .music-toggle {
    top: 0.9rem;
    right: 0.9rem;
    width: 2.55rem;
    height: 2.55rem;
  }

  .hero {
    align-items: flex-end;
    min-height: 90svh;
    padding: 6rem 1.4rem 6rem;
  }

  .hero__shade {
    background: linear-gradient(0deg, rgba(4, 17, 32, 0.97), rgba(4, 17, 32, 0.6) 55%, rgba(4, 17, 32, 0.1));
  }

  .hero h1 {
    font-size: 3.1rem;
  }

  .hero__eyebrow {
    font-size: 1.13rem;
  }

  .hero__wish {
    max-width: 18em;
    font-size: 1rem;
  }

  .section-inner,
  .letter-section__inner {
    width: min(100% - 2.8rem, 34rem);
  }

  .section-inner,
  .letter-section__inner {
    padding-block: 5rem 6rem;
  }

  .gifts h2,
  .letter-section h2 {
    font-size: 2rem;
  }

  .gift-list {
    margin-top: 2.6rem;
  }

  .gift {
    grid-template-columns: 2.6rem minmax(0, 1fr);
    gap: 0.8rem 0.6rem;
    min-height: 0;
    padding: 2rem 0 2.2rem;
  }

  .gift__count {
    font-size: 1.05rem;
  }

  .gift h3 {
    font-size: 1.38rem;
  }

  .gift p {
    font-size: 0.88rem;
  }

  .gift__button {
    grid-column: 2;
    width: min(100%, 14rem);
    margin-top: 0.65rem;
  }

  .letter-paper__body {
    padding: 2rem 1.4rem 1rem;
    font-size: 1.15rem;
    line-height: 2;
  }

  .letter-paper__to {
    font-size: 1.35rem;
  }

  .letter-paper__photo {
    padding: 0 0.6rem 1.3rem;
  }

  .finale {
    min-height: 55svh;
    padding: 5rem 1.4rem 1.5rem;
  }

  .finale__content p {
    font-size: 2.05rem;
  }

  .photo-dialog {
    width: min(97vw, 28rem);
  }
}

@media (max-width: 360px) {
  .hero h1 { font-size: 2.65rem; }
  .gifts h2, .letter-section h2 { font-size: 1.76rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .has-observer .reveal { opacity: 1; transform: none; }
  .has-observer .star-button:not(.is-visible) .star-button__star { opacity: 1; transform: none; }
}
