%% sneaker.sty
%% Copyright 2026 Aaron Molt
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later version.
%% The latest version of this license is in:
%%   https://www.latex-project.org/lppl.txt
%%
%% Maintainer: https://github.com/Aargon06/sneaker

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sneaker}[2026/06/02 v1.1 Configurable TikZ sneaker package]
 
\RequirePackage{tikz}
\usetikzlibrary{calc}
 
%% ---- Feature flags ----
\newif\ifsneakerlaces
\newif\ifsneakervelcro
\newif\ifsneakereyelets
\newif\ifsneakerpattern
\newif\ifsneakerstitching
\newif\ifsneakerrolls

%% ---- Pattern type storage ----
\def\sneakerPatternType{bolt}

%% ---- Custom colour flags ----
\newif\ifsneakercustompatterncolor
\newif\ifsneakercustomtonguecolor
\newif\ifsneakercustomlacecolor
\newif\ifsneakercustomsolecolor
\newif\ifsneakercustomtoecapcolor
 
%% ---- Default colour ----
\colorlet{MainCol}{blue}
 
%% ---- TikZ key interface ----
\tikzset{
  sneaker/.cd,
  color/.code={\colorlet{MainCol}{#1}},
  laces/.is   if=sneakerlaces,
  velcro/.is  if=sneakervelcro,
  eyelets/.is if=sneakereyelets,
  pattern/.is if=sneakerpattern,
  stitching/.is if=sneakerstitching,
  rolls/.is if=sneakerrolls,
  %% Pattern type: bolt (default) or star
  pattern type/.store in=\sneakerPatternType,
  pattern type/.default=bolt,
  %% Shortcuts
  bolt/.style={pattern=true, pattern type=bolt},
  star/.style={pattern=true, pattern type=star},
  %% Configurable colours
  pattern color/.code={\colorlet{CustomPatternCol}{#1}\sneakercustompatterncolortrue},
  tongue color/.code={\colorlet{CustomTongueCol}{#1}\sneakercustomtonguecolortrue},
  lace color/.code={\colorlet{CustomLaceCol}{#1}\sneakercustomlacecolortrue},
  sole color/.code={\colorlet{CustomSoleCol}{#1}\sneakercustomsolecolortrue},
  toe cap color/.code={\colorlet{CustomToeCapCol}{#1}\sneakercustomtoecapcolortrue},
}
 
%% =============================================================
%% Shared profile macros
%% =============================================================
 
\newcommand{\sneakerUpperNearOld}{%
  (0.12, 0.34)
  .. controls (0.04,0.50) and (0.02,0.72)  .. (0.02, 0.88)
  .. controls (0.02,1.02) and (0.04,1.14)  .. (0.08, 1.20)
  .. controls (0.10,1.34) and (0.20,1.42)  .. (0.34, 1.40)
  .. controls (0.48,1.36) and (0.56,1.28)  .. (0.68, 1.23)
  .. controls (0.85,1.22) and (1.00,1.21)  .. (1.15, 1.20)
  .. controls (1.50,1.12) and (1.85,1.02)  .. (2.10, 0.94)
  .. controls (2.50,0.78) and (2.80,0.55)  .. (3.00, 0.34)
}

\newcommand{\sneakerUpperNear}{%
  (0.12, 0.34)
  .. controls (0.04,0.50) and (0.02,0.72)  .. (0.02, 0.88)
  .. controls (0.02,1.02) and (0.04,1.14)  .. (0.08, 1.20)
  .. controls (0.10,1.34) and (0.20,1.42)  .. (0.34, 1.40)
  .. controls (0.48,1.36) and (0.56,1.28)  .. (0.68, 1.26)
  .. controls (0.85,1.25) and (1.00,1.24)  .. (1.15, 1.23)
  .. controls (1.50,1.18) and (1.85,1.12)  .. (2.10, 1.06)
  .. controls (2.50,0.97) and (3.22,0.78) .. (3.0+\dx*0.64, 0.34+\dy*0.64)
  ..controls (2.95, 0.43) and (2.80, 0.38) .. (2.50, 0.34)
  ..controls (2.2, 0.3) and (1.6, 0.45) .. (1.05, 0.34)
 .. controls (0.55, 0.27) and (0.3, 0.31) .. (0.13, 0.34)
}
 
\newcommand{\sole}{
	 (0.16, 0)
          .. controls (0.1, 0) and (0.04, 0.14) .. (0.06, 0.34)
          .. controls (0.3, 0.31) and (0.55, 0.27) .. (1.13,0.34)
	 .. controls (1.6, 0.45) and (2.2, 0.3) .. (2.5, 0.34)
	 .. controls (2.80, 0.38) and (2.95, 0.43)  .. (3.0+\dx*0.64, 0.34+\dy*0.64)
	   .. controls ({2.96+\dx*0.8}, {0.34+\dy*0.8+\bump/2})
          .. ({2.98+\dx}, {0.34+\dy})
	   .. controls ({3.06+\dx},{0.34+\dy}) and ({3.16+\dx},{0.11+\dy})
          .. ({3.13+\dx}, {0.1+\dy})
	   .. controls  (3.0+\dx*0.8, 0.1+\dy*0.41) .. (3.0+\dx*0.68, 0.1+\dy*0.4)
          .. controls (2.95, 0.09) and (2.80, 0.04) .. (2.53, 0)
	.. controls  (2.2, -0.02) and (1.6, 0.12) .. (1.04,0)
	.. controls  (0.55, -0.07) and (0.3, -0.02) .. (0.17, 0)
}

%% middle accent line on sole — follows wavy bottom
\newcommand{\soleMiddleLine}{%
  (0.14, 0.16)
  .. controls (0.30, 0.14) and (0.55, 0.09)  .. (1.05, 0.17)
  .. controls (1.60, 0.29) and (2.20, 0.14)  .. (2.50, 0.17)
  .. controls (2.78, 0.22) and (2.93, 0.28)  .. ({3.0+\dx*0.5}, {0.22+\dy*0.5})
}

\newcommand{\sneakerBevelInner}{%
  (2.94, 0.42)
  .. controls (2.74,0.60) and (2.44,0.82)  .. (2.05, 0.98)
  .. controls (1.80,1.06) and (1.46,1.15)  .. (1.15, 1.14)
  .. controls (1.00,1.15) and (0.85,1.16)  .. (0.68, 1.17)
  .. controls (0.56,1.22) and (0.48,1.30)  .. (0.34, 1.34)
  .. controls (0.22,1.36) and (0.14,1.28)  .. (0.12, 1.16)
  .. controls (0.08,1.04) and (0.08,0.88)  .. (0.08, 0.74)
}
 
\newcommand{\sneakerUpperFar}{%
  ({0.12+\dx}, {0.34+\dy})
  .. controls ({0.04+\dx},{0.50+\dy}) and ({0.02+\dx},{0.72+\dy})
  .. ({0.02+\dx}, {0.88+\dy})
  .. controls ({0.02+\dx},{1.02+\dy}) and ({0.04+\dx},{1.14+\dy})
  .. ({0.08+\dx}, {1.20+\dy})
  .. controls ({0.10+\dx},{1.34+\dy}) and ({0.20+\dx},{1.42+\dy})
  .. ({0.34+\dx}, {1.40+\dy})
  .. controls ({0.48+\dx},{1.36+\dy}) and ({0.56+\dx},{1.28+\dy})
  .. ({0.68+\dx}, {1.23+\dy})
  .. controls ({0.85+\dx},{1.22+\dy}) and ({1.00+\dx},{1.21+\dy})
  .. ({1.15+\dx}, {1.20+\dy})
  .. controls ({1.50+\dx},{1.12+\dy}) and ({1.85+\dx},{1.02+\dy})
  .. ({2.10+\dx}, {0.94+\dy})
  .. controls ({2.50+\dx},{0.78+\dy}) and ({2.80+\dx},{0.55+\dy})
  .. ({3.00+\dx}, {0.34+\dy})
}
 
%% =============================================================
%% pic definition
%% =============================================================
\tikzset{
  pics/sneaker/.style={
    code={
      %% reset all flags
      \tikzset{sneaker/laces=false, sneaker/velcro=false,
               sneaker/eyelets=false, sneaker/pattern=false,
               sneaker/stitching=false,
               sneaker/rolls=false}
      \sneakercustompatterncolorfalse
      \sneakercustomtonguecolorfalse
      \sneakercustomlacecolorfalse
      \sneakercustomsolecolorfalse
      \sneakercustomtoecapcolorfalse
      \def\sneakerPatternType{bolt}
      %% apply caller's keys
      \tikzset{sneaker/.cd, #1}
 
      %% derived colour palette
      \colorlet{DarkCol}{MainCol!55!black}
      \colorlet{MidCol}{MainCol!78!black}
      \colorlet{LightCol}{MainCol!35!white}
      \ifsneakercustomtoecapcolor
        \colorlet{ToeCol}{CustomToeCapCol}
        \colorlet{ToeTopCol}{CustomToeCapCol!85!black}
      \else
        \colorlet{ToeCol}{MainCol!12!white}
        \colorlet{ToeTopCol}{MainCol!22!white}
      \fi
      \ifsneakercustomtonguecolor
        \colorlet{TongueCol}{CustomTongueCol}
      \else
        \colorlet{TongueCol}{MainCol!45!white}
      \fi
      \colorlet{BevelCol}{MainCol!30!white}
      \ifsneakercustomlacecolor
        \colorlet{LaceCol}{CustomLaceCol}
      \else
        \colorlet{LaceCol}{white!90!yellow}
      \fi
      \ifsneakercustompatterncolor
        \colorlet{PatternCol}{CustomPatternCol}
      \else
        \colorlet{PatternCol}{white}
      \fi
      \ifsneakercustomsolecolor
        \colorlet{SoleCol}{CustomSoleCol}
      \else
        \colorlet{SoleCol}{white}
      \fi
 
      %% depth offset
      \pgfmathsetmacro{\dx}{0.60}
      \pgfmathsetmacro{\dy}{0.35}
      \pgfmathsetmacro{\bump}{0.08}

      %% stitch style
      \tikzset{sneaker stitch/.style={
        black!40, line width=0.25pt,
        dash pattern=on 0.8pt off 0.6pt,
        line cap=round
      }}
 
      \begin{scope}[line join=round, line cap=round]

      %% wheel parameters (needed early for far-side rolls in L1)
      \pgfmathsetmacro{\wheelR}{0.15}
      \pgfmathsetmacro{\hubR}{0.055}
      \pgfmathsetmacro{\axleR}{0.022}
      \pgfmathsetmacro{\wheelEmbed}{0.10}
      \pgfmathsetmacro{\wheelY}{-\wheelR+\wheelEmbed}
      \pgfmathsetmacro{\wA}{0.75}
      \pgfmathsetmacro{\wB}{2.15}
      %% approximate sole-bottom y at each wheel column (for hangers)
      \pgfmathsetmacro{\soleYA}{-0.03}
      \pgfmathsetmacro{\soleYB}{0.02}
 
      %% =============================================================
      %% L1 — far side
      %% =============================================================

      %% ---- far side rolls (bottoms peek below the near sole) ----
      \ifsneakerrolls
        \pgfmathsetmacro{\dyFar}{0.22}
        \foreach \wx in {\wA, \wB} {
          \fill[black!55, draw=black!65, line width=0.2pt]
            ({\wx+\dx}, {\wheelY+\dyFar}) circle (\wheelR);
          \fill[white!85!black, draw=black!25, line width=0.15pt]
            ({\wx+\dx}, {\wheelY+\dyFar}) circle ({\wheelR*0.72});
          \fill[gray!40]
            ({\wx+\dx}, {\wheelY+\dyFar}) circle (\hubR);
        }
      \fi

      \fill[MidCol, draw=black!25, line width=0.3pt]
        \sneakerUpperFar -- cycle;
 
      \fill[DarkCol!75!black, draw=black!20, line width=0.3pt]
        ({0.12+\dx}, {0.34+\dy})
        .. controls ({0.04+\dx},{0.50+\dy}) and ({0.02+\dx},{0.72+\dy})
        .. ({0.02+\dx}, {0.88+\dy})
        .. controls ({0.02+\dx},{1.02+\dy}) and ({0.04+\dx},{1.14+\dy})
        .. ({0.08+\dx}, {1.20+\dy})
        -- ({0.36+\dx}, {1.12+\dy})
        .. controls ({0.38+\dx}, {0.70+\dy}) and ({0.42+\dx}, {0.45+\dy})
        .. ({0.48+\dx}, {0.34+\dy})
        -- cycle;
 
      %% =============================================================
      %% L2 — top surfaces
      %% =============================================================
 
      \fill[SoleCol, draw=black!15, line width=0.3pt]
        (0.06, 0.34)
        .. controls ({0.08+\dx*0.5}, {0.34+\dy*0.5+\bump})
        .. ({0.08+\dx}, {0.34+\dy})
        -- ({2.95+\dx}, {0.34+\dy})
        .. controls ({2.95+\dx*0.5}, {0.34+\dy*0.5+\bump})
        .. (2.95, 0.34)
        -- cycle;

      \fill[LightCol, draw=black!25, line width=0.3pt]
        (0.06, 1.22)
        .. controls (0.08,1.36) and (0.18,1.44) .. (0.34, 1.42)
        .. controls ({0.34+\dx*0.5}, {1.42+\dy*0.5+\bump*0.8})
        .. ({0.34+\dx}, {1.42+\dy})
        .. controls ({0.18+\dx},{1.44+\dy}) and ({0.08+\dx},{1.36+\dy})
        .. ({0.06+\dx}, {1.22+\dy})
        .. controls ({0.06+\dx*0.5}, {1.22+\dy*0.5+\bump*1.2})
        .. (0.06, 1.22);
 
      \fill[MidCol]
        (0.34, 1.42)
        .. controls (0.46,1.38) and (0.56,1.30) .. (0.68, 1.25)
        .. controls (0.80,1.24) and (0.90,1.23) .. (1.00, 1.22)
        -- (1.00, 0.60)
        .. controls ({1.00+\dx*0.5}, {0.60+\dy*0.5+\bump})
        .. ({1.00+\dx}, {0.60+\dy})
        -- ({1.00+\dx}, {1.22+\dy})
        .. controls ({0.90+\dx},{1.23+\dy}) and ({0.80+\dx},{1.24+\dy})
        .. ({0.68+\dx}, {1.25+\dy})
        .. controls ({0.56+\dx},{1.30+\dy}) and ({0.46+\dx},{1.38+\dy})
        .. ({0.34+\dx}, {1.42+\dy})
        .. controls ({0.34+\dx*0.5}, {1.42+\dy*0.5+\bump*0.8})
        .. (0.34, 1.42);
      \fill[black, opacity=0.35]
        (0.34, 1.42)
        .. controls (0.46,1.38) and (0.56,1.30) .. (0.68, 1.25)
        .. controls (0.80,1.24) and (0.90,1.23) .. (1.00, 1.22)
        -- (1.00, 0.60)
        .. controls ({1.00+\dx*0.5}, {0.60+\dy*0.5+\bump})
        .. ({1.00+\dx}, {0.60+\dy})
        -- ({1.00+\dx}, {1.22+\dy})
        .. controls ({0.90+\dx},{1.23+\dy}) and ({0.80+\dx},{1.24+\dy})
        .. ({0.68+\dx}, {1.25+\dy})
        .. controls ({0.56+\dx},{1.30+\dy}) and ({0.46+\dx},{1.38+\dy})
        .. ({0.34+\dx}, {1.42+\dy})
        .. controls ({0.34+\dx*0.5}, {1.42+\dy*0.5+\bump*0.8})
        .. (0.34, 1.42);

      %% ---- collar padding ----
      \colorlet{CollarPadCol}{MainCol!38!white}
      \fill[CollarPadCol, draw=black!30, line width=0.3pt]
        (0.34, 1.42)
        .. controls (0.46,1.38) and (0.56,1.30) .. (0.68, 1.25)
        .. controls ({0.68+\dx*0.35}, {1.25+\dy*0.35+0.10})
        .. ({0.68+\dx}, {1.25+\dy})
        .. controls ({0.56+\dx},{1.30+\dy}) and ({0.46+\dx},{1.38+\dy})
        .. ({0.34+\dx}, {1.42+\dy})
        .. controls ({0.34+\dx*0.5}, {1.42+\dy*0.5+0.18})
        .. (0.34, 1.42);
      \fill[MainCol!20!white, opacity=0.45]
        (0.36, 1.41)
        .. controls (0.46,1.37) and (0.55,1.30) .. (0.65, 1.26)
        .. controls ({0.65+\dx*0.35}, {1.26+\dy*0.35+0.12})
        .. ({0.65+\dx}, {1.26+\dy})
        .. controls ({0.55+\dx},{1.31+\dy}) and ({0.46+\dx},{1.37+\dy})
        .. ({0.36+\dx}, {1.41+\dy})
        .. controls ({0.36+\dx*0.5}, {1.41+\dy*0.5+0.20})
        .. (0.36, 1.41);
      

      %% ---- eyelets far side ----
      \ifsneakereyelets
        \foreach \i in {0,...,3} {
          \pgfmathsetmacro{\t}{\i/4}
          \pgfmathsetmacro{\nex}{1.15 + \t*(2.10-1.15)}
          \pgfmathsetmacro{\ney}{1.20 + \t*(1.00-1.20) - 0.06}
          \pgfmathsetmacro{\fex}{\nex + \dx}
          \pgfmathsetmacro{\fey}{\ney + \dy}
          \fill[gray!50] (\fex, \fey) circle (0.04);
          \fill[black!45] (\fex, \fey) circle (0.018);
        }
      \fi

      %% ---- tongue ----
      \pgfmathsetmacro{\bumpToe}{0.04}
      \pgfmathsetmacro{\bumpCollar}{0.26}
 
      \fill[TongueCol, draw=black!30, line width=0.3pt]
        (1.15, 1.20)
        .. controls (1.50,1.12) and (1.85,1.02) .. (2.15, 0.94)
        .. controls ({2.10+\dx*0.5}, {0.94+\dy*0.5+\bumpToe})
        .. ({2.10+\dx}, {0.94+\dy-0.01})
        .. controls ({1.85+\dx},{1.02+\dy-0.07}) and ({1.50+\dx},{1.12+\dy-0.07})
        .. ({1.15+\dx}, {1.20+\dy-0.02})
        .. controls ({1.15+\dx*0.5}, {1.20+\dy*0.5+\bumpCollar})
        .. (1.15, 1.20);
      \fill[black, opacity=0.18]
        (1.15, 1.20)
        .. controls (1.50,1.12) and (1.85,1.02) .. (2.15, 0.94)
        .. controls ({2.10+\dx*0.5}, {0.94+\dy*0.5+\bumpToe})
        .. ({2.10+\dx}, {0.94+\dy-0.01})
        .. controls ({1.85+\dx},{1.02+\dy-0.07}) and ({1.50+\dx},{1.12+\dy-0.07})
        .. ({1.15+\dx}, {1.20+\dy-0.02})
        .. controls ({1.15+\dx*0.5}, {1.20+\dy*0.5+\bumpCollar})
        .. (1.15, 1.20);

%% Shadow Tongue
\begin{scope}
        % Clip auf die Zungenform
        \clip (1.15, 1.20) .. controls (1.50,1.12) and (1.85,1.02) .. (2.15, 0.94)
              .. controls ({2.10+\dx*0.5}, {0.94+\dy*0.5+\bumpToe})
              .. ({2.10+\dx}, {0.94+\dy-0.01})
              .. controls ({1.85+\dx},{1.02+\dy-0.07}) and ({1.50+\dx},{1.12+\dy-0.07})
              .. ({1.15+\dx}, {1.20+\dy-0.02})
              .. controls ({1.15+\dx*0.5}, {1.20+\dy*0.5+\bumpCollar}) .. (1.15, 1.20);
              
        % Schatten von der nahen Wand (links/unten)
        \fill[black, opacity=0.2] (1.1, 1.2) -- (2.2, 0.9) -- (2.2, 1.0) -- (1.1, 1.3) -- cycle;
        % Schatten von der hinteren Wand (oben)
        \fill[black, opacity=0.1] ({1.29+\dx}, {1.38+\dy}) circle (0.3);
      \end{scope}

	%%top part after tongue
	\fill[MainCol, draw=black!30, line width=0.3pt]
    (2.17, 0.94)  
    .. controls (2.60,0.68) and (2.80,0.50) .. (2.95, 0.33)
    .. controls ({2.95+\dx*0.5}, {0.34+\dy*0.5-\bump}) 
    .. ({2.98+\dx}, {0.35+\dy})                          
    ..  controls  ({2.80+\dx},{0.55+\dy}) and ({2.50+\dx},{0.78+\dy})
    .. ({2.10+\dx}, {0.94+\dy-0.01}) 
    .. controls ({2.10+\dx*0.5}, {0.94+\dy*0.5+\bumpToe}) 
    .. (2.17, 0.94) -- cycle;
 
      %% ---- toe cap top ----
      \fill[ToeTopCol, draw=black!30, line width=0.3pt, opacity=100]
        (2.35, 0.80)
        .. controls (2.60,0.68) and (2.80,0.50) .. (2.95, 0.33)
        .. controls ({2.95+\dx*0.5}, {0.34+\dy*0.5-\bump})
        .. ({2.98+\dx}, {0.35+\dy})
        .. controls ({2.82+\dx},{0.50+\dy}) and ({2.60+\dx},{0.68+\dy})
        .. ({2.36+\dx}, {0.81+\dy})
        .. controls ({2.35+\dx*0.5}, {0.80+\dy*0.5+\bump})
        .. (2.35, 0.80);
 
      %% =============================================================
      %% L3 — near side upper
      %% =============================================================
 
      \fill[MainCol, draw=black!45, line width=0.4pt]
        \sneakerUpperNear -- cycle;
 
      \fill[ToeCol, draw=black!45, line width=0.4pt, opacity=100]
        (2.40, 0.3)
	.. controls (2.43, 0.3) and (2.47, 0.32) .. (2.5, 0.34)
        .. controls (2.80, 0.38) and (2.95, 0.43)  .. (3.0+\dx*0.64, 0.34+\dy*0.64)
        .. controls (3.22,0.78) and (2.55,0.92) .. (2.52, 0.95)
        .. controls (2.32,0.68) and (2.34,0.52) .. (2.4, 0.34);
 
      \fill[DarkCol, draw=black!45, line width=0.4pt]
        (0.12, 0.34)
        .. controls (0.04,0.50) and (0.02,0.72) .. (0.02, 0.88)
        .. controls (0.02,1.02) and (0.04,1.14) .. (0.08, 1.2)
        .. controls (0.16, 1.14) and (0.27, 1.13) .. (0.36, 1.12)
        .. controls (0.37, 0.75) and (0.40, 0.45) .. (0.48, 0.31)
	.. controls (0.32, 0.3) and (0.2, 0.33) .. (0.13, 0.34)
        -- cycle;
 
      %% ---- side patch (pattern base) ----
      \fill[MidCol, opacity=0.25]
        (0.52, 0.40)
        .. controls (0.46,0.55) and (0.44,0.72) .. (0.48, 0.90)
        .. controls (0.95,1.00) and (1.55,0.98) .. (2.20, 0.82)
        .. controls (2.28,0.62) and (2.26,0.48) .. (2.20, 0.40)
        .. controls (1.60,0.46) and (1.00,0.42) .. (0.52, 0.40)
        -- cycle;
      \ifsneakerstitching
        \draw[black!55, line width=0.4pt, dash pattern=on 1.6pt off 1.0pt]
          (0.52, 0.40)
          .. controls (0.46,0.55) and (0.44,0.72) .. (0.48, 0.90)
          .. controls (0.95,1.00) and (1.55,0.98) .. (2.20, 0.82)
          .. controls (2.28,0.62) and (2.26,0.48) .. (2.20, 0.40)
          .. controls (1.60,0.46) and (1.00,0.42) .. (0.52, 0.40)
          -- cycle;
      \else
        \draw[black!45, line width=0.4pt]
          (0.52, 0.40)
          .. controls (0.46,0.55) and (0.44,0.72) .. (0.48, 0.90)
          .. controls (0.95,1.00) and (1.55,0.98) .. (2.20, 0.82)
          .. controls (2.28,0.62) and (2.26,0.48) .. (2.20, 0.40)
          .. controls (1.60,0.46) and (1.00,0.42) .. (0.52, 0.40)
          -- cycle;
      \fi
 
       %% ---- bevel ----
      \fill[BevelCol, opacity=0.50]
        (0.06, 1.22)
        .. controls (0.08,1.36) and (0.18,1.44) .. (0.34, 1.42)
        .. controls (0.46,1.38) and (0.56,1.30) .. (0.68, 1.26)
        .. controls (0.84,1.25) and (1.00,1.24) .. (1.15, 1.23)
        .. controls (1.46,1.19) and (1.80,1.14) .. (2.10, 1.06)
        .. controls (2.28,1.02) and (2.36, 0.98) .. (2.52,0.96)
	-- (2.48,0.92) 
        .. controls (2.3,0.95) and (2.18,0.98) .. (2.05, 1.00)
        .. controls (1.78,1.08) and (1.46,1.16) .. (1.15, 1.17)
        .. controls (1.00,1.18) and (0.84,1.19) .. (0.68, 1.20)
        .. controls (0.56,1.25) and (0.46,1.33) .. (0.34, 1.36)
        .. controls (0.20,1.38) and (0.12,1.30) .. (0.10, 1.18)
        -- cycle;


      %% =============================================================
      %% L4 — near side sole
      %% =============================================================

      \ifsneakerrolls
       %% 1. Parameter für die Aussparung (etwas größer als das Rad für den Gap-Effekt)
        \pgfmathsetmacro{\wellR}{\wheelR + 0.03} 
        \pgfmathsetmacro{\angA}{asin((\soleYA-\wheelY)/\wellR)}
        \pgfmathsetmacro{\angAend}{180-\angA}
        \pgfmathsetmacro{\angAx}{\wellR*cos(\angA)}
        \pgfmathsetmacro{\angB}{asin((\soleYB-\wheelY)/\wellR)}
        \pgfmathsetmacro{\angBend}{180-\angB}
        \pgfmathsetmacro{\angBx}{\wellR*cos(\angB)}

        %% 2. DIE TECHNISCHE SCHIENE (Halterung aus Bild 4)
        % Diese Schiene verbindet die Räder optisch und gibt Stabilität

	\foreach \wx/\sy in {\wA/\soleYA, \wB/\soleYB} {
    %% 1. DIE SEITENWAND (Rechts - erzeugt die Tiefe)
    \fill[black!30, draw=black!50, line width=0.3pt]
      ({\wx+0.25}, \wheelY)                     % Unten Vorne
      -- ({\wx+0.25+\dx}, \wheelY+\dy)          % Unten Hinten
      -- ({\wx+0.25+\dx}, \sy+\dy)                   % Oben Hinten (bündig Sohle)
      -- ({\wx+0.25}, \sy)                            % Oben Vorne (bündig Sohle)
      -- cycle;

    %% 2. DIE UNTERSEITE (mit deiner Kurve)
    \fill[black!15, draw=black!45, line width=0.3pt]
      ({\wx-0.25}, \wheelY) 
      .. controls ({\wx-0.02}, \wheelY) and ({\wx+0.02}, \wheelY+0.01) .. ({\wx+0.25}, \wheelY) 
      -- ({\wx+0.25+\dx}, \wheelY+\dy)
      .. controls ({\wx+0.02+\dx}, \wheelY+0.01+\dy) and ({\wx-0.02+\dx}, \wheelY+\dy) .. ({\wx-0.25+\dx}, \wheelY+\dy)
      -- cycle;

    %% 3. DIE VORDERSEITE
    \fill[black!22, draw=black!45, line width=0.3pt]
      ({\wx-0.25}, 0.13)                               % Oben Links
      -- ({\wx+0.25}, 0.13)                            % Oben Rechts
      -- ({\wx+0.25}, \wheelY)                   % Unten Rechts
      .. controls ({\wx+0.02}, \wheelY+0.01) and ({\wx-0.02}, \wheelY) .. ({\wx-0.25}, \wheelY) 
      -- cycle;
}
        
        % Kleine Achsschrauben-Andeutungen auf der Schiene
        \foreach \wx in {\wA, \wB} {
            \fill[black!30] (\wx, \wheelY+0.09) circle (0.02);
        }

        %% 3. SOHLE MIT WEICHEN AUSSPARUNGEN
        \fill[SoleCol, draw=black!40, line width=0.4pt]
          (0.16, 0)
          .. controls (0.1, 0) and (0.04, 0.14) .. (0.06, 0.34)
          .. controls (0.3, 0.31) and (0.55, 0.27) .. (1.13, 0.34)
          .. controls (1.6, 0.45) and (2.2, 0.3) .. (2.5, 0.34)
          .. controls (2.80, 0.38) and (2.95, 0.43) .. (3.0+\dx*0.64, 0.34+\dy*0.64)
          .. controls ({2.96+\dx*0.8}, {0.34+\dy*0.8+\bump/2})
          .. ({2.98+\dx}, {0.34+\dy})
          .. controls ({3.06+\dx},{0.34+\dy}) and ({3.16+\dx},{0.11+\dy})
          .. ({3.13+\dx}, {0.1+\dy})
          .. controls (3.0+\dx*0.8, 0.1+\dy*0.41) .. (3.0+\dx*0.68, 0.1+\dy*0.4)
          .. controls (2.95, 0.09) and (2.80, 0.04) .. (2.53, 0)
          % Weicher Übergang zu Rad B
          .. controls (2.45, 0.01) .. ({\wB+\angBx}, \soleYB)
          arc[start angle={\angB}, end angle={\angBend}, radius=\wellR]
          % Flache Brücke zwischen den Rädern (wie in Bild 4)
          .. controls (1.50, 0.12) .. ({\wA+\angAx}, \soleYA)
          arc[start angle={\angA}, end angle={\angAend}, radius=\wellR]
          % Übergang zur Ferse
          .. controls (0.40, 0.02) .. (0.17, 0)
          -- cycle;

        \draw[black!13, line width=0.25pt] \soleMiddleLine;

        %% 4. RÄDER (Vordergrund)
        \foreach \wx in {\wA, \wB} {
          % Reifenaußenseite (dunkler Ring)
          \fill[black!85, draw=black, line width=0.3pt] (\wx, \wheelY) circle (\wheelR);
          % Felge (heller Kern)
          \fill[white!95!black, draw=black!30, line width=0.2pt] (\wx, \wheelY) circle ({\wheelR*0.75});
          % Speichen/Design
          \foreach \a in {0,60,...,300} {
            \draw[black!15, line width=0.2pt] (\wx, \wheelY) -- +(\a:{\wheelR*0.7});
          }
          % Achse
          \fill[gray!40, draw=black!40, line width=0.2pt] (\wx, \wheelY) circle (\hubR);
          \fill[black!70] (\wx, \wheelY) circle (\axleR);
        }
      \else
        \fill[SoleCol, draw=black!40, line width=0.4pt]
          \sole -- cycle;
        \draw[black!13, line width=0.25pt] \soleMiddleLine;
      \fi

      %% =============================================================
      %% features
      %% =============================================================

      %% ---- stitching handled by side patch outline above ----
 
      %% ---- pattern ----
      \ifsneakerpattern
        \def\tmpbolt{bolt}
        \def\tmpstar{star}
        \ifx\sneakerPatternType\tmpstar
          \fill[PatternCol, opacity=0.88]
            (1.30, 0.84) -- (1.37, 0.71) -- (1.55, 0.66)
            -- (1.40, 0.60) -- (1.44, 0.46)
            -- (1.30, 0.54) -- (1.16, 0.46)
            -- (1.20, 0.60) -- (1.05, 0.66)
            -- (1.23, 0.71) -- cycle;
          \draw[PatternCol!50!black, line width=0.3pt, opacity=0.5]
            (1.30, 0.84) -- (1.37, 0.71) -- (1.55, 0.66)
            -- (1.40, 0.60) -- (1.44, 0.46)
            -- (1.30, 0.54) -- (1.16, 0.46)
            -- (1.20, 0.60) -- (1.05, 0.66)
            -- (1.23, 0.71) -- cycle;
        \else
          \fill[PatternCol, opacity=0.88]
            (1.09, 0.88) -- (1.34, 0.70) -- (1.17, 0.70)
            -- (1.51, 0.48) -- (1.39, 0.63) -- (1.56, 0.63) -- cycle;
          \draw[PatternCol!50!black, line width=0.3pt, opacity=0.5]
            (1.09, 0.88) -- (1.34, 0.70) -- (1.17, 0.70)
            -- (1.51, 0.48) -- (1.39, 0.63) -- (1.56, 0.63) -- cycle;
        \fi
      \fi
 
     %% ---- eyelets near side ----
      \ifsneakereyelets
        \foreach \i in {0,...,4} {
          \pgfmathsetmacro{\t}{\i/4}
          \pgfmathsetmacro{\nex}{1.15 + \t*(2.10-1.15)}
          \pgfmathsetmacro{\ney}{1.20 + \t*(1.00-1.20) - 0.06}
          \fill[gray!40] (\nex, \ney) circle (0.050);
          \fill[black!50] (\nex, \ney) circle (0.025);
        }
      \fi
  
      %% ---- laces ----
      \ifsneakerlaces
        \pgfmathsetmacro{\outx}{0.062}
        \pgfmathsetmacro{\outy}{0.11}
        \pgfmathsetmacro{\inx}{0.01}
        \pgfmathsetmacro{\iny}{-0.05}

        \ifsneakervelcro
          \pgfmathsetmacro{\t}{0}
          \pgfmathsetmacro{\nex}{1.15 + \t*(2.10-1.15)}
          \pgfmathsetmacro{\ney}{1.20 + \t*(1.00-1.20) - 0.08}
          \pgfmathsetmacro{\fex}{1.15 + \t*(2.10-1.15) + \dx}
          \pgfmathsetmacro{\fey}{1.20 + \t*(1.00-1.20) + \dy}
          \draw[LaceCol, line width=0.7pt] (\nex, \ney) -- (\fex, \fey);
          \foreach \i in {0,...,1} {
            \pgfmathsetmacro{\ta}{\i/4}
            \pgfmathsetmacro{\tb}{(\i+1)/4}
            \pgfmathsetmacro{\nexa}{1.15 + \ta*(2.10-1.15)}
            \pgfmathsetmacro{\neya}{1.20 + \ta*(1.00-1.20) - 0.06}
            \pgfmathsetmacro{\nexb}{1.15 + \tb*(2.10-1.15)}
            \pgfmathsetmacro{\neyb}{1.20 + \tb*(1.00-1.20) - 0.06}
            \pgfmathsetmacro{\fexa}{1.15 + \ta*(2.10-1.15) + \dx}
            \pgfmathsetmacro{\feya}{1.20 + \ta*(1.00-1.20) + \dy}
            \pgfmathsetmacro{\fexb}{1.15 + \tb*(2.10-1.15) + \dx}
            \pgfmathsetmacro{\feyb}{1.20 + \tb*(1.00-1.20) + \dy}
            \draw[LaceCol, line width=0.7pt]
              (\nexa, \neya) -- ({\fexb+\inx}, {\feyb+\iny});
            \draw[LaceCol, line width=0.7pt]
              (\fexa + 0.01, \feya + 0.01) -- (\nexb + \outx, \neyb+ \outy);
            \pgfmathsetmacro{\tend}{(2)/4}
            \pgfmathsetmacro{\nex}{1.15 + \tend*(2.10-1.15)}
            \pgfmathsetmacro{\ney}{1.20 + \tend*(1.00-1.20) - 0.06}
            \draw[LaceCol, line width=0.7pt] (\nex, \ney) -- ({\nex+\dx}, {\ney+\dy});
          }
        \else
          \pgfmathsetmacro{\t}{0}
          \pgfmathsetmacro{\nex}{1.15 + \t*(2.10-1.15)}
          \pgfmathsetmacro{\ney}{1.20 + \t*(1.00-1.20) - 0.06}
          \pgfmathsetmacro{\fex}{1.15 + \t*(2.10-1.15) + \dx}
          \pgfmathsetmacro{\fey}{1.20 + \t*(1.00-1.20) + \dy}
          \draw[LaceCol, line width=0.7pt] (\nex, \ney) -- (\fex, \fey);
          \foreach \i in {0,...,3} {
            \pgfmathsetmacro{\ta}{\i/4}
            \pgfmathsetmacro{\tb}{(\i+1)/4}
            \pgfmathsetmacro{\nexa}{1.15 + \ta*(2.10-1.15)}
            \pgfmathsetmacro{\neya}{1.20 + \ta*(1.00-1.20) - 0.06}
            \pgfmathsetmacro{\nexb}{1.15 + \tb*(2.10-1.15)}
            \pgfmathsetmacro{\neyb}{1.20 + \tb*(1.00-1.20) - 0.06}
            \pgfmathsetmacro{\fexa}{1.15 + \ta*(2.10-1.15) + \dx}
            \pgfmathsetmacro{\feya}{1.20 + \ta*(1.00-1.20) + \dy}
            \pgfmathsetmacro{\fexb}{1.15 + \tb*(2.10-1.15) + \dx}
            \pgfmathsetmacro{\feyb}{1.20 + \tb*(1.00-1.20) + \dy}
            \ifnum\i=3
              \draw[LaceCol, line width=0.7pt]
                (\nexa, \neya) -- ({\fexb+\inx-0.1}, {\feyb+\iny-0.02});
            \else
              \draw[LaceCol, line width=0.7pt]
                (\nexa, \neya) -- ({\fexb+\inx}, {\feyb+\iny});
            \fi
            \draw[LaceCol, line width=0.7pt]
              (\fexa + 0.075, \feya - \i * 0.013) -- (\nexb + \outx, \neyb+ \outy);
            \pgfmathsetmacro{\tend}{(4)/4}
            \pgfmathsetmacro{\nex}{1.15 + \tend*(2.10-1.15)}
            \pgfmathsetmacro{\ney}{1.20 + \tend*(1.00-1.20)}
            \draw[LaceCol, line width=0.7pt]
              (\nex, \ney -0.06) -- ({\nex+\dx}, {\ney+\dy-0.03});
          }
        \fi

        %% bow
        \pgfmathsetmacro{\bx}{1.18 + \dx*0.5}
        \pgfmathsetmacro{\by}{1.20 + \dy*0.5 + 0.01}
        \begin{scope}[shift={(\bx,\by)}, rotate=37, yscale=0.8, xscale=1.1]
          \draw[LaceCol, fill=LaceCol] (0,0) circle (0.02);
          \draw[LaceCol, line width=0.8pt, line cap=round]
            (0,0) .. controls (-0.4, 0.4) and (-0.8, 0.1) .. (0,0);
          \draw[LaceCol, line width=0.8pt, line cap=round]
            (0,0) .. controls (0.5, -0.3) and (0.9, 0.1) .. (0,0);
          \draw[LaceCol, line width=0.7pt, line cap=round]
            (0,0) .. controls (-0.2, -0.1) .. (-0.5, -0.2);
          \draw[LaceCol, line width=0.7pt, line cap=round]
            (0,0) .. controls (0.2, -0.4) .. (0.6, -0.5);
        \end{scope}
      \fi
 
      %% ---- velcro ----
      \ifsneakervelcro
        \ifsneakerlaces
          \pgfmathsetmacro{\ta}{0.70}
          \pgfmathsetmacro{\tb}{0.95}
          \pgfmathsetmacro{\na}{1.15 + \ta*(2.10-1.15)}
          \pgfmathsetmacro{\naz}{1.20 + \ta*(1.00-1.20)}
          \pgfmathsetmacro{\nb}{1.15 + \tb*(2.10-1.15)}
          \pgfmathsetmacro{\nbz}{1.20 + \tb*(1.00-1.20)}
          \pgfmathsetmacro{\fa}{\na + \dx}
          \pgfmathsetmacro{\faz}{\naz + \dy}
          \pgfmathsetmacro{\fb}{\nb + \dx}
          \pgfmathsetmacro{\fbz}{\nbz + \dy}
          \fill[gray!15, draw=gray!55, line width=0.5pt]
            (\na, \naz) -- (\fa, \faz) -- (\fb, \fbz) -- (\nb, \nbz) -- cycle;
          \pgfmathsetmacro{\mx}{(\na+\fb)/2}
          \pgfmathsetmacro{\my}{(\naz+\fbz)/2}
          \foreach \jj in {-0.08,-0.02,0.04,0.10} {
            \foreach \kk in {-0.03,0.03} {
              \fill[gray!40] ({\mx+\jj},{\my+\kk}) circle (0.011);
            }
          }
          \fill[gray!30, draw=gray!60, line width=0.4pt]
            ({\fa-0.02},\faz) -- ({\fa+0.06},{\faz+0.02})
            -- ({\fb+0.06},{\fbz+0.02}) -- ({\fb-0.02},\fbz) -- cycle;
        \else
          \foreach \i in {0,1} {
            \pgfmathsetmacro{\ta}{0.12 + \i*0.42}
            \pgfmathsetmacro{\tb}{\ta + 0.22}
            \pgfmathsetmacro{\na}{1.15 + \ta*(2.10-1.15)}
            \pgfmathsetmacro{\naz}{1.20 + \ta*(1.00-1.20)}
            \pgfmathsetmacro{\nb}{1.15 + \tb*(2.10-1.15)}
            \pgfmathsetmacro{\nbz}{1.20 + \tb*(1.00-1.20)}
            \pgfmathsetmacro{\fa}{\na + \dx}
            \pgfmathsetmacro{\faz}{\naz + \dy}
            \pgfmathsetmacro{\fb}{\nb + \dx}
            \pgfmathsetmacro{\fbz}{\nbz + \dy}
            \fill[gray!15, draw=gray!55, line width=0.5pt]
              (\na, \naz) -- (\fa, \faz) -- (\fb, \fbz) -- (\nb, \nbz) -- cycle;
            \pgfmathsetmacro{\mx}{(\na+\fb)/2}
            \pgfmathsetmacro{\my}{(\naz+\fbz)/2}
            \foreach \jj in {-0.08,-0.02,0.04,0.10} {
              \foreach \kk in {-0.03,0.03} {
                \fill[gray!40] ({\mx+\jj},{\my+\kk}) circle (0.011);
              }
            }
            \fill[gray!30, draw=gray!60, line width=0.4pt]
              ({\fa-0.02},\faz) -- ({\fa+0.06},{\faz+0.02})
              -- ({\fb+0.06},{\fbz+0.02}) -- ({\fb-0.02},\fbz) -- cycle;
          }
        \fi
      \fi

      \end{scope}
    }
  }
}
 
\endinput