// SVG icon definitions. Each icon is built on a 1024 viewBox so it scales cleanly to
// every iOS tile size. The outer rounded shell is provided by the parent container
// (border-radius), so the SVG fills 0–1024 edge-to-edge with the background plate.

// --- A. APERTURE ---------------------------------------------------------------
// A hunter's aperture / iris. Six bold blades wrap a single rising candle wick.
// Sniper / focus metaphor. Deep midnight base with a single emerald accent.
const IconAperture = ({ idSuffix = "" }) => {
  const uid = "a" + idSuffix;
  return (
    <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <linearGradient id={`${uid}-bg`} x1="0" y1="0" x2="1" y2="1">
          <stop offset="0" stopColor="#0d1220"/>
          <stop offset="1" stopColor="#1b2238"/>
        </linearGradient>
        <linearGradient id={`${uid}-blade`} x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stopColor="#1f2a44"/>
          <stop offset="1" stopColor="#0a0f1c"/>
        </linearGradient>
        <radialGradient id={`${uid}-glow`} cx="0.5" cy="0.5" r="0.4">
          <stop offset="0" stopColor="#34d399" stopOpacity="0.5"/>
          <stop offset="1" stopColor="#34d399" stopOpacity="0"/>
        </radialGradient>
      </defs>
      <rect width="1024" height="1024" fill={`url(#${uid}-bg)`}/>
      <circle cx="512" cy="512" r="280" fill={`url(#${uid}-glow)`}/>
      {/* six aperture blades */}
      <g transform="translate(512 512)" stroke="rgba(255,255,255,0.04)" strokeWidth="2">
        {[0,1,2,3,4,5].map(i => (
          <g key={i} transform={`rotate(${i*60})`}>
            <path d="M -160 -260 L 200 -200 L 0 60 Z" fill={`url(#${uid}-blade)`}/>
          </g>
        ))}
      </g>
      {/* central single candle */}
      <g transform="translate(512 512)">
        <line x1="0" y1="-180" x2="0" y2="180" stroke="#34d399" strokeWidth="14" strokeLinecap="round"/>
        <rect x="-46" y="-90" width="92" height="200" rx="14" fill="#34d399"/>
        <rect x="-46" y="-90" width="92" height="92" rx="14" fill="#10b981"/>
      </g>
    </svg>
  );
};

// --- B. RETICLE ----------------------------------------------------------------
// Pure scope reticle. Ring + broken cross arms, nothing in the middle.
// Cool charcoal plate, signal-orange accent.
const IconReticle = ({ idSuffix = "" }) => {
  const uid = "b" + idSuffix;
  return (
    <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <linearGradient id={`${uid}-bg`} x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stopColor="#22252c"/>
          <stop offset="1" stopColor="#0f1115"/>
        </linearGradient>
      </defs>
      <rect width="1024" height="1024" fill={`url(#${uid}-bg)`}/>
      {/* reticle ring — solid + soft halo */}
      <circle cx="512" cy="512" r="300" fill="none" stroke="rgba(255,107,61,0.22)" strokeWidth="46"/>
      <circle cx="512" cy="512" r="300" fill="none" stroke="#ff6b3d" strokeWidth="24"/>
      {/* cross arms — broken, leaving the center wide open */}
      <g stroke="#ff6b3d" strokeWidth="24" strokeLinecap="round">
        <line x1="512" y1="120" x2="512" y2="232"/>
        <line x1="512" y1="792" x2="512" y2="904"/>
        <line x1="120" y1="512" x2="232" y2="512"/>
        <line x1="792" y1="512" x2="904" y2="512"/>
      </g>
    </svg>
  );
};

// --- B2. RETICLE — THIN THROUGH ------------------------------------------------
// Alternate take: arms pass continuously through the ring, with a clean gap at
// the very center. More "engineering instrument" than "scope".
const IconReticleThrough = ({ idSuffix = "" }) => {
  const uid = "b2" + idSuffix;
  return (
    <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <linearGradient id={`${uid}-bg`} x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stopColor="#22252c"/>
          <stop offset="1" stopColor="#0f1115"/>
        </linearGradient>
        <mask id={`${uid}-gap`}>
          <rect width="1024" height="1024" fill="white"/>
          <circle cx="512" cy="512" r="60" fill="black"/>
        </mask>
      </defs>
      <rect width="1024" height="1024" fill={`url(#${uid}-bg)`}/>
      <g mask={`url(#${uid}-gap)`} stroke="#ff6b3d" strokeWidth="18" strokeLinecap="round">
        <line x1="512" y1="120" x2="512" y2="904"/>
        <line x1="120" y1="512" x2="904" y2="512"/>
      </g>
      <circle cx="512" cy="512" r="300" fill="none" stroke="#ff6b3d" strokeWidth="24"/>
    </svg>
  );
};

// --- B3. RETICLE — DOUBLE RING -------------------------------------------------
// Two concentric rings, short outer cross ticks only. Premium / instrument feel.
const IconReticleDouble = ({ idSuffix = "" }) => {
  const uid = "b3" + idSuffix;
  return (
    <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <linearGradient id={`${uid}-bg`} x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stopColor="#22252c"/>
          <stop offset="1" stopColor="#0f1115"/>
        </linearGradient>
      </defs>
      <rect width="1024" height="1024" fill={`url(#${uid}-bg)`}/>
      <circle cx="512" cy="512" r="340" fill="none" stroke="#ff6b3d" strokeWidth="22"/>
      <circle cx="512" cy="512" r="200" fill="none" stroke="#ff6b3d" strokeWidth="14" opacity="0.55"/>
      <g stroke="#ff6b3d" strokeWidth="22" strokeLinecap="round">
        <line x1="512" y1="120" x2="512" y2="170"/>
        <line x1="512" y1="854" x2="512" y2="904"/>
        <line x1="120" y1="512" x2="170" y2="512"/>
        <line x1="854" y1="512" x2="904" y2="512"/>
      </g>
    </svg>
  );
};

// --- C. PEAK -------------------------------------------------------------------
// Bull-run mountain peaks form an upward arrow / "H" silhouette. Sunrise gradient
// behind. Heroic, optimistic; the daily-hunt narrative.
const IconPeak = ({ idSuffix = "" }) => {
  const uid = "c" + idSuffix;
  return (
    <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <linearGradient id={`${uid}-sky`} x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stopColor="#ffb74d"/>
          <stop offset="0.55" stopColor="#ff7a59"/>
          <stop offset="1" stopColor="#c2185b"/>
        </linearGradient>
        <linearGradient id={`${uid}-peak`} x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stopColor="#1a1f2c"/>
          <stop offset="1" stopColor="#0a0d14"/>
        </linearGradient>
      </defs>
      <rect width="1024" height="1024" fill={`url(#${uid}-sky)`}/>
      {/* sun disc */}
      <circle cx="512" cy="420" r="120" fill="#ffe082" opacity="0.95"/>
      <circle cx="512" cy="420" r="120" fill="none" stroke="#fff3c4" strokeWidth="2" opacity="0.6"/>
      {/* back peak */}
      <path d="M -20 820 L 280 540 L 460 720 L 720 360 L 1044 820 Z" fill={`url(#${uid}-peak)`} opacity="0.7"/>
      {/* front peak — sharper "hunter" silhouette */}
      <path d="M -20 900 L 220 700 L 380 820 L 580 580 L 760 740 L 1044 540 L 1044 1044 L -20 1044 Z" fill={`url(#${uid}-peak)`}/>
      {/* tiny tick marker on the highest crest */}
      <g transform="translate(580 580)">
        <path d="M 0 -28 L 14 -8 L -14 -8 Z" fill="#ffe082"/>
        <line x1="0" y1="-8" x2="0" y2="24" stroke="#ffe082" strokeWidth="6" strokeLinecap="round"/>
      </g>
    </svg>
  );
};

// --- D. MONOGRAM ---------------------------------------------------------------
// A bold "DH" monogram cut into a financial-green plate, where the H's crossbar
// is replaced by a rising chart line. Confident, brand-forward.
const IconMonogram = ({ idSuffix = "" }) => {
  const uid = "d" + idSuffix;
  return (
    <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <linearGradient id={`${uid}-bg`} x1="0" y1="0" x2="1" y2="1">
          <stop offset="0" stopColor="#0f4f3a"/>
          <stop offset="1" stopColor="#062a20"/>
        </linearGradient>
        <linearGradient id={`${uid}-shine`} x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stopColor="#ffffff" stopOpacity="0.18"/>
          <stop offset="0.5" stopColor="#ffffff" stopOpacity="0"/>
        </linearGradient>
      </defs>
      <rect width="1024" height="1024" fill={`url(#${uid}-bg)`}/>
      <rect width="1024" height="540" fill={`url(#${uid}-shine)`}/>
      {/* faint chart grid */}
      <g stroke="rgba(255,255,255,0.05)" strokeWidth="2">
        <line x1="0" y1="260" x2="1024" y2="260"/>
        <line x1="0" y1="520" x2="1024" y2="520"/>
        <line x1="0" y1="780" x2="1024" y2="780"/>
      </g>
      {/* big H — stylized as two vertical bars */}
      <g fill="#f3efe6">
        <rect x="220" y="240" width="120" height="544" rx="20"/>
        <rect x="684" y="240" width="120" height="544" rx="20"/>
      </g>
      {/* crossbar replaced by a rising line + tick */}
      <polyline points="220,640 400,560 540,600 680,420"
        fill="none" stroke="#7af2c0" strokeWidth="40" strokeLinecap="round" strokeLinejoin="round"/>
      <circle cx="680" cy="420" r="36" fill="#7af2c0"/>
      <circle cx="680" cy="420" r="14" fill="#062a20"/>
    </svg>
  );
};

// --- E. CANDLE ARROW -----------------------------------------------------------
// Three candles ascending into a sharp arrowhead. Pure, iconic, very legible at
// 40px. Two-tone navy + electric cyan.
const IconCandleArrow = ({ idSuffix = "" }) => {
  const uid = "e" + idSuffix;
  return (
    <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <linearGradient id={`${uid}-bg`} x1="0" y1="0" x2="1" y2="1">
          <stop offset="0" stopColor="#1e3a8a"/>
          <stop offset="1" stopColor="#0b1638"/>
        </linearGradient>
      </defs>
      <rect width="1024" height="1024" fill={`url(#${uid}-bg)`}/>
      {/* three candles + a final arrowhead */}
      <g strokeLinecap="round">
        {/* candle 1 */}
        <line x1="240" y1="600" x2="240" y2="800" stroke="rgba(255,255,255,0.4)" strokeWidth="14"/>
        <rect x="190" y="640" width="100" height="180" rx="14" fill="#ffffff" opacity="0.55"/>
        {/* candle 2 */}
        <line x1="460" y1="460" x2="460" y2="760" stroke="rgba(255,255,255,0.55)" strokeWidth="14"/>
        <rect x="410" y="500" width="100" height="220" rx="14" fill="#ffffff" opacity="0.75"/>
        {/* candle 3 */}
        <line x1="680" y1="320" x2="680" y2="700" stroke="#ffffff" strokeWidth="14"/>
        <rect x="630" y="360" width="100" height="280" rx="14" fill="#ffffff"/>
      </g>
      {/* arrow head extending from candle 3 toward upper-right */}
      <g transform="translate(680 320)">
        <line x1="0" y1="0" x2="120" y2="-120" stroke="#22d3ee" strokeWidth="44" strokeLinecap="round"/>
        <path d="M 80 -160 L 160 -160 L 160 -80 Z" fill="#22d3ee"/>
      </g>
    </svg>
  );
};

// --- F. RADAR ------------------------------------------------------------------
// Radar sweep — concentric rings with a bright candle blip at the lock-on point.
// Premium-quant feel; the "scanning the market" metaphor.
const IconRadar = ({ idSuffix = "" }) => {
  const uid = "f" + idSuffix;
  return (
    <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <radialGradient id={`${uid}-bg`} cx="0.5" cy="0.5" r="0.7">
          <stop offset="0" stopColor="#1a2030"/>
          <stop offset="1" stopColor="#06080f"/>
        </radialGradient>
        <linearGradient id={`${uid}-sweep`} x1="0.5" y1="0.5" x2="1" y2="0">
          <stop offset="0" stopColor="#a3e635" stopOpacity="0.55"/>
          <stop offset="1" stopColor="#a3e635" stopOpacity="0"/>
        </linearGradient>
      </defs>
      <rect width="1024" height="1024" fill={`url(#${uid}-bg)`}/>
      {/* concentric rings */}
      <g fill="none" stroke="#a3e635" strokeWidth="3" opacity="0.35">
        <circle cx="512" cy="512" r="120"/>
        <circle cx="512" cy="512" r="220"/>
        <circle cx="512" cy="512" r="320"/>
        <circle cx="512" cy="512" r="420"/>
      </g>
      {/* crosshairs */}
      <g stroke="#a3e635" strokeWidth="3" opacity="0.25">
        <line x1="512" y1="60" x2="512" y2="964"/>
        <line x1="60" y1="512" x2="964" y2="512"/>
      </g>
      {/* sweep wedge */}
      <path d="M 512 512 L 512 92 A 420 420 0 0 1 932 512 Z" fill={`url(#${uid}-sweep)`}/>
      {/* blip — a tiny green candle */}
      <g transform="translate(720 340)">
        <circle r="58" fill="#a3e635" opacity="0.25"/>
        <circle r="30" fill="#a3e635" opacity="0.45"/>
        <line x1="0" y1="-30" x2="0" y2="30" stroke="#0c1a07" strokeWidth="4"/>
        <rect x="-12" y="-18" width="24" height="40" rx="3" fill="#0c1a07"/>
      </g>
      {/* center dot */}
      <circle cx="512" cy="512" r="10" fill="#a3e635"/>
    </svg>
  );
};

const ICONS = [
  {
    key: "reticle",
    name: "Reticle — Broken Cross",
    tag: "01 · scope / classic",
    desc: "Pure scope reticle. Solid ring with a soft outer halo, four broken cross arms keep the center wide open and weightless. The most iconic 'aim' silhouette.",
    Comp: IconReticle,
    swatches: ["#0f1115", "#22252c", "#ff6b3d"],
  },
  {
    key: "reticle-through",
    name: "Reticle — Through Cross",
    tag: "02 · instrument",
    desc: "Thinner arms pass continuously through the ring with a small gap at the very center. Reads as a precision instrument rather than a weapon scope — cleaner, more 'finance-grade'.",
    Comp: IconReticleThrough,
    swatches: ["#0f1115", "#22252c", "#ff6b3d"],
  },
  {
    key: "reticle-double",
    name: "Reticle — Double Ring",
    tag: "03 · premium",
    desc: "Two concentric rings with short outer cross ticks only. Feels more like a high-end optical sight — quieter, more premium, more layered.",
    Comp: IconReticleDouble,
    swatches: ["#0f1115", "#22252c", "#ff6b3d"],
  },
];

window.ICONS = ICONS;
window.IconAperture = IconAperture;
window.IconReticle = IconReticle;
window.IconReticleThrough = IconReticleThrough;
window.IconReticleDouble = IconReticleDouble;
window.IconPeak = IconPeak;
window.IconMonogram = IconMonogram;
window.IconCandleArrow = IconCandleArrow;
window.IconRadar = IconRadar;
