.gift {
  --tilt-x: -24deg;
  position: absolute;
  z-index: 5;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.gift:focus { outline: none; }
.gift:focus-visible .g-light-pool { opacity: 1; }
.gift:focus-visible::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -6px;
  height: 3px;
  border-radius: 2px;
  background: #f2c35b;
}

.g-camera {
  position: absolute;
  inset: 0;
  perspective: 760px;
  perspective-origin: 50% var(--anchor-y);
  transform-origin: 50% 100%;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.g-world {
  position: absolute;
  left: 50%;
  top: var(--anchor-y);
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--tilt-x)) rotateY(var(--rotation-y));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}
.g-box, .g-lid, .g-bow {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
}

.g-face {
  position: absolute;
  left: 0;
  top: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.g-face::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.g-box .g-front::after  { background: linear-gradient(rgba(20, 10, 0, .3), rgba(20, 10, 0, 0) calc(var(--lid-height) + 7px)), linear-gradient(rgba(255, 240, 220, .05), rgba(20, 10, 0, .16)); }
.g-box .g-left::after  { background: linear-gradient(rgba(20, 10, 0, .32), rgba(20, 10, 0, .1) calc(var(--lid-height) + 7px), rgba(20, 10, 0, .22)); }
.g-box .g-right::after { background: linear-gradient(rgba(20, 10, 0, .42), rgba(20, 10, 0, .26) calc(var(--lid-height) + 7px), rgba(20, 10, 0, .4)); }
.g-box-top::after   { background: linear-gradient(140deg, rgba(255, 246, 228, .2), rgba(255, 246, 228, 0) 55%, rgba(20, 10, 0, .06)); }
.g-box-front::after  { background: rgba(20, 10, 0, .05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28); }
.g-box-left::after  { background: rgba(20, 10, 0, .12); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18); }
.g-box-right::after { background: rgba(20, 10, 0, .28); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }
.g-box-back::after { background: rgba(20, 10, 0, .22); }
.g-box-bottom { background: linear-gradient(to bottom, #e9dabd 35%, #ffd795); box-shadow: inset 0 0 0 3px var(--edge-color, #b89d74), inset 0 0 14px rgba(60, 35, 10, .35); }
.g-box-bottom::after { background: linear-gradient(rgba(20, 10, 0, .06), rgba(20, 10, 0, .22)); }

.g-ground-shadow {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(22, 12, 4, .55) 40%, rgba(22, 12, 4, .2) 70%, rgba(22, 12, 4, 0));
  pointer-events: none;
}
.g-inside, .g-box-bottom, .g-box-back { display: none; }
.gift--done.gift--opened .g-inside, .gift--opening .g-inside,
.gift--done.gift--opened .g-box-bottom, .gift--opening .g-box-bottom,
.gift--done.gift--opened .g-box-back, .gift--opening .g-box-back,
.gift--done.gift--unlocked:hover .g-inside { display: block; }
.g-inside {
  background: radial-gradient(ellipse at 50% 50%, #fff7dd 0%, #ffd889 40%, #f0a548 85%, #d9822f 100%);
}

.g-lid {
  transform-origin: 0 calc(var(--lid-height) / 2) calc(var(--lid-depth) / -2);
  transform: translateY(var(--lid-y));
  transition: transform .45s cubic-bezier(.3, 1.3, .5, 1);
}

.g-bow { transform: translateY(calc(var(--lid-height) / -2)); }
.g-plane {
  position: absolute;
  left: 0;
  top: 0;
  background: center / 100% 100% no-repeat;
  pointer-events: none;
}
.g-billboard {
  transform: translateY(var(--lift)) rotateY(calc(var(--rotation-y) * -1)) rotateX(calc(var(--tilt-x) * -1));
}

.g-front { background: var(--front-image); }
.gift--today .g-front { background: var(--front-image-today); }
.g-box-top { background: var(--top-image); }
.gift--today .g-box-top { background: var(--top-image-today); }

.g-tag, .g-tag__swing, .g-tag__card {
  position: absolute;
  left: 0;
  top: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}
.g-tag, .g-tag__swing { width: 0; height: 0; }
.g-tag__card {
  transform: var(--card-rest);
  transition: transform .7s cubic-bezier(.3, 1.35, .5, 1);
}
.g-tag__side {
  position: absolute;
  inset: 0;
  background: center / 100% 100% no-repeat;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.g-tag__front { background-image: var(--tag-front); }
.g-tag__back { background-image: var(--tag-back); transform: rotateY(180deg); }
.gift--today .g-tag__front { background-image: var(--tag-front-today); }
.gift--today .g-tag__back { background-image: var(--tag-back-today); }
.gift:hover .g-tag__card, .gift:focus-visible .g-tag__card { transform: var(--card-readable); }
.gift:hover .g-tag__swing { animation: g-tag-swing 1.9s ease-in-out; }
.cart--airborne .g-tag__swing { animation: g-tag-swing .8s ease-in-out infinite; }
@keyframes g-tag-swing {
  0%, 100% { transform: rotate(0deg); }
  18% { transform: rotate(11deg); }
  42% { transform: rotate(-8deg); }
  66% { transform: rotate(4deg); }
  84% { transform: rotate(-1.5deg); }
}

.gift--new-bow .g-bow { animation: g-bow-drop .75s cubic-bezier(.45, 0, .7, 1) both; }
@keyframes g-bow-drop {
  0%   { transform: translateY(calc(var(--lid-height) / -2 - 130px)) rotateZ(-14deg); opacity: 0; }
  12%  { opacity: 1; }
  70%  { transform: translateY(calc(var(--lid-height) / -2)) rotateZ(4deg); }
  84%  { transform: translateY(calc(var(--lid-height) / -2 - 9px)) rotateZ(-2deg); }
  100% { transform: translateY(calc(var(--lid-height) / -2)); opacity: 1; }
}

.gift--new-tag .g-tag__swing { animation: g-tag-in 1.4s cubic-bezier(.3, .7, .4, 1); }
@keyframes g-tag-in {
  0%   { transform: rotate(-70deg); opacity: 0; }
  15%  { opacity: 1; }
  40%  { transform: rotate(24deg); }
  62%  { transform: rotate(-12deg); }
  82%  { transform: rotate(5deg); }
  100% { transform: rotate(0deg); }
}

.gift--landing .g-camera { animation: g-land .55s cubic-bezier(.3, .7, .4, 1); }
@keyframes g-land {
  0%   { transform: scale(1.1, .84); }
  45%  { transform: scale(.95, 1.06) translateY(-5px); }
  100% { transform: none; }
}

.g-ray {
  position: absolute;
  left: 0;
  top: 0;
  display: none;
  pointer-events: none;
  opacity: 0;
  border-radius: 40% 40% 0 0;
  background: linear-gradient(to top, rgba(255, 216, 140, .7), rgba(255, 216, 140, .2) 45%, rgba(255, 216, 140, 0));
  transform: translateY(calc(var(--box-height) / -2)) rotateY(calc(var(--rotation-y) * -1)) rotateX(calc(var(--tilt-x) * -1));
}
.gift--opening .g-ray { display: block; }

.g-light-pool {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 34%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 205, 120, .55), rgba(255, 205, 120, 0));
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s;
}

.gift--done.gift--unlocked:hover .g-camera { transform: translateY(-3px); }
.gift--done.gift--unlocked:not(.gift--opened):hover .g-lid {
  transform: translateY(calc(var(--lid-y) - 6px)) rotateX(9deg);
}

.gift--today.gift--done .g-light-pool { opacity: 1; }
.gift--today.gift--done:not(.gift--opened) .g-camera { animation: g-hop 4s ease-in-out 1.2s infinite; }

.gift--done.gift--opened .g-lid { transform: translateY(var(--lid-y)) rotateX(112deg); }
.gift--opening .g-lid { animation: g-lid-open 1.05s cubic-bezier(.3, .8, .4, 1) forwards; }
.gift--opening .g-ray { animation: g-ray-pulse 1.6s ease-out forwards; }
.gift--opening .g-camera { animation: g-anticipation .35s ease-in-out; }

.gift--shaking .g-camera { animation: g-shake .6s ease; }

.no-transition .g-lid, .no-transition .g-world { transition: none !important; }

.gift--searched .g-light-pool { opacity: 1; animation: g-searched .9s ease-in-out 3; }
@keyframes g-searched { 50% { transform: translate(-50%, 34%) scale(1.5); } }

@keyframes g-lid-open {
  0%   { transform: translateY(var(--lid-y)) rotateX(0deg); }
  28%  { transform: translateY(calc(var(--lid-y) - 26px)) rotateX(-8deg); }
  58%  { transform: translateY(calc(var(--lid-y) - 8px)) rotateX(96deg); }
  80%  { transform: translateY(var(--lid-y)) rotateX(118deg); }
  100% { transform: translateY(var(--lid-y)) rotateX(112deg); }
}
@keyframes g-ray-pulse {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes g-anticipation {
  0%, 100% { transform: none; }
  30% { transform: scale(1.04, .95); }
  70% { transform: scale(.98, 1.03) translateY(-2px); }
}
@keyframes g-hop {
  0%, 72%, 100% { transform: none; }
  78% { transform: scale(1.03, .96); }
  84% { transform: translateY(-10px) scale(.98, 1.03); }
  90% { transform: none; }
  94% { transform: translateY(-3px); }
}
@keyframes g-shake {
  0%, 100% { transform: none; }
  15% { transform: rotate(-4deg); }
  32% { transform: rotate(3.5deg); }
  48% { transform: rotate(-2.5deg); }
  64% { transform: rotate(2deg); }
  80% { transform: rotate(-1deg); }
}
