:root {
  --bg: #140d18;
  --cream: #fff6ec;
  --blush: #f3b6c3;
  --blush-soft: #f7d5da;
  --gold: #e8c895;
  --text: rgba(255, 246, 236, 0.8);
  --text-soft: rgba(255, 246, 236, 0.62);
  --line: rgba(255, 236, 221, 0.14);
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(243, 182, 195, 0.36);
  color: #fff;
}

.scene {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 14% 4%, rgba(143, 66, 101, 0.5), transparent 44%),
    radial-gradient(ellipse at 88% 24%, rgba(126, 76, 42, 0.32), transparent 44%),
    radial-gradient(ellipse at 50% 110%, rgba(92, 44, 70, 0.35), transparent 48%),
    linear-gradient(155deg, #1e1123 0%, #120c16 54%, #1c0f19 100%);
}

.scene::after {
  position: absolute;
  inset: 0;
  content: "";
  background-image: radial-gradient(circle, rgba(255, 241, 226, 0.16) 0.6px, transparent 0.8px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 72%);
  opacity: 0.28;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.38;
  will-change: transform;
}

.orb--rose {
  top: -22%;
  left: -16%;
  width: min(68vw, 780px);
  aspect-ratio: 1;
  background: radial-gradient(circle, #d47698 0%, rgba(199, 86, 126, 0.55) 42%, transparent 70%);
  animation: drift-a 22s ease-in-out infinite alternate;
}

.orb--gold {
  top: 28%;
  right: -24%;
  width: min(54vw, 660px);
  aspect-ratio: 1;
  background: radial-gradient(circle, #c79358 0%, rgba(173, 115, 60, 0.38) 46%, transparent 70%);
  animation: drift-b 28s ease-in-out infinite alternate;
}

.orb--violet {
  bottom: -30%;
  left: 18%;
  width: min(62vw, 720px);
  aspect-ratio: 1;
  background: radial-gradient(circle, #744b91 0%, rgba(91, 55, 115, 0.4) 45%, transparent 70%);
  animation: drift-c 25s ease-in-out infinite alternate;
}

.spark {
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--cream);
  clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
  opacity: 0;
  animation: twinkle 7s ease-in-out infinite;
}

.spark--1 { top: 14%; left: 8%; animation-delay: 0.4s; }
.spark--2 { top: 22%; right: 12%; animation-delay: 2.1s; }
.spark--3 { top: 46%; left: 5%; animation-delay: 4.3s; }
.spark--4 { top: 63%; right: 7%; animation-delay: 1.2s; }
.spark--5 { top: 78%; left: 14%; animation-delay: 5.4s; }
.spark--6 { top: 36%; right: 24%; animation-delay: 3.3s; }
.spark--7 { top: 86%; right: 18%; animation-delay: 0.9s; }
.spark--8 { top: 8%; left: 38%; animation-delay: 4.8s; }

.hero {
  position: sticky;
  z-index: 10;
  top: 0;
  padding: clamp(1.4rem, 3.4vh, 2.6rem) clamp(1rem, 4vw, 3rem) clamp(1.4rem, 4vh, 3rem);
  text-align: center;
  background: linear-gradient(180deg, #170f1b 0%, #140d18 100%);
  box-shadow: 0 22px 48px rgba(9, 5, 12, 0.3);
  animation: hero-in 0.9s cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

.hero::after {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  height: 1.75rem;
  content: "";
  background: linear-gradient(180deg, rgba(20, 13, 24, 0.9), rgba(20, 13, 24, 0));
  pointer-events: none;
}

.hero__eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.7rem, 2vw, 1.2rem);
  margin: 0;
  color: var(--gold);
  font-size: clamp(0.52rem, 0.9vw, 0.66rem);
  font-weight: 600;
  letter-spacing: 0.34em;
  line-height: 1.4;
  text-transform: uppercase;
}

.hero__line {
  width: clamp(1.5rem, 5vw, 3.8rem);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 200, 149, 0.65));
}

.hero__line:last-child {
  transform: scaleX(-1);
}

.hero__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: clamp(0.45rem, 1.4vh, 0.85rem) auto 0;
  font-family: var(--serif);
  line-height: 0.88;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.hero__name {
  display: block;
  color: var(--blush);
  font-size: clamp(3rem, 8vw, 6.8rem);
  font-weight: 700;
  text-shadow: 0 12px 55px rgba(226, 130, 158, 0.24);
}

.hero__wish {
  display: block;
  margin-top: 0.17em;
  padding-bottom: 0.06em;
  background: linear-gradient(100deg, #fff8ed 4%, #f8d9c0 52%, #e8c58e 96%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  font-size: clamp(1.9rem, 5vw, 4.3rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.035em;
}

.letter {
  width: min(47rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.5rem, 5vh, 4rem) 0 clamp(4rem, 11vh, 8rem);
}

.letter__card {
  position: relative;
  width: 100%;
  max-width: 47rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 5.2vw, 3.6rem);
  border: 1px solid var(--line);
  border-radius: clamp(1.3rem, 3vw, 2.2rem);
  background:
    radial-gradient(circle at 50% -14%, rgba(243, 182, 195, 0.15), transparent 42%),
    linear-gradient(145deg, rgba(42, 26, 43, 0.88), rgba(24, 15, 28, 0.82));
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: card-in 1s 0.12s cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

.letter__ornament {
  display: block;
  margin-bottom: clamp(1.4rem, 3.2vh, 2.2rem);
  color: var(--gold);
  font-size: 1.05rem;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 24px rgba(232, 200, 149, 0.5);
}

.letter p {
  margin: 0;
  color: var(--text);
  font-size: clamp(1rem, 1.2vw, 1.09rem);
  line-height: 1.82;
}

.letter p + p {
  margin-top: 1.45rem;
}

.letter__lead {
  color: var(--cream) !important;
  font-family: var(--serif);
  font-size: clamp(1.24rem, 2.2vw, 1.52rem) !important;
  line-height: 1.58 !important;
  letter-spacing: -0.012em;
}

.date {
  position: fixed;
  z-index: 20;
  right: clamp(1rem, 3.5vw, 2.2rem);
  bottom: max(1rem, env(safe-area-inset-bottom));
  color: rgba(232, 200, 149, 0.68);
  font-size: clamp(0.62rem, 0.85vw, 0.72rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2em;
  line-height: 1;
  text-shadow:
    0 1px 3px var(--bg),
    0 0 18px var(--bg);
  pointer-events: none;
  user-select: none;
}

.date::before {
  display: inline-block;
  width: 1.6rem;
  height: 1px;
  margin-right: 0.65rem;
  background: linear-gradient(90deg, transparent, rgba(232, 200, 149, 0.5));
  content: "";
  vertical-align: middle;
}

@media (max-width: 1180px) {
  .date {
    position: static;
    display: block;
    margin-top: 1.4rem;
    padding-right: 0.2rem;
    text-align: right;
  }
}

@keyframes hero-in {
  from {
    opacity: 0;
    transform: translateY(-18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(7vw, 5vh, 0) scale(1.12); }
}

@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.08); }
  to { transform: translate3d(-6vw, 8vh, 0) scale(0.96); }
}

@keyframes drift-c {
  from { transform: translate3d(0, 0, 0) scale(0.96); }
  to { transform: translate3d(4vw, -6vh, 0) scale(1.1); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.6) rotate(0deg); }
  45% { opacity: 0.8; transform: scale(1) rotate(20deg); }
  60% { opacity: 0.28; transform: scale(0.8) rotate(35deg); }
}

@supports not (background-clip: text) {
  .hero__wish {
    color: var(--cream);
  }
}

@media (max-width: 520px) {
  .hero {
    padding-top: 1.1rem;
  }

  .hero__eyebrow {
    letter-spacing: 0.24em;
  }

  .letter {
    width: calc(100% - 1.2rem);
    padding: 2rem 0 2.5rem;
  }

  .letter__card {
    padding: 1.5rem 1.25rem 1.7rem;
    border-radius: 1.25rem;
  }

  .letter p {
    line-height: 1.76;
  }

  .letter__lead {
    line-height: 1.54 !important;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .hero {
    padding-top: 0.7rem;
    padding-bottom: 0.9rem;
  }

  .hero__eyebrow {
    display: none;
  }

  .hero__title {
    flex-direction: row;
    align-items: baseline;
    gap: 0.34em;
    margin-top: 0;
    line-height: 1;
  }

  .hero__name {
    font-size: clamp(2rem, 4.6vw, 3rem);
  }

  .hero__wish {
    margin-top: 0;
    padding-bottom: 0;
    font-size: clamp(1.55rem, 3.6vw, 2.4rem);
  }

  .letter {
    padding-top: 2rem;
  }
}

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

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

  .spark {
    opacity: 0.45;
  }
}
