@import url("https://fonts.googleapis.com/css2?family=Archivo+Black&family=Kalam:wght@400;700&display=swap");

:root {
  --ink: #1c1c18;
  --paper: #eae9df;
  --green: #c9dc54;
  --yellow: #f5c246;
  --pink: #f676ce;
  --hand: "Kalam", "Comic Sans MS", cursive;
  --heavy: "Archivo Black", "Arial Black", sans-serif;
  background: #fff;
  color: var(--ink);
  font-family: var(--hand);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px dashed #ab3291; outline-offset: 5px; }
[tabindex="-1"]:focus { outline: none; }

#invitation {
  --position: 0%;
  --pulse: 0;
  --sway: 0deg;
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}
#invitation[data-slide="1"] { --position: -100%; }
#invitation[data-slide="2"] { --position: -200%; }
.slides { height: 100%; transform: translate3d(0, var(--position), 0); transition: transform 720ms cubic-bezier(.78, 0, .19, 1); }
.screen { height: 100%; width: 100%; position: relative; overflow: hidden; isolation: isolate; }
.entry { display: grid; place-items: center; background: #fff; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .55em;
  min-height: 46px;
  padding: .48em 1.02em .26em;
  border: 2px solid var(--ink);
  border-radius: 7px 5px 8px 5px;
  background: #fffdf5;
  box-shadow: 3px 4px 0 var(--ink);
  font: 700 clamp(1rem, 2.65vh, 1.22rem)/1.15 var(--hand);
  text-decoration: none;
  transition: transform 170ms, box-shadow 170ms, background-color 170ms;
}
.button:hover { transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 5px 6px 0 var(--ink); }
.button:active { transform: translate(3px, 4px); box-shadow: 0 0 0 var(--ink); }
.enter { transform: rotate(-3deg); padding-inline: 1.3em; font-size: 1.25rem; }
.enter span { color: #313711; font-size: 1.15em; }
.enter:hover { background: var(--green); }

.cover, .details { background-color: var(--paper); }
.cover::before, .details::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .19;
  background: url("assets/grain.png") repeat;
}
.cover { display: grid; place-items: center; }
.poster {
  --poster-height: min(83dvh, 860px, calc(100vw * 1.45));
  position: relative;
  height: var(--poster-height);
  width: calc(var(--poster-height) / 1.38);
  max-width: 98vw;
  margin-bottom: clamp(36px, 8dvh, 66px);
  container-type: inline-size;
}
.art, #confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#confetti { z-index: 12; }
.piece { position: absolute; opacity: 0; }
.cover.is-seen .piece {
  animation: reveal 700ms cubic-bezier(.19, .86, .32, 1.21) both;
  animation-delay: calc(400ms + var(--order) * 105ms);
}
@keyframes reveal {
  from { opacity: 0; transform: translate(var(--from-x, 0), var(--from-y, 18%)) rotate(var(--from-angle, -16deg)) scale(.58); }
  to { opacity: 1; transform: translate(0, 0) rotate(var(--angle, 0deg)) scale(1); }
}
.age {
  z-index: 1;
  left: 14%;
  top: 0;
  margin: 0;
  color: transparent;
  background: url("assets/grain.png"), var(--ink);
  -webkit-background-clip: text;
  background-clip: text;
  font: 900 66cqw/.85 var(--heavy);
  letter-spacing: -.115em;
  --angle: -8deg;
}
.cover.is-seen .age {
  animation: stamp 820ms cubic-bezier(.21, .8, .29, 1) 290ms both;
}
@keyframes stamp {
  0% { opacity: 0; transform: translateY(-30%) rotate(10deg) scale(1.17); }
  43% { opacity: 1; transform: translateY(2%) rotate(-11deg) scale(1.055, .945); }
  71% { opacity: 1; transform: translateY(-2%) rotate(-6deg) scale(.988, 1.025); }
  100% { opacity: 1; transform: rotate(var(--angle)) scale(1); }
}
.green-scribble, .yellow-scribble, .pink-scribble, .tiny-star { line-height: .78; }
.green-scribble { z-index: 2; color: #a9bc38; left: 14%; top: 22%; font-size: 77cqw; --angle: -13deg; --from-x: -36%; }
.yellow-scribble { z-index: 5; color: var(--yellow); left: -1%; top: 50%; font-size: 33cqw; --angle: -14deg; --from-x: -35%; }
.pink-scribble { z-index: 10; color: var(--pink); left: 68%; top: 56%; font-size: 27cqw; --angle: 13deg; --from-y: -55%; }
.tiny-star { z-index: 3; color: var(--pink); left: 80%; top: 12%; font-size: 14cqw; --angle: 14deg; }
.piece img, .art .piece > span { display: block; width: 100%; }
.art .piece > span {
  transform: rotate(calc(var(--sway) * var(--direction, 1))) scale(calc(1 + var(--pulse) * var(--amount, .035)));
  filter: drop-shadow(2px 5px 1px #1c1c183b);
  user-select: none;
}
.portrait { z-index: 4; left: 15%; top: 23%; width: 68%; --angle: -6deg; --amount: .016; }
.wine { z-index: 5; left: 75%; top: 35%; width: 25%; --angle: 13deg; --from-x: 50%; --from-angle: 45deg; --direction: -1; }
.beer-left { z-index: 6; left: 0%; top: 70%; width: 26%; --angle: -14deg; --from-x: -50%; }
.beer-right { z-index: 10; right: 0%; top: 67%; width: 24%; --angle: 12deg; --from-x: 45%; --direction: -1; }
.cake { z-index: 9; left: 28%; top: 59%; width: 62%; --angle: -4deg; --from-y: 40%; --from-angle: 14deg; --amount: .047; }
.note {
  z-index: 11;
  left: 1%;
  top: 52%;
  width: 33%;
  max-width: 13.5em;
  margin: 0;
  padding: .42em .65em .31em;
  background: #fff5bf;
  box-shadow: 2px 3px 0 #1c1c1854;
  font: 700 clamp(.86rem, 3.65cqw, 1.2rem)/1.17 var(--hand);
  --angle: -8deg;
  --from-x: -36%;
}
.note span { white-space: nowrap; display: inline; width: auto; }
.next { position: absolute; z-index: 13; bottom: max(4dvh, calc(env(safe-area-inset-bottom) + 12px)); background: var(--green); }

.details {
  display: grid;
  place-items: center;
  background-color: #d5e477;
}
.details-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: clamp(6px, 1.7dvh, 17px);
  width: min(86vw, 510px);
  padding: 0 0 25px;
}
.details-inner > :not(.details-beer, .detail-star) { position: relative; z-index: 2; }
.details h2 {
  margin: 0;
  font: 900 clamp(2.2rem, min(10vw, 8.8dvh), 5rem)/.97 var(--heavy);
  letter-spacing: -.085em;
  transform: rotate(-5deg);
}
.details h2 span { font-size: .77em; letter-spacing: -.07em; }
.details time {
  margin-top: 3px;
  font: 700 clamp(1.65rem, min(7vw, 5dvh), 3rem)/1.1 var(--hand);
}
.address { display: grid; gap: 5px; justify-items: start; }
.address p, .food { margin: 0; font: 700 clamp(1.05rem, min(5vw, 3.6dvh), 1.4rem)/1.24 var(--hand); }
.food { max-width: 17ch; margin-top: 3px; }
.map { background: #fffdf5; }
.confirm { background: #202019; color: #fffdf5; box-shadow: 3px 4px 0 #6f792b; }
.confirm:hover { box-shadow: 5px 6px 0 #6f792b; }
.details-beer { position: absolute; width: min(33vw, 210px); right: -5%; bottom: -1%; transform: translateY(calc(-5px * var(--pulse))) rotate(calc(18deg + var(--sway))); filter: drop-shadow(3px 5px 1px #1c1c1844); }
.detail-star { position: absolute; color: var(--pink); right: 0; top: 19%; font-size: clamp(3.3rem, 15vw, 8rem); line-height: .7; transform: rotate(calc(11deg - var(--sway) * 2)) scale(calc(1 + var(--pulse) * .085)); pointer-events: none; }
.back {
  position: absolute; bottom: max(2.5dvh, calc(env(safe-area-inset-bottom) + 6px)); left: 50%;
  transform: translateX(-50%); border: 0; background: none; padding: 8px; white-space: nowrap;
  font: 700 1rem/1.2 var(--hand); text-decoration: underline; text-underline-offset: .2em;
}
.sound {
  position: absolute; z-index: 15; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  width: 44px; height: 44px; display: grid; place-items: center; background: #fffdf5;
  border: 2px solid var(--ink); border-radius: 50%; box-shadow: 2px 2px 0 var(--ink);
  font: 700 1.27rem/1 var(--hand);
}
.sound[hidden] { display: none; }
.sound[aria-pressed="false"]::after { content: ""; position: absolute; width: 20px; height: 2px; background: currentColor; transform: rotate(-47deg); }

.art .green-scribble > span { transform: none; }
@media (prefers-reduced-motion: no-preference) {
  .art .green-scribble > span { animation: turn-star 8.2s linear infinite paused; }
  #invitation[data-slide="1"] .green-scribble > span { animation-play-state: running; }
}
@keyframes turn-star {
  to { transform: rotate(1turn); }
}

.sticker {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}
.sticker-layer { display: block; position: relative; width: 100%; }
.sticker-layer > img { display: block; width: 100%; pointer-events: none; -webkit-user-drag: none; }
.sticker-layer > img:first-child { transition: opacity 150ms ease; }
.sticker-layer > .surprise-image { position: absolute; inset: 0; height: 100%; object-fit: contain; opacity: 0; transition: opacity 150ms ease; }
.sticker.is-swapped .sticker-layer > img:first-child { opacity: 0; }
.sticker.is-swapped .sticker-layer > .surprise-image.is-active { opacity: 1; }
.portrait-doodle { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#ink { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 14; pointer-events: none; }
[data-ink-react] { translate: var(--ink-x, 0px) var(--ink-y, 0px); }
.screen { user-select: none; }

@media (max-width: 430px) {
  .details-beer { right: -7%; bottom: 15%; }
  .detail-star { right: -2%; top: 21%; }
}
@media (max-height: 555px) {
  .poster { --poster-height: min(82dvh, calc(100vw * 1.2)); margin-bottom: 35px; }
  .next { bottom: 9px; }
  .details-inner { gap: 5px; padding-bottom: 26px; }
  .details-inner .button { min-height: 34px; }
  .details-inner h2 { font-size: clamp(1.65rem, 8.5dvh, 2.7rem); }
  .details-beer { width: min(22vw, 120px); }
  .back { bottom: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  #confetti { display: none; }
}
