/* =============================================
   SNOW CRITTERS — illustrated scenes
   Critters are <symbol>s in the sprite at the top of <body>, instanced with <use>.
   Style critter parts with bare, unique classes (.crit-*), never "symbol .x" or any ancestor
   selector: Chrome matches rules against the original symbol, Safari against the <use>
   clone (where the symbol has become an <svg>), so only bare classes work in both.
   Anything that must look right even without CSS (eyelids hidden) lives in the markup.
   Instance variables are namespaced (--look-*, --blink-d, ...): an unset one inherits from
   :root, and --px there is the page gutter — that once pushed every pupil out of the head.
   Per-instance behaviour is passed in through inherited custom properties:
     --look-x/-y   pupil offset         --blink-d  blink phase
     --walk        paused | running     --play     paused | running (whole scene)
   Scenes play from the first paint (no waiting for JS); JS adds .is-off to pause the ones
   scrolled out of view, to save battery. Reduced motion keeps them still.
   Pivots: an outer <g transform="translate(x y)"> places the pivot, the inner
   animated <g> rotates around its local 0 0 — never animate an element that also
   has a transform attribute (CSS transform replaces it).
   ============================================= */

.critter-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.scene { --play: running; pointer-events: none; overflow: visible; display: block; }
.scene .walker { --walk: running; }
.scene.is-off { --play: paused; }
.scene.is-off .walker { --walk: paused; }
.scene *, .crit-body, .crit-body * { animation-play-state: var(--play, paused) !important; }
.crit-foot { animation-play-state: var(--walk, paused) !important; }

/* ---------- critter parts ---------- */
.crit-body { transform-box: fill-box; transform-origin: 50% 100%; animation: cr-breathe 3.2s ease-in-out infinite; }
@keyframes cr-breathe { 50% { transform: translateY(-1.5px) scale(1.015, 1.035); } }

.crit-pupil { transform: translate(var(--look-x, 0px), var(--look-y, 0px)); transition: transform 160ms ease-out; }

/* The lid also carries opacity="0" in the markup, so the eyes stay open if this never applies. */
.crit-lid { transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(0); opacity: 0;
    animation: cr-blink 4.6s infinite; animation-delay: var(--blink-d, 0s); }
@keyframes cr-blink {
    0%, 92.9%, 98.1%, 100% { transform: scaleY(0); opacity: 0; }
    93%, 98%               { transform: scaleY(0); opacity: 1; }
    95.5%                  { transform: scaleY(1); opacity: 1; }
}

.crit-foot { transform-box: fill-box; transform-origin: 50% 100%; animation: cr-step .34s ease-in-out infinite alternate; }
.crit-foot-r { animation-delay: -.34s; }
@keyframes cr-step { from { transform: translateY(0); } to { transform: translateY(-4px) rotate(-6deg); } }

.crit-pom { transform-box: fill-box; transform-origin: 50% 100%; animation: cr-pom 1.6s ease-in-out infinite; }
@keyframes cr-pom { 50% { transform: rotate(14deg); } }

/* shared bits */
.wheel { transform-box: fill-box; transform-origin: 50% 50%; animation: sc-spin .7s linear infinite; }
@keyframes sc-spin { to { transform: rotate(360deg); } }

.puff { transform-box: fill-box; transform-origin: 50% 50%; animation: sc-puff 1.4s ease-out infinite; animation-delay: var(--t, 0s); }
@keyframes sc-puff {
    0%   { transform: translate(0, 0) scale(.4); opacity: 0; }
    15%  { opacity: .55; }
    100% { transform: translate(var(--dx, -10px), -26px) scale(1.6); opacity: 0; }
}

/* Thrown snow: outer layer moves along x (linear), inner along y (up then down) = an arc. */
.arc-x { animation: sc-arc-x var(--d, 1.2s) linear infinite; animation-delay: var(--t, 0s); }
.arc-y { animation: sc-arc-y var(--d, 1.2s) infinite; animation-delay: var(--t, 0s); }
@keyframes sc-arc-x {
    0%   { transform: translateX(0); opacity: 0; }
    8%   { opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: translateX(var(--dx, 80px)); opacity: 0; }
}
@keyframes sc-arc-y {
    0%   { transform: translateY(0); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
    40%  { transform: translateY(var(--h, -40px)); animation-timing-function: cubic-bezier(.6, 0, .8, .4); }
    100% { transform: translateY(var(--dy, 60px)); }
}

/* ═══════════════════════════════════════════
   HERO — plow rig clears the street, snow falls back in
   ═══════════════════════════════════════════ */
.hero-scene {
    --rig-w: 240px;
    --run: 16s;
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 150px;
    z-index: 1;
    overflow: hidden;
}

.hs-road {
    position: absolute; left: 0; right: 0; bottom: 0; height: 30px;
    background:
        repeating-linear-gradient(90deg, rgba(255, 200, 90, .55) 0 34px, transparent 34px 70px) center 13px / 100% 3px no-repeat,
        linear-gradient(#141C30, #0E1424);
    border-top: 1px solid rgba(170, 200, 255, .08);
}

.hs-snow {
    position: absolute; left: 0; right: 0; bottom: 0; height: 40px;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 40' preserveAspectRatio='none'%3E%3Cpath d='M0 40V16C14 7 30 6 44 12S72 6 88 11 116 4 132 10 160 8 176 13 206 5 222 11 236 14 240 16V40Z' fill='%23E9F1FA'/%3E%3Cpath d='M0 40V30C40 26 80 32 120 28S200 32 240 30V40Z' fill='%23C9D9EC'/%3E%3C/svg%3E") repeat-x left bottom / 240px 40px;
    filter: drop-shadow(0 -2px 6px rgba(200, 225, 255, .12));
    animation: hs-clear var(--run) linear infinite;
}

@keyframes hs-clear {
    0%     { clip-path: inset(0 0 0 calc(var(--rig-w) * -.17)); opacity: 1; }
    80%    { clip-path: inset(0 0 0 calc(100vw + var(--rig-w))); opacity: 1; }
    80.3%  { clip-path: inset(0 0 0 calc(100vw + var(--rig-w))); opacity: 0; }
    80.6%  { clip-path: inset(0 0 0 0); opacity: 0; }
    100%   { clip-path: inset(0 0 0 0); opacity: 1; }
}

.hs-rig {
    position: absolute; left: 0; bottom: 2px;
    width: var(--rig-w); height: calc(var(--rig-w) * .54);
    animation: hs-drive var(--run) linear infinite;
}

@keyframes hs-drive {
    0%        { transform: translateX(calc(var(--rig-w) * -1)); }
    80%, 100% { transform: translateX(calc(100vw + 20px)); }
}

.hs-rig .rumble { animation: hs-rumble .18s steps(2) infinite; }
@keyframes hs-rumble { 50% { transform: translateY(-1px); } }

.hs-rig .beacon { animation: hs-beacon .8s steps(2) infinite; }
@keyframes hs-beacon { 50% { opacity: .25; } }

.hs-rig .pile { animation: hs-pile var(--run) linear infinite; }
@keyframes hs-pile {
    0%        { transform: scale(.35); }
    80%, 100% { transform: scale(1.15); }
}

/* ═══════════════════════════════════════════
   SECTION HEAD with a scene beside the heading
   ═══════════════════════════════════════════ */
.sec-head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 40px;
}

.sec-head .scene { width: 320px; height: auto; margin-bottom: 40px; }

/* ═══════════════════════════════════════════
   SERVICES — Gus shovels the walk
   ═══════════════════════════════════════════ */
.sg-lean   { animation: sg-lean 1.8s ease-in-out infinite; }
.sg-shovel { animation: sg-shovel 1.8s infinite; }
.sg-load   { animation: sg-load 1.8s infinite; }
.sg-fly-x  { animation: sg-fly-x 1.8s linear infinite; }
.sg-fly-y  { animation: sg-fly-y 1.8s infinite; }
.sg-pile   { animation: sg-pile 1.8s ease-out infinite; }
.sg-splat  { animation: sg-splat 1.8s ease-out infinite; }

@keyframes sg-lean {
    0%, 100% { transform: rotate(0); }
    16%      { transform: rotate(6deg); }
    42%      { transform: rotate(-6deg); }
    62%      { transform: rotate(0); }
}
@keyframes sg-shovel {
    0%, 100% { transform: rotate(0); animation-timing-function: ease-in-out; }
    16%      { transform: rotate(5deg) translateX(3px); animation-timing-function: ease-in; }
    30%      { transform: rotate(-16deg); animation-timing-function: cubic-bezier(.3, 0, .2, 1); }
    42%      { transform: rotate(-62deg); animation-timing-function: ease-in-out; }
    60%      { transform: rotate(-24deg); }
    80%      { transform: rotate(0); }
}
@keyframes sg-load {
    0%, 12%    { transform: scale(0); }
    22%, 41.9% { transform: scale(1); }
    42%, 100%  { transform: scale(0); }
}
@keyframes sg-fly-x {
    0%, 41.9% { transform: translateX(0); opacity: 0; }
    42%       { opacity: 1; }
    68%       { transform: translateX(64px); opacity: 1; }
    70%, 100% { transform: translateX(64px); opacity: 0; }
}
@keyframes sg-fly-y {
    0%, 42% { transform: translateY(0); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
    54%     { transform: translateY(-24px); animation-timing-function: cubic-bezier(.6, 0, .8, .4); }
    68%     { transform: translateY(36px); }
    100%    { transform: translateY(36px); }
}
@keyframes sg-pile {
    0%, 67%, 100% { transform: scale(1, 1); }
    72%           { transform: scale(1.06, .93); }
    80%           { transform: scale(.98, 1.02); }
}
@keyframes sg-splat {
    0%, 67%   { transform: scale(.3); opacity: 0; }
    70%       { opacity: .9; }
    86%, 100% { transform: scale(1.4) translateY(-6px); opacity: 0; }
}

/* ═══════════════════════════════════════════
   WHY US — Blizz runs the snow blower
   ═══════════════════════════════════════════ */
.why-scene { width: 100%; max-width: 420px; height: auto; margin-top: 28px; }
.wb-walker { animation: wb-bob .34s ease-in-out infinite alternate; }
@keyframes wb-bob { to { transform: translateY(-2px); } }
.wb-blower { animation: wb-jitter .09s steps(2) infinite; }
@keyframes wb-jitter { 50% { transform: translate(.6px, -.8px); } }

/* ═══════════════════════════════════════════
   AREAS — Pip salts the sidewalk
   ═══════════════════════════════════════════ */
.salt-scene {
    --run: 13s;
    position: relative;
    height: 110px;
    margin: 8px 0 28px;
    container-type: inline-size;
    overflow: hidden;
    border-radius: 0 0 12px 12px;
}

.ss-ice {
    position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
    background: linear-gradient(180deg, rgba(160, 215, 245, .35), rgba(120, 180, 225, .12));
    border-top: 1px solid rgba(190, 230, 255, .35);
    border-radius: 6px;
}

.ss-salted {
    position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
    background:
        radial-gradient(circle, rgba(242, 246, 251, .6) 0 1px, transparent 1.6px) 0 2px / 7px 5px,
        #1A2540;
    border-radius: 6px;
    animation: ss-salt var(--run) linear infinite;
}

@keyframes ss-salt {
    0%     { clip-path: inset(0 calc(100% + 65px) 0 0); opacity: 1; }
    85%    { clip-path: inset(0 -125px 0 0); opacity: 1; }
    92%    { clip-path: inset(0 -125px 0 0); opacity: 0; }
    92.1%, 100% { clip-path: inset(0 100% 0 0); opacity: 0; }
}

.ss-rig {
    position: absolute; left: 0; bottom: 0;
    width: 170px; height: 110px;
    animation: ss-walk var(--run) linear infinite;
}

@keyframes ss-walk {
    0%        { transform: translateX(-180px); }
    85%, 100% { transform: translateX(calc(100cqw + 10px)); }
}

.ss-bob { animation: wb-bob .34s ease-in-out infinite alternate; }

.salt { animation: ss-grain .9s ease-in infinite; animation-delay: var(--t, 0s); }
@keyframes ss-grain {
    0%   { transform: translate(0, 0); opacity: 0; }
    10%  { opacity: 1; }
    100% { transform: translate(var(--dx, -20px), 15px); opacity: 0; }
}

/* ═══════════════════════════════════════════
   TESTIMONIALS — Gus slips on ice, lands in a pile
   ═══════════════════════════════════════════ */
.tg-x     { animation: tg-x 6.5s linear infinite; }
.tg-body  { animation: tg-body 6.5s infinite; transform-origin: 0 -34px; }
.tg-hat   { animation: tg-hat 6.5s infinite; }
.tg-pile  { animation: tg-pile 6.5s ease-out infinite; }
.tg-burst { animation: tg-burst 6.5s ease-out infinite; }
.tg-dizzy { animation: tg-dizzy 6.5s infinite; }
.tg-spin  { animation: sc-spin 1.1s linear infinite; }

@keyframes tg-x {
    0%        { transform: translateX(0); opacity: 0; }
    4%        { opacity: 1; }
    32%       { transform: translateX(110px); animation-timing-function: ease-out; }
    40%       { transform: translateX(160px); animation-timing-function: ease-in; }
    48%       { transform: translateX(236px); }
    94%       { transform: translateX(236px); opacity: 1; }
    98%, 100% { transform: translateX(236px); opacity: 0; }
}
@keyframes tg-body {
    0%, 32%   { transform: translateY(0) rotate(0); }
    35%       { transform: translateY(0) rotate(-14deg); }
    38%       { transform: translateY(0) rotate(16deg); }
    40%       { transform: translateY(-4px) rotate(-30deg); animation-timing-function: ease-out; }
    44%       { transform: translateY(-46px) rotate(-150deg); animation-timing-function: ease-in; }
    48%       { transform: translateY(-8px) rotate(-210deg); }
    52%       { transform: translateY(44px) rotate(-210deg); }
    56%       { transform: translateY(44px) rotate(0); animation-timing-function: cubic-bezier(.3, 1.6, .5, 1); }
    63%       { transform: translateY(-14px) rotate(0); }
    70%       { transform: translateY(-14px) rotate(0); }
    73%       { transform: translateY(-14px) rotate(11deg); }
    76%       { transform: translateY(-14px) rotate(-11deg); }
    79%       { transform: translateY(-14px) rotate(9deg); }
    82%       { transform: translateY(-14px) rotate(0); }
    90%       { transform: translateY(-14px) rotate(0); animation-timing-function: ease-in; }
    97%, 100% { transform: translateY(44px) rotate(0); }
}
@keyframes tg-hat {
    0%, 55%   { opacity: 0; }
    56%, 96%  { opacity: 1; }
    97%, 100% { opacity: 0; }
}
@keyframes tg-pile {
    0%, 48%, 100% { transform: scale(1, 1); }
    51%           { transform: scale(1.1, .86); }
    55%           { transform: scale(.96, 1.04); }
    59%           { transform: scale(1, 1); }
}
@keyframes tg-burst {
    0%, 48%   { transform: scale(.3); opacity: 0; }
    50%       { opacity: 1; }
    62%, 100% { transform: scale(1.6) translateY(-10px); opacity: 0; }
}
@keyframes tg-dizzy {
    0%, 64%   { opacity: 0; }
    66%, 86%  { opacity: 1; }
    90%, 100% { opacity: 0; }
}

/* ═══════════════════════════════════════════
   CONTACT — Pip leans on the shovel and waves
   ═══════════════════════════════════════════ */
.contact-scene { width: 260px; height: auto; margin: 0 auto 28px; }
.cw-wave   { animation: cw-wave 2.8s ease-in-out infinite; }
.cw-bubble { transform-box: fill-box; transform-origin: 0% 100%; animation: cw-bubble 5.6s infinite; }
@keyframes cw-wave {
    0%, 44%, 100% { transform: rotate(0); }
    8%, 24%       { transform: rotate(-32deg); }
    16%, 32%      { transform: rotate(8deg); }
}
@keyframes cw-bubble {
    0%        { transform: scale(0); opacity: 0; }
    6%        { transform: scale(1.08); opacity: 1; }
    9%, 70%   { transform: scale(1); opacity: 1; }
    76%, 100% { transform: scale(0); opacity: 0; }
}

/* ═══════════════════════════════════════════
   CTA — Blizz peeks over the banner
   ═══════════════════════════════════════════ */
.cta-peek {
    position: absolute;
    bottom: 100%;
    right: 72px;
    width: 92px;
    height: 64px;
    overflow: hidden;
    z-index: 4;
}
.cp-rise { animation: cp-rise 7s infinite; }
@keyframes cp-rise {
    0%, 8%    { transform: translateY(70px); }
    16%       { transform: translateY(-2px); animation-timing-function: ease-in-out; }
    20%, 58%  { transform: translateY(4px); }
    62%       { transform: translateY(0); }
    72%, 100% { transform: translateY(70px); }
}

/* ═══════════════════════════════════════════
   FOOTER — the crew on break
   ═══════════════════════════════════════════ */
.foot .wrap { position: relative; }
.foot-crew {
    position: absolute;
    right: var(--px);
    bottom: calc(100% + 79px); /* snowbank rests on the footer top edge (footer has 80px top padding) */
    width: 300px;
    height: auto;
}
.fc-wave  { animation: cw-wave 3.6s ease-in-out infinite; animation-delay: -1s; }
.fc-steam { animation: fc-steam 2.4s ease-out infinite; animation-delay: var(--t, 0s); }
@keyframes fc-steam {
    0%   { transform: translateY(0) scaleX(1); opacity: 0; }
    20%  { opacity: .6; }
    100% { transform: translateY(-16px) scaleX(1.6); opacity: 0; }
}

/* ═══════════════════════════════════════════
   SNOW CAPS on cards
   ═══════════════════════════════════════════ */
.service-card::after,
.feature-card::after,
.testimonial-card::after,
.cta-banner::after,
.contact__phone-btn::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    top: -9px;
    height: 20px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M0 13C3 6 10 3 20 5 30 0 44 1 54 5 66 0 82 1 92 4 106-1 124 0 136 4 150 0 166 1 176 5 188 3 197 7 200 13 199 15 196 16 190 16 186 20 183 20 181 16H120C117 19 114 19 112 16H58C55 20 51 20 49 16H8C3 16 0 15 0 13Z' fill='%23EEF4FB'/%3E%3Cpath d='M4 14C40 11 90 13 130 12S180 13 196 14 196 16 190 16H8C4 16 4 15 4 14Z' fill='%23C9D9EC'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35));
    pointer-events: none;
    z-index: 3;
}

.testimonial-card,
.feature-card,
.contact__phone-btn { position: relative; }

/* ═══════════════════════════════════════════
   RESPONSIVE + MOTION
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
    .sec-head { grid-template-columns: 1fr; gap: 0; }
    .sec-head .scene { width: 100%; max-width: 320px; margin: 0 auto 28px; }
    .why-scene { margin: 20px auto 0; }
}

@media (max-width: 768px) {
    .hero-scene { --rig-w: 170px; height: 110px; }
    .foot-crew { width: 220px; }
    .cta-peek { right: 32px; }
}

@media (prefers-reduced-motion: reduce) {
    /* scenes stay as still illustrations; freeze the hero rig mid-street */
    .scene { --play: paused; }
    .scene .walker { --walk: paused; }
    .hs-rig, .hs-snow, .hs-rig .pile { animation-delay: -5s; }
    .ss-rig, .ss-salted { animation-delay: -4s; }
}
