:root {
  color-scheme: light dark;
  --cream: #fff8eb;
  --cream-deep: #f7e6c9;
  --brown: #3f2d22;
  --brown-soft: #76573d;
  --ink: #16120f;
  --gold: #c7922c;
  --gold-light: #edc56f;
  --blush: #f6d7c8;
  --final-cream: #fff3dc;
  --gift-surface: #fff4df;
  --gift-ribbon: rgba(199, 146, 44, 0.55);
  --gift-border: rgba(118, 87, 61, 0.36);
  --dot-brown: rgba(63, 45, 34, 0.24);
  --cream-glow: rgba(255, 248, 235, 0.95);
  --shadow: rgba(86, 55, 25, 0.18);
}

* {
  box-sizing: border-box;
  color-scheme: light dark;
}

html {
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  background-color: var(--cream);
  color-scheme: light dark;
}

body {
  margin: 0;
  background-color: var(--cream);
  color: var(--brown);
  font-family: "Gaegu", "Comic Sans MS", cursive;
  letter-spacing: 0;
  overflow: hidden;
  height: 100svh;
}

main {
  transition: transform 720ms cubic-bezier(0.22, 0.8, 0.24, 1);
  will-change: transform;
}

html,
body {
  forced-color-adjust: none;
}

button {
  font: inherit;
}

.section {
  position: relative;
  height: 100svh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 42px 22px;
  overflow: hidden;
  border-bottom: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background:
    radial-gradient(circle at 18% 16%, rgba(237, 197, 111, 0.2), transparent 24%),
    radial-gradient(circle at 82% 84%, rgba(246, 215, 200, 0.38), transparent 26%),
    var(--cream);
}

.page-arrow {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 45;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 2px solid rgba(199, 146, 44, 0.5);
  border-radius: 50%;
  background: color-mix(in srgb, var(--cream) 78%, transparent);
  color: var(--ink);
  cursor: pointer;
  box-shadow:
    0 12px 22px var(--shadow),
    0 0 18px rgba(199, 146, 44, 0.38);
  -webkit-tap-highlight-color: transparent;
}

.page-arrow svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.page-arrow:focus-visible {
  outline: 3px solid rgba(199, 146, 44, 0.62);
  outline-offset: 4px;
}

.hero {
  isolation: isolate;
}

.sprinkles::before,
.sprinkles::after,
.letter-section::before,
.letter-section::after,
.name-section::before,
.final-section::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml,%3Csvg width='38' height='38' viewBox='0 0 38 38' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M19 3l3.7 11.4L34 19l-11.3 4.6L19 35l-3.7-11.4L4 19l11.3-4.6L19 3z' fill='%23c7922c' fill-opacity='.55'/%3E%3C/svg%3E"),
    radial-gradient(circle, rgba(199, 146, 44, 0.68) 0 2px, transparent 2.5px),
    radial-gradient(circle, var(--dot-brown) 0 1.5px, transparent 2px);
  background-size: 146px 132px, 132px 126px, 170px 150px;
  background-position: 20px 26px, 88px 12px, 40px 80px;
  opacity: 0.34;
}

.sprinkles::after,
.letter-section::after {
  transform: rotate(9deg);
  opacity: 0.28;
}

.gift-button {
  position: relative;
  width: 170px;
  height: 170px;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
  transition: transform 220ms ease;
}

.gift-hint {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: calc(50% - 176px);
  width: min(220px, 72vw);
  color: var(--ink);
  font-size: clamp(1.05rem, 4.4vw, 1.65rem);
  line-height: 0.9;
  text-align: center;
  transform: translateX(-50%) rotate(-2deg);
  text-shadow:
    0 0 7px rgba(237, 197, 111, 0.95),
    0 0 16px rgba(199, 146, 44, 0.7),
    0 0 26px rgba(199, 146, 44, 0.42);
}

.gift-button:focus-visible {
  outline: 3px solid rgba(199, 146, 44, 0.55);
  outline-offset: 10px;
  border-radius: 24px;
}

.gift-button:hover,
.gift-button:active {
  transform: translateY(-4px) rotate(-2deg);
}

.gift {
  position: absolute;
  inset: 0;
  display: block;
  filter: drop-shadow(0 18px 22px var(--shadow));
}

.gift-box,
.gift-lid {
  position: absolute;
  left: 24px;
  width: 122px;
  background:
    linear-gradient(90deg, transparent 45%, var(--gift-ribbon) 45% 55%, transparent 55%),
    linear-gradient(0deg, transparent 45%, rgba(199, 146, 44, 0.42) 45% 55%, transparent 55%),
    var(--gift-surface);
  border: 2px solid var(--gift-border);
}

.gift-box {
  bottom: 26px;
  height: 94px;
  border-radius: 10px 10px 14px 14px;
}

.gift-lid {
  bottom: 112px;
  height: 32px;
  border-radius: 12px 12px 8px 8px;
}

.gift-box::before,
.gift-lid::before {
  content: "♡  ˚  ♡  ˚";
  position: absolute;
  inset: 12px 0 auto;
  color: rgba(199, 146, 44, 0.58);
  font-size: 21px;
  text-align: center;
}

.gift-bow {
  position: absolute;
  left: 52px;
  bottom: 135px;
  width: 68px;
  height: 42px;
  z-index: 2;
}

.gift-bow::before,
.gift-bow::after {
  content: "";
  position: absolute;
  top: 10px;
  width: 42px;
  height: 30px;
  border: 3px solid rgba(199, 146, 44, 0.66);
  background: color-mix(in srgb, var(--gift-surface) 86%, transparent);
}

.gift-bow::before {
  left: -8px;
  border-radius: 80% 38% 72% 42%;
  transform: rotate(25deg);
}

.gift-bow::after {
  right: -8px;
  border-radius: 38% 80% 42% 72%;
  transform: rotate(-25deg);
}

.gift-shadow {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 15px;
  height: 16px;
  border-radius: 50%;
  background: rgba(86, 55, 25, 0.12);
}

.birthday-message {
  display: none;
  position: relative;
  z-index: 30;
  max-width: 680px;
  text-align: center;
  animation: popIn 600ms cubic-bezier(0.2, 1.35, 0.33, 1) both;
}

.birthday-message.is-visible {
  display: block;
}

.birthday-message.is-visible ~ .gift-hint,
.hero:has(.birthday-message.is-visible) .gift-hint {
  display: none;
}

.birthday-message h1 {
  margin: 0;
  font-size: clamp(3rem, 13vw, 6.7rem);
  line-height: 0.9;
  font-weight: 700;
  text-wrap: balance;
  text-shadow:
    0 0 10px var(--cream-glow),
    0 0 18px color-mix(in srgb, var(--cream-glow) 90%, transparent);
}

.down-arrow {
  width: clamp(70px, 22vw, 108px);
  color: var(--ink);
  animation: bounce 1.1s ease-in-out infinite;
}

.scroll-cue {
  position: relative;
  display: inline-grid;
  justify-items: center;
  margin-top: 24px;
}

.scroll-cue span {
  position: absolute;
  left: 50%;
  top: -8px;
  color: var(--ink);
  font-size: clamp(1.25rem, 5vw, 1.9rem);
  line-height: 1;
  transform: translateX(-50%) rotate(-4deg);
  text-shadow:
    0 0 7px rgba(237, 197, 111, 0.95),
    0 0 16px rgba(199, 146, 44, 0.7),
    0 0 26px rgba(199, 146, 44, 0.42);
}

.letter-section.alt {
  background:
    radial-gradient(circle at 80% 12%, rgba(237, 197, 111, 0.22), transparent 25%),
    var(--cream-deep);
}

.letter-section.blush {
  background:
    radial-gradient(circle at 10% 80%, rgba(237, 197, 111, 0.22), transparent 28%),
    linear-gradient(180deg, var(--cream), var(--blush));
}

.letter-card {
  position: relative;
  z-index: 30;
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--brown);
}

.letter {
  font-size: clamp(7.5rem, 34vw, 13rem);
  line-height: 0.74;
  font-weight: 700;
  text-shadow:
    0 12px 20px rgba(86, 55, 25, 0.1),
    0 0 14px color-mix(in srgb, var(--cream-glow) 94%, transparent);
}

.word {
  position: relative;
  font-size: clamp(2.45rem, 11vw, 4.8rem);
  line-height: 1;
  color: var(--ink);
  text-shadow:
    0 0 7px rgba(237, 197, 111, 0.95),
    0 0 16px rgba(199, 146, 44, 0.7),
    0 0 26px rgba(199, 146, 44, 0.42);
}

.word::after,
.name-wrap p::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: min(170px, 70vw);
  height: 12px;
  border-bottom: 4px solid rgba(199, 146, 44, 0.72);
  border-radius: 50%;
  transform: translateX(-50%) rotate(-1deg);
}

.word small {
  display: block;
  margin-top: 8px;
  font-family: "Marhey", "Times New Roman", serif;
  font-size: clamp(1.1rem, 5.3vw, 2rem);
  font-weight: 700;
  color: var(--ink);
  text-shadow:
    0 0 7px rgba(237, 197, 111, 0.95),
    0 0 16px rgba(199, 146, 44, 0.7),
    0 0 26px rgba(199, 146, 44, 0.42);
}

.name-section {
  background:
    radial-gradient(circle at 16% 18%, rgba(199, 146, 44, 0.24), transparent 24%),
    radial-gradient(circle at 90% 70%, rgba(246, 215, 200, 0.42), transparent 27%),
    var(--cream);
}

.name-wrap {
  position: relative;
  z-index: 30;
  max-width: 780px;
  text-align: center;
}

.name-wrap h2 {
  margin: 0 0 20px;
  font-size: clamp(4.2rem, 18vw, 9rem);
  line-height: 0.8;
  font-weight: 700;
  text-shadow:
    0 0 12px color-mix(in srgb, var(--cream-glow) 96%, transparent),
    0 0 20px color-mix(in srgb, var(--cream-glow) 90%, transparent);
}

.name-wrap p {
  position: relative;
  margin: 0 auto;
  max-width: 620px;
  color: var(--brown-soft);
  font-size: clamp(1.7rem, 7vw, 3rem);
  line-height: 1;
}

.summary-arrow {
  width: clamp(58px, 18vw, 86px);
  margin-top: 26px;
}

.final-section {
  background:
    radial-gradient(circle at 20% 100%, rgba(199, 146, 44, 0.22), transparent 24%),
    radial-gradient(circle at 92% 20%, rgba(237, 197, 111, 0.22), transparent 24%),
    linear-gradient(180deg, var(--cream), var(--final-cream));
}

.final-message {
  position: relative;
  z-index: 30;
  max-width: 760px;
  text-align: center;
  color: var(--ink);
}

.final-message p {
  margin: 0 auto 28px;
  font-size: clamp(2.05rem, 7.6vw, 3.5rem);
  line-height: 1.08;
  color: var(--ink);
  text-shadow:
    0 0 7px rgba(237, 197, 111, 0.95),
    0 0 16px rgba(199, 146, 44, 0.7),
    0 0 26px rgba(199, 146, 44, 0.42);
}

.final-message .arabic {
  max-width: 690px;
  font-family: "Marhey", "Times New Roman", serif;
  font-size: clamp(1.58rem, 6.1vw, 2.82rem);
  line-height: 1.75;
  font-weight: 700;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink);
  text-shadow:
    0 0 7px rgba(237, 197, 111, 0.95),
    0 0 16px rgba(199, 146, 44, 0.7),
    0 0 26px rgba(199, 146, 44, 0.42);
}

.final-message .birthday-girl {
  margin-top: 12px;
  margin-bottom: 8px;
  font-size: clamp(2rem, 7.4vw, 3.45rem);
}

.final-message .birthday-girl-ar {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 6.4vw, 3rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --cream: #1f1711;
    --cream-deep: #291d14;
    --brown: #fff1d8;
    --brown-soft: #e8c987;
    --ink: #fff4dc;
    --gold: #f0c76c;
    --gold-light: #ffe19a;
    --blush: #3a221d;
    --final-cream: #26190f;
    --gift-surface: #3a2a1e;
    --gift-ribbon: rgba(240, 199, 108, 0.62);
    --gift-border: rgba(255, 225, 154, 0.34);
    --dot-brown: rgba(255, 241, 216, 0.18);
    --cream-glow: rgba(31, 23, 17, 0.92);
    --shadow: rgba(0, 0, 0, 0.36);
  }

  html,
  body {
    background-color: var(--cream);
    color: var(--brown);
  }
}

.gold-stars,
.gold-stars::before,
.gold-stars::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.gold-stars {
  inset: 0;
  opacity: 0.74;
  background-image:
    radial-gradient(circle, rgba(199, 146, 44, 0.62) 0 3px, transparent 3.6px),
    radial-gradient(circle, rgba(237, 197, 111, 0.58) 0 2px, transparent 2.6px);
  background-position: 12vw 18vh, 82vw 28vh;
  background-repeat: no-repeat;
  background-size: 28px 28px, 22px 22px;
}

.gold-stars::before {
  display: none;
}

.gold-stars::after {
  display: none;
}

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

.confetti-piece {
  position: absolute;
  top: -2rem;
  font-size: var(--size);
  animation: confettiFall var(--duration) linear forwards;
  filter: drop-shadow(0 4px 4px rgba(86, 55, 25, 0.14));
}

.reveal {
  opacity: 0;
  transform: scale(0.92) translateY(28px);
  transition:
    opacity 720ms ease,
    transform 720ms cubic-bezier(0.2, 0.8, 0.25, 1);
}

.reveal.in-view {
  opacity: 1;
  transform: scale(1) translateY(0);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(18px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(14px);
  }
}

@keyframes confettiFall {
  from {
    transform: translate3d(0, -10vh, 0) rotate(0deg);
    opacity: 1;
  }
  to {
    transform: translate3d(var(--drift), 112vh, 0) rotate(var(--spin));
    opacity: 0.92;
  }
}

@media (max-width: 430px) {
  .section {
    padding: 34px 18px;
  }

  .gift-button {
    width: 148px;
    height: 148px;
  }

  .gift-hint {
    left: 50%;
    top: calc(50% - 166px);
    width: 190px;
  }

  .gift-box,
  .gift-lid {
    left: 20px;
    width: 108px;
  }

  .gift-box {
    bottom: 24px;
    height: 84px;
  }

  .gift-lid {
    bottom: 102px;
  }

  .gift-bow {
    left: 43px;
    bottom: 124px;
  }

  .birthday-message h1 {
    font-size: clamp(2.7rem, 16vw, 4.9rem);
  }

}

@media (min-width: 760px) {
  .letter-section {
    min-height: 92vh;
  }

  .section {
    padding-inline: 56px;
  }

  .final-message p {
    max-width: 650px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  main {
    transition: none;
  }
}
