/*
 * Winter / Christmas theme overrides.
 *
 * Loaded after main.4b8b8fd5.css (see index.html), so rules here win.
 * Design: Figma "Mr-Men_Winter-App". Artwork lives in /static/media/winter/.
 *
 * Nothing in the original build is modified: removing the <link> to this
 * file from index.html returns the app to the standard theme.
 */

/* ---- Sky: slowly falling snow replaces the festival bunting ----------- */

:root {
    /* One snow tile is 1344x1981 drawn at full screen width. */
    --winter-snow-tile: calc(100vw * 1981 / 1344);
    /* Time for the snow to fall one tile (about 1.5 screen widths). */
    --winter-snow-speed: 50s;
}

body.screen-gamesactivities,
body.screen.screen-landing,
body.screen.screen-matchingpairs,
body.screen.screen-meetthecharacters,
body.screen.screen-quiz.quiz-complete,
body.screen.screen-searchandfind.scene-complete {
    background-image: none;
    isolation: isolate; /* keeps the snow layer above the sky, below the content */
}

body.screen-gamesactivities::before,
body.screen.screen-landing::before,
body.screen.screen-matchingpairs::before,
body.screen.screen-meetthecharacters::before,
body.screen.screen-quiz.quiz-complete::before,
body.screen.screen-searchandfind.scene-complete::before {
    content: "";
    position: fixed;
    z-index: -1;
    left: 0;
    top: calc(-1 * var(--winter-snow-tile));
    width: 100%;
    height: calc(100% + var(--winter-snow-tile));
    background: url(/static/media/winter/snow.png) 0 0 / var(--winter-snow-width, 100%) auto repeat;
    pointer-events: none;
    will-change: transform;
    animation: winter-snowfall var(--winter-snow-speed) linear infinite;
}

/* The tile repeats, so moving down by exactly one tile loops seamlessly. */
@keyframes winter-snowfall {
    to { transform: translateY(var(--winter-snow-tile)); }
}

/* No snow over the camera photo or the dress-up character. */
body.screen.screen-meetthecharacters.camera-mode.photo-taken::before,
body.screen.screen-meetthecharacters.dress-character::before {
    display: none;
}

/* Respect "reduce motion": snow stays, but holds still. */
@media (prefers-reduced-motion: reduce) {
    body.screen::before {
        animation: none !important;
    }
}

/* ---- Landing ---------------------------------------------------------- */

.landing-screen:after {
    background-image: url(/static/media/winter/landing-page-bg.png);
}

.landing-screen .btn-primary {
    --ba-btn-bg: #8dd4f5;
}

/* Short phones: keep the scene at its designed size so the buttons sit on
   the snow below the characters (the base theme enlarges it by 9%). */
@media (max-height: 667px) {
    .landing-screen:after {
        height: 100%;
    }
}

/* Narrow phones: let each button label fit on two lines, as designed. */
@media (max-width: 350px) {
    .landing-screen .btn-container .btn-primary {
        --ba-btn-font-size: 1.1rem;
        --ba-btn-padding-x: 0.25rem;
    }
}

/* Footer logos and copyright line are white artwork; the snow needs black. */
.landing-screen .sponsors img,
.landing-screen .copyright-text img {
    filter: brightness(0);
}

/* ---- Snowy hills: games menu, matching pairs, meet the characters ----- */

.games-activities-screen:after,
.matching-pairs-screen:after,
.character-select-screen:after {
    background-image: url(/static/media/winter/activities-bg.png);
}

.character-select-screen:after {
    height: 150px;
}

/* ---- "Well done" screens: quiz, search & find, matching pairs --------- */

/* Let the falling snow show through the sky on these screens. */
body.screen.screen-quiz.quiz-complete .quiz-screen,
body.screen.screen-searchandfind.scene-complete .screen-search-find {
    background: transparent;
}

body.screen.screen-quiz.quiz-complete .quiz-screen:after,
body.screen.screen-searchandfind.scene-complete .screen-search-find:after,
body.screen.screen-matchingpairs.complete .matching-pairs-screen:after {
    background-image: url(/static/media/winter/complete-bg.png);
}

/* "More games" sits on white snow rather than green grass. */
.quiz-complete .btn-link {
    background: transparent;
    color: #000;
}

/* ---- Parent zone ------------------------------------------------------ */

.parent-zone-header {
    background-image: url(/static/media/winter/parent-zone-bg.png);
    margin-top: 60px;
}

/* Keep the logo clear of the house and the tree on narrow phones. */
.parent-zone-screen .text {
    width: min(150px, 37vw);
}

/* ---- Desktop ("scan the code") and landscape ("please rotate") screens -- */

/*
 * The base theme paints these as a body background. Here the scene artwork
 * has a transparent sky and sits in ::after, so the snow (::before) falls
 * behind the hills, the characters and the QR code, never over them.
 */
body.desktop-mode,
body.orientation-message {
    background-image: none !important;
    background-color: #81cff0 !important;
    isolation: isolate;
    /* Fixed flake size: a full-width tile would make giant flakes here. */
    --winter-snow-width: 420px;
    --winter-snow-tile: calc(420px * 1981 / 1344);
}

body.desktop-mode::before,
body.orientation-message::before {
    content: "";
    display: block !important;
    position: fixed;
    z-index: -1;
    left: 0;
    top: calc(-1 * var(--winter-snow-tile));
    width: 100%;
    height: calc(100% + var(--winter-snow-tile));
    background: url(/static/media/winter/snow.png) 0 0 / var(--winter-snow-width) auto repeat;
    pointer-events: none;
    will-change: transform;
    animation: winter-snowfall var(--winter-snow-speed) linear infinite;
}

body.desktop-mode::after,
body.orientation-message::after {
    content: "";
    position: fixed;
    z-index: -1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url(/static/media/winter/desktop-mode.png) 50% / cover no-repeat;
    pointer-events: none;
}

body.orientation-message::after {
    background-image: url(/static/media/winter/rotate-device.png);
}
