// identity-board.jsx — Complete identity board for North Atlantic Semiconductor, Inc.
//
// One long vertical document (1440 px column) that packages the chosen system —
// W2 narrow built-N mark + corner registration pips, System B blue, Michroma /
// IBM Plex Mono / Helvetica Neue type — across every required production register.
//
// Section order:
//   §00  Masthead
//   §01  System — two primitives, one rule
//   §02  Mark — construction, anatomy, clear space
//   §03  Mark — colour treatments + scale
//   §04  Wordmark
//   §05  Lockup
//   §06  Layout primitive — corner pips
//   §07  Colour systems
//   §08  Typography
//   §09  Voice + correspondence
//   §10  Applications
//   §11  Colophon
//
// Production components (Letterhead, BusinessCard, DatasheetPage1/2, Website,
// HtmlSignature, StationerySheet, CSWebCards, CSDatasheetHeader) are re-used
// at their native sizes and scaled to fit board panels.

const IB = {
  blue: '#003DA5',
  ink:  '#111111',
  grey: '#666666',
  rule: '#dcd9d2',
  bg:   '#f0eee9',
  paper:'#ffffff',
};

const mono = {
  fontFamily: '"IBM Plex Mono", ui-monospace, monospace',
  letterSpacing: '0.08em',
};
// Body face — IBM Plex Sans. Same foundry / family as Plex Mono used in the
// register; reads more lawyered and less Swiss-modern than Helvetica, and
// keeps the wordmark (Michroma) and register (Plex Mono) in one extended set.
const sans = {
  fontFamily: '"IBM Plex Sans", "Inter", system-ui, sans-serif',
};

// ─────────────────────────────────────────────────────────────
// Shared chrome
// ─────────────────────────────────────────────────────────────
function SectionHead({ no, title, lede }) {
  return (
    <div style={{
      ...sans, padding:'0 0 18px 0',
      borderBottom: `1px solid ${IB.ink}`,
      marginBottom: 28,
    }}>
      <div style={{ display:'flex', alignItems:'baseline', gap: 20 }}>
        <div style={{ ...mono, fontSize: 11, color: IB.blue, minWidth: 56 }}>
          §{no}
        </div>
        <div style={{ flex:'1 1 auto' }}>
          <div style={{ fontSize: 26, letterSpacing:'-0.01em', lineHeight: 1.2 }}>
            {title}
          </div>
          {lede && (
            <div style={{ marginTop: 8, fontSize: 13, lineHeight: 1.55, color:'#333', maxWidth: 900, textWrap:'pretty' }}>
              {lede}
            </div>
          )}
        </div>
        <div style={{ ...mono, fontSize: 10, color: IB.grey, textAlign:'right' }}>
          NORTH ATLANTIC SEMICONDUCTOR<br/>IDENTITY BOARD · 1986
        </div>
      </div>
    </div>
  );
}

function Panel({ children, label, sub, padding = 28, height, bg = IB.paper, style = {} }) {
  return (
    <div style={{
      background: bg, position:'relative',
      boxShadow:`inset 0 0 0 1px ${IB.rule}`,
      ...sans, color: IB.ink,
      ...style,
    }}>
      {(label || sub) && (
        <div style={{
          padding:'14px 18px 0', display:'flex', justifyContent:'space-between',
          ...mono, fontSize: 9, color: IB.grey,
        }}>
          <span>{label}</span>
          <span>{sub}</span>
        </div>
      )}
      <div style={{ padding, height, boxSizing:'border-box' }}>{children}</div>
    </div>
  );
}

function MonoCap({ children, color = IB.grey, size = 10 }) {
  return <div style={{ ...mono, fontSize: size, color, letterSpacing:'0.1em' }}>{children}</div>;
}

// ─────────────────────────────────────────────────────────────
// §00 — Masthead
// ─────────────────────────────────────────────────────────────
function Masthead() {
  return (
    <div style={{ ...sans, position:'relative', background: IB.paper, padding:'36px 56px 44px', boxShadow:`inset 0 0 0 1px ${IB.rule}` }}>
      <CornerPips size={8} inset={20} color={IB.blue} />

      <div style={{ display:'flex', justifyContent:'space-between', ...mono, fontSize: 10, color: IB.grey }}>
        <span>NORTH ATLANTIC SEMICONDUCTOR, INC. · IDENTITY BOARD · v1.0 · 14 MAY 1986</span>
        <span>FOR THE FILE · OFFICE OF THE CORPORATE SECRETARY</span>
      </div>

      <div style={{
        marginTop: 36, display:'flex', alignItems:'center', gap: 32,
        paddingBottom: 32, borderBottom: `1px solid ${IB.rule}`,
      }}>
        <MarkBuiltNarrow size={140} color={IB.blue} />
        <div style={{ flex:'1 1 auto', minWidth: 0 }}>
          <Wordmark size={20} color={IB.ink} tmColor={IB.ink} />
          <div style={{ marginTop: 16, fontSize: 13, lineHeight: 1.65, color:'#222', maxWidth: 640, textWrap:'pretty' }}>
            The corporate identity in a single document. Mark, wordmark, lockup,
            and the layout primitive that carries them — colour, type, language
            and the production artefacts that close out the brief.
          </div>
        </div>
        <div style={{ textAlign:'right', ...mono, fontSize: 10, color: IB.ink, lineHeight: 1.7 }}>
          ROUND 08 · FINAL<br/>
          <span style={{ color: IB.blue }}>W2 NARROW BUILT-N</span><br/>
          <span style={{ color: IB.blue }}>+ CORNER REGISTRATION PIPS</span><br/>
          SYSTEM B · PANTONE 286 C
        </div>
      </div>

      <div style={{ marginTop: 22, display:'grid', gridTemplateColumns:'repeat(4, 1fr)', gap: 24 }}>
        <Stat k="MARK"        v="W2 — narrow built-N" />
        <Stat k="PRIMITIVE"   v="Corner registration pips" />
        <Stat k="WORDMARK"    v="Michroma — upright" />
        <Stat k="CONTACT"     v="Telex / Marine cable only" />
      </div>
    </div>
  );
}
function Stat({ k, v }) {
  return (
    <div>
      <MonoCap>{k}</MonoCap>
      <div style={{ marginTop: 4, fontSize: 13, color: IB.ink }}>{v}</div>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// §01 — System: two primitives
// ─────────────────────────────────────────────────────────────
function Sec01() {
  return (
    <div>
      <SectionHead no="01" title="The system — two primitives, one rule"
        lede="The brand is split deliberately. A typographic mark carries the name. A layout primitive carries the surface. They meet across a page; they never combine inside the logo." />

      <div style={{ display:'grid', gridTemplateColumns:'1fr 1fr', gap: 24 }}>
        <Panel label="PRIMITIVE 01" sub="MARK" height={360}>
          <div style={{ height:'100%', display:'flex', flexDirection:'column', justifyContent:'space-between' }}>
            <MonoCap color={IB.blue}>W2 · NARROW BUILT-N</MonoCap>
            <div style={{ display:'flex', justifyContent:'center', alignItems:'center', flex:'1 1 auto' }}>
              <MarkBuiltNarrow size={200} color={IB.blue} />
            </div>
            <div style={{ fontSize: 12, color:'#333', lineHeight: 1.55 }}>
              Reads as a glyph from a condensed sans, not as a logo.
              Carries the semiconductor signal by proportion. Survives 16&nbsp;px.
            </div>
          </div>
        </Panel>

        <Panel label="PRIMITIVE 02" sub="LAYOUT" height={360}>
          <div style={{ height:'100%', display:'flex', flexDirection:'column', justifyContent:'space-between' }}>
            <MonoCap color={IB.blue}>CORNER REGISTRATION PIPS</MonoCap>
            <div style={{ display:'flex', justifyContent:'center', alignItems:'center', flex:'1 1 auto' }}>
              <div style={{ position:'relative', width: 220, height: 200, background:'#fafaf7', boxShadow:`inset 0 0 0 1px ${IB.rule}` }}>
                <CornerPips size={12} inset={12} color={IB.blue} />
              </div>
            </div>
            <div style={{ fontSize: 12, color:'#333', lineHeight: 1.55 }}>
              Four filled squares at the corners of every page, card,
              register block and content module. The vocabulary of a fab datasheet.
            </div>
          </div>
        </Panel>
      </div>

      <div style={{ marginTop: 18, padding:'14px 18px', background: IB.bg, boxShadow:`inset 0 0 0 1px ${IB.rule}`, ...mono, fontSize: 10.5, color: IB.ink, letterSpacing:'0.1em' }}>
        RULE · THE TWO PRIMITIVES MEET ACROSS A LAYOUT.&nbsp;
        <span style={{ color: IB.blue }}>THEY NEVER COMBINE INSIDE THE MARK.</span>
      </div>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// §02 — Mark construction
// ─────────────────────────────────────────────────────────────
function ConstructionGrid({ size = 320 }) {
  // 100×100 grid; draws unit-rule lines + W2 on top.
  const stroke = '#cfd9ea';
  const major  = '#9fb3d6';
  const cells = [];
  for (let i = 10; i < 100; i += 10) {
    cells.push(<line key={'v'+i} x1={i} y1={0} x2={i} y2={100} stroke={i===50?major:stroke} strokeWidth={i===50?0.35:0.2} />);
    cells.push(<line key={'h'+i} x1={0} y1={i} x2={100} y2={i} stroke={i===50?major:stroke} strokeWidth={i===50?0.35:0.2} />);
  }
  return (
    <svg width={size} height={size} viewBox="0 0 100 100" style={{ display:'block' }}>
      <rect x={0} y={0} width={100} height={100} fill="#fafaf7" />
      {cells}
      {/* W2 geometry */}
      <rect x="22" y="12" width="12" height="76" fill={IB.blue} />
      <rect x="66" y="12" width="12" height="76" fill={IB.blue} />
      <polygon points="38,12 48,12 62,88 52,88" fill={IB.blue} />
      {/* annotation rules */}
      <line x1="22" y1="4" x2="78" y2="4" stroke={IB.ink} strokeWidth="0.3" />
      <line x1="22" y1="2" x2="22" y2="6" stroke={IB.ink} strokeWidth="0.3" />
      <line x1="78" y1="2" x2="78" y2="6" stroke={IB.ink} strokeWidth="0.3" />
      <line x1="94" y1="12" x2="94" y2="88" stroke={IB.ink} strokeWidth="0.3" />
      <line x1="92" y1="12" x2="96" y2="12" stroke={IB.ink} strokeWidth="0.3" />
      <line x1="92" y1="88" x2="96" y2="88" stroke={IB.ink} strokeWidth="0.3" />
      <text x="50" y="2.4" textAnchor="middle" fontSize="3" fill={IB.ink} fontFamily="IBM Plex Mono, monospace">56u</text>
      <text x="96" y="50" textAnchor="middle" fontSize="3" fill={IB.ink} fontFamily="IBM Plex Mono, monospace" transform="rotate(90,96,50)">76u</text>
      <text x="28" y="50" textAnchor="middle" fontSize="3" fill={IB.ink} fontFamily="IBM Plex Mono, monospace" opacity="0.7">12</text>
      <text x="72" y="50" textAnchor="middle" fontSize="3" fill={IB.ink} fontFamily="IBM Plex Mono, monospace" opacity="0.7">12</text>
    </svg>
  );
}

function ClearSpaceDiagram({ size = 320 }) {
  // Mark surrounded by an "N-square" clear zone (one stem width on every side).
  return (
    <svg width={size} height={size} viewBox="0 0 140 140" style={{ display:'block' }}>
      <rect x={0} y={0} width={140} height={140} fill="#fafaf7" />
      {/* clear-space rect — width of one vertical (12u) on each side of the 56×76 cap box */}
      <rect x={20-12} y={20-12} width={56+24} height={76+24} fill="none" stroke={IB.blue} strokeDasharray="2 2" strokeWidth="0.4" />
      {/* hairline arrows */}
      <line x1={20-12} y1={6} x2={20} y2={6} stroke={IB.ink} strokeWidth="0.3" />
      <text x={14} y={5} fontSize="3" fill={IB.ink} fontFamily="IBM Plex Mono, monospace" textAnchor="middle">x</text>
      {/* W2 placed inside */}
      <g transform="translate(20,20)">
        <rect x="22" y="12" width="12" height="76" fill={IB.blue} />
        <rect x="66" y="12" width="12" height="76" fill={IB.blue} />
        <polygon points="38,12 48,12 62,88 52,88" fill={IB.blue} />
      </g>
      <text x={70} y={134} fontSize="4" fill={IB.ink} fontFamily="IBM Plex Mono, monospace" textAnchor="middle">x = stem width (12u)</text>
    </svg>
  );
}

function ScaleRow() {
  const sizes = [16, 32, 64, 96, 144];
  return (
    <div style={{ display:'flex', alignItems:'flex-end', gap: 28, padding:'18px 22px', background:'#fafaf7', boxShadow:`inset 0 0 0 1px ${IB.rule}` }}>
      {sizes.map((s) => (
        <div key={s} style={{ display:'flex', flexDirection:'column', alignItems:'center', gap: 8 }}>
          <MarkBuiltNarrow size={s} color={IB.blue} />
          <span style={{ ...mono, fontSize: 9, color: IB.grey }}>{s}px</span>
        </div>
      ))}
    </div>
  );
}

function Sec02() {
  return (
    <div>
      <SectionHead no="02" title="Mark — construction"
        lede="W2 is built on a 100-unit square. Two 12-unit verticals; one 14-unit diagonal. Cap height 76. The geometry is exposed deliberately — there are no curves to argue about." />

      <div style={{ display:'grid', gridTemplateColumns:'1fr 1fr', gap: 24, marginBottom: 18 }}>
        <Panel label="A · CONSTRUCTION" sub="100 × 100 GRID" padding={28}>
          <div style={{ display:'flex', gap: 28, alignItems:'flex-start' }}>
            <ConstructionGrid />
            <ul style={{ margin: 0, padding: 0, listStyle:'none', fontSize: 12, lineHeight: 1.85, color:'#333' }}>
              <li><b style={{ ...mono, fontSize: 10, color: IB.blue }}>VERTICAL</b> &nbsp; 12u × 76u, twice</li>
              <li><b style={{ ...mono, fontSize: 10, color: IB.blue }}>DIAGONAL</b> &nbsp; 10u apex tapering across 76u</li>
              <li><b style={{ ...mono, fontSize: 10, color: IB.blue }}>CAP BOX</b> &nbsp; 56u × 76u, centered</li>
              <li><b style={{ ...mono, fontSize: 10, color: IB.blue }}>MARGIN</b> &nbsp; 22u left / 22u right</li>
              <li><b style={{ ...mono, fontSize: 10, color: IB.blue }}>NO CURVES</b> &nbsp; reads at any resolution</li>
            </ul>
          </div>
        </Panel>

        <Panel label="B · CLEAR SPACE" sub="x = STEM WIDTH (12u)" padding={28}>
          <div style={{ display:'flex', gap: 28, alignItems:'flex-start' }}>
            <ClearSpaceDiagram />
            <div style={{ fontSize: 12, lineHeight: 1.6, color:'#333' }}>
              Reserve a clear zone equal to one stem width on all four sides of
              the cap box. Nothing — type, rule, photograph, edge of substrate
              — crosses this boundary. The corner pips of the surrounding page
              live <i>outside</i> this zone.
            </div>
          </div>
        </Panel>
      </div>

      <Panel label="C · SCALE" sub="16 / 32 / 64 / 96 / 144 PX">
        <ScaleRow />
        <div style={{ marginTop: 14, fontSize: 12, lineHeight: 1.6, color:'#333' }}>
          Minimum size: 16 px on screen, 0.20 in print. Below 16 px the
          letter still reads but spacing inside the lockup compresses past
          legibility — switch to mark-only.
        </div>
      </Panel>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// §03 — Mark colour treatments
// ─────────────────────────────────────────────────────────────
function Treatment({ label, bg, color, border = false }) {
  return (
    <div style={{
      background: bg, padding: 28, position:'relative',
      boxShadow: border ? `inset 0 0 0 1px ${IB.rule}` : 'none',
      display:'flex', flexDirection:'column', alignItems:'center', justifyContent:'space-between',
      minHeight: 240,
    }}>
      <MonoCap color={bg === '#fff' || bg === '#fafaf7' ? IB.grey : 'rgba(255,255,255,0.7)'}>{label}</MonoCap>
      <MarkBuiltNarrow size={88} color={color} />
      <div style={{ ...mono, fontSize: 9, color: bg === '#fff' || bg === '#fafaf7' ? IB.grey : 'rgba(255,255,255,0.7)' }}>
        {color}
      </div>
    </div>
  );
}

function Sec03() {
  return (
    <div>
      <SectionHead no="03" title="Mark — colour treatments"
        lede="Four. Positive blue on paper is the default. Reverse to white when the page itself takes the accent. Ink-only for one-colour print and fax. Reverse on ink for low-fidelity newsprint and embossing." />

      <div style={{ display:'grid', gridTemplateColumns:'repeat(4, 1fr)', gap: 1, background: IB.rule, boxShadow:`inset 0 0 0 1px ${IB.rule}` }}>
        <Treatment label="01 · POSITIVE"        bg="#fff"     color={IB.blue} />
        <Treatment label="02 · REVERSE / FIELD" bg={IB.blue}  color="#fff" />
        <Treatment label="03 · INK ONLY"        bg="#fff"     color={IB.ink} />
        <Treatment label="04 · REVERSE / INK"   bg={IB.ink}   color="#fff" />
      </div>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// §04 — Wordmark
// ─────────────────────────────────────────────────────────────
function Sec04() {
  return (
    <div>
      <SectionHead no="04" title="Wordmark"
        lede="Set in Michroma — the closest free analogue to the licensed Eurostile / Microgramma the brief specifies. Tracked +20, set tight to the trademark glyph. Upright by default. A 6° forward italic is the documented alternate, used sparingly on packaging." />

      <Panel label="A · WORDMARK · UPRIGHT" sub="MICHROMA · +20 TRACK">
        <div style={{ padding:'36px 8px', display:'flex', justifyContent:'center' }}>
          <Wordmark size={28} color={IB.ink} tmColor={IB.ink} />
        </div>
      </Panel>

      <div style={{ display:'grid', gridTemplateColumns:'1fr 1fr', gap: 24, marginTop: 18 }}>
        <Panel label="B · UPRIGHT" sub="RECOMMENDED">
          <div style={{ padding:'18px 0', display:'flex', justifyContent:'center' }}>
            <Wordmark size={16} color={IB.ink} tmColor={IB.ink} />
          </div>
          <div style={{ marginTop: 6, fontSize: 12, lineHeight: 1.55, color:'#333' }}>
            Default. Reads as legitimate, scaleable, lawyered.
          </div>
        </Panel>
        <Panel label="C · 6° FORWARD ITALIC" sub="PERIOD ALT">
          <div style={{ padding:'18px 0', display:'flex', justifyContent:'center' }}>
            <span style={{ transform:'skewX(-6deg)', display:'inline-block' }}>
              <Wordmark size={16} color={IB.ink} tmColor={IB.ink} />
            </span>
          </div>
          <div style={{ marginTop: 6, fontSize: 12, lineHeight: 1.55, color:'#333' }}>
            Suggests motion. Reserve for product and packaging.
          </div>
        </Panel>
      </div>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// §05 — Lockup
// ─────────────────────────────────────────────────────────────
function Sec05() {
  return (
    <div>
      <SectionHead no="05" title="Lockup"
        lede="Mark cap-aligned to the wordmark. Mark height slightly exceeds cap height. Gutter is 0.7 ✕ cap size. A horizontal rule in the accent colour, beneath the wordmark, introduces sub-entity copy where the document requires it." />

      <Panel label="A · PRIMARY HORIZONTAL" sub="USE EVERYWHERE BY DEFAULT">
        <div style={{ padding:'22px 0', display:'flex', justifyContent:'center' }}>
          <Lockup palette="B" markComp={MarkBuiltNarrow} size={18} />
        </div>
      </Panel>

      <div style={{ display:'grid', gridTemplateColumns:'1.2fr 1fr', gap: 24, marginTop: 18 }}>
        <Panel label="B · SUB-ENTITY CALLOUT" sub="§9 RULE">
          <div style={{ padding:'14px 0' }}>
            <Lockup
              palette="B" markComp={MarkBuiltNarrow} size={16}
              showRule subentity={<>Office of the Corporate Secretary</>}
            />
          </div>
          <div style={{ marginTop: 14, fontSize: 12, color:'#333', lineHeight: 1.55 }}>
            Accent rule below the wordmark; sub-entity in IBM Plex Sans, tracked +40.
            One sub-entity per document; never stacked.
          </div>
        </Panel>

        <Panel label="C · MINIMUM SIZE" sub="WORDMARK CAP ≥ 9 PT">
          <div style={{ padding:'14px 0', display:'flex', flexDirection:'column', gap: 16 }}>
            <Lockup palette="B" markComp={MarkBuiltNarrow} size={9} />
            <Lockup palette="B" markComp={MarkBuiltNarrow} size={11} />
            <Lockup palette="B" markComp={MarkBuiltNarrow} size={14} />
          </div>
        </Panel>
      </div>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// §06 — Corner pip system
// ─────────────────────────────────────────────────────────────
function PageDiagram({ w = 240, h = 320, inset = 18, pip = 7, label }) {
  return (
    <div style={{ display:'flex', flexDirection:'column', alignItems:'center', gap: 8 }}>
      <div style={{ position:'relative', width: w, height: h, background:'#fff', boxShadow:`inset 0 0 0 1px ${IB.rule}` }}>
        <CornerPips size={pip} inset={inset} color={IB.blue} />
        {/* dummy content lines */}
        <div style={{ position:'absolute', top: inset + pip + 20, left: inset + pip + 14, right: inset + pip + 14 }}>
          <div style={{ height: 6, background:'#eee', width: '50%', marginBottom: 8 }} />
          <div style={{ height: 4, background:'#f1ede4' }} />
          <div style={{ height: 4, background:'#f1ede4', marginTop: 4, width:'85%' }} />
          <div style={{ height: 4, background:'#f1ede4', marginTop: 4, width:'70%' }} />
        </div>
      </div>
      <MonoCap>{label}</MonoCap>
    </div>
  );
}

function Sec06() {
  return (
    <div>
      <SectionHead no="06" title="Layout primitive — corner registration pips"
        lede="A filled square at each of the four corners of any bordered surface. Pip side = page width ÷ 80 (with floor and ceiling). Inset = pip × 4. The pip is a layout fact, not a decoration: every formal artefact carries them; nothing else does." />

      <div style={{ display:'grid', gridTemplateColumns:'1fr 1fr', gap: 24 }}>
        <Panel label="A · GEOMETRY" sub="FILLED SQUARE" padding={28}>
          <div style={{ display:'flex', gap: 28, alignItems:'flex-start' }}>
            <div style={{ position:'relative', width: 220, height: 220, background:'#fafaf7', boxShadow:`inset 0 0 0 1px ${IB.rule}` }}>
              <CornerPips size={14} inset={14} color={IB.blue} />
              {/* annotation lines */}
              <div style={{ position:'absolute', top: 14, left: 32, ...mono, fontSize: 9, color: IB.ink }}>← s</div>
              <div style={{ position:'absolute', top: 38, left: 14, ...mono, fontSize: 9, color: IB.ink }}>↑<br/>4s</div>
            </div>
            <ul style={{ margin: 0, padding: 0, listStyle:'none', fontSize: 12, lineHeight: 1.85, color:'#333' }}>
              <li><b style={{ ...mono, fontSize: 10, color: IB.blue }}>SHAPE</b> &nbsp; filled square, accent colour</li>
              <li><b style={{ ...mono, fontSize: 10, color: IB.blue }}>SIZE s</b> &nbsp; page width ÷ 80</li>
              <li><b style={{ ...mono, fontSize: 10, color: IB.blue }}>INSET</b> &nbsp; 4 × s from each edge</li>
              <li><b style={{ ...mono, fontSize: 10, color: IB.blue }}>FLOOR</b> &nbsp; min 3 px / 0.04 in.</li>
              <li><b style={{ ...mono, fontSize: 10, color: IB.blue }}>CEILING</b> &nbsp; max 12 px / 0.15 in.</li>
            </ul>
          </div>
        </Panel>

        <Panel label="B · WHERE PIPS LIVE" sub="PAGE · CARD · MODULE" padding={28}>
          <div style={{ display:'grid', gridTemplateColumns:'repeat(3, 1fr)', gap: 18, alignItems:'end' }}>
            <PageDiagram w={156} h={208} inset={14} pip={5} label="LETTERHEAD" />
            <PageDiagram w={156} h={92}  inset={9}  pip={3} label="BUSINESS CARD" />
            <PageDiagram w={156} h={132} inset={8}  pip={3} label="WEB MODULE" />
          </div>
        </Panel>
      </div>

      <div style={{ marginTop: 18, padding:'14px 18px', background: IB.bg, boxShadow:`inset 0 0 0 1px ${IB.rule}`, ...mono, fontSize: 10.5, color: IB.ink, letterSpacing:'0.1em' }}>
        ABSENCE IS SIGNAL · ANY DOCUMENT WITHOUT PIPS DID NOT ORIGINATE FROM THE COMPANY.
      </div>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// §07 — Colour systems
// ─────────────────────────────────────────────────────────────
function Swatch({ label, name, hex, pantone, cmyk, rgb, primary }) {
  return (
    <div style={{ background:'#fff', boxShadow:`inset 0 0 0 1px ${IB.rule}` }}>
      <div style={{ height: 160, background: hex, position:'relative' }}>
        {primary && (
          <div style={{ position:'absolute', top: 12, left: 14, ...mono, fontSize: 9, letterSpacing:'0.1em', color: hex === '#5F6772' || hex === IB.blue || hex === '#E4002B' ? 'rgba(255,255,255,0.85)' : IB.grey }}>
            PRIMARY
          </div>
        )}
      </div>
      <div style={{ padding:'18px 18px 20px' }}>
        <MonoCap>{label}</MonoCap>
        <div style={{ marginTop: 4, fontSize: 14, color: IB.ink }}>{name}</div>
        <div style={{ marginTop: 12, display:'grid', gridTemplateColumns:'auto 1fr', gap:'4px 14px', ...mono, fontSize: 10.5, color:'#333' }}>
          <span style={{ color: IB.grey }}>PANTONE</span><span>{pantone}</span>
          <span style={{ color: IB.grey }}>CMYK</span><span>{cmyk}</span>
          <span style={{ color: IB.grey }}>RGB</span><span>{rgb}</span>
          <span style={{ color: IB.grey }}>HEX</span><span>{hex.toUpperCase()}</span>
        </div>
      </div>
    </div>
  );
}

function Sec07() {
  return (
    <div>
      <SectionHead no="07" title="Colour systems"
        lede="Three palettes. System B (blue) is the primary, used on every formal artefact. System A (red) is reserved for product packaging and marketing. System C (cool grey) is the monochrome alternate for low-fidelity reproduction." />

      <div style={{ display:'grid', gridTemplateColumns:'repeat(3, 1fr)', gap: 24 }}>
        <Swatch label="SYSTEM B" name="Pantone 286 C — National Blue" hex={IB.blue}
          pantone="286 C" cmyk="100 / 75 / 0 / 12" rgb="0 / 61 / 165" primary />
        <Swatch label="SYSTEM A" name="Pantone 185 C — Signal Red" hex="#E4002B"
          pantone="185 C" cmyk="0 / 100 / 81 / 4" rgb="228 / 0 / 43" />
        <Swatch label="SYSTEM C" name="Cool Grey 9 C — Plate" hex="#5F6772"
          pantone="Cool Grey 9 C" cmyk="55 / 45 / 40 / 30" rgb="95 / 103 / 114" />
      </div>

      <div style={{ marginTop: 18, display:'grid', gridTemplateColumns:'repeat(4, 1fr)', gap: 1, background: IB.rule, boxShadow:`inset 0 0 0 1px ${IB.rule}` }}>
        <Swatchlet label="INK" hex={IB.ink} note="#111111" />
        <Swatchlet label="RULE" hex={IB.rule} note="#DCD9D2" />
        <Swatchlet label="PAPER" hex={IB.bg} note="#F0EEE9 — 80gsm warm white" />
        <Swatchlet label="STOCK" hex="#fafaf7" note="#FAFAF7 — datasheet" />
      </div>
    </div>
  );
}

function Swatchlet({ label, hex, note }) {
  return (
    <div style={{ background:'#fff', padding:'18px 20px', display:'flex', alignItems:'center', gap: 14 }}>
      <div style={{ width: 44, height: 44, background: hex, boxShadow: hex === IB.bg || hex === '#fafaf7' ? `inset 0 0 0 1px ${IB.rule}` : 'none' }} />
      <div>
        <MonoCap>{label}</MonoCap>
        <div style={{ ...mono, fontSize: 11, color: IB.ink, marginTop: 2 }}>{note}</div>
      </div>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// §08 — Typography
// ─────────────────────────────────────────────────────────────
function TypeRow({ family, role, sample, sampleStyle, meta }) {
  return (
    <div style={{ display:'grid', gridTemplateColumns:'220px 1fr 220px', gap: 28, alignItems:'baseline', padding:'28px 0', borderBottom:`1px solid ${IB.rule}` }}>
      <div>
        <MonoCap color={IB.blue}>{role}</MonoCap>
        <div style={{ marginTop: 6, fontSize: 16, color: IB.ink }}>{family}</div>
      </div>
      <div style={{ ...sampleStyle, color: IB.ink, textWrap:'balance' }}>{sample}</div>
      <div style={{ ...mono, fontSize: 10.5, color:'#333', lineHeight: 1.7 }}>{meta}</div>
    </div>
  );
}

function Sec08() {
  return (
    <div>
      <SectionHead no="08" title="Typography"
        lede="Three families, each with a single job. Michroma wears the name. IBM Plex Mono carries part numbers, register data, and every annotation. Helvetica Neue runs body copy. Nothing else." />

      <Panel padding={28}>
        <TypeRow
          family="Michroma"
          role="01 · WORDMARK"
          sample={<span style={{ fontFamily:'Michroma, sans-serif', fontSize: 26, letterSpacing:'0.04em' }}>NORTH ATLANTIC SEMICONDUCTOR</span>}
          meta={<>USE FOR<br/>WORDMARK ONLY<br/>—<br/>NEVER BODY<br/>NEVER UI</>}
        />
        <TypeRow
          family="IBM Plex Mono"
          role="02 · REGISTER"
          sample={
            <div style={{ ...mono, fontSize: 13, color: IB.ink, lineHeight: 1.6 }}>
              NA-1804B · 14-BIT A/D · 200 KSPS · N28 / SO28<br/>
              TELEX&nbsp;&nbsp;510-3211 NATLSEMI · 14 MAY 1986
            </div>
          }
          meta={<>WEIGHTS 400 / 500 / 600<br/>—<br/>TRACK +60 ALL CAPS<br/>—<br/>PART NUMBERS,<br/>DATES, TELEX, FIELDS</>}
        />
        <TypeRow
          family={<span>IBM Plex Sans <span style={{ color: IB.grey, fontSize: 12 }}>· primary body</span></span>}
          role="03 · BODY"
          sample={
            <div style={{ ...sans, fontSize: 14, lineHeight: 1.55, color: IB.ink }}>
              The matter referenced above has been noted and recorded.
              Communications to the Company are not accepted by post,
              telephone or facsimile.
            </div>
          }
          meta={<>WEIGHTS 400 / 500 / 600 / 700<br/>—<br/>BODY MIN 10 PT<br/>—<br/>BODY MAX 14 PT</>}
        />
      </Panel>

      <div style={{ display:'grid', gridTemplateColumns:'repeat(3, 1fr)', gap: 24, marginTop: 18 }}>
        <Panel label="SPECIMEN · MICHROMA" padding={24}>
          <div style={{ fontFamily:'Michroma, sans-serif', fontSize: 36, letterSpacing:'0.02em', color: IB.ink }}>NAS</div>
          <div style={{ fontFamily:'Michroma, sans-serif', fontSize: 14, letterSpacing:'0.04em', color: IB.ink, marginTop: 10 }}>ABCDEFGHIJ<br/>0123456789</div>
        </Panel>
        <Panel label="SPECIMEN · IBM PLEX MONO" padding={24}>
          <div style={{ ...mono, fontSize: 14, color: IB.ink, lineHeight: 1.5 }}>
            NA-1804B<br/>NA-1602<br/>NA-0812
          </div>
        </Panel>
        <Panel label="SPECIMEN · IBM PLEX SANS" padding={24}>
          <div style={{ ...sans, fontSize: 28, letterSpacing:'-0.01em', color: IB.ink, fontWeight: 600 }}>Aa Bb Cc</div>
          <div style={{ ...sans, fontSize: 12, color:'#333', marginTop: 8 }}>The matter referenced above.</div>
        </Panel>
      </div>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// §09 — Voice + correspondence
// ─────────────────────────────────────────────────────────────
function Sec09() {
  const Rule = ({ n, title, body }) => (
    <div style={{ display:'grid', gridTemplateColumns:'80px 1fr', gap: 18, padding:'22px 0', borderBottom:`1px solid ${IB.rule}` }}>
      <MonoCap color={IB.blue}>R{n}</MonoCap>
      <div>
        <div style={{ fontSize: 18, letterSpacing:'-0.01em', color: IB.ink, marginBottom: 8 }}>{title}</div>
        <div style={{ fontSize: 12.5, color:'#333', lineHeight: 1.6, maxWidth: 720, textWrap:'pretty' }}>{body}</div>
      </div>
    </div>
  );
  return (
    <div>
      <SectionHead no="09" title="Voice + correspondence"
        lede="The company speaks rarely. Where it does, it speaks formally, in the third person, and only by the channels it underwrites. Three rules govern every external communication." />

      <Panel padding={28}>
        <Rule n="01" title="One channel."
          body="Telex 510-3211 NATLSEMI is the address of record. Marine cable NATLSEMI NEW YORK is the alternate. Mail, telephone, and facsimile are not accepted; correspondence sent by these means is not opened." />
        <Rule n="02" title="One signature."
          body="Only the Office of the Corporate Secretary signs on behalf of the company. Individual officers do not. Where the document requires a name, William S. Fraser signs for the Office." />
        <Rule n="03" title="No reply invited."
          body="A communication from the Company is, by default, a record. Where a response is contemplated by its terms, it shall be made by telex or marine cable. Otherwise none is invited or required." />
      </Panel>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// §10 — Applications
// Re-uses production components scaled to fit board panels.
// ─────────────────────────────────────────────────────────────
function ScaledFrame({ w, h, scale, children, label, sub }) {
  // child renders at native (w,h); we visually scale it.
  const dispW = Math.round(w * scale);
  const dispH = Math.round(h * scale);
  return (
    <div style={{ background:'#fff', boxShadow:`inset 0 0 0 1px ${IB.rule}` }}>
      <div style={{ padding:'14px 18px 0', display:'flex', justifyContent:'space-between', ...mono, fontSize: 9, color: IB.grey }}>
        <span>{label}</span>
        <span>{sub}</span>
      </div>
      <div style={{ padding: 22, display:'flex', justifyContent:'center' }}>
        <div style={{ width: dispW, height: dispH, position:'relative' }}>
          <div style={{
            transform:`scale(${scale})`, transformOrigin:'top left',
            width: w, height: h,
          }}>{children}</div>
        </div>
      </div>
    </div>
  );
}

function Sec10() {
  const InvLine = ({ n, v }) => (
    <div style={{ display:'grid', gridTemplateColumns:'40px 1fr', gap: 12, padding:'8px 0', borderBottom:`1px solid ${IB.rule}`, alignItems:'baseline' }}>
      <span style={{ ...mono, fontSize: 10, color: IB.blue }}>{n}</span>
      <span style={{ fontSize: 12.5, color: IB.ink }}>{v}</span>
    </div>
  );
  return (
    <div>
      <SectionHead no="10" title="Applications"
        lede="Production artefacts rendered with W2 and corner pips. Native sizes preserved; thumbnails are linearly scaled. See print-a4.html for A4-paper output and the design canvas for full-size review." />

      <div style={{ display:'grid', gridTemplateColumns:'1fr 1fr', gap: 24 }}>
        <ScaledFrame w={612} h={792} scale={0.62} label="A · LETTERHEAD" sub="612 × 792 / US LETTER">
          <Letterhead palette="B" markComp={MarkBuiltNarrow} />
        </ScaledFrame>
        <ScaledFrame w={612} h={792} scale={0.62} label="B · DATASHEET p.1" sub="612 × 792">
          <DatasheetPage1 palette="B" markComp={MarkBuiltNarrow} />
        </ScaledFrame>
      </div>

      <div style={{ display:'grid', gridTemplateColumns:'350px 1fr', gap: 24, marginTop: 24, alignItems:'start' }}>
        <ScaledFrame w={350} h={200} scale={1.0} label="C · BUSINESS CARD" sub="3.5 × 2 in.">
          <BusinessCard palette="B" markComp={MarkBuiltNarrow} />
        </ScaledFrame>
        <ScaledFrame w={720} h={460} scale={0.86} label="D · DATASHEET REGISTER BLOCK" sub="720 × 460">
          <CSDatasheetHeader />
        </ScaledFrame>
      </div>

      <div style={{ display:'grid', gridTemplateColumns:'1fr 1fr', gap: 24, marginTop: 24 }}>
        <ScaledFrame w={960} h={540} scale={0.66} label="E · WEB CONTENT MODULE" sub="960 × 540">
          <CSWebCards />
        </ScaledFrame>
        <ScaledFrame w={520} h={420} scale={1.0} label="F · EMAIL SIGNATURE" sub="HTML">
          <HtmlSignature palette="B" markComp={MarkBuiltNarrow} />
        </ScaledFrame>
      </div>

      <div style={{ display:'grid', gridTemplateColumns:'1fr 1fr', gap: 24, marginTop: 24, alignItems:'start' }}>
        <ScaledFrame w={612} h={792} scale={0.95} label="G · INTERNAL STATIONERY REFERENCE" sub="612 × 792">
          <StationerySheet palette="B" markComp={MarkBuiltNarrow} />
        </ScaledFrame>
        <Panel label="H · APPLIED INVENTORY" sub="WHAT THIS UNLOCKS" padding={28}>
          <div style={{ display:'flex', flexDirection:'column', gap: 16 }}>
            <InvLine n="01" v="Letterhead, US Letter + A4 (print-a4.html)" />
            <InvLine n="02" v="Business card, 3.5 × 2 in." />
            <InvLine n="03" v="Datasheet template, two-page" />
            <InvLine n="04" v="Datasheet register-block, generic" />
            <InvLine n="05" v="Placeholder website, fixed 960 px column" />
            <InvLine n="06" v="Email signature, plain + HTML" />
            <InvLine n="07" v="Favicon set, 16 / 32 / 180" />
            <InvLine n="08" v="Internal stationery reference (this)" />
          </div>
          <div style={{ marginTop: 22, paddingTop: 18, borderTop:`1px solid ${IB.rule}`, ...mono, fontSize: 10, color: IB.grey, lineHeight: 1.6 }}>
            FOR REVIEW AT NATIVE SIZE,<br/>
            SEE <span style={{ color: IB.blue }}>index.html</span> · DESIGN CANVAS.
          </div>
        </Panel>
      </div>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// §11 — Colophon
// ─────────────────────────────────────────────────────────────
function Sec11() {
  const Line = ({ k, v }) => (
    <div style={{ display:'grid', gridTemplateColumns:'180px 1fr', gap: 18, padding:'10px 0', borderBottom:`1px solid ${IB.rule}`, ...mono, fontSize: 11 }}>
      <span style={{ color: IB.grey }}>{k}</span>
      <span style={{ color: IB.ink }}>{v}</span>
    </div>
  );
  return (
    <div>
      <SectionHead no="11" title="Colophon"
        lede="The board itself. Sources, files, signatures." />

      <Panel padding={28}>
        <Line k="DOCUMENT"     v="NORTH ATLANTIC SEMICONDUCTOR · IDENTITY BOARD · v1.0" />
        <Line k="DATE"         v="14 MAY 1986 · FOR THE FILE" />
        <Line k="MARK"         v="W2 NARROW BUILT-N · MarkBuiltNarrow (marks-round3.jsx)" />
        <Line k="LAYOUT"       v="CornerPips · CornerTicks (corner-system.jsx)" />
        <Line k="LOCKUP"       v="Lockup · Wordmark · PALETTES (lockup.jsx)" />
        <Line k="APPLICATIONS" v="Letterhead · BusinessCard · DatasheetPage1/2 · Website · HtmlSignature · StationerySheet" />
        <Line k="PRIMARY"      v="System B · Pantone 286 C · #003DA5" />
        <Line k="TYPOGRAPHY"   v="Michroma · IBM Plex Mono · IBM Plex Sans" />
        <Line k="SIGNED"       v="William S. Fraser · Office of the Corporate Secretary" />
      </Panel>

      <div style={{ marginTop: 22, display:'flex', justifyContent:'space-between', alignItems:'center', ...mono, fontSize: 10, color: IB.grey }}>
        <span>NORTH ATLANTIC SEMICONDUCTOR, INC. · NEW YORK</span>
        <span>END · §11 OF 11</span>
      </div>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// Root
// ─────────────────────────────────────────────────────────────
function IdentityBoard() {
  return (
    <div style={{
      ...sans, color: IB.ink, background: IB.bg,
      minHeight:'100vh', padding:'40px 0',
    }}>
      <div style={{
        width: 1440, margin:'0 auto',
        background: IB.bg,
        display:'flex', flexDirection:'column', gap: 48,
        padding:'0 40px',
      }}>
        <Masthead />
        <Sec01 />
        <Sec02 />
        <Sec03 />
        <Sec04 />
        <Sec05 />
        <Sec06 />
        <Sec07 />
        <Sec08 />
        <Sec09 />
        <Sec10 />
        <Sec11 />
      </div>
    </div>
  );
}

Object.assign(window, { IdentityBoard });
