/*
 * Kilkea Castle – festive decorations for the homepage.
 * Everything here is scoped to html.festive, which /assets/js/snow.js adds
 * only inside its date window (15 Nov – 6 Jan), so it all retires itself in January.
 *
 *  1. Snow lip hanging from the bottom of the fixed nav
 *  2. Snow drift along the top of the Explore cards  (<figure class="… snowcap">)
 *  3. Frosted-window vignette creeping in over the hero (homepage video,
 *     or the slider on CMS pages listed in $festive_slugs in page.php)
 */

/* ---------- 1. Nav ---------- */
.festive .navv2_blue::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 18px;
    margin-top: -2px;                 /* tuck under the bar so there is no seam */
    background: url("/assets/img/festive/snow-drift.svg") 0 0 / 190px 18px repeat-x;
    pointer-events: none;
    z-index: -1;                      /* stays under the dropdown menus */
    animation: festive-fade-in 1.2s ease-out both;
}

/* ---------- 2. Explore cards ---------- */
.festive .snowcap::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 20px;
    background: url("/assets/img/festive/snow-drift.svg") 0 0 / 230px 20px repeat-x;
    pointer-events: none;
    z-index: 2;                       /* above the zooming image */
}
/* vary the drift so the four cards don't look stamped */
.festive .col-md-6:nth-child(2) .snowcap::before { background-position: -70px 0; }
.festive .col-md-6:nth-child(3) .snowcap::before { background-position: -140px 0; }
.festive .col-md-6:nth-child(4) .snowcap::before { background-position: -35px 0; transform: scaleX(-1); }

/* ---------- 3. Frosted window on the hero (homepage video / inner-page slider) ---------- */
.festive .video-container {
    position: relative;
    z-index: 0;                       /* own stacking context, so the frost never paints over the fixed nav */
}

/* soft frost glow, heaviest in the corners, plus a faint cold rim all round */
.festive .video-container::after,
.festive .video-container::before,
.festive .rev_slider_wrapper::after,
.festive .rev_slider_wrapper::before {
    content: "";
    position: absolute;
    top: 60px;                        /* the container's padding-top under the nav */
    right: 0;
    bottom: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}
/* the slider wrapper is already relative, z-index 0, with 60px padding-top under the nav */
.festive .rev_slider_wrapper::after,
.festive .rev_slider_wrapper::before {
    z-index: 30;                      /* above the slides and their captions */
}

.festive .video-container::after,
.festive .rev_slider_wrapper::after {
    background:
        radial-gradient(ellipse at top left,     rgba(255,255,255,.46), rgba(236,244,252,.18) 32%, rgba(255,255,255,0) 66%) top left     / 48% 62% no-repeat,
        radial-gradient(ellipse at top right,    rgba(255,255,255,.42), rgba(236,244,252,.16) 32%, rgba(255,255,255,0) 66%) top right    / 42% 55% no-repeat,
        radial-gradient(ellipse at bottom left,  rgba(255,255,255,.50), rgba(236,244,252,.20) 32%, rgba(255,255,255,0) 66%) bottom left  / 52% 66% no-repeat,
        radial-gradient(ellipse at bottom right, rgba(255,255,255,.46), rgba(236,244,252,.18) 32%, rgba(255,255,255,0) 66%) bottom right / 46% 60% no-repeat;
    box-shadow: inset 0 0 80px 6px rgba(222,234,248,.30);
    animation: festive-frost-glow 9s cubic-bezier(.2,.7,.2,1) .6s both;
}

/* crystalline ice texture, masked to the corners */
.festive .video-container::before,
.festive .rev_slider_wrapper::before {
    background: url("/assets/img/festive/frost.svg") 0 0 / 320px 320px repeat;
    opacity: .65;
    -webkit-mask-image:
        radial-gradient(ellipse at top left,     #000, rgba(0,0,0,.35) 35%, transparent 68%),
        radial-gradient(ellipse at top right,    #000, rgba(0,0,0,.35) 35%, transparent 68%),
        radial-gradient(ellipse at bottom left,  #000, rgba(0,0,0,.35) 35%, transparent 68%),
        radial-gradient(ellipse at bottom right, #000, rgba(0,0,0,.35) 35%, transparent 68%);
    -webkit-mask-position: top left, top right, bottom left, bottom right;
    -webkit-mask-size: 44% 58%, 38% 50%, 48% 62%, 42% 56%;
    -webkit-mask-repeat: no-repeat;
            mask-image:
        radial-gradient(ellipse at top left,     #000, rgba(0,0,0,.35) 35%, transparent 68%),
        radial-gradient(ellipse at top right,    #000, rgba(0,0,0,.35) 35%, transparent 68%),
        radial-gradient(ellipse at bottom left,  #000, rgba(0,0,0,.35) 35%, transparent 68%),
        radial-gradient(ellipse at bottom right, #000, rgba(0,0,0,.35) 35%, transparent 68%);
            mask-position: top left, top right, bottom left, bottom right;
            mask-size: 44% 58%, 38% 50%, 48% 62%, 42% 56%;
            mask-repeat: no-repeat;
    animation: festive-frost-texture 11s cubic-bezier(.2,.7,.2,1) .6s both;
}

/* phones: portrait video, keep the frost tighter so the castle stays clear */
@media (max-width: 767px) {
    .festive .video-container::after,
    .festive .rev_slider_wrapper::after {
        background-size: 60% 34%, 55% 30%, 64% 38%, 58% 34%;
        box-shadow: inset 0 0 50px 4px rgba(222,234,248,.28);
    }
    .festive .video-container::before,
    .festive .rev_slider_wrapper::before {
        -webkit-mask-size: 56% 30%, 50% 26%, 60% 34%, 54% 30%;
                mask-size: 56% 30%, 50% 26%, 60% 34%, 54% 30%;
    }
    .festive .snowcap::before { height: 16px; background-size: 190px 16px; }
}

/* the frost creeps in from the corners: sizes grow from nothing to the values above */
@keyframes festive-frost-glow {
    from { background-size: 0 0, 0 0, 0 0, 0 0; opacity: 0; }
    30%  { opacity: 1; }
}
@keyframes festive-frost-texture {
    from { -webkit-mask-size: 0 0, 0 0, 0 0, 0 0; mask-size: 0 0, 0 0, 0 0, 0 0; opacity: 0; }
    35%  { opacity: .65; }
}
@keyframes festive-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
}

@media (prefers-reduced-motion: reduce) {
    .festive .navv2_blue::after,
    .festive .video-container::after,
    .festive .video-container::before,
    .festive .rev_slider_wrapper::after,
    .festive .rev_slider_wrapper::before { animation: none; }
}
