* { box-sizing: border-box }
[hidden] { display: none !important }
html {
  height: 100%;
  scrollbar-width: none;
  overscroll-behavior: none;
}
html.wrapped, html.watching { overflow: hidden; touch-action: pinch-zoom }
html::-webkit-scrollbar { display: none }
body {
  margin: 0;
  height: calc(100% + var(--distance, 0px));
  background: #f9f8f5;
  color: #181615;
  font-family: Arial, sans-serif;
  user-select: none;
}
main, #confetti { position: fixed; inset: 0; overflow: hidden }
main::before, main::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
main::before {
  z-index: -2;
  background: #ecebea url(paper.png) center / cover no-repeat;
  opacity: .76;
}
@media (orientation: landscape) {
  main::before {
    inset: 50% auto auto 50%;
    width: 100dvh;
    height: 100vw;
    translate: -50% -50%;
    rotate: 90deg;
  }
}
main::after {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='grain' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Cpath fill='%23000' filter='url(%23grain)' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
  opacity: .15;
  z-index: -1;
}
video {
  position: absolute;
  left: 50%;
  top: 48%;
  translate: -50% -50%;
  width: min(85vw, 91vh, 660px);
  height: auto;
  border: 0;
  box-shadow: 0 12px 36px #2519092b, 0 2px 6px #26180915;
  background: transparent;
}
video:first-of-type { z-index: 103 }
#sound {
  position: absolute;
  z-index: 104;
  left: 50%;
  top: 48%;
  translate: -50% -50%;
  background: #171412dc;
  box-shadow: 0 2px 12px #0003;
}
video:last-of-type {
  width: min(84vw, 42dvh, 464px);
  top: 50%;
  z-index: 0;
  pointer-events: none;
}
#pile { position: absolute; inset: 13% 5% 14%; pointer-events: none }
.photo {
  position: absolute;
  translate: -50% -50%;
  box-shadow: 0 6px 19px #25190930, 0 1px 4px #26180918;
  background: white;
  display: grid;
  place-items: center;
}
img { position: absolute; pointer-events: none }
footer {
  position: fixed;
  inset: auto 0 max(4vh, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  pointer-events: none;
}
button {
  font: 500 14px/1.2 Arial, sans-serif;
  border: none;
  border-radius: 99px;
  color: white;
  background: #151515;
  padding: 13px 22px;
  cursor: pointer;
  transition: background .2s;
}
button:hover { background: #383533 }
.wrapped :is(#pile, video, footer) { visibility: hidden }
#gift {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 3dvh;
  padding-top: 7dvh;
}
#gift .bunting {
  position: absolute;
  top: -1px;
  width: min(103vw, 60dvh);
  pointer-events: none;
  filter: drop-shadow(0 2px 2px #49302420);
}
#gift svg:not(.bunting) {
  width: min(74vw, 46dvh, 380px);
  aspect-ratio: 633 / 817;
  display: block;
  filter: drop-shadow(0 5px 6px #40202b20);
}
#open-gift, #again {
  padding: 16px 28px;
  font-size: 17px;
  font-weight: 500;
  box-shadow: 0 4px 12px #32120e26;
  white-space: nowrap;
  transform: scale(1);
  transition: transform 420ms ease-in-out, box-shadow 320ms ease;
}
section { position: absolute; inset: 0; isolation: isolate }
section > * { position: absolute }
section svg { display: block; pointer-events: none }
.disco {
  width: min(19vw, 25dvh);
  left: 4%;
  top: 0;
}
.stars {
  width: min(11vw, 15dvh);
  top: 10%;
  left: 43%;
}
h1 {
  width: min(50vw, 98dvh);
  left: 29%;
  top: 49%;
  translate: -50% -50%;
  margin: 0;
}
h1 svg { width: 100% }
.portrait {
  width: min(42vw, 65dvh);
  left: 76%;
  top: 50%;
  translate: -50% -50%;
}
#again {
  left: 29%;
  top: calc(49% + min(15vw, 28dvh));
  translate: -50% 0;
}
:is(#again, #open-gift):is(:hover, :focus-visible, :active) {
  color: #201132;
  background:
    linear-gradient(110deg, transparent 38%, #fff9 50%, transparent 62%) 120% 0 / 300% 100%,
    linear-gradient(105deg, #ff99d9, #cbacff, #88efff, #fff19a, #ff99d9) 0 0 / 200% 100%;
  box-shadow: -5px 3px 18px #fc4ec866, 5px -2px 18px #7765ff70, inset 0 1px 2px white;
}
@media (prefers-reduced-motion: no-preference) {
  :is(#again, #open-gift):is(:hover, :focus-visible) {
    transform: scale(1.06);
    animation: disco-shine 2s linear infinite;
  }
}
@keyframes disco-shine {
  to { background-position: -20% 0, 200% 0 }
}
#confetti { pointer-events: none; z-index: 3 }
#confetti i { position: absolute; bottom: -18px; width: 9px; height: 15px }
@media (max-aspect-ratio: 1/1) {
  #pile { inset: 14% 7% 16% }
  .disco { width: min(27vw, 13dvh); left: 4% }
  .stars { width: min(20vw, 11dvh); top: 4%; left: auto; right: 6% }
  h1 { top: 22%; left: 50%; width: min(89vw, 45dvh) }
  .portrait { top: 61%; left: 50%; width: min(90vw, 40dvh) }
  #again { left: 50%; top: 94%; translate: -50% -50% }
  button { padding: 13px 17px }
}
@media (max-height: 540px) {
  button { padding: 9px 15px }
  #pile { inset: 18% 7% 20% }
}
