import type { ReactNode } from 'react';
import { cx } from '@/site/lib/cx';

/**
 * Line drawings for the four steps of the process (home page): they fill
 * the step pictures until the clinic's own photos are added to the media
 * library (media/home/process-1…4.*). Tinted by the nearest [data-accent].
 */
const drawings: ReactNode[] = [
    // 1 · Listening: two circles that overlap — a conversation.
    <>
        <circle cx="158" cy="150" r="78" />
        <circle cx="242" cy="150" r="78" />
        <path
            d="M200 84c22 16 34 40 34 66s-12 50-34 66c-22-16-34-40-34-66s12-50 34-66Z"
            fill="var(--accent)"
            fillOpacity="0.16"
        />
        <path
            d="M52 118c-10 20-10 44 0 64M30 100c-16 32-16 68 0 100M348 118c10 20 10 44 0 64M370 100c16 32 16 68 0 100"
            opacity="0.55"
        />
        <circle cx="200" cy="150" r="4" fill="var(--accent)" stroke="none" />
    </>,
    // 2 · Plan: a route through marked points.
    <>
        <g strokeWidth="0.7" opacity="0.4">
            <path d="M40 60H360M40 105H360M40 150H360M40 195H360M40 240H360M80 30V270M140 30V270M200 30V270M260 30V270M320 30V270" />
        </g>
        <path
            d="M80 240C120 240 110 150 140 150S190 195 200 105 250 60 320 60"
            strokeWidth="1.8"
        />
        <g fill="var(--color-ink)">
            <circle cx="80" cy="240" r="9" />
            <circle cx="140" cy="150" r="9" />
            <circle cx="200" cy="105" r="9" />
        </g>
        <circle cx="320" cy="60" r="16" opacity="0.5" />
        <circle cx="320" cy="60" r="7" fill="var(--accent)" stroke="none" />
    </>,
    // 3 · Treatment: a precise point inside measured rings.
    <>
        <circle cx="200" cy="150" r="112" strokeDasharray="1 7" />
        <circle cx="200" cy="150" r="78" opacity="0.75" />
        <circle cx="200" cy="150" r="42" />
        <circle
            cx="200"
            cy="150"
            r="42"
            fill="var(--accent)"
            fillOpacity="0.14"
            stroke="none"
        />
        <path d="M200 20V96M200 204V280M70 150H146M254 150H330" />
        <path
            d="M200 38h10M200 262h10M88 150v10M312 150v10"
            strokeWidth="0.8"
            opacity="0.6"
        />
        <circle cx="200" cy="150" r="5" fill="var(--accent)" stroke="none" />
    </>,
    // 4 · Follow-up: a cycle with its check-ups marked.
    <>
        <path d="M290 84A112 112 0 1 0 311 164" strokeWidth="1.8" />
        <path d="M268 78l24 6 2-25" strokeWidth="1.8" />
        <circle cx="200" cy="150" r="70" strokeDasharray="1 7" opacity="0.7" />
        <g fill="var(--color-ink)">
            <circle cx="104" cy="92" r="10" />
            <circle cx="112" cy="218" r="10" />
            <circle cx="232" cy="257" r="10" />
        </g>
        <path
            d="M99 92l4 4 7-8M107 218l4 4 7-8M227 257l4 4 7-8"
            strokeWidth="1.4"
        />
        <path d="M200 112v38l26 16" />
        <circle cx="200" cy="150" r="4" fill="var(--accent)" stroke="none" />
    </>,
];

type ProcessArtProps = {
    /** Step number, from 1. */
    step: number;
    className?: string;
};

export function ProcessArt({ step, className }: ProcessArtProps) {
    return (
        <div
            className={cx(
                'stage-dark relative isolate grid size-full place-items-center overflow-hidden',
                className,
            )}
        >
            <div
                aria-hidden="true"
                className="absolute inset-0 -z-10 bg-[radial-gradient(90%_80%_at_50%_45%,var(--accent-2),transparent_70%)] opacity-35"
            />
            <svg
                viewBox="0 0 400 300"
                fill="none"
                stroke="var(--accent)"
                strokeWidth="1.2"
                strokeLinecap="round"
                strokeLinejoin="round"
                aria-hidden="true"
                className="block h-[82%] w-auto max-w-full"
            >
                {drawings[(step - 1) % drawings.length]}
            </svg>
        </div>
    );
}
