:root {
  --yellow: #fff179;
  --green: #006536;
  --blue: #273582;
  --white-soft: rgba(255, 255, 255, 0.76);
  --white-faint: rgba(255, 255, 255, 0.16);
  --text-font: Bahnschrift, "Bahnschrift Regular", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--yellow);
  color: var(--blue);
  font-family: var(--text-font);
}

.birth-page {
  min-height: 100svh;
  background: var(--yellow);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 4vh, 44px);
  min-height: 100svh;
  padding: clamp(24px, 5vw, 64px);
}

.name-wrap {
  width: min(76vw, 960px);
}

.name-mark {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2460 / 1215;
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  animation: name-arrival 1250ms cubic-bezier(0.16, 0.88, 0.28, 1) 180ms forwards;
}

.letter-slot {
  position: absolute;
  display: block;
  transform-origin: center;
  animation: letter-arrival 1320ms cubic-bezier(0.16, 0.88, 0.28, 1) backwards;
}

.letter-piece {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  will-change: transform;
}

.letter-m {
  left: 4.67%;
  top: 23.05%;
  width: 32.32%;
  height: 62.55%;
  animation-delay: 240ms;
}

.letter-i {
  left: 37.4%;
  top: 30.86%;
  width: 12.4%;
  height: 56.38%;
  animation-delay: 350ms;
}

.letter-e {
  left: 54.27%;
  top: 38.68%;
  width: 19.31%;
  height: 61.32%;
  animation-delay: 460ms;
}

.letter-l {
  left: 78.66%;
  top: 27.57%;
  width: 17.28%;
  height: 59.67%;
  animation-delay: 570ms;
}

.name-dot {
  left: 43.7%;
  top: 0;
  width: 11.1%;
  height: 21.81%;
  animation: dot-arrival 1050ms cubic-bezier(0.16, 0.88, 0.28, 1) 720ms backwards;
}

.celebration {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  animation: celebration-show 900ms ease 520ms forwards;
}

.pop {
  position: absolute;
  display: block;
  width: clamp(5px, 1.1vw, 13px);
  height: clamp(5px, 1.1vw, 13px);
  border-radius: 999px;
  background: var(--green);
  opacity: 0;
  transform-origin: center;
  animation: dot-drift-a 6.8s ease-in-out 650ms infinite;
}

.pop-a {
  left: 18.4%;
  top: 19.8%;
}

.pop-b {
  left: 72.4%;
  top: 24.6%;
  width: clamp(4px, 0.9vw, 10px);
  height: clamp(4px, 0.9vw, 10px);
  background: var(--green);
  animation-name: dot-drift-b;
  animation-delay: 1.15s;
  animation-duration: 7.4s;
}

.pop-c {
  left: 91.2%;
  top: 38.6%;
  width: clamp(5px, 0.9vw, 11px);
  height: clamp(5px, 0.9vw, 11px);
  background: var(--green);
  animation-name: dot-drift-c;
  animation-delay: 1.65s;
  animation-duration: 7.1s;
}

.gift-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 156px;
  min-height: 46px;
  padding: 12px 22px 11px;
  border: 1px solid var(--white-soft);
  border-radius: 999px;
  background: var(--white-faint);
  color: var(--blue);
  font-family: var(--text-font);
  font-size: clamp(0.94rem, 0.86rem + 0.22vw, 1.08rem);
  letter-spacing: 0;
  line-height: 1;
  text-decoration: none;
  opacity: 0;
  transform: translateY(10px);
  backdrop-filter: blur(5px);
  animation: button-in 760ms ease 1.55s forwards;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.gift-link:hover,
.gift-link:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.95);
  transform: translateY(6px);
}

.gift-link:focus-visible {
  outline: 2px solid rgba(39, 53, 130, 0.36);
  outline-offset: 4px;
}

.gift-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes name-arrival {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }

  70% {
    opacity: 1;
    transform: translateY(-2px) scale(1.004);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes letter-arrival {
  0% {
    opacity: 0;
    transform: translateY(-24px) rotate(-1.2deg) scale(0.97);
  }

  68% {
    opacity: 1;
    transform: translateY(2px) rotate(0.35deg) scale(1.004);
  }

  100% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

@keyframes dot-arrival {
  0% {
    opacity: 0;
    transform: scale(0.78) translateY(10px);
  }

  70% {
    opacity: 1;
    transform: scale(1.025) translateY(-1px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes celebration-show {
  0% {
    opacity: 0;
  }

  24%,
  100% {
    opacity: 1;
  }
}

@keyframes dot-drift-a {
  0%,
  100% {
    opacity: 0;
    transform: translate3d(-18px, 22px, 0) scale(0.7);
  }

  34% {
    opacity: 0.28;
    transform: translate3d(12px, -20px, 0) scale(1);
  }

  66% {
    opacity: 0.1;
    transform: translate3d(30px, -42px, 0) scale(0.82);
  }
}

@keyframes dot-drift-b {
  0%,
  100% {
    opacity: 0;
    transform: translate3d(14px, 18px, 0) scale(0.72);
  }

  42% {
    opacity: 0.24;
    transform: translate3d(-20px, -28px, 0) scale(1);
  }

  72% {
    opacity: 0.08;
    transform: translate3d(-36px, -48px, 0) scale(0.84);
  }
}

@keyframes dot-drift-c {
  0%,
  100% {
    opacity: 0;
    transform: translate3d(-10px, 24px, 0) scale(0.7);
  }

  38% {
    opacity: 0.22;
    transform: translate3d(24px, -26px, 0) scale(0.96);
  }

  70% {
    opacity: 0.07;
    transform: translate3d(42px, -52px, 0) scale(0.82);
  }
}

@keyframes button-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .hero {
    padding-inline: 18px;
  }

  .name-wrap {
    width: min(70vw, 500px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
