/* Holiday / offer popup
   Partial: resources/views/front/layout/_holiday-popup.blade.php
   Linked by every page that includes that partial - currently front/index and
   front/cart/shop-cart.

   Everything is scoped under #vkHolidayPopup. style.css styles generic class
   names globally, so an unscoped .close or .dialog here would be restyled from
   under this file without warning. */

#vkHolidayPopup {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(12, 18, 24, .72);
    animation: vk-hp-fade .18s ease-out;

    /* Older browsers that ignore `inset` still need the popup pinned, or it
       collapses to a strip at the top of the viewport. */
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* The [hidden] attribute is what opens and closes this - but `display: flex`
   above outranks the browser's default [hidden] { display: none }, so it has to
   be restated at the same specificity or the popup never hides. */
#vkHolidayPopup[hidden] {
    display: none;
}

@keyframes vk-hp-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#vkHolidayPopup .vk-hp__dialog {
    position: relative;
    max-width: 92vw;
    animation: vk-hp-rise .22s ease-out;
}

@keyframes vk-hp-rise {
    from { transform: translateY(14px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Bounded on both axes: a tall poster has to fit the viewport height without
   pushing its own close button off the screen, so the height cap carries the
   button's row and the padding around it. */
#vkHolidayPopup .vk-hp__img {
    display: block;
    max-width: 100%;
    max-height: 78vh;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

/* Sits above the image's top-right corner rather than on it - see the partial:
   a cross laid over an unknown image is invisible as often as not. */
#vkHolidayPopup .vk-hp__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0 0 10px auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
    color: #152B39;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    opacity: 1;
    transition: transform .15s ease, background .15s ease;
}

#vkHolidayPopup .vk-hp__close:hover,
#vkHolidayPopup .vk-hp__close:focus {
    background: #F3F5F7;
    transform: scale(1.06);
    outline: none;
}

#vkHolidayPopup .vk-hp__close:focus-visible {
    outline: 2px solid #B58A46;
    outline-offset: 2px;
}

/* The page behind must not scroll under the popup - most visibly on phones,
   where a scroll gesture aimed at the image would otherwise move the home page
   behind it. */
body.vk-hp-open {
    overflow: hidden;
}

@media (max-width: 575px) {
    #vkHolidayPopup {
        padding: 14px;
    }

    #vkHolidayPopup .vk-hp__img {
        max-height: 72vh;
    }
}

/* Respects the visitor's reduced-motion setting: the popup still appears, it
   just stops sliding and fading in. */
@media (prefers-reduced-motion: reduce) {
    #vkHolidayPopup,
    #vkHolidayPopup .vk-hp__dialog {
        animation: none;
    }
}
