/* Empress Palace — fun features styles */

/* ——— Sway animations ——— */
@keyframes sway-a {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}
@keyframes sway-b {
  0%, 100% { transform: rotate(2.5deg); }
  50%      { transform: rotate(-2.5deg); }
}
.sway-a { animation: sway-a 4.5s ease-in-out infinite; transform-origin: 50% 0; }
.sway-b { animation: sway-b 5.2s ease-in-out infinite; transform-origin: 50% 0; }

/* ——— Hanging lanterns inside hero ——— */
.hanging-lanterns {
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 130px;
  pointer-events: none;
  z-index: 1;
}
.hanging-lanterns .hl-1 {
  position: absolute;
  top: 0;
  left: 6%;
  filter: drop-shadow(0 8px 12px rgba(107, 24, 24, 0.18));
}
.hanging-lanterns .hl-2 {
  position: absolute;
  top: 12px;
  right: 6%;
  filter: drop-shadow(0 8px 12px rgba(107, 24, 24, 0.18));
}

/* ——— Drifting dumplings ——— */
.drift-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
@keyframes drift-up {
  0%   { transform: translateY(40px) scale(var(--s, 0.7)); opacity: 0; }
  15%  { opacity: 0.45; }
  85%  { opacity: 0.3; }
  100% { transform: translateY(-200px) scale(var(--s, 0.7)); opacity: 0; }
}
.drift-dumpling {
  position: absolute;
  bottom: 0;
  width: 50px;
  height: 36px;
  opacity: 0;
  animation: drift-up linear infinite both;
  filter: drop-shadow(0 2px 4px rgba(165, 42, 42, 0.1));
}
/* Position hero content above drifters/lanterns */
.hero .hero-grid { position: relative; z-index: 2; }

/* ——— Lucky cat ——— */
.lucky-cat {
  position: fixed;
  bottom: 110px;
  right: 24px;
  z-index: 55;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.18));
}
@keyframes paw-wave {
  0%, 100% { transform: rotate(0deg); }
  10%, 30%, 50%, 70% { transform: rotate(-22deg); }
  20%, 40%, 60%      { transform: rotate(18deg); }
  85% { transform: rotate(0deg); }
}
.cat-paw {
  transform-origin: 76px 92px;
  transition: transform 0.5s ease;
}
.cat-paw.wave { animation: paw-wave 2.4s ease-in-out; }
.cat-paw.idle { transform: rotate(-8deg); }

/* ——— Fortune lantern ——— */
.fortune-wrap {
  position: fixed;
  top: 90px;
  right: 24px;
  z-index: 55;
  pointer-events: auto;
  transition: opacity 0.45s ease, transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: top right;
}
.fortune-wrap.is-hidden {
  opacity: 0;
  transform: translateY(-40px) scale(0.5);
  pointer-events: none;
}
.fortune-wrap.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.fortune-lantern-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: block;
  filter: drop-shadow(0 8px 16px rgba(107, 24, 24, 0.25));
  transition: transform 0.2s ease;
}
.fortune-lantern-btn:hover { transform: scale(1.06); }
.fortune-lantern-btn:active { transform: scale(0.96); }
.fortune-lantern-btn.is-open .sway-a { animation-play-state: paused; }

.fortune-hint {
  position: absolute;
  top: 20px;
  right: 78px;
  background: var(--parchment);
  border: 1px solid var(--gold);
  padding: 8px 12px;
  border-radius: 4px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  color: var(--red-deep);
  white-space: nowrap;
  text-align: right;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  animation: hint-bob 2s ease-in-out infinite;
}
.fortune-hint::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -7px;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: var(--gold);
}
@keyframes hint-bob {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(-4px); }
}

.fortune-slip {
  position: absolute;
  top: 100px;
  right: 0;
  width: 260px;
  background: var(--parchment);
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 24px 24px 20px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0,0,0,0.25);
  transform: translateY(-20px) scaleY(0.5);
  transform-origin: top center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fortune-slip.open {
  opacity: 1;
  transform: translateY(0) scaleY(1);
  pointer-events: auto;
}
.fortune-slip::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  right: auto;
  width: 1px;
  height: 8px;
  background: var(--gold);
}
.fortune-stamp {
  width: 44px;
  height: 44px;
  background: var(--red);
  color: var(--gold);
  border: 1.5px solid var(--gold);
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  border-radius: 3px;
  transform: rotate(-4deg);
}
.fortune-eyebrow {
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  letter-spacing: 0.25em;
  color: var(--gold-deep);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.fortune-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  line-height: 1.4;
  color: var(--ink);
  margin: 0 0 6px;
  font-style: italic;
}
.fortune-cn-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  color: var(--gold-deep);
  letter-spacing: 0.15em;
  margin: 0 0 14px;
}
.fortune-again { font-size: 13px; padding: 6px 14px; }
.fortune-close {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 22px;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.fortune-close:hover { color: var(--red); }

/* ——— Red envelope confetti ——— */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 250;
}
@keyframes hongbao-fall {
  0%   { transform: translateY(-120px) rotate(var(--rot0, 0deg)); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(var(--rot1, 360deg)); opacity: 0; }
}
.hongbao {
  position: absolute;
  top: 0;
  opacity: 0;
  animation: hongbao-fall ease-in both;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

/* ——— Plum blossom petals ——— */
.petals-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}
@keyframes petal-fall {
  0%   { transform: translateY(-60px) translateX(0) rotate(var(--rot0, 0deg)) scale(var(--scale, 0.7)); opacity: 0; }
  10%  { opacity: 0.9; }
  90%  { opacity: 0.7; }
  100% { transform: translateY(105vh) translateX(var(--drift, 0px)) rotate(var(--rot1, 360deg)) scale(var(--scale, 0.7)); opacity: 0; }
}
.petal {
  position: absolute;
  top: 0;
  width: 22px;
  height: 22px;
  animation: petal-fall ease-in forwards;
  filter: drop-shadow(0 2px 4px rgba(216, 143, 168, 0.2));
}

/* ——— Mobile: hide some fixed elements so the corners don't get crowded ——— */
@media (max-width: 720px) {
  .lucky-cat, .fortune-wrap { display: none; }
  .hanging-lanterns .hl-1 { left: -8px; transform: scale(0.7); transform-origin: top left; }
  .hanging-lanterns .hl-2 { right: -8px; transform: scale(0.7); transform-origin: top right; }
}

/* ——— Toast stack ——— */
.toast-stack {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
@keyframes toast-in {
  0%   { opacity: 0; transform: translateY(22px) scale(0.95); }
  60%  { opacity: 1; transform: translateY(-4px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-10px); }
}
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--white);
  border: 1px solid var(--gold);
  border-left: 4px solid var(--red);
  border-radius: 4px;
  padding: 12px 20px 12px 14px;
  box-shadow: 0 12px 28px rgba(107, 24, 24, 0.18);
  font-family: 'Source Sans 3', sans-serif;
  min-width: 280px;
  max-width: 380px;
  animation: toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both,
             toast-out 0.3s ease 2.5s forwards;
}
.toast-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--parchment-warm);
  border: 1.5px solid var(--gold);
  display: grid;
  place-items: center;
  font-size: 19px;
  flex-shrink: 0;
  line-height: 1;
}
.toast-title {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 17px;
  font-weight: 500;
  color: var(--red-deep);
  line-height: 1.2;
}
.toast-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.toast-price { color: var(--red-deep); font-weight: 600; margin-left: 4px; }

/* ——— Cart fab bump animation ——— */
@keyframes fab-bump {
  0%, 100% { transform: scale(1); }
  40%      { transform: scale(1.12); }
}
.cart-fab.bump { animation: fab-bump 0.45s ease-out; }
