/*
 * Winter decorations for Opraveno.com.
 *
 * Loaded by the layout only while App\Service\SeasonalDecor::isWinterActive() is true
 * (1 December to the end of 6 January, Prague time), so for the rest of the year this
 * file is never requested and none of it applies.
 *
 * Three decorations, nothing else:
 *   1. a Santa hat on the left corner of the logo, with one wiggle on hover;
 *   2. snow caps lying on the main cards of the home page and the model pages;
 *   3. a string of lights across the top of the dark header.
 *
 * Rules every rule in this file keeps:
 *   - pointer-events: none on everything drawn, so no link, button or field under a
 *     decoration becomes harder to tap;
 *   - no decoration takes layout space, so nothing on the page moves;
 *   - no animation at all for visitors who ask for reduced motion.
 */

/* ------------------------------------------------------------------ 1. Santa hat */

.navbar-brand {
    position: relative;
}

.navbar-brand::before {
    content: "";
    position: absolute;
    left: -14px;
    top: -10px;
    width: 48px;
    height: 36px;
    background: url("/assets/images/winter/santa-hat.svg") no-repeat center center;
    background-size: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35));
    transform-origin: 80% 88%;
    pointer-events: none;
    z-index: 2;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .navbar-brand:hover::before {
        animation: opr-hat-wiggle .6s ease-in-out 1;
    }
}

@keyframes opr-hat-wiggle {
    0%   { transform: rotate(0deg); }
    30%  { transform: rotate(-9deg); }
    60%  { transform: rotate(5deg); }
    84%  { transform: rotate(-2deg); }
    100% { transform: rotate(0deg); }
}

/* --------------------------------------------------------------- 2. Snow caps */

.priceBox > .rounded-3,
.map-box,
.container-articles .card {
    position: relative;
}

.priceBox > .rounded-3::before,
.map-box::before,
.container-articles .card::before {
    content: "";
    position: absolute;
    top: -13px;
    left: -8px;
    right: -8px;
    height: 20px;
    border-radius: 12px 12px 4px 4px;
    /* a flat ridge of snow with three lumps of different size and depth hanging off
       its lower edge; the pattern repeats every 64px, so it fits a card of any width */
    background:
        radial-gradient(circle 8px at 11px 0, #dfebf7 90%, rgba(223, 235, 247, 0) 100%) repeat-x 0 100% / 64px 13px,
        radial-gradient(circle 7px at 33px 0, #dfebf7 90%, rgba(223, 235, 247, 0) 100%) repeat-x 0 100% / 64px 9px,
        radial-gradient(circle 5px at 50px 0, #dfebf7 90%, rgba(223, 235, 247, 0) 100%) repeat-x 0 100% / 64px 11px,
        linear-gradient(180deg, #ffffff 0%, #f7fbff 48%, #dfebf7 100%) no-repeat 0 0 / 100% 13px;
    filter: drop-shadow(0 2px 2.5px rgba(26, 45, 72, .24));
    pointer-events: none;
    z-index: 3;
}

/* ------------------------------------------------------------ 3. String of lights */

.opr-xmas-lights {
    position: relative;
    height: 0;
    pointer-events: none;
}

.opr-xmas-lights > span {
    position: absolute;
    top: -21px;
    left: 0;
    right: 0;
    height: 20px;
    display: block;
    pointer-events: none;
}

.opr-xl-cord {
    background-image: linear-gradient(to bottom,
        rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0) 3px,
        rgba(255, 255, 255, .28) 3px, rgba(255, 255, 255, .28) 4px,
        rgba(255, 255, 255, 0) 4px);
}

/* One bulb every 216 px per colour; the three colours are offset by 72 px, so the
   string reads red, gold, ice blue at any window width without any script. */
.opr-xl-bulbs {
    background-repeat: repeat-x;
    background-size: 216px 20px;
}

.opr-xl-bulbs-1 {
    background-image:
        radial-gradient(8px 7px at 36px 11px, rgba(226, 64, 60, .34), rgba(226, 64, 60, 0) 70%),
        radial-gradient(3.4px 3.8px at 36px 11px, #ff6f66 28%, #cf2b27 88%, rgba(207, 43, 39, 0) 100%),
        radial-gradient(.8px 3.2px at 36px 6.2px, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0));
    background-position: 0 0;
}

.opr-xl-bulbs-2 {
    background-image:
        radial-gradient(8px 7px at 36px 11px, rgba(240, 180, 60, .34), rgba(240, 180, 60, 0) 70%),
        radial-gradient(3.4px 3.8px at 36px 11px, #ffd77f 28%, #dd9a11 88%, rgba(221, 154, 17, 0) 100%),
        radial-gradient(.8px 3.2px at 36px 6.2px, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0));
    background-position: 72px 0;
}

.opr-xl-bulbs-3 {
    background-image:
        radial-gradient(8px 7px at 36px 11px, rgba(130, 214, 238, .34), rgba(130, 214, 238, 0) 70%),
        radial-gradient(3.4px 3.8px at 36px 11px, #c4eefc 28%, #4bb3d6 88%, rgba(75, 179, 214, 0) 100%),
        radial-gradient(.8px 3.2px at 36px 6.2px, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0));
    background-position: 144px 0;
}

/* The twinkle is a slow brightness change, not a blink: each colour dims by about a
   quarter over eleven to seventeen seconds. A visitor whose system asks for reduced
   motion gets no animation at all, and the lights simply stay lit. To make the lights
   static for everyone, delete this one block. */
@media (prefers-reduced-motion: no-preference) {
    .opr-xl-bulbs-1 { animation: opr-xl-twinkle 11s ease-in-out -2s infinite; }
    .opr-xl-bulbs-2 { animation: opr-xl-twinkle 14s ease-in-out -6s infinite; }
    .opr-xl-bulbs-3 { animation: opr-xl-twinkle 17s ease-in-out -11s infinite; }
}

@keyframes opr-xl-twinkle {
    0%, 100% { opacity: 1; }
    50%      { opacity: .72; }
}

/* ------------------------------------------------------------------- small screens */

@media (max-width: 575.98px) {
    .navbar-brand::before {
        left: -10px;
        top: -10px;
        width: 38px;
        height: 28.5px;
    }

    .priceBox > .rounded-3::before,
    .map-box::before,
    .container-articles .card::before {
        top: -10px;
        left: -6px;
        right: -6px;
        height: 16px;
        border-radius: 9px 9px 3px 3px;
        background:
            radial-gradient(circle 6px at 8px 0, #dfebf7 90%, rgba(223, 235, 247, 0) 100%) repeat-x 0 100% / 46px 10px,
            radial-gradient(circle 5.5px at 24px 0, #dfebf7 90%, rgba(223, 235, 247, 0) 100%) repeat-x 0 100% / 46px 7px,
            radial-gradient(circle 4px at 36px 0, #dfebf7 90%, rgba(223, 235, 247, 0) 100%) repeat-x 0 100% / 46px 8.5px,
            linear-gradient(180deg, #ffffff 0%, #f7fbff 48%, #dfebf7 100%) no-repeat 0 0 / 100% 10px;
    }

    .opr-xmas-lights > span {
        top: -18px;
        height: 17px;
    }

    .opr-xl-bulbs {
        background-size: 150px 17px;
    }

    .opr-xl-bulbs-1 { background-position: 0 0; }
    .opr-xl-bulbs-2 { background-position: 50px 0; }
    .opr-xl-bulbs-3 { background-position: 100px 0; }
}
