/* Shared by both pages: design tokens, the night scene (lights, snow, hills), paper card, type. */

:root {
    --night-top: #1b5c45;
    --night: #114232;
    --night-deep: #0a2a20;
    --paper: #fffaf0;
    --paper-line: #eadfc8;
    --ink: #24332c;
    --ink-soft: #5f6d66;
    --red: #c8342c;
    --red-dark: #9f251f;
    --green: #2d8b4e;
    --green-dark: #1f6e3a;
    --gold: #e9b949;
    --gold-soft: #fff4d6;
    --gold-ink: #7a5a0c;
    --blue: #4a9fd8;
    --cream: #fff6e0;
    --snow: #f3f8f6;
    --snow-shade: #cfe2da;

    --font-display: "Caprasimo", Georgia, "Times New Roman", serif;
    --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

    /* String lights: one 160x64 tile, repeated across the top. The wire is static; the bulbs are
       split over two layers so they can twinkle alternately. */
    --lights-wire: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='64'><path d='M0 6Q80 44 160 6' fill='none' stroke='%23061a13' stroke-width='2'/><g fill='%23061a13'><rect x='16.5' y='13' width='7' height='6' rx='1.5'/><rect x='56.5' y='22.5' width='7' height='6' rx='1.5'/><rect x='96.5' y='22.5' width='7' height='6' rx='1.5'/><rect x='136.5' y='13' width='7' height='6' rx='1.5'/></g></svg>");
    --lights-a: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='64'><defs><radialGradient id='a'><stop offset='0' stop-color='%23ff6b5e' stop-opacity='.6'/><stop offset='1' stop-color='%23ff6b5e' stop-opacity='0'/></radialGradient><radialGradient id='b'><stop offset='0' stop-color='%237cc6ff' stop-opacity='.6'/><stop offset='1' stop-color='%237cc6ff' stop-opacity='0'/></radialGradient></defs><circle cx='20' cy='28' r='16' fill='url(%23a)'/><ellipse cx='20' cy='27.5' rx='5.5' ry='8.5' fill='%23ff6b5e'/><ellipse cx='18' cy='24' rx='1.5' ry='2.5' fill='%23fff' opacity='.6'/><circle cx='100' cy='37.5' r='16' fill='url(%23b)'/><ellipse cx='100' cy='37' rx='5.5' ry='8.5' fill='%237cc6ff'/><ellipse cx='98' cy='33.5' rx='1.5' ry='2.5' fill='%23fff' opacity='.6'/></svg>");
    --lights-b: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='64'><defs><radialGradient id='a'><stop offset='0' stop-color='%23ffd166' stop-opacity='.6'/><stop offset='1' stop-color='%23ffd166' stop-opacity='0'/></radialGradient><radialGradient id='b'><stop offset='0' stop-color='%237be3a6' stop-opacity='.6'/><stop offset='1' stop-color='%237be3a6' stop-opacity='0'/></radialGradient></defs><circle cx='60' cy='37.5' r='16' fill='url(%23a)'/><ellipse cx='60' cy='37' rx='5.5' ry='8.5' fill='%23ffd166'/><ellipse cx='58' cy='33.5' rx='1.5' ry='2.5' fill='%23fff' opacity='.6'/><circle cx='140' cy='28' r='16' fill='url(%23b)'/><ellipse cx='140' cy='27.5' rx='5.5' ry='8.5' fill='%237be3a6'/><ellipse cx='138' cy='24' rx='1.5' ry='2.5' fill='%23fff' opacity='.6'/></svg>");

    --tree: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 92'><rect x='26' y='82' width='8' height='10' fill='%232e2118'/><path d='M30 4 46 34H38L52 60H40L56 84H4L20 60H8L22 34H14Z' fill='%230b3023'/><path d='M30 4 38 19Q30 14 22 19ZM22 34 30 30 38 34 43 43Q30 35 17 43ZM20 60 30 56 40 60 46 71Q30 62 14 71Z' fill='%23dcebe5'/></svg>");
    --hill-back: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 150' preserveAspectRatio='none'><path d='M0 78Q300 14 640 70T1200 46V150H0Z' fill='%23cfe2da'/></svg>");
    --hill-front: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 150' preserveAspectRatio='none'><path d='M0 112Q260 56 580 104T1200 86V150H0Z' fill='%23f3f8f6'/></svg>");
}

* {
    box-sizing: border-box;
}

html {
    background: var(--night-deep);
}

body {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
    background: radial-gradient(130% 720px at 50% 0, var(--night-top), var(--night) 55%, var(--night-deep)) no-repeat var(--night-deep);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

/* Night scene. Decorative only: sits behind the page content and ignores the pointer. */

.scene {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.lights,
.lights::before,
.lights::after {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: center top / 160px 64px repeat-x;
}

.lights {
    background-image: var(--lights-wire);
}

.lights::before,
.lights::after {
    content: "";
    animation: twinkle 2.8s ease-in-out infinite;
}

.lights::before {
    background-image: var(--lights-a);
}

.lights::after {
    background-image: var(--lights-b);
    animation-delay: -1.4s;
}

@keyframes twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Snow: three tiled layers. Each one is a tile taller than the viewport and slides down by exactly
   one tile, so the loop is seamless and only `transform` animates (no repaint per frame). */

.snow {
    position: fixed;
    inset: 0;
    overflow: hidden;
}

.snow i {
    position: absolute;
    top: calc(-1 * var(--tile));
    bottom: 0;
    left: -16px;
    right: -16px;
    background-size: var(--tile) var(--tile);
    animation: snowfall var(--fall) linear infinite, snowsway var(--sway) ease-in-out infinite alternate;
    will-change: transform;
}

.snow i:nth-child(1) {
    --tile: 240px;
    --fall: 20s;
    --sway: 7s;
    opacity: 0.55;
    background-image:
        radial-gradient(circle at 8% 12%, #fff 0 1px, transparent 2px),
        radial-gradient(circle at 27% 64%, #fff 0 1px, transparent 2px),
        radial-gradient(circle at 46% 30%, #fff 0 1.2px, transparent 2.2px),
        radial-gradient(circle at 63% 82%, #fff 0 1px, transparent 2px),
        radial-gradient(circle at 78% 18%, #fff 0 1.2px, transparent 2.2px),
        radial-gradient(circle at 92% 52%, #fff 0 1px, transparent 2px),
        radial-gradient(circle at 36% 92%, #fff 0 1px, transparent 2px);
}

.snow i:nth-child(2) {
    --tile: 340px;
    --fall: 16s;
    --sway: 5.5s;
    opacity: 0.75;
    background-image:
        radial-gradient(circle at 10% 40%, #fff 0 1.8px, transparent 3px),
        radial-gradient(circle at 30% 10%, #fff 0 2px, transparent 3.2px),
        radial-gradient(circle at 52% 70%, #fff 0 1.8px, transparent 3px),
        radial-gradient(circle at 74% 30%, #fff 0 2.2px, transparent 3.4px),
        radial-gradient(circle at 90% 84%, #fff 0 1.8px, transparent 3px),
        radial-gradient(circle at 20% 78%, #fff 0 2px, transparent 3.2px);
}

.snow i:nth-child(3) {
    --tile: 460px;
    --fall: 11s;
    --sway: 4s;
    opacity: 0.9;
    background-image:
        radial-gradient(circle at 15% 20%, #fff 0 2.6px, transparent 4.6px),
        radial-gradient(circle at 45% 55%, #fff 0 3px, transparent 5px),
        radial-gradient(circle at 80% 10%, #fff 0 2.6px, transparent 4.6px),
        radial-gradient(circle at 65% 85%, #fff 0 3.2px, transparent 5.4px),
        radial-gradient(circle at 95% 45%, #fff 0 2.6px, transparent 4.6px);
}

@keyframes snowfall {
    to { transform: translate3d(0, var(--tile), 0); }
}

@keyframes snowsway {
    from { translate: -12px 0; }
    to { translate: 12px 0; }
}

/* Snowy ground at the end of the page: back hill, trees standing on it, front hill over their feet. */

.hills,
.hills::before,
.hills::after {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
}

.hills {
    height: 130px;
    background: var(--hill-back) center bottom / 100% 100% no-repeat;
}

.hills::before {
    content: "";
    height: 210px;
    background:
        var(--tree) left 4% bottom 58px / 60px 92px no-repeat,
        var(--tree) left 13% bottom 70px / 36px 55px no-repeat,
        var(--tree) right 5% bottom 60px / 70px 107px no-repeat,
        var(--tree) right 16% bottom 76px / 40px 61px no-repeat;
}

.hills::after {
    content: "";
    height: 100%;
    background: var(--hill-front) center bottom / 100% 100% no-repeat;
}

/* Paper card with a candy-cane edge */

.card {
    position: relative;
    border-radius: 22px;
    background:
        repeating-linear-gradient(-45deg, var(--red) 0 10px, #fff 10px 20px) top / 100% 10px no-repeat,
        var(--paper);
    box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.2);
}

button,
input,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .hills {
        height: 90px;
    }

    .hills::before {
        height: 160px;
        background:
            var(--tree) left -8px bottom 38px / 44px 67px no-repeat,
            var(--tree) right -10px bottom 40px / 52px 80px no-repeat;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    /* Keep the snow in the air instead of letting it settle one tile down. */
    .snow i {
        animation: none;
    }
}
