/* Ski Trail Divider — kabdalis2 design system. S-curved dashed ski tracks
   with a tiny skier gliding along the curve via CSS offset-path.

   Sizing approach (deliberate): CSS offset-path uses the raw px units of
   the path, so the skier and the SVG tracks must share one unscaled
   coordinate space. Everything is drawn on a fixed 600×80px "stage" that
   is absolutely centred in the root and uniformly scaled per size
   (sm ×.6 / md ×1 / lg ×1.35); the root only reserves the matching
   height. On screens narrower than 600px the root shrinks (max-width +
   overflow hidden) and the centred stage crops equally on both sides —
   no JS, no container queries. */

.b-trail{
    --trail-scale: 1;
    position: relative;
    max-width: 600px;
    margin-inline: auto;
    overflow: hidden;
}
.b-trail--sm{ height: 48px; --trail-scale: 0.6; }
.b-trail--md{ height: 80px; }
.b-trail--lg{ height: 110px; --trail-scale: 1.35; }

/* Mirror everything (tracks + skier) in one go */
.b-trail--flip{ transform: scaleX(-1); }

.b-trail__stage{
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 80px;
    transform: translate(-50%, -50%) scale(var(--trail-scale));
}

.b-trail__svg{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.b-trail__track{
    fill: none;
    stroke: var(--line, #e4ded2);
    stroke-width: 2;
    stroke-dasharray: 6 7;
    opacity: 0.9;
}
/* Second track: shifted dash phase for the hand-made feel */
.b-trail__track--b{ stroke-dashoffset: 5; }

/* Skier font sizes compensate for the stage scale so the rendered glyph
   lands at sm ≈14px / md 18px / lg ≈24px. */
.b-trail__skier{
    position: absolute;
    top: 0;
    left: 0;
    line-height: 1;
    color: var(--pine, #2f4a3c);
    offset-path: path("M0,52 C150,12 300,72 450,28 S600,44 600,44");
    offset-rotate: 0deg;
    animation: kab-trail-glide 9s ease-in-out infinite alternate;
}
.b-trail--sm .b-trail__skier{ font-size: 23px; } /* ×0.6 ≈ 14px */
.b-trail--md .b-trail__skier{ font-size: 18px; }
.b-trail--lg .b-trail__skier{ font-size: 18px; } /* ×1.35 ≈ 24px */

@keyframes kab-trail-glide{
    from{ offset-distance: 0%; }
    to{ offset-distance: 100%; }
}

/* No offset-path support → hide the skier, keep the tracks */
@supports not (offset-path: path("M0,0 L1,1")){
    .b-trail__skier{ display: none; }
}

/* Reduced motion: park the skier partway along the trail */
@media (prefers-reduced-motion: reduce){
    .b-trail__skier{
        animation: none;
        offset-distance: 60%;
    }
}
