:root {
  --ink: #1c1612;
  --paper: #f4efe6;
  --muted: #6d6258;
  --gold: #e7c98a;
  --night: #14110e;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Outfit", "Segoe UI", sans-serif;
  color: var(--paper);
  background: var(--night);
}

button, a {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.gift-scene {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 2.5rem 1.25rem 3rem;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 30%, #3a2c24 0%, transparent 55%),
    var(--night);
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gold);
}

h1 {
  margin: 0.2rem 0 1.6rem;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 560;
  font-size: clamp(3.2rem, 10vw, 5.5rem);
  line-height: 0.95;
}

.stage {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0.25rem 0 0.5rem;
}

.gift {
  --box: #c4a27a;
  --box-mid: #d7b892;
  --box-dark: #a4845c;
  --lid: #edd7b4;
  --lid-mid: #c9a67c;
  --lid-edge: #9a784f;
  --ribbon: #8d2433;
  --ribbon-dark: #641824;
  --ribbon-light: #c25060;

  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.gift--inner {
  --box: #2f5d4a;
  --box-mid: #3d7a61;
  --box-dark: #244739;
  --lid: #4a9173;
  --lid-mid: #356b54;
  --lid-edge: #1f3d31;
  --ribbon: #c9a24a;
  --ribbon-dark: #8f6f28;
  --ribbon-light: #e0c06a;
}

.gift:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 12px;
  border-radius: 8px;
}

.box {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  height: 230px;
}

.cavity {
  position: absolute;
  z-index: 1;
  left: 34px;
  right: 34px;
  bottom: 0;
  height: 520px;
  overflow: hidden;
  pointer-events: none;
}

.inner-rise,
.photo-crop {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -96px;
  height: 168px;
  overflow: hidden;
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.55s;
}

.inner-rise {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
}

.gift-photo {
  position: absolute;
  left: -22%;
  top: -20%;
  width: 144%;
  max-width: none;
}

.mini-gift {
  position: relative;
  width: 118px;
  height: 108px;
}

.mini-body {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 62px;
  border-radius: 3px 3px 6px 6px;
  background: linear-gradient(180deg, #3d7a61, #244739);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.28);
}

.mini-body::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 18px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #8f6f28, #c9a24a 45%, #e0c06a 60%, #8f6f28);
}

.mini-lid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 54px;
  height: 28px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #4a9173, #356b54);
  box-shadow: 0 4px 0 #1f3d31;
}

.mini-lid::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 18px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #8f6f28, #c9a24a 45%, #e0c06a 60%, #8f6f28);
}

.mini-bow {
  position: absolute;
  left: 50%;
  bottom: 68px;
  width: 34px;
  height: 18px;
  transform: translateX(-50%);
  background: #c9a24a;
  border-radius: 999px;
  box-shadow:
    -16px 4px 0 -4px #c9a24a,
    16px 4px 0 -4px #c9a24a;
}

.box-body {
  position: absolute;
  z-index: 2;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 132px;
  border-radius: 3px 3px 8px 8px;
  background: linear-gradient(180deg, var(--box-mid) 0%, var(--box) 38%, var(--box-dark) 100%);
  box-shadow:
    0 18px 30px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.box-body::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 14px;
  right: 14px;
  top: 10px;
  height: 18px;
  border-radius: 3px;
  background: rgba(20, 14, 10, 0.28);
  opacity: 0;
  transition: opacity 0.4s ease 0.7s;
}

.ribbon-v,
.band,
.ribbon-lid,
.tail {
  background: linear-gradient(90deg, var(--ribbon-dark), var(--ribbon) 42%, var(--ribbon-light) 62%, var(--ribbon-dark));
}

.ribbon-v {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 34px;
  transform: translateX(-50%);
  transition: transform 0.55s ease 0.2s, opacity 0.45s ease 0.28s;
}

.band {
  position: absolute;
  z-index: 2;
  top: 46px;
  width: 52%;
  height: 34px;
  transition: transform 0.55s ease 0.15s, opacity 0.4s ease 0.35s;
}

.band-left { left: 0; }
.band-right { right: 0; }

.lid {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 124px;
  height: 70px;
  transition: transform 0.5s ease 0.32s, opacity 0.35s ease 0.45s;
}

.lid-face {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--lid), var(--lid-mid));
  box-shadow:
    0 7px 0 var(--lid-edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.ribbon-lid {
  bottom: 0;
  height: 46px;
  top: auto;
}

.bow {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 132px;
  height: 58px;
  transform: translateX(-50%);
  z-index: 4;
}

.loop {
  position: absolute;
  top: 0;
  width: 54px;
  height: 36px;
  border: 9px solid var(--ribbon);
  border-bottom-color: transparent;
  border-radius: 50% 50% 42% 42%;
  transition: transform 0.55s ease, opacity 0.45s ease;
}

.loop-left {
  left: 8px;
  transform: rotate(-16deg);
  border-right-color: var(--ribbon-dark);
}

.loop-right {
  right: 8px;
  transform: rotate(16deg);
  border-left-color: var(--ribbon-light);
}

.knot {
  position: absolute;
  left: 50%;
  top: 24px;
  width: 18px;
  height: 16px;
  transform: translateX(-50%);
  background: var(--ribbon);
  border-radius: 3px;
  box-shadow: inset 0 -3px 0 var(--ribbon-dark);
  transition: transform 0.45s ease, opacity 0.35s ease;
}

.tail {
  position: absolute;
  top: 34px;
  width: 16px;
  height: 28px;
  border-radius: 2px;
  transition: transform 0.55s ease, opacity 0.4s ease;
}

.tail-left {
  left: 46px;
  transform: rotate(28deg);
}

.tail-right {
  right: 46px;
  transform: rotate(-28deg);
}

.gift.is-open .loop-left {
  transform: translate(-78px, -36px) rotate(-50deg);
  opacity: 0;
}

.gift.is-open .loop-right {
  transform: translate(78px, -28px) rotate(50deg);
  opacity: 0;
}

.gift.is-open .knot {
  transform: translateX(-50%) translateY(-24px) scale(0.6);
  opacity: 0;
}

.gift.is-open .tail-left {
  transform: translate(-36px, 70px) rotate(80deg);
  opacity: 0;
}

.gift.is-open .tail-right {
  transform: translate(36px, 70px) rotate(-80deg);
  opacity: 0;
}

.gift.is-open .band-left {
  transform: translateX(-120%);
  opacity: 0;
}

.gift.is-open .band-right {
  transform: translateX(120%);
  opacity: 0;
}

.gift.is-open .ribbon-v {
  transform: translateX(-50%) translateY(24px);
  opacity: 0;
}

.gift.is-open .lid {
  transform: translateY(-28px);
  opacity: 0;
}

.gift.is-open .box-body::after {
  opacity: 1;
}

.gift.is-open .inner-rise,
.gift.is-open .photo-crop {
  transform: translateY(-210px);
}

.gift--outer.is-spent {
  animation: spent 0.45s ease forwards;
  pointer-events: none;
}

.gift--inner.is-arrive {
  animation: arrive 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  pointer-events: none;
}

.gift--inner.is-ready {
  pointer-events: auto;
}

@keyframes spent {
  to {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: scale(0.86) translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hint {
  margin: 0.25rem 0 0;
  color: rgba(244, 239, 230, 0.72);
  font-size: 0.95rem;
  min-height: 1.2em;
}

.gift-scene.is-leaving {
  animation: fade-out 0.45s ease forwards;
}

@keyframes fade-out {
  to { opacity: 0; transform: scale(0.98); }
}

.present {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 50% 0%, #fffaf2 0%, var(--paper) 42%);
  color: var(--ink);
  padding: 3.5rem 1.25rem 4rem;
}

.present-inner {
  max-width: 640px;
  margin: 0 auto;
}

.present h2 {
  margin: 0.35rem 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 560;
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  outline: none;
}

.lead {
  margin: 0.55rem 0 1.6rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  color: #3d342c;
}

.hero {
  margin: 0;
  background: #fff;
  border-radius: 18px;
  padding: 0.75rem;
  box-shadow: 0 18px 40px rgba(60, 36, 16, 0.1);
}

.hero img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 10px;
  background: #fafafa;
}

.thumbs {
  display: flex;
  gap: 0.55rem;
  margin: 0.85rem 0 1.8rem;
  overflow-x: auto;
}

.thumb {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.thumb.is-selected {
  border-color: #8a5a32;
}

.thumb:focus-visible {
  outline: 2px solid #8a5a32;
  outline-offset: 2px;
}

.copy h3 {
  margin: 0 0 0.4rem;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 560;
  font-size: 1.45rem;
}

.copy p {
  margin: 0;
  line-height: 1.55;
  font-size: 1.05rem;
  color: var(--muted);
}

.copy a {
  color: #7a2c38;
}

.present.is-visible .present-inner {
  animation: rise 0.7s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gift.is-open .lid,
  .gift.is-open .loop-left,
  .gift.is-open .loop-right,
  .gift.is-open .knot,
  .gift.is-open .tail-left,
  .gift.is-open .tail-right,
  .gift.is-open .band-left,
  .gift.is-open .band-right,
  .gift.is-open .ribbon-v,
  .gift.is-open .inner-rise,
  .gift.is-open .photo-crop,
  .gift--outer.is-spent,
  .gift--inner.is-arrive,
  .gift-scene.is-leaving,
  .present.is-visible .present-inner {
    animation: none;
    transition: none;
  }
}
