/* ──────────────────────────────────────────────────────────────────────────
   Birthday surprise overlay — warm & elegant.
   Loaded by legacy/footer.php. Trigger: type "DAD" or triple-click logo.
   Revert: delete legacy/birthday/ and remove the two <tag> lines in
   footer.php that reference it.
   ────────────────────────────────────────────────────────────────────────── */

@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=Inter:wght@400;500&display=swap");

#bday-root {
    position: fixed;
    inset: 0;
    z-index: 2147483600; /* sit above legacy modals / sticky headers */
    pointer-events: none;
    opacity: 0;
    transition: opacity 480ms cubic-bezier(0.16, 1, 0.3, 1);
    font-family: "Inter", system-ui, sans-serif;
    color: #5a3f12;
}

#bday-root.bday-armed,
#bday-root.bday-celebrate,
#bday-root.bday-exit {
    pointer-events: auto;
    opacity: 1;
}

/* Soft warm wash that intensifies through stages */
#bday-root .bday-wash {
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 90% at 50% 50%, rgba(255, 250, 235, 0) 0%, rgba(255, 232, 196, 0) 100%);
    transition: background 1100ms cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition-property: background, backdrop-filter, -webkit-backdrop-filter;
}

#bday-root.bday-armed .bday-wash {
    background: radial-gradient(120% 90% at 50% 50%, rgba(255, 250, 235, 0.7) 0%, rgba(255, 226, 184, 0.85) 80%);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#bday-root.bday-celebrate .bday-wash,
#bday-root.bday-exit .bday-wash {
    background: radial-gradient(120% 90% at 50% 45%, rgba(255, 250, 239, 0.98) 0%, rgba(252, 220, 170, 1) 80%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Inner golden halo during celebrate */
#bday-root .bday-halo {
    position: absolute;
    inset: 0;
    background: radial-gradient(50% 45% at 50% 45%, rgba(255, 220, 160, 0.6) 0%, rgba(255, 220, 160, 0) 70%);
    opacity: 0;
    transition: opacity 700ms ease-out;
    pointer-events: none;
}

#bday-root.bday-celebrate .bday-halo,
#bday-root.bday-exit .bday-halo {
    opacity: 1;
}

/* Center stage container */
#bday-root .bday-stage {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.75rem;
    padding: 2rem;
    text-align: center;
}

/* Gift box */
#bday-root .bday-gift {
    width: 220px;
    height: 220px;
    cursor: pointer;
    background: transparent;
    border: 0;
    padding: 0;
    outline: none;
    opacity: 0;
    transform: translateY(-280px) rotate(-12deg);
    filter: drop-shadow(0 24px 36px rgba(140, 95, 20, 0.32));
    transition: transform 220ms ease-out, filter 220ms ease-out;
    animation: none;
}

#bday-root.bday-armed .bday-gift {
    animation: bday-drop 1100ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
        bday-float 3000ms ease-in-out 1300ms infinite;
}

#bday-root .bday-gift:hover {
    filter: drop-shadow(0 30px 44px rgba(140, 95, 20, 0.42)) brightness(1.04);
}

#bday-root .bday-gift:active {
    transform: scale(0.96);
}

#bday-root .bday-gift svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

#bday-root .bday-prompt {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-style: italic;
    font-size: clamp(1.25rem, 2.2vw, 1.75rem);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #7c5a1e;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 700ms ease-out, transform 700ms ease-out;
    transition-delay: 700ms;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

#bday-root.bday-armed .bday-prompt {
    opacity: 1;
    transform: translateY(0);
}

#bday-root.bday-celebrate .bday-gift,
#bday-root.bday-exit .bday-gift,
#bday-root.bday-celebrate .bday-prompt,
#bday-root.bday-exit .bday-prompt {
    opacity: 0;
    transform: scale(1.5);
    pointer-events: none;
    transition: opacity 500ms ease-in, transform 500ms ease-in;
    animation: none;
}

/* Headline */
#bday-root .bday-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.9) translateY(28px);
    opacity: 0;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-weight: 500;
    font-size: clamp(2.5rem, 8vw, 6rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
    background: linear-gradient(180deg, #b78a3a 0%, #e7c285 45%, #8d6320 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
    transition: opacity 1100ms cubic-bezier(0.16, 1, 0.3, 1),
        transform 1100ms cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: 350ms;
    padding: 0 1rem;
    white-space: nowrap;
    pointer-events: none;
}

#bday-root.bday-celebrate .bday-title,
#bday-root.bday-exit .bday-title {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) translateY(0);
}

/* Subtitle that fades in after the title */
#bday-root .bday-subtitle {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, calc(-50% + 5rem));
    opacity: 0;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-style: italic;
    font-size: clamp(1rem, 1.8vw, 1.35rem);
    color: #7c5a1e;
    transition: opacity 900ms ease-out;
    transition-delay: 1700ms;
    pointer-events: none;
    letter-spacing: 0.04em;
}

#bday-root.bday-celebrate .bday-subtitle,
#bday-root.bday-exit .bday-subtitle {
    opacity: 0.85;
}

/* Confetti pieces */
#bday-root .bday-confetti {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

#bday-root .bday-confetti span {
    position: absolute;
    top: -12vh;
    width: 9px;
    height: 4px;
    border-radius: 2px;
    opacity: 0;
    animation: bday-fall var(--bday-dur, 4s) cubic-bezier(0.45, 0, 0.55, 1) var(--bday-delay, 0s) forwards;
    transform-origin: center;
}

/* Radial wipe that scales out from the center at the end, fading to cream */
#bday-root .bday-wipe {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at center, #fff8ea 0%, #fcdfb0 100%);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    box-shadow: 0 0 80px 30px rgba(255, 232, 196, 0.6);
    transition: transform 1400ms cubic-bezier(0.7, 0, 0.3, 1),
        opacity 600ms ease-out;
}

#bday-root.bday-exit .bday-wipe {
    transform: translate(-50%, -50%) scale(150);
    opacity: 1;
}

#bday-root.bday-exit .bday-title,
#bday-root.bday-exit .bday-subtitle {
    transition-delay: 0ms;
    transition-duration: 700ms;
    opacity: 0;
}

/* Hint badge — sits outside #bday-root so it can show before the overlay exists. */
.bday-hint {
    position: fixed !important;
    right: 22px;
    bottom: 22px;
    z-index: 2147483599;
    padding: 10px 16px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 248, 234, 0.97), rgba(252, 224, 170, 0.97));
    border: 1px solid rgba(184, 134, 11, 0.4);
    color: #7c5a1e;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-style: italic;
    font-size: 1rem;
    line-height: 1;
    letter-spacing: 0.04em;
    box-shadow: 0 10px 24px -10px rgba(140, 95, 20, 0.45), 0 2px 6px rgba(140, 95, 20, 0.18);
    cursor: pointer;
    opacity: 0;
    transform: translateY(6px) scale(0.96);
    transition: opacity 700ms ease-out, transform 700ms ease-out, box-shadow 200ms ease-out;
    user-select: none;
    margin: 0;
    outline: none;
}

.bday-hint:hover {
    box-shadow: 0 14px 30px -10px rgba(140, 95, 20, 0.55), 0 2px 6px rgba(140, 95, 20, 0.2);
}

.bday-hint.bday-hint-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: bday-hint-pulse 2.6s ease-in-out 1s infinite;
}

.bday-hint::before {
    content: "🎁";
    margin-right: 8px;
}

@keyframes bday-hint-pulse {
    0%, 100% {
        box-shadow: 0 10px 24px -10px rgba(140, 95, 20, 0.45), 0 0 0 0 rgba(184, 134, 11, 0.0);
    }
    50% {
        box-shadow: 0 10px 24px -10px rgba(140, 95, 20, 0.45), 0 0 0 10px rgba(184, 134, 11, 0.0);
    }
}

@keyframes bday-drop {
    0% {
        opacity: 0;
        transform: translateY(-300px) rotate(-12deg);
    }
    60% {
        opacity: 1;
        transform: translateY(14px) rotate(2deg);
    }
    78% {
        transform: translateY(-6px) rotate(-1deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(0);
    }
}

@keyframes bday-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes bday-fall {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--bday-sway, 30px), 112vh) rotate(var(--bday-spin, 720deg));
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    #bday-root .bday-gift,
    #bday-root .bday-prompt,
    #bday-root .bday-title,
    #bday-root .bday-subtitle,
    #bday-root .bday-confetti span {
        transition-duration: 250ms !important;
        animation-duration: 250ms !important;
    }
}
