@font-face {
  font-family: Rubik;
  src: url('assets/rubik-regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Rubik;
  src: url('assets/rubik-bold.ttf') format('truetype');
  font-weight: 700 900;
  font-display: swap;
}

:root {
  --ink: #191f48;
  --wine: #833846;
  --paper: #faf9f6;
  --line: #dedfe5;
  --muted: #60647a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Rubik, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.music-toggle {
  position: fixed;
  z-index: 30;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid rgba(92, 32, 48, .25);
  border-radius: 999px;
  background: rgba(255, 253, 248, .92);
  color: #5c2030;
  box-shadow: 0 5px 18px rgba(38, 29, 31, .10);
  backdrop-filter: blur(8px);
  font: 600 14px/1 system-ui, sans-serif;
  cursor: pointer;
}

.music-toggle[aria-pressed="true"] { color: var(--muted); }

button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--wine); outline-offset: 5px; }
[hidden] { display: none !important; }
main { width: 100%; min-height: 100svh; }

.playful {
  font-family: Rubik, 'Arial Rounded MT Bold', sans-serif;
  font-weight: 900;
  letter-spacing: .025em;
  line-height: 1.17;
  text-wrap: balance;
}

.cover {
  min-height: 100svh;
  max-width: 760px;
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px 36px;
}
.eyebrow { font-size: 13px; letter-spacing: .2em; margin: 0 0 18px; }
.cover h1 { font-size: clamp(32px, 7.5vw, 52px); margin: 0; white-space: nowrap; }
.cover-date { font-size: 14px; letter-spacing: .22em; margin: 20px 0 15px; }

.envelope-wrap {
  width: min(100%, 560px);
  aspect-ratio: 1.5;
  position: relative;
  perspective: 1100px;
  margin: 16px 0 18px;
  isolation: isolate;
}
.envelope-back, .envelope-flap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 1.15s ease, opacity .8s;
}
.envelope-back { z-index: 2; clip-path: polygon(9% 12%, 50% 60%, 91% 12%, 91% 87%, 9% 87%); }
.envelope-flap {
  z-index: 3;
  clip-path: polygon(9% 11.7%, 91% 11.7%, 89% 20%, 58% 59%, 55% 65%, 45% 65%, 42% 59%, 11% 20%);
  transform-origin: 50% 11.7%;
  backface-visibility: hidden;
}
.seal-button {
  position: absolute;
  top: 37%;
  left: 39%;
  width: 22%;
  height: 30%;
  border: 0;
  background: transparent;
  border-radius: 50%;
  z-index: 5;
  transition: transform .2s;
}
.seal-button:hover { transform: scale(1.05); box-shadow: 0 0 0 2px #83384633; }
.inside-letter {
  z-index: 1;
  position: absolute;
  left: 17%;
  top: 20%;
  width: 66%;
  height: 65%;
  background: #fff;
  box-shadow: 0 2px 18px #24284815;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  border: 1px solid #eee;
  transition: transform 1.25s .35s ease;
  font-weight: 700;
}
.mini-date { font-size: 13px; font-weight: 400; }
.opening .envelope-flap { transform: rotateX(165deg); opacity: 0; }
.opening .inside-letter { transform: translateY(-47%); }
.opening .envelope-back { transform: translateY(12%); }
.opening .seal-button { pointer-events: none; }
.open-hint { font-size: 16px; margin: 12px 0 20px; }
.text-button {
  padding: 10px 3px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 5px;
}
.direct { font-size: 13px; }

.experience {
  width: min(100%, 680px);
  margin: auto;
  min-height: 100svh;
  background: #fff;
  box-shadow: 0 0 80px #1a203805;
}
.story {
  padding: 28px 20px 35px;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.story-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 12px;
  letter-spacing: .13em;
}
.story-top button { letter-spacing: 0; }
.story-title { display: none; }
.stage {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: clamp(290px, 74vw, 440px);
  overflow: hidden;
  background: #fff;
}
.stage { display: block; }
.sprite { background-image: url("assets/characters.png"); background-repeat: no-repeat; background-size: 400% 300%; opacity: 1; }
.story-controls {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 12px;
  max-width: 450px;
  width: 100%;
  margin: 14px auto 0;
}
.progress-track { height: 2px; background: #dddfe6; flex: 1; overflow: hidden; }
#progress { display: block; height: 100%; width: 0; background: var(--wine); }
.duration { font-size: 12px; color: var(--muted); }
.invitation { padding: 48px 30px 44px; text-align: center; outline: none; }
.names { font-size: clamp(33px, 7vw, 48px); margin: 0; }
.wine { color: var(--wine); }
.family {
  width: min(290px, 70vw);
  aspect-ratio: 1;
  margin: 12px auto 3px;
  background-image: url('assets/story/hug.png');
  background-size: contain;
  background-position: center bottom;
}
.invite-title { font-size: clamp(29px, 7vw, 42px); max-width: 480px; margin: 0 auto 24px; }
.celebration { font-size: 19px; line-height: 1.7; margin: 0 0 17px; }
.celebration strong { font-weight: 700; }
.party-copy { max-width: 380px; margin: 0 auto 13px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.bring-note { max-width: 340px; margin: 0 auto 27px; color: var(--muted); font-size: 14px; line-height: 1.7; }

.venue-entrance {
  width: min(100%, 520px);
  margin: 24px auto 26px;
}

.venue-entrance img {
  display: block;
  width: 100%;
  height: auto;
  border: 7px solid #fffdf8;
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(36, 30, 31, .13);
}

.venue-entrance figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .025em;
}
.bring-note strong { color: var(--ink); }
.when {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  border-block: 1px solid var(--line);
  max-width: 330px;
  margin: 30px auto 25px;
  padding: 14px;
}
.day { font-size: 53px; line-height: 1.15; font-weight: 700; }
.when div { text-align: left; display: flex; flex-direction: column; gap: 3px; }
.when strong { font-size: 17px; }
.when span:not(.day) { font-size: 16px; }
address { font-style: normal; font-size: 17px; line-height: 1.75; margin-bottom: 25px; }
address span { font-size: 14px; }
.actions { max-width: 380px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: auto; }
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 15px 13px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid var(--ink);
  border-radius: 5px;
  min-height: 50px;
  transition: background .2s, transform .2s;
}
.button:hover { transform: translateY(-2px); }
.button.primary { width: 100%; color: #fff; background: var(--ink); gap: 10px; }
.button.primary.rsvp { background: var(--wine); border-color: var(--wine); }
.button.secondary { flex: 1; color: var(--ink); background: #fff; white-space: nowrap; }
.button.secondary:hover { background: #f4f4f8; }
.feedback { font-size: 13px; min-height: 1.6em; margin: 10px auto; }
.rsvp-number { font-size: 12px; color: var(--muted); letter-spacing: .04em; margin: 8px auto 0; }
.signature { font-size: 14px; line-height: 1.8; margin: 24px auto 14px; }
.signature strong { font-weight: 400; }
.blessings { max-width: 390px; margin: 0 auto 20px; color: var(--muted); font-size: 13px; line-height: 1.75; }
.blessings span { color: var(--ink); }
.replay { font-size: 13px; }

.letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(10px) rotate(-8deg);
  animation: letter-in .48s cubic-bezier(.2, .8, .2, 1.2) forwards;
  animation-delay: calc(var(--i) * 55ms);
}
.word { display: inline-block; white-space: nowrap; }
.no-script { text-align: center; padding: 30px; }

@keyframes letter-in {
  65% { transform: translateY(-3px) rotate(3deg); }
  100% { opacity: 1; transform: translateY(0) rotate(0); }
}

@media (min-width: 760px) {
  .experience { margin: 35px auto; min-height: calc(100svh - 70px); border: 1px solid #e9e9eb; }
  .story { min-height: calc(100svh - 70px); padding-inline: 45px; }
  .invitation { padding-inline: 65px; }
  .cover { padding-block: 60px; }
  .stage { height: 390px; }
}

@media (max-width: 360px) {
  .cover { padding-inline: 12px; }
  .cover h1 { font-size: 30px; }
  .invitation { padding-inline: 20px; }
  .story { padding-inline: 13px; }
  .button.secondary { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
  .letter { opacity: 1; transform: none; }
}
