// Marks-round3.jsx — convergence round.
//
// Founder picks this round: Z9 (compact die), X9 (built N), Z5 (wide-
// gap built N). Two of three are the same lineage — built N is the
// direction. Z9's role here is the modular grid signature.
//
// This round narrows. Six options only:
//   W1–W4 · proportion / weight studies on the built N
//   W5    · cellular N — bridge between built-N and Z9's grid
//   W6    · built N + crop-mark corners — bridge with Z9 again
//
// If any of these land, the next step is to roll the winner through
// letterhead, card, datasheet, signatures, and favicon.

// ─────────────────────────────────────────────────────────────
// W1 — Built N, classic
// The "production" version of X9. Carefully tuned: 14-wide
// verticals, ~14-wide diagonal, balanced gaps and margins.
// Quietly more confident than X9 without losing the construction.
// ─────────────────────────────────────────────────────────────
function MarkBuiltClassic({ size = 64, color = '#003DA5' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 100 100" aria-label="Mark — built N, classic">
      <rect x="14" y="14" width="14" height="72" fill={color} />
      <rect x="72" y="14" width="14" height="72" fill={color} />
      <polygon points="32,14 46,14 68,86 54,86" fill={color} />
    </svg>
  );
}

// ─────────────────────────────────────────────────────────────
// W2 — Built N, narrow
// Same construction, narrower legs (12 wide) and a tighter
// overall footprint. More upright; more typographic.
// Looks like an N from a condensed sans.
// ─────────────────────────────────────────────────────────────
function MarkBuiltNarrow({ size = 64, color = '#003DA5' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 100 100" aria-label="Mark — built N, narrow">
      <rect x="22" y="12" width="12" height="76" fill={color} />
      <rect x="66" y="12" width="12" height="76" fill={color} />
      <polygon points="38,12 48,12 62,88 52,88" fill={color} />
    </svg>
  );
}

// ─────────────────────────────────────────────────────────────
// W3 — Built N, square
// 1:1 aspect — the N is roughly as wide as it is tall. More
// chiselled; better in tight contexts (favicon, app icon).
// ─────────────────────────────────────────────────────────────
function MarkBuiltSquare({ size = 64, color = '#003DA5' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 100 100" aria-label="Mark — built N, square">
      <rect x="18" y="22" width="14" height="56" fill={color} />
      <rect x="68" y="22" width="14" height="56" fill={color} />
      <polygon points="36,22 48,22 64,78 52,78" fill={color} />
    </svg>
  );
}

// ─────────────────────────────────────────────────────────────
// W4 — Built N, heavy
// X9 with markedly heavier pieces (18-wide verticals, 18-wide
// diagonal). More authoritative; less air. Pulls the mark away
// from "drafted" and toward "stamped".
// ─────────────────────────────────────────────────────────────
function MarkBuiltHeavy2({ size = 64, color = '#003DA5' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 100 100" aria-label="Mark — built N, heavy">
      <rect x="10" y="12" width="18" height="76" fill={color} />
      <rect x="72" y="12" width="18" height="76" fill={color} />
      <polygon points="32,12 50,12 68,88 50,88" fill={color} />
    </svg>
  );
}

// ─────────────────────────────────────────────────────────────
// W5 — Cellular N
// N constructed from discrete square cells on a 5×5 grid.
// Bridges built-N and Z9: same primitive (square) but
// arranged to draw the letter. More "stamped" than X6's
// dot grid, more "letter" than Z9's pure die.
// ─────────────────────────────────────────────────────────────
function MarkCellularN({ size = 64, color = '#003DA5' }) {
  const grid = [
    '10001',
    '11001',
    '10101',
    '10011',
    '10001',
  ];
  const cell = 14;
  const gap  = 3;
  const w    = 5 * cell + 4 * gap;
  const ox   = (100 - w) / 2;
  const oy   = (100 - w) / 2;
  const cells = [];
  for (let r = 0; r < 5; r++) {
    for (let c = 0; c < 5; c++) {
      if (grid[r][c] === '1') {
        cells.push(
          <rect key={`${r}-${c}`}
            x={ox + c * (cell + gap)}
            y={oy + r * (cell + gap)}
            width={cell} height={cell} fill={color} />
        );
      }
    }
  }
  return (
    <svg width={size} height={size} viewBox="0 0 100 100" aria-label="Mark — cellular N">
      {cells}
    </svg>
  );
}

// ─────────────────────────────────────────────────────────────
// W6 — Built N + crop marks
// Built N flanked by four small filled squares at the corners
// of an implied frame — printing-registration / crop-mark
// register. Pulls Z9's "small filled square as signature" idea
// into the X9 lineage without surrounding the N in a box.
// ─────────────────────────────────────────────────────────────
function MarkBuiltCrop({ size = 64, color = '#003DA5' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 100 100" aria-label="Mark — built N with crop marks">
      {/* Four corner crop marks */}
      <rect x="4"  y="4"  width="8" height="8" fill={color} />
      <rect x="88" y="4"  width="8" height="8" fill={color} />
      <rect x="4"  y="88" width="8" height="8" fill={color} />
      <rect x="88" y="88" width="8" height="8" fill={color} />
      {/* Built N centred inside */}
      <rect x="20" y="20" width="14" height="60" fill={color} />
      <rect x="66" y="20" width="14" height="60" fill={color} />
      <polygon points="36,20 48,20 64,80 52,80" fill={color} />
    </svg>
  );
}

// Registry
const ROUND3_MARKS = [
  { id: 'W1', family: 'BUILT', name: 'Built N, classic',  desc: 'The production version of X9. Carefully tuned proportions, balanced gaps and margins. Quietly more confident.',                  Comp: MarkBuiltClassic },
  { id: 'W2', family: 'BUILT', name: 'Built N, narrow',   desc: 'Tighter footprint, narrower legs. More upright and more typographic \u2014 reads like a condensed sans.',                          Comp: MarkBuiltNarrow },
  { id: 'W3', family: 'BUILT', name: 'Built N, square',   desc: 'Roughly 1:1 aspect. Chiselled, more compact \u2014 wins in tight contexts like favicons and app icons.',                            Comp: MarkBuiltSquare },
  { id: 'W4', family: 'BUILT', name: 'Built N, heavy',    desc: 'Markedly thicker pieces. Pulls the mark away from drafted and toward stamped. More authority, less air.',                          Comp: MarkBuiltHeavy2 },
  { id: 'W5', family: 'HYBRID', name: 'Cellular N',       desc: 'N drawn on a 5\u00d75 cell grid. Bridges X9 and Z9 \u2014 same square primitive, arranged to form the letter.',                     Comp: MarkCellularN },
  { id: 'W6', family: 'HYBRID', name: 'Built N + crop marks', desc: 'Built N with four filled crop-mark squares at the corners. Pulls Z9\u2019s signature pip into the X9 lineage without a box.', Comp: MarkBuiltCrop },
];

Object.assign(window, {
  MarkBuiltClassic, MarkBuiltNarrow, MarkBuiltSquare, MarkBuiltHeavy2,
  MarkCellularN, MarkBuiltCrop,
  ROUND3_MARKS,
});
