<?php
/**
 * Leaf sprig — stem with alternating leaves.
 *
 * @var string    $color
 * @var int       $size
 * @var float|int $delay
 */
$color = $color ?? 'var(--cc-moss)';
$size = (int)($size ?? 120);
$delay = $delay ?? 0.3;
?>
<svg viewBox="0 0 120 120" width="<?= $size ?>" height="<?= $size ?>" style="overflow:visible;" aria-hidden="true">
    <g fill="none" stroke="<?= h($color) ?>" stroke-width="1.6" stroke-linecap="round"
       class="cc-draw-path"
       pathLength="1"
       style="--cc-draw-delay: <?= h((string)$delay) ?>s; animation-duration: 2s;">
        <path d="M60,110 C 60,80 60,40 60,14" />
        <?php for ($i = 0; $i < 5; $i++):
            $y = 100 - $i * 18;
            $dir = $i % 2 === 0 ? 1 : -1;
            $x2 = 60 + $dir * 28;
            $y2 = $y - 14;
            $cpx1 = 60 + $dir * 14; $cpy1 = $y - 4;
            $cpx2 = 60 + $dir * 22; $cpy2 = $y - 10;
        ?>
            <path d="M60,<?= $y ?> C <?= $cpx1 ?>,<?= $cpy1 ?> <?= $cpx2 ?>,<?= $cpy2 ?> <?= $x2 ?>,<?= $y2 ?>" />
            <ellipse cx="<?= $x2 ?>" cy="<?= $y2 ?>" rx="6" ry="2.5"
                     transform="rotate(<?= $dir * 30 ?> <?= $x2 ?> <?= $y2 ?>)"
                     fill="<?= h($color) ?>" fill-opacity="0.15" stroke="none" />
        <?php endfor; ?>
    </g>
</svg>
