:root {
  --paper: #fffaf0;
  --paper-deep: #fff0dd;
  --ink: #6f3028;
  --red: #c94b32;
  --red-deep: #a93825;
  --orange: #ef7946;
  --pink: #f7b7ad;
  --green: #7f9f73;
  --line: #d8b7a6;
  --shadow: 0 24px 60px rgba(120, 55, 34, 0.2);
  --radius: clamp(18px, 3vw, 34px);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #ffd7c4;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  font-family: "Gaegu", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.48), transparent 22rem),
    linear-gradient(135deg, #ffe4d5 0%, #fff4de 52%, #ffd4c7 100%);
  overflow-x: hidden;
}

button {
  font: inherit;
}

.surprise-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.3vw, 28px);
}

.scrapbook-frame {
  width: min(92vw, 1220px);
  min-height: min(760px, calc(100svh - 24px));
  border: clamp(10px, 1.8vw, 20px) solid transparent;
  border-radius: calc(var(--radius) + 12px);
  background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    repeating-conic-gradient(
      from 45deg,
      #f57843 0 25%,
      #fff3e3 0 50%
    ) border-box;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.scrapbook-frame::before,
.scrapbook-frame::after {
  content: "";
  position: absolute;
  inset: clamp(8px, 1.2vw, 16px);
  border: 2px solid rgba(201, 75, 50, 0.28);
  border-radius: var(--radius);
  pointer-events: none;
  z-index: 2;
}

.scrapbook-frame::after {
  inset: clamp(18px, 2.4vw, 34px);
  border-color: rgba(111, 48, 40, 0.16);
}

.page {
  min-height: inherit;
  display: grid;
  place-items: center;
  padding: clamp(28px, 5vw, 70px);
  position: relative;
  opacity: 1;
  transform: scale(1);
  transition: opacity 240ms ease, transform 240ms ease;
}

.page.is-leaving {
  opacity: 0;
  transform: scale(0.975) translateY(8px);
}

.page-inner {
  width: min(100%, 980px);
  display: grid;
  justify-items: center;
  gap: clamp(14px, 2vw, 24px);
  text-align: center;
  z-index: 3;
}

.title {
  margin: 0;
  color: var(--red-deep);
  font-family: "Gaegu", system-ui, sans-serif;
  font-size: clamp(2.05rem, 6.6vw, 5.2rem);
  line-height: 0.92;
  font-weight: 700;
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow: 1px 2px 0 rgba(255, 255, 255, 0.85);
}

.title.arc {
  max-width: 900px;
  transform: rotate(-2deg);
}

.subtitle {
  margin: 0;
  color: var(--red-deep);
  font-size: clamp(1.45rem, 4.5vw, 3.25rem);
  line-height: 1;
  font-weight: 700;
  text-wrap: balance;
}

.body-copy {
  max-width: 730px;
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.75rem);
  line-height: 1.18;
}

.photo-cutout,
.polaroid img,
.memory-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-photo .photo-cutout {
  object-position: 48% 38%;
}

.stern-photo .photo-cutout {
  object-position: 35% center;
}

.excited-photo-wrap .photo-cutout {
  object-position: 72% 16%;
}

.hero-photo {
  width: clamp(138px, 24vw, 260px);
  aspect-ratio: 1 / 1;
  border-radius: 42% 58% 48% 52% / 52% 42% 58% 48%;
  overflow: hidden;
  filter: drop-shadow(0 12px 10px rgba(126, 57, 33, 0.18));
  background: #fff;
}

.stern-photo {
  width: clamp(150px, 27vw, 300px);
  aspect-ratio: 0.92 / 1;
  border-radius: 45% 55% 35% 65% / 48% 42% 58% 52%;
}

.excited-photo-wrap {
  width: min(360px, 64vw);
  aspect-ratio: 1.24 / 1;
  position: relative;
}

.excited-photo-wrap::after {
  content: "";
  position: absolute;
  left: 11%;
  right: 11%;
  bottom: -7%;
  height: 18%;
  background: #9c5428;
  transform: rotate(0.5deg);
  border-radius: 4px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(10px, 2vw, 18px);
}

.sticker-btn {
  min-width: clamp(104px, 22vw, 172px);
  min-height: 48px;
  border: 3px solid #fff9ef;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  box-shadow:
    0 6px 0 var(--red-deep),
    0 13px 20px rgba(135, 55, 34, 0.24);
  padding: 8px 22px 10px;
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transform: rotate(var(--tilt, -1deg));
  transition: transform 160ms ease, box-shadow 160ms ease, translate 160ms ease;
}

.sticker-btn:hover,
.sticker-btn:focus-visible {
  transform: rotate(var(--tilt, -1deg)) translateY(-3px) scale(1.03);
}

.sticker-btn:active {
  translate: 0 5px;
  box-shadow:
    0 2px 0 var(--red-deep),
    0 8px 16px rgba(135, 55, 34, 0.2);
}

.sticker-btn:focus-visible,
.arrow-btn:focus-visible,
.gift:focus-visible {
  outline: 4px solid rgba(127, 159, 115, 0.55);
  outline-offset: 4px;
}

.no-btn {
  transition: transform 180ms ease, translate 180ms ease;
}

.tilt-right {
  --tilt: 2deg;
}

.corner-sticker {
  position: absolute;
  width: clamp(66px, 12vw, 130px);
  aspect-ratio: 1;
  border: 7px solid #fff8ee;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  background: #fff8ee;
  z-index: 4;
  filter: drop-shadow(0 8px 8px rgba(100, 48, 32, 0.18));
}

.corner-sticker.left {
  left: clamp(4px, 2vw, 26px);
  bottom: clamp(14px, 3vw, 40px);
  transform: rotate(-4deg);
}

.corner-sticker.right {
  right: clamp(4px, 2vw, 26px);
  bottom: clamp(12px, 2vw, 30px);
  transform: rotate(5deg);
}

.paper-curl {
  position: absolute;
  width: clamp(66px, 14vw, 180px);
  aspect-ratio: 1;
  background: var(--orange);
  border: 3px solid rgba(255, 255, 255, 0.7);
  z-index: 1;
}

.paper-curl.top-left {
  left: -55px;
  top: -48px;
  border-radius: 0 0 55px 0;
}

.paper-curl.bottom-right {
  right: -55px;
  bottom: -48px;
  border-radius: 55px 0 0 0;
}

.arrow-btn {
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: clamp(3.2rem, 8vw, 6.2rem);
  line-height: 1;
  cursor: pointer;
  padding: 0 clamp(6px, 1vw, 12px);
  text-shadow: 0 6px 0 rgba(169, 56, 37, 0.14);
  transition: transform 160ms ease;
}

.arrow-btn:hover {
  transform: translateX(6px) rotate(3deg);
}

.floating-arrow {
  position: absolute;
  right: clamp(18px, 4vw, 58px);
  top: 50%;
  translate: 0 -50%;
  z-index: 5;
}

.gifts-grid {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 3vw, 34px);
  align-items: end;
  margin-block: clamp(8px, 2vw, 18px);
}

.gift {
  border: 0;
  background: transparent;
  min-height: clamp(132px, 22vw, 210px);
  display: grid;
  place-items: center;
  cursor: pointer;
  transform: rotate(var(--rot));
}

.gift-box {
  width: min(86%, 184px);
  aspect-ratio: 1.05 / 1;
  position: relative;
  filter: drop-shadow(0 14px 10px rgba(120, 55, 34, 0.2));
  transition: transform 220ms ease;
}

.gift:hover .gift-box,
.gift:focus-visible .gift-box {
  transform: translateY(-8px) scale(1.04);
}

.gift-base {
  position: absolute;
  inset: 28% 6% 6%;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 42%, rgba(255, 255, 255, 0.28) 42% 58%, transparent 58%),
    linear-gradient(135deg, #d96770, #f7a3a8 48%, #c9505e);
  border: 2px solid rgba(142, 54, 49, 0.2);
}

.gift-lid {
  position: absolute;
  inset: 17% 0 48%;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 43%, rgba(255, 255, 255, 0.32) 43% 57%, transparent 57%),
    linear-gradient(135deg, #df6f78, #ffc2c6 50%, #c94d59);
  transform-origin: 50% 100%;
}

.gift-bow,
.gift-bow::before,
.gift-bow::after {
  position: absolute;
  content: "";
  background: linear-gradient(135deg, #c74552, #ffc2c5);
}

.gift-bow {
  width: 22%;
  height: 15%;
  left: 39%;
  top: 3%;
  border-radius: 50% 50% 10px 10px;
}

.gift-bow::before,
.gift-bow::after {
  width: 72%;
  aspect-ratio: 1.2 / 1;
  top: 18%;
  border-radius: 55% 45% 55% 45%;
}

.gift-bow::before {
  right: 74%;
  transform: rotate(-28deg);
}

.gift-bow::after {
  left: 74%;
  transform: rotate(28deg);
}

.gift.is-opening .gift-box {
  animation: gift-pop 680ms ease both;
}

.gift.is-opening .gift-lid {
  animation: lid-open 680ms ease both;
}

.gift.is-opening .gift-bow {
  animation: bow-wiggle 680ms ease both;
}

.click-note {
  margin: 0;
  color: var(--red);
  font-size: clamp(2rem, 6vw, 4.7rem);
  line-height: 0.9;
  font-weight: 700;
}

.decor-doodle {
  position: absolute;
  color: var(--red);
  font-size: clamp(1.7rem, 4vw, 3.2rem);
  font-weight: 700;
  z-index: 2;
}

.decor-doodle.star-a {
  left: 8%;
  top: 17%;
  transform: rotate(-18deg);
}

.decor-doodle.star-b {
  right: 16%;
  top: 19%;
  transform: rotate(12deg);
}

.greeting-layout {
  width: min(100%, 920px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
  align-items: center;
  gap: clamp(22px, 5vw, 54px);
  text-align: left;
}

.rakhi {
  position: absolute;
  left: clamp(16px, 4vw, 58px);
  top: clamp(14px, 3vw, 38px);
  width: clamp(58px, 12vw, 130px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, #f8c842 0 12%, #b9432f 13% 20%, #f9d76d 21% 30%, #e96d3d 31% 42%, #fff1c6 43% 52%, #c94b32 53% 62%, transparent 63%),
    repeating-conic-gradient(#e96d3d 0 12deg, #fff1c6 12deg 24deg);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.7), 0 10px 18px rgba(130, 56, 32, 0.18);
}

.polaroid {
  width: min(100%, 360px);
  aspect-ratio: 1 / 0.92;
  background: #d9542d;
  padding: clamp(10px, 2vw, 16px) clamp(10px, 2vw, 16px) clamp(34px, 5vw, 56px);
  box-shadow: 0 18px 22px rgba(116, 50, 31, 0.18);
  transform: rotate(5deg);
}

.polaroid img {
  border: 4px solid rgba(255, 255, 255, 0.62);
  object-position: center 42%;
}

.ribbon {
  display: inline-block;
  margin-top: clamp(10px, 2vw, 18px);
  padding: 8px 28px;
  color: #fff;
  background: var(--red);
  font-size: clamp(1.2rem, 2.6vw, 1.75rem);
  font-weight: 700;
  clip-path: polygon(0 0, 100% 0, 90% 50%, 100% 100%, 0 100%, 10% 50%);
}

.certificate {
  width: min(100%, 920px);
  min-height: clamp(430px, 68svh, 600px);
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vw, 72px);
  border: 2px solid rgba(111, 48, 40, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(145deg, transparent 0 83%, rgba(239, 121, 70, 0.92) 84%),
    linear-gradient(315deg, transparent 0 85%, rgba(239, 121, 70, 0.92) 86%),
    #fffdf7;
  position: relative;
}

.certificate h2 {
  margin: 0;
  color: var(--red-deep);
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.25rem, 6vw, 5.25rem);
  line-height: 1;
  letter-spacing: 0;
}

.presented {
  margin: 8px 0 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(0.95rem, 2vw, 1.2rem);
}

.name {
  margin: 0;
  color: #2d2926;
  font-family: "Sacramento", cursive;
  font-size: clamp(3rem, 8vw, 6.3rem);
  line-height: 0.9;
}

.award-copy {
  max-width: 640px;
  margin: 0;
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  line-height: 1.13;
}

.medal {
  width: clamp(56px, 10vw, 90px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, #ffe68a 0 28%, #d44935 29% 35%, #f7c454 36% 58%, #a93825 59% 64%, #e57348 65%);
  position: relative;
  margin-top: 8px;
}

.medal::before,
.medal::after {
  content: "";
  position: absolute;
  top: 72%;
  width: 34%;
  height: 62%;
  background: #c94b32;
  clip-path: polygon(0 0, 100% 0, 84% 100%, 50% 72%, 16% 100%);
  z-index: -1;
}

.medal::before {
  left: 18%;
  transform: rotate(12deg);
}

.medal::after {
  right: 18%;
  transform: rotate(-12deg);
}

.memory-board {
  width: min(100%, 1040px);
  display: grid;
  gap: clamp(16px, 3vw, 28px);
}

.memory-line {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: clamp(10px, 2vw, 22px);
  position: relative;
  padding-top: 26px;
}

.memory-line::before {
  content: "";
  position: absolute;
  left: 2%;
  right: 2%;
  top: 24px;
  border-top: 3px solid #a95a3b;
  transform: rotate(-1deg);
}

.memory-photo {
  position: relative;
  aspect-ratio: 0.74 / 1;
  padding: 8px;
  background:
    repeating-conic-gradient(from 45deg, #f57843 0 25%, #fff3e3 0 50%) 0 0 / 18px 18px;
  box-shadow: 0 13px 15px rgba(112, 51, 33, 0.16);
  transform: rotate(var(--rot));
}

.memory-photo::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 48px;
  left: 50%;
  top: -25px;
  translate: -50% 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #d7b87d, #f8e0a6 55%, #bd955c);
  box-shadow: 0 2px 4px rgba(91, 51, 31, 0.2);
  z-index: 2;
}

.memory-photo img {
  object-fit: contain;
  background: #fff8ee;
}

.memory-photo figcaption {
  margin-top: 8px;
  color: var(--red-deep);
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  font-weight: 700;
}

.final-layout {
  width: min(100%, 880px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(14px, 4vw, 34px);
  align-items: end;
  text-align: center;
}

.letter {
  padding: clamp(18px, 4vw, 42px);
  border: 2px dashed rgba(201, 75, 50, 0.36);
  border-radius: 22px;
  background:
    linear-gradient(90deg, rgba(127, 159, 115, 0.12), transparent 12% 88%, rgba(247, 183, 173, 0.18)),
    rgba(255, 255, 255, 0.42);
}

.letter h2 {
  margin: 0 0 12px;
  color: var(--red-deep);
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.letter p {
  margin: 0;
  font-size: clamp(1.16rem, 2.6vw, 1.7rem);
  line-height: 1.14;
}

.bouquet {
  width: clamp(84px, 15vw, 150px);
  aspect-ratio: 0.85 / 1;
  position: relative;
  align-self: center;
}

.bouquet::before {
  content: "";
  position: absolute;
  inset: 44% 22% 0;
  background: #f2d7a7;
  clip-path: polygon(0 0, 100% 0, 72% 100%, 24% 100%);
  border-radius: 0 0 18px 18px;
}

.flower {
  position: absolute;
  width: 36%;
  aspect-ratio: 1;
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle, #ffe68a 0 16%, #f4a4ac 17% 54%, #d86b79 55%);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.42);
}

.flower.one { left: 12%; top: 12%; }
.flower.two { left: 42%; top: 4%; }
.flower.three { right: 4%; top: 22%; }

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}

.confetti-piece {
  position: absolute;
  top: -24px;
  color: var(--red);
  font-size: 24px;
  animation: confetti-fall 1100ms ease-out forwards;
}

@keyframes gift-pop {
  0% { transform: scale(1) rotate(0); }
  35% { transform: scale(1.12) rotate(-5deg); }
  68% { transform: scale(1.05) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes lid-open {
  0% { transform: translateY(0) rotate(0); }
  45% { transform: translateY(-20%) rotate(-9deg); }
  100% { transform: translateY(-42%) rotate(-16deg); }
}

@keyframes bow-wiggle {
  0%, 100% { transform: rotate(0); }
  35% { transform: rotate(12deg); }
  65% { transform: rotate(-10deg); }
}

@keyframes confetti-fall {
  to {
    transform: translateY(88vh) rotate(360deg);
    opacity: 0;
  }
}

@media (max-width: 760px) {
  .scrapbook-frame {
    width: min(96vw, 620px);
    min-height: calc(100svh - 18px);
  }

  .page {
    padding: 28px 18px;
  }

  .floating-arrow {
    position: static;
    translate: 0;
    margin-top: -4px;
  }

  .greeting-layout,
  .final-layout {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .polaroid {
    justify-self: center;
    width: min(260px, 76vw);
  }

  .gifts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gift:nth-child(3) {
    grid-column: 1 / -1;
    width: min(56%, 190px);
    justify-self: center;
  }

  .memory-line {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .memory-line::before {
    display: none;
  }

  .corner-sticker.left {
    opacity: 0.92;
  }
}

@media (max-width: 430px) {
  .surprise-shell {
    padding: 7px;
  }

  .scrapbook-frame {
    width: 100%;
  }

  .paper-curl {
    display: none;
  }

  .page-inner {
    gap: 12px;
  }

  .button-row {
    gap: 9px;
  }

  .sticker-btn {
    min-width: 116px;
    padding-inline: 18px;
  }

  .memory-line {
    grid-template-columns: 1fr;
    width: min(230px, 82vw);
    justify-self: center;
  }

  .corner-sticker {
    width: 60px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .scrapbook-frame {
    min-height: auto;
  }

  .page {
    padding-block: 20px;
  }

  .hero-photo,
  .stern-photo {
    width: clamp(108px, 20vw, 170px);
  }

  .title {
    font-size: clamp(1.8rem, 5vw, 3.2rem);
  }

  .subtitle {
    font-size: clamp(1.3rem, 3.8vw, 2.3rem);
  }
}

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