:root {
  --cream: #f4efe6;
  --ink: #2c2416;
  --gold: #c4a574;
  --gold-deep: #a8884e;
  --gold-light: #e8d5a8;
  --ivory: #f7f1e6;
  --ivory-deep: #e4d6c0;
  --night: #120e0a;
  --veil: rgba(12, 8, 6, 0.62);
  --shadow: rgba(44, 36, 22, 0.18);
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Outfit", system-ui, sans-serif;
}

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

html {
  margin: 0;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--cream);
  color: #f4ead8;
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.7;
}

body.is-opened {
  background: var(--night);
}

body.is-locked {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

main {
  position: relative;
  z-index: 1;
}

/* Atmosphere */

.atmosphere {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 2;
  visibility: hidden;
}

body.is-opened .atmosphere {
  visibility: visible;
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 46%, rgba(8, 5, 3, 0.28) 100%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  opacity: 0.28;
}

.glow--a {
  width: 42vw;
  height: 42vw;
  left: -8%;
  top: 18%;
  background: radial-gradient(circle, rgba(196, 165, 116, 0.45), transparent 70%);
  animation: drift 18s ease-in-out infinite;
}

.glow--b {
  width: 36vw;
  height: 36vw;
  right: -10%;
  bottom: 10%;
  background: radial-gradient(circle, rgba(196, 90, 78, 0.28), transparent 70%);
  animation: drift 22s ease-in-out infinite reverse;
}

.motes,
.petals {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.mote {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 10px rgba(232, 213, 168, 0.9);
  animation: mote var(--dur, 14s) linear infinite;
  animation-delay: var(--delay, 0s);
  left: var(--x, 50%);
  opacity: 0.55;
}

.petal {
  position: absolute;
  top: -12%;
  left: var(--x, 40%);
  width: var(--w, 14px);
  height: var(--h, 18px);
  border-radius: 80% 0 70% 20%;
  background: var(--petal, linear-gradient(135deg, #f0d0b4, #c4786a));
  opacity: 0.5;
  filter: blur(0.2px);
  transform: rotate(var(--rot, 20deg));
  animation: fall var(--dur, 16s) linear infinite;
  animation-delay: var(--delay, 0s);
  box-shadow: 0 0 12px rgba(196, 165, 116, 0.18);
}

/* Portal */

.portal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1.75rem;
  background: var(--cream);
  color: var(--ink);
  transition: opacity 0.85s ease, visibility 0.85s ease;
}

.portal.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.portal.is-gone {
  display: none;
}

.kicker,
.sign,
.portal-kicker,
.portal-hint {
  font-family: var(--sans);
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.portal-kicker,
.portal-hint {
  margin: 0;
  color: var(--gold-deep);
  font-size: 0.68rem;
}

.gift {
  position: relative;
  width: 220px;
  height: 230px;
  display: grid;
  place-items: center;
}

.gift:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 14px;
}

.gift-glow {
  position: absolute;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 213, 168, 0.55), transparent 68%);
  filter: blur(6px);
  animation: pulse 3.6s ease-in-out infinite;
}

.gift.is-open .gift-glow {
  animation: none;
  opacity: 0.2;
  transform: scale(1.35);
  transition: opacity 0.8s ease, transform 1s ease;
}

.gift-scene {
  position: relative;
  width: 168px;
  height: 168px;
  transform-origin: 50% 80%;
  transition: transform 0.75s cubic-bezier(0.45, 0.05, 0.2, 1);
}

.gift.is-open .gift-scene {
  transform: rotate(8deg) translateY(10px);
}

.gift-body {
  position: absolute;
  left: 14px;
  bottom: 8px;
  width: 140px;
  height: 108px;
  filter: drop-shadow(0 18px 22px var(--shadow));
}

.body-face {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #fbf6ec 0%, var(--ivory-deep) 100%);
  border: 1px solid rgba(168, 136, 78, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.body-ribbon-v,
.lid-ribbon {
  position: absolute;
  top: 0;
  left: 50%;
  width: 22px;
  height: 100%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, var(--gold-light), var(--gold) 40%, var(--gold-deep) 52%, var(--gold) 100%);
}

.body-ribbon-h {
  position: absolute;
  left: 0;
  top: 44%;
  width: 100%;
  height: 22px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold) 45%, var(--gold-deep) 58%, var(--gold));
}

.gift-lid {
  position: absolute;
  left: 4px;
  top: 18px;
  width: 160px;
  height: 46px;
  z-index: 2;
  transform-origin: 12% 100%;
  transition: transform 0.7s cubic-bezier(0.22, 0.9, 0.3, 1) 0.55s;
}

.lid-top {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #fffaf0, var(--ivory-deep));
  border: 1px solid rgba(168, 136, 78, 0.4);
  box-shadow: 0 8px 16px rgba(44, 36, 22, 0.12);
}

.gift.is-open .gift-lid {
  transform: translateY(-92px) translateX(16px) rotate(-16deg);
}

.bow {
  position: absolute;
  left: 50%;
  top: -18px;
  width: 72px;
  height: 42px;
  transform: translateX(-50%);
  z-index: 3;
}

.bow-loop {
  position: absolute;
  top: 4px;
  width: 34px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-light), var(--gold) 45%, var(--gold-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.bow-loop--left {
  left: 2px;
  transform: rotate(-18deg);
}

.bow-loop--right {
  right: 2px;
  transform: rotate(18deg);
}

.bow-knot {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 30% 30%, var(--gold-light), var(--gold-deep));
}

.bow-tail {
  position: absolute;
  top: 20px;
  width: 10px;
  height: 28px;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  clip-path: polygon(0 0, 100% 0, 70% 100%, 0 78%);
}

.bow-tail--left {
  left: 22px;
  transform: rotate(18deg);
}

.bow-tail--right {
  right: 22px;
  transform: rotate(-18deg) scaleX(-1);
}

.gift-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.spark {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 5px;
  height: 5px;
  margin: -2px;
  background: var(--gold-light);
  border-radius: 50%;
  opacity: 0;
}

.gift.is-open .spark {
  animation: spark 0.95s ease-out forwards;
}

/* Scenes */

.act {
  position: relative;
}

.act--tall .act-media,
.act-media.is-fill {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.act--full {
  min-height: 100svh;
}

.act-media {
  overflow: hidden;
}

.act-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.act--full .act-media img {
  object-position: 50% 18%;
}

.shade {
  position: absolute;
  inset: 0;
}

.shade--deep {
  background:
    linear-gradient(180deg, rgba(10, 7, 5, 0.55) 0%, rgba(10, 7, 5, 0.28) 42%, rgba(10, 7, 5, 0.72) 100%),
    radial-gradient(ellipse at 50% 40%, rgba(196, 165, 116, 0.16), transparent 55%);
}

.shade--side {
  background:
    linear-gradient(90deg, rgba(10, 7, 5, 0.78) 0%, rgba(10, 7, 5, 0.45) 42%, rgba(10, 7, 5, 0.22) 100%),
    linear-gradient(180deg, rgba(10, 7, 5, 0.35), transparent 30%, rgba(10, 7, 5, 0.5));
}

.shade--finale {
  background:
    linear-gradient(180deg, rgba(10, 7, 5, 0.35) 0%, rgba(10, 7, 5, 0.18) 40%, rgba(10, 7, 5, 0.78) 100%),
    radial-gradient(ellipse at 50% 35%, rgba(196, 165, 116, 0.2), transparent 50%);
}

.gold-frame {
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(232, 213, 168, 0.28);
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.28),
    0 0 40px rgba(196, 165, 116, 0.08);
  pointer-events: none;
}

.gold-frame::before,
.gold-frame::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(232, 213, 168, 0.5);
}

.gold-frame::before {
  top: -1px;
  left: -1px;
  border-right: 0;
  border-bottom: 0;
}

.gold-frame::after {
  right: -1px;
  bottom: -1px;
  border-left: 0;
  border-top: 0;
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 4.5rem 1.4rem 3.5rem;
}

.cover {
  text-align: center;
  gap: 0.7rem;
}

.cover-sub {
  margin: 0.35rem 0 0;
  font-style: italic;
  font-size: 1.45rem;
  color: rgba(232, 213, 168, 0.88);
  text-shadow: 0 0 18px rgba(196, 165, 116, 0.45);
}

.cover-more {
  position: absolute;
  left: 50%;
  bottom: 1.7rem;
  width: 9px;
  height: 9px;
  border-right: 1px solid var(--gold-light);
  border-bottom: 1px solid var(--gold-light);
  transform: translateX(-50%) rotate(45deg);
  opacity: 0.75;
}

.title-glow {
  margin: 0.1rem 0 0.35rem;
  font-size: clamp(3.2rem, 12vw, 7.2rem);
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 0.92;
  color: #f7ecd8;
  text-shadow:
    0 0 18px rgba(232, 213, 168, 0.55),
    0 0 48px rgba(196, 165, 116, 0.35),
    0 8px 28px rgba(0, 0, 0, 0.45);
}

.glow-text {
  margin: 0;
  color: var(--gold-light);
  font-size: 0.72rem;
  text-shadow: 0 0 16px rgba(232, 213, 168, 0.45);
}

.rule {
  display: block;
  width: 88px;
  height: 1px;
  margin: 0.15rem auto 0.55rem;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
  box-shadow: 0 0 12px rgba(232, 213, 168, 0.55);
}

.glass {
  width: min(38rem, 100%);
  padding: 2rem 1.5rem;
  background: linear-gradient(180deg, rgba(16, 11, 8, 0.62), rgba(12, 8, 6, 0.72));
  border: 1px solid rgba(232, 213, 168, 0.2);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.35),
    0 0 50px rgba(196, 165, 116, 0.08);
}

.glass--narrow {
  width: min(28rem, 100%);
}

.salute {
  font-style: italic;
  font-size: 1.55rem;
  margin: 0 0 1.35rem;
  color: var(--gold-light);
  text-shadow: 0 0 18px rgba(196, 165, 116, 0.4);
}

.letter p,
.pull,
.pull-soft {
  margin: 0 0 1.2rem;
  color: rgba(247, 236, 216, 0.94);
  font-size: clamp(1.12rem, 2.3vw, 1.32rem);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}

.letter p:last-child {
  margin-bottom: 0;
}

.pull {
  font-size: clamp(1.45rem, 3vw, 2rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 0.85rem;
}

.pull-soft {
  margin: 0;
  color: var(--gold-light);
  font-size: 1.05rem;
}

.stage--left {
  justify-items: start;
  align-content: center;
}

.finale {
  align-content: end;
  text-align: center;
  padding-bottom: 4.2rem;
}

.ornament {
  display: block;
  width: 11px;
  height: 11px;
  margin: 0 auto 1.3rem;
  transform: rotate(45deg);
  background: var(--gold-light);
  box-shadow: 0 0 16px rgba(232, 213, 168, 0.8);
}

.closing {
  margin: 0 0 1.4rem;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-style: italic;
  font-weight: 500;
}

.sign {
  margin: 0;
  font-size: 0.72rem;
}

.reveal {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.reveal.is-in {
  opacity: 1;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes spark {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.4);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--x), var(--y)) scale(1);
  }
}

@keyframes fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  8% {
    opacity: 0.55;
  }
  100% {
    transform: translate3d(var(--drift, 40px), 120vh, 0) rotate(260deg);
    opacity: 0;
  }
}

@keyframes mote {
  0% {
    transform: translate3d(0, 110vh, 0);
    opacity: 0;
  }
  12% {
    opacity: 0.7;
  }
  100% {
    transform: translate3d(var(--drift, -30px), -10vh, 0);
    opacity: 0;
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(4%, -6%);
  }
}

@media (max-width: 859px) {
  .shade--side {
    background:
      linear-gradient(180deg, rgba(10, 7, 5, 0.38) 0%, rgba(10, 7, 5, 0.5) 48%, rgba(10, 7, 5, 0.72) 100%),
      radial-gradient(ellipse at 50% 20%, rgba(196, 165, 116, 0.12), transparent 50%);
  }

  .stage--left {
    justify-items: center;
    text-align: center;
  }
}

@media (min-width: 860px) {
  .gold-frame {
    inset: 22px;
  }

  .glass {
    padding: 2.6rem 2.3rem;
  }

  .stage--left {
    padding-left: 8vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gift-scene,
  .gift-lid,
  .gift-glow,
  .reveal,
  .petal,
  .mote,
  .glow {
    animation: none !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1;
  }

  .petals,
  .motes,
  .glow {
    display: none;
  }
}
