/*
   Christmas gift popup, rebuilt from pop-up.psd (1200x748 artboard).

   Scaling: the card width is one expression — min(900px, 94vw, 141.1765vh) —
   and every type size repeats that same expression scaled by its own factor,
   so sizes and the card move in lockstep off the viewport alone. Positions and
   boxes are plain percentages of their parent. Everything therefore resolves
   in a single layout pass; container-query units were doing the same job but
   resolve in a later pass, which made the icon visibly trail the box it sits
   in while a window was being dragged.

   The 900px cap is a presentation choice, not the artboard. The artwork is
   1200px wide, so at the cap it is always displayed downscaled, which keeps it
   sharp on high-DPI screens. To change the cap, change it in the four places
   below together: each px term is the artboard value times cap/1200.

   The numbers come from the PSD: type size is the layer's font size times its
   transform scale (1.5147 / 1.3746 / 1.2554), line-height is that layer's
   explicit leading, and each block's offset is derived from its baseline using
   Rouna's metrics (1000 upm, 950 ascender, 250 descender).
*/

@font-face {
    font-family: 'Rouna';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/rouna-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Rouna';
    font-style: normal;
    font-weight: 700 800;
    font-display: swap;
    src: url('/fonts/rouna-bold.woff2') format('woff2');
}

#giftPopupOverlay,
#giftPopupOverlay * {
    box-sizing: border-box;
}

#giftPopupOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

#giftPopupOverlay.is-visible {
    display: flex;
}

.gift-popup-card {
    position: relative;
    width: min(900px, 94vw, 141.1765vh);
    aspect-ratio: 1200 / 748;
    flex: none;
    background: #F5F2EC;
    border-radius: var(--border_radius, 8px);
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .35);
}

.gift-popup-scene {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Not in the PSD — kept in px so it stays tappable when the card is small. */
.gift-popup-close {
    position: absolute;
    top: clamp(6px, min(1.41vw, 2.118vh), 20px);
    right: clamp(6px, min(1.41vw, 2.118vh), 20px);
    width: clamp(28px, min(3.76vw, 5.647vh), 44px);
    height: clamp(28px, min(3.76vw, 5.647vh), 44px);
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--primary_color, #0098A9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(12px, min(1.7vw, 2.55vh), 19px);
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
    transition: background-color .15s ease, transform .15s ease;
}

.gift-popup-close:hover,
.gift-popup-close:focus-visible {
    background: #007a87;
    transform: scale(1.06);
}

.gift-popup-text {
    position: absolute;
    inset: 0;
    z-index: 2;
}

/* nowrap: every break is an explicit <br> taken from the PSD's own hard
   returns, so the copy can never re-wrap into the phone or the button. */
.gift-popup-title,
.gift-popup-desc {
    position: absolute;
    margin: 0;
    white-space: nowrap;
    font-family: 'Rouna', system-ui, sans-serif;
    color: var(--black, #1d1d1b);
}

.gift-popup-title {
    left: 5.32618%;
    top: 9.81229%;
    font-size: min(61.12337px, 6.384vw, 9.58798vh);
    line-height: 0.99952;
    font-weight: 700;
}

.gift-popup-desc {
    left: 5.50827%;
    top: 36.81032%;
    font-size: min(30.84078px, 3.22115vw, 4.83777vh);
    line-height: 1.40358;
    font-weight: 400;
}

.gift-popup-title .hl,
.gift-popup-desc .hl {
    color: var(--primary_color, #0098A9);
}

.gift-popup-desc strong,
.gift-popup-desc .hl {
    font-weight: 700;
}

/* Stadium, not an ellipse: an over-large radius is clamped to half the height. */
.gift-popup-cta {
    position: absolute;
    left: 5.58333%;
    top: 73.93048%;
    width: 36.16667%;
    height: 16.17647%;
    border-radius: 9999px;
    background: var(--primary_color, #0098A9);
    border: none;
    display: block;
    cursor: pointer;
    z-index: 2;
    text-decoration: none;
    transition: background-color .15s ease;
}

.gift-popup-cta:hover,
.gift-popup-cta:focus-visible {
    background: #007a87;
}

/* Inline SVG rather than a bitmap: no resampling while the window is dragged,
   and it stays sharp on high-DPI screens, where the 58px source would not. */
.gift-popup-cta-icon {
    position: absolute;
    left: 8.06452%;
    top: 23.96694%;
    width: 13.36406%;
    height: 47.93388%;
    display: block;
    color: #fff;
}

.gift-popup-cta-label {
    position: absolute;
    left: 26.47667%;
    top: 34.65565%;
    font-family: 'Rouna', system-ui, sans-serif;
    font-weight: 700;
    font-size: min(28.16603px, 2.94179vw, 4.4182vh);
    line-height: 1;
    color: #fff;
    white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Entrance / exit.

   The card lands with a small overshoot and its contents follow in sequence,
   on the same bounce curve the gift landing page already uses, so the popup
   moves like the rest of the brand. Only opacity and transform are animated,
   so nothing here touches layout or re-triggers the scaling work above.

   Entrances use fill-mode `backwards` — it holds the from-state through the
   delay, then hands the property back to the stylesheet once finished, so a
   finished animation can't out-rank the close button's :hover transform the
   way `forwards` would. Exits use `forwards`: that end state has to survive
   until the overlay is actually hidden.
   --------------------------------------------------------------------------- */

@keyframes giftOverlayIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes giftOverlayOut { from { opacity: 1 } to { opacity: 0 } }

@keyframes giftCardIn {
    from { opacity: 0; transform: translateY(18px) scale(.9); }
    to   { opacity: 1; transform: none; }
}

@keyframes giftCardOut {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateY(8px) scale(.97); }
}

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

@keyframes giftPopIn {
    from { opacity: 0; transform: scale(.3) rotate(-18deg); }
    to   { opacity: 1; transform: none; }
}

#giftPopupOverlay.is-shown {
    animation: giftOverlayIn .24s ease-out backwards;
}

#giftPopupOverlay.is-shown .gift-popup-card {
    animation: giftCardIn .42s cubic-bezier(.26, .9, .37, 1.25) 40ms backwards;
}

#giftPopupOverlay.is-shown .gift-popup-title {
    animation: giftRise .36s ease-out 130ms backwards;
}

#giftPopupOverlay.is-shown .gift-popup-desc {
    animation: giftRise .36s ease-out 185ms backwards;
}

#giftPopupOverlay.is-shown .gift-popup-cta {
    animation: giftRise .38s cubic-bezier(.26, .9, .37, 1.25) 240ms backwards;
}

/* The gift gets the springiest curve of the set — it is the thing being sold. */
#giftPopupOverlay.is-shown .gift-popup-cta-icon {
    animation: giftPopIn .36s cubic-bezier(.3, 1.5, .5, 1) 330ms backwards;
}

#giftPopupOverlay.is-shown .gift-popup-close {
    animation: giftPopIn .3s cubic-bezier(.3, 1.5, .5, 1) 300ms backwards;
}

#giftPopupOverlay.is-closing {
    animation: giftOverlayOut .18s ease-in forwards;
}

#giftPopupOverlay.is-closing .gift-popup-card {
    animation: giftCardOut .18s ease-in forwards;
}

/* Same reveal, no travel and no stagger. */
@media (prefers-reduced-motion: reduce) {
    #giftPopupOverlay.is-shown,
    #giftPopupOverlay.is-shown .gift-popup-card,
    #giftPopupOverlay.is-shown .gift-popup-title,
    #giftPopupOverlay.is-shown .gift-popup-desc,
    #giftPopupOverlay.is-shown .gift-popup-cta,
    #giftPopupOverlay.is-shown .gift-popup-cta-icon,
    #giftPopupOverlay.is-shown .gift-popup-close {
        animation: giftOverlayIn .15s ease-out backwards;
    }

    #giftPopupOverlay.is-closing,
    #giftPopupOverlay.is-closing .gift-popup-card {
        animation: giftOverlayOut .15s ease-in forwards;
    }
}
