/* Hand-drawn SVG primitives — all stroke-based so we can animate draw-in */

type SvgStyleProps = { style?: React.CSSProperties };
type SvgColorProps = SvgStyleProps & { color?: string };
type IconSizeProps = { size?: number; color?: string };

const Underline = ({ style }: SvgStyleProps) => (
  <svg viewBox="0 0 300 14" preserveAspectRatio="none" style={style}>
    <path
      d="M2 8 Q 40 2, 80 7 T 160 8 Q 220 11, 298 6"
      fill="none"
      stroke="var(--ochre-deep)"
      strokeWidth="4"
      strokeLinecap="round"
    />
  </svg>
);

const UnderlineDouble = ({ style }: SvgStyleProps) => (
  <svg viewBox="0 0 300 14" preserveAspectRatio="none" style={style}>
    <path d="M2 5 Q 60 1, 160 6 T 298 4" fill="none" stroke="var(--ochre-deep)" strokeWidth="3" strokeLinecap="round" />
    <path d="M4 10 Q 80 13, 160 10 T 296 11" fill="none" stroke="var(--ochre-deep)" strokeWidth="2" strokeLinecap="round" opacity="0.7" />
  </svg>
);

const CircleScribble = ({ style, color = "var(--ochre-deep)" }: SvgColorProps) => (
  <svg viewBox="0 0 200 60" preserveAspectRatio="none" style={style}>
    <path
      d="M100 6 C 40 6, 8 20, 10 32 C 12 48, 60 56, 100 54 C 160 52, 194 44, 192 30 C 190 14, 150 4, 95 8"
      fill="none"
      stroke={color}
      strokeWidth="2.5"
      strokeLinecap="round"
    />
  </svg>
);

const ArrowHand = ({ style, color = "var(--ink-soft)" }: SvgColorProps) => (
  <svg viewBox="0 0 70 50" style={style}>
    <path
      d="M4 6 Q 20 30, 58 38"
      fill="none"
      stroke={color}
      strokeWidth="1.8"
      strokeLinecap="round"
    />
    <path
      d="M48 28 L 60 40 L 48 44"
      fill="none"
      stroke={color}
      strokeWidth="1.8"
      strokeLinecap="round"
      strokeLinejoin="round"
    />
  </svg>
);

const ArrowRight = ({ size = 18, color = "currentColor" }: IconSizeProps) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill="none">
    <path d="M4 12h15m-5-6l6 6-6 6" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
  </svg>
);

const Asterisk = ({ size = 20, color = "var(--ochre-deep)" }: IconSizeProps) => (
  <svg width={size} height={size} viewBox="0 0 20 20">
    <g stroke={color} strokeWidth="1.6" strokeLinecap="round">
      <line x1="10" y1="2" x2="10" y2="18" />
      <line x1="3" y1="6" x2="17" y2="14" />
      <line x1="17" y1="6" x2="3" y2="14" />
    </g>
  </svg>
);

const Strike = ({ style }: SvgStyleProps) => (
  <svg viewBox="0 0 100 10" preserveAspectRatio="none" style={style}>
    <path d="M2 6 Q 30 2, 50 6 T 98 5" fill="none" stroke="var(--red)" strokeWidth="2" strokeLinecap="round" />
  </svg>
);

const Star = ({ size = 24, color = "var(--ochre-deep)" }: IconSizeProps) => (
  <svg width={size} height={size} viewBox="0 0 24 24">
    <path
      d="M12 2 L 13.5 9.5 L 21 11 L 15 15 L 17 22 L 12 18 L 7 22 L 9 15 L 3 11 L 10.5 9.5 Z"
      fill="none"
      stroke={color}
      strokeWidth="1.4"
      strokeLinejoin="round"
    />
  </svg>
);

// hand-drawn service icons
const IconPencil = () => (
  <svg viewBox="0 0 64 64" width="64" height="64">
    <g fill="none" stroke="var(--ink)" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
      <path d="M8 54 L 14 40 L 44 10 Q 48 6, 52 10 Q 56 14, 52 18 L 22 48 L 8 54 Z" />
      <path d="M42 12 L 50 20" />
      <path d="M14 40 L 22 48" />
      <path d="M8 54 L 14 48" />
    </g>
    <circle cx="52" cy="8" r="4" fill="var(--ochre)" stroke="var(--ink)" strokeWidth="1.5" />
  </svg>
);

const IconBrain = () => (
  <svg viewBox="0 0 64 64" width="64" height="64">
    <g fill="none" stroke="var(--ink)" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
      <path d="M20 18 Q 12 18, 10 26 Q 8 32, 14 36 Q 10 42, 16 48 Q 22 54, 32 50 Q 42 54, 48 48 Q 54 42, 50 36 Q 56 32, 54 26 Q 52 18, 44 18 Q 40 10, 32 12 Q 24 10, 20 18 Z" />
      <path d="M32 12 L 32 50" strokeDasharray="2 3" />
      <circle cx="22" cy="28" r="2" fill="var(--ochre)" />
      <circle cx="42" cy="34" r="2" fill="var(--ochre)" />
    </g>
  </svg>
);

const IconCode = () => (
  <svg viewBox="0 0 64 64" width="64" height="64">
    <g fill="none" stroke="var(--ink)" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
      <rect x="6" y="12" width="52" height="40" rx="2" />
      <path d="M6 22 L 58 22" />
      <circle cx="12" cy="17" r="1.4" fill="var(--ink)" />
      <circle cx="17" cy="17" r="1.4" fill="var(--ink)" />
      <circle cx="22" cy="17" r="1.4" fill="var(--ink)" />
      <path d="M18 32 L 12 38 L 18 44" />
      <path d="M46 32 L 52 38 L 46 44" />
      <path d="M36 30 L 28 46" stroke="var(--ochre-deep)" />
    </g>
  </svg>
);

const IconShop = () => (
  <svg viewBox="0 0 64 64" width="64" height="64">
    <g fill="none" stroke="var(--ink)" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
      <path d="M8 20 L 12 52 L 52 52 L 56 20 Z" />
      <path d="M8 20 L 14 8 L 50 8 L 56 20" />
      <path d="M24 28 Q 24 36, 32 36 Q 40 36, 40 28" strokeDasharray="0" />
      <circle cx="20" cy="44" r="1.4" fill="var(--ochre)" />
      <circle cx="44" cy="44" r="1.4" fill="var(--ochre)" />
    </g>
  </svg>
);

const IconBot = () => (
  <svg viewBox="0 0 64 64" width="64" height="64">
    <g fill="none" stroke="var(--ink)" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
      <rect x="12" y="18" width="40" height="32" rx="4" />
      <circle cx="22" cy="32" r="3" fill="var(--ochre)" />
      <circle cx="42" cy="32" r="3" fill="var(--ochre)" />
      <path d="M26 42 L 38 42" />
      <path d="M32 18 L 32 10" />
      <circle cx="32" cy="8" r="3" fill="var(--paper)" />
      <path d="M6 28 L 12 28" />
      <path d="M52 28 L 58 28" />
    </g>
  </svg>
);

const IconFlow = () => (
  <svg viewBox="0 0 64 64" width="64" height="64">
    <g fill="none" stroke="var(--ink)" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
      <rect x="6" y="10" width="18" height="14" />
      <rect x="40" y="10" width="18" height="14" />
      <rect x="6" y="40" width="18" height="14" />
      <rect x="40" y="40" width="18" height="14" />
      <path d="M24 17 L 40 17" />
      <path d="M24 47 L 40 47" />
      <path d="M15 24 L 15 40" strokeDasharray="3 3" />
      <path d="M49 24 L 49 40" strokeDasharray="3 3" />
      <circle cx="32" cy="32" r="3" fill="var(--ochre)" />
    </g>
  </svg>
);

Object.assign(window, {
  Underline, UnderlineDouble, CircleScribble, ArrowHand, ArrowRight,
  Asterisk, Strike, Star,
  IconPencil, IconBrain, IconCode, IconShop, IconBot, IconFlow,
});
