/* openthis.gift — custom layer on top of Tailwind CDN.
   Everything here exists because Tailwind can't express it: the box, the
   unwrap, the foil, the confetti. Keep utility work in the markup. */

:root {
  --ink:    #150726;
  --ink-2:  #241041;
  --gold:   #F5C451;
  --rose:   #FF5D8F;
  --mint:   #4ADE9B;
  --violet: #A78BFA;
  --paper:  #FFF6E9;
  --accent: var(--gold);
}

html { -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Outfit', ui-sans-serif, system-ui, sans-serif;
  background: var(--ink);
  color: var(--paper);
  overflow-x: hidden;
}

.display {
  font-family: 'Fraunces', ui-serif, Georgia, serif;
  font-variation-settings: 'SOFT' 40, 'WONK' 1, 'opsz' 100;
  letter-spacing: -0.02em;
}

/* ---------- ambient night sky ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(90rem 50rem at 50% -20%, #3A1660 0%, transparent 60%),
    radial-gradient(60rem 40rem at 90% 10%, #4A1240 0%, transparent 55%),
    var(--ink);
}
.sky::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,246,233,.55), transparent),
    radial-gradient(1.5px 1.5px at 70% 15%, rgba(255,246,233,.4), transparent),
    radial-gradient(1px 1px at 45% 60%, rgba(245,196,81,.5), transparent),
    radial-gradient(1.5px 1.5px at 85% 55%, rgba(255,246,233,.35), transparent),
    radial-gradient(1px 1px at 12% 75%, rgba(255,93,143,.45), transparent);
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .5 } to { opacity: 1 } }

/* ---------- the gift box (signature element) ---------- */

.gift {
  position: relative;
  display: block;
  width: 200px;
  height: 210px;
  margin: 0 auto;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 800px;
}
@media (min-width: 640px) { .gift { width: 240px; height: 250px; } }

.gift:focus-visible { outline: 3px solid var(--paper); outline-offset: 14px; border-radius: 12px; }

.gift__glow {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 150%;
  height: 60%;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 45%, transparent), transparent);
  filter: blur(14px);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity:.55; transform:translateX(-50%) scale(.92) } 50% { opacity:1; transform:translateX(-50%) scale(1.06) } }

/* box + lid share this wrapper so the idle nudge rotates them as one object */
.gift__stage {
  position: absolute;
  inset: 0;
  transform-origin: 50% 92%;
}

.gift__box {
  position: absolute;
  left: 8%;
  bottom: 0;
  width: 84%;
  height: 66%;
  border-radius: 10px;
  background:
    linear-gradient(115deg,
      color-mix(in srgb, var(--accent) 88%, #fff) 0%,
      color-mix(in srgb, var(--accent) 65%, #000) 38%,
      color-mix(in srgb, var(--accent) 95%, #fff) 55%,
      color-mix(in srgb, var(--accent) 60%, #000) 100%);
  background-size: 250% 100%;
  box-shadow: inset 0 -14px 24px rgba(0,0,0,.32), 0 18px 40px rgba(0,0,0,.45);
  animation: foil 5s linear infinite;
}
@keyframes foil { from { background-position: 0% 0 } to { background-position: 250% 0 } }

.gift__ribbon-v {
  position: absolute;
  left: 50%;
  top: 0;
  width: 17%;
  height: 100%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, var(--paper), color-mix(in srgb, var(--paper) 78%, #000));
  box-shadow: 0 0 12px rgba(0,0,0,.25);
}

.gift__lid {
  position: absolute;
  left: 2%;
  bottom: 62%;
  width: 96%;
  height: 22%;
  border-radius: 8px;
  transform-origin: 50% 100%;
  background:
    linear-gradient(115deg,
      color-mix(in srgb, var(--accent) 95%, #fff),
      color-mix(in srgb, var(--accent) 62%, #000));
  box-shadow: 0 10px 24px rgba(0,0,0,.4);
  transition: transform .1s ease;
}
.gift__ribbon-lid {
  position: absolute;
  left: 50%;
  top: 0;
  width: 15%;
  height: 100%;
  transform: translateX(-50%);
  background: var(--paper);
}
.gift__bow {
  position: absolute;
  left: 50%;
  top: -46%;
  width: 62%;
  height: 60%;
  transform: translateX(-50%);
}
.gift__bow::before, .gift__bow::after {
  content: '';
  position: absolute;
  top: 8%;
  width: 46%;
  height: 84%;
  border-radius: 60% 60% 40% 40%;
  background: linear-gradient(160deg, var(--paper), color-mix(in srgb, var(--paper) 70%, var(--rose)));
  box-shadow: 0 4px 10px rgba(0,0,0,.3);
}
.gift__bow::before { left: 0;  transform: rotate(-24deg) skewX(-8deg); }
.gift__bow::after  { right: 0; transform: rotate(24deg)  skewX(8deg); }

.gift__hint {
  position: absolute;
  left: 50%;
  bottom: -34px;
  transform: translateX(-50%);
  font-size: .78rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--paper) 65%, transparent);
  white-space: nowrap;
}

/* idle nudge — the whole parcel tilts, so people know it's tappable */
.gift:not(.is-open) .gift__stage { animation: nudge 3.4s ease-in-out infinite; }
@keyframes nudge {
  0%, 86%, 100% { transform: rotate(0deg) }
  90% { transform: rotate(-2.5deg) }
  95% { transform: rotate(2.5deg) }
}

.gift:active:not(.is-open) .gift__stage { animation-play-state: paused; }
.gift:active:not(.is-open) { transform: scale(.96); transition: transform .08s ease; }
.gift.is-open .gift__stage { animation: none; }

/* open state */
.gift.is-open { pointer-events: none; }
.gift.is-open .gift__lid {
  animation: none;
  transform: translateY(-150px) rotate(-24deg);
  opacity: 0;
  transition: transform .7s cubic-bezier(.2,.9,.25,1), opacity .7s ease .25s;
}
.gift.is-open .gift__box {
  animation: none;
  transform: scale(.86) translateY(24px);
  opacity: 0;
  transition: transform .6s ease .1s, opacity .5s ease .2s;
}
.gift.is-open .gift__hint, .gift.is-open .gift__glow { opacity: 0; transition: opacity .3s; }

/* ---------- the card that comes out ---------- */

.cardface {
  position: relative;
  background: var(--paper);
  color: #2A1436;
  border-radius: 22px;
  box-shadow: 0 30px 70px rgba(0,0,0,.5);
}
.cardface::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 14px;
  pointer-events: none;
}

.reveal {
  opacity: 0;
  transform: translateY(26px) scale(.96);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .6s ease, transform .7s cubic-bezier(.2,.9,.25,1);
}

/* ---------- confetti ---------- */

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}
.confetti span {
  position: absolute;
  font-size: 22px;
  will-change: transform, opacity;
}

/* ---------- misc ---------- */

.chip {
  border: 1px solid rgba(255,246,233,.18);
  background: rgba(255,246,233,.05);
  transition: background .18s, border-color .18s, transform .18s;
}
.chip:hover { background: rgba(255,246,233,.12); transform: translateY(-1px); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #22102F;
  font-weight: 600;
}

.linkbox {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .85rem;
  word-break: break-all;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
