// Six logo directions for Noura Lawyers
// Each exports a React component rendering on a 900x560 canvas
// Palette: navy #0F1B2D ground, gold #C9A961 mark

const NAVY = '#0F1B2D';
const NAVY_DEEP = '#0A1220';
const GOLD = '#C9A961';
const GOLD_BRIGHT = '#E0BD6E';
const GOLD_SOFT = '#8E7340';
const CREAM = '#F5F1EA';

// ---------- Shared lockup pieces ----------

function Wordmark({ size = 64, letterSpacing = '0.06em', weight = 500, color = GOLD, font = "'Cormorant Garamond', serif" }) {
  return (
    <div style={{
      fontFamily: font,
      fontWeight: weight,
      fontSize: size,
      letterSpacing,
      color,
      lineHeight: 1,
      whiteSpace: 'nowrap',
    }}>NOURA</div>
  );
}

function Subtitle({ text = 'LAWYERS', size = 13, color = GOLD, letterSpacing = '0.42em', weight = 500 }) {
  return (
    <div style={{
      fontFamily: "'Cinzel', serif",
      fontWeight: weight,
      fontSize: size,
      letterSpacing,
      color,
      lineHeight: 1,
    }}>{text}</div>
  );
}

function ArabicWord({ size = 30, color = GOLD, font = "'Amiri', serif" }) {
  // نورة للمحاماة - Noura for Law
  return (
    <div style={{
      fontFamily: font,
      fontSize: size,
      color,
      direction: 'rtl',
      lineHeight: 1,
      letterSpacing: '0.01em',
    }}>نورة</div>
  );
}

function ConceptLabel({ name, tagline, color = GOLD_SOFT }) {
  return (
    <div style={{ position: 'absolute', top: 28, left: 32, right: 32, display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', gap: 24 }}>
      <div style={{ fontFamily: "'Cinzel', serif", fontSize: 11, letterSpacing: '0.3em', color, textTransform: 'uppercase' }}>{name}</div>
      <div style={{ fontFamily: "'Cormorant Garamond', serif", fontStyle: 'italic', fontSize: 14, color: color, opacity: 0.85, textAlign: 'right' }}>{tagline}</div>
    </div>
  );
}

function Frame({ children, bg = NAVY, label, tagline }) {
  return (
    <div style={{
      position: 'absolute', inset: 0,
      background: bg,
      display: 'flex', alignItems: 'center', justifyContent: 'center',
      overflow: 'hidden',
    }}>
      <ConceptLabel name={label} tagline={tagline} />
      <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 28 }}>
        {children}
      </div>
      {/* hairline frame */}
      <div style={{ position: 'absolute', inset: 16, border: `1px solid ${GOLD}22`, pointerEvents: 'none' }} />
    </div>
  );
}

// ============================================
// 1. ECLIPSE — Light from Shadow
// A gold disc with a navy crescent emerging. Litigation = bringing
// what was hidden into the light.
// ============================================
function LogoEclipse() {
  return (
    <Frame label="01 · Eclipse" tagline="Light from shadow">
      {/* Horizontal lockup matching the original: mark | divider | wordmark */}
      <div style={{ display: 'flex', alignItems: 'center', gap: 32 }}>
        {/* Eclipse mark — left */}
        <svg width="150" height="150" viewBox="0 0 170 170" style={{ overflow: 'visible', flexShrink: 0 }}>
          <defs>
            <mask id="ecl-mask">
              <rect width="170" height="170" fill="white"/>
              <circle cx="115" cy="62" r="62" fill="black"/>
            </mask>
          </defs>
          <circle cx="85" cy="85" r="74" fill={GOLD} mask="url(#ecl-mask)"/>
        </svg>

        {/* Vertical divider */}
        <div style={{ width: 1.5, height: 140, background: GOLD }}/>

        {/* Wordmark stack — right */}
        <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
          <div style={{
            fontFamily: "'Cormorant Garamond', serif",
            fontWeight: 500,
            fontSize: 86,
            letterSpacing: '0.06em',
            color: GOLD,
            lineHeight: 0.9,
          }}>NOURA</div>
          <div style={{
            fontFamily: "'Cinzel', serif",
            fontWeight: 500,
            fontSize: 14,
            letterSpacing: '0.55em',
            color: GOLD,
            textAlign: 'center',
            paddingLeft: '0.55em',
          }}>LAWYERS</div>
        </div>
      </div>

      <ArabicWord size={26}/>
    </Frame>
  );
}

// ============================================
// 2. HORIZON — Sunrise / We Rise
// Gold half-disc rising over a horizon line. Forward-moving,
// optimistic challenger energy.
// ============================================
function LogoHorizon() {
  return (
    <Frame label="02 · Horizon" tagline="A new dawn for counsel">
      <svg width="220" height="160" viewBox="0 0 220 160" style={{ overflow: 'visible' }}>
        {/* rays */}
        {[-50, -30, -10, 10, 30, 50].map((deg, i) => {
          const len = 6;
          const rad = (deg - 90) * Math.PI / 180;
          const x1 = 110 + Math.cos(rad) * 78;
          const y1 = 120 + Math.sin(rad) * 78;
          const x2 = 110 + Math.cos(rad) * (78 + 12);
          const y2 = 120 + Math.sin(rad) * (78 + 12);
          return <line key={i} x1={x1} y1={y1} x2={x2} y2={y2} stroke={GOLD} strokeWidth="2" strokeLinecap="round" opacity={0.45 + i*0.05}/>;
        })}
        {/* half disc */}
        <path d="M 40 120 A 70 70 0 0 1 180 120 Z" fill={GOLD}/>
        {/* horizon line */}
        <line x1="0" y1="120" x2="220" y2="120" stroke={GOLD} strokeWidth="2.5"/>
        {/* inner navy line — slim cut for depth */}
        <line x1="40" y1="120" x2="180" y2="120" stroke={NAVY} strokeWidth="3"/>
      </svg>

      <Wordmark size={68} weight={500} letterSpacing="0.09em"/>
      <Subtitle text="L · A · W · Y · E · R · S" letterSpacing="0.05em" size={12}/>
      <ArabicWord size={26}/>
    </Frame>
  );
}

// ============================================
// 3. NOON (ن) — Arabic Heritage
// The first letter of نورة in Arabic — already a bowl with a sun-dot.
// The most meaningful, ownable mark for a GCC firm.
// ============================================
function LogoNoon() {
  return (
    <Frame label="03 · Noon · ن" tagline="The letter that begins her name">
      <svg width="200" height="180" viewBox="0 0 200 180" style={{ overflow: 'visible' }}>
        {/* Stylized geometric Noon (ن): half-circle bowl below + dot above */}
        {/* Bowl: open at top, thick stroke */}
        <path
          d="M 30 70 A 70 70 0 0 0 170 70"
          stroke={GOLD}
          strokeWidth="14"
          fill="none"
          strokeLinecap="square"
        />
        {/* Tiny terminals on either side - make it feel like a proper letter */}
        <rect x="23" y="55" width="14" height="16" fill={GOLD}/>
        <rect x="163" y="55" width="14" height="16" fill={GOLD}/>
        {/* Dot above — this is the sun */}
        <circle cx="100" cy="30" r="14" fill={GOLD}/>
      </svg>

      <div style={{ display: 'flex', alignItems: 'baseline', gap: 22 }}>
        {/* Both Latin and Arabic rendered in Amiri — one family, perfect match */}
        <div style={{
          fontFamily: "'Amiri', serif",
          fontWeight: 700,
          fontSize: 60,
          letterSpacing: '0.06em',
          color: GOLD,
          lineHeight: 1,
        }}>NOURA</div>
        <div style={{
          fontFamily: "'Amiri', serif",
          fontWeight: 700,
          fontSize: 60,
          color: GOLD,
          direction: 'rtl',
          lineHeight: 1,
        }}>نورة</div>
      </div>
      <div style={{
        fontFamily: "'Amiri', serif",
        fontWeight: 400,
        fontSize: 14,
        letterSpacing: '0.42em',
        color: GOLD,
        opacity: 0.85,
      }}>LAWYERS · المحاماة</div>
    </Frame>
  );
}

// ============================================
// 4. PRISM — Clarity from Complexity
// Sun split into wedges of light. Litigation = analyzing facts,
// separating truth into its parts.
// ============================================
function LogoPrism() {
  return (
    <Frame label="04 · Prism" tagline="Clarity, separated from complexity">
      <svg width="170" height="170" viewBox="0 0 170 170" style={{ overflow: 'visible' }}>
        <g transform="translate(85 85)">
          {/* 8 wedges around a hollow center, alternating opacity */}
          {[0,1,2,3,4,5,6,7].map(i => {
            const a1 = (i * 45 - 90 - 18) * Math.PI / 180;
            const a2 = (i * 45 - 90 + 18) * Math.PI / 180;
            const r1 = 22, r2 = 70;
            const x1 = Math.cos(a1)*r1, y1 = Math.sin(a1)*r1;
            const x2 = Math.cos(a1)*r2, y2 = Math.sin(a1)*r2;
            const x3 = Math.cos(a2)*r2, y3 = Math.sin(a2)*r2;
            const x4 = Math.cos(a2)*r1, y4 = Math.sin(a2)*r1;
            return (
              <path
                key={i}
                d={`M ${x1} ${y1} L ${x2} ${y2} A ${r2} ${r2} 0 0 1 ${x3} ${y3} L ${x4} ${y4} A ${r1} ${r1} 0 0 0 ${x1} ${y1} Z`}
                fill={GOLD}
                opacity={i % 2 === 0 ? 1 : 0.5}
              />
            );
          })}
          {/* center dot */}
          <circle r="11" fill={GOLD}/>
        </g>
      </svg>

      <Wordmark size={68} weight={500} letterSpacing="0.09em"/>
      <Subtitle text="LAWYERS" letterSpacing="0.5em" size={12}/>
      <ArabicWord size={26}/>
    </Frame>
  );
}

// ============================================
// 5. MONOGRAM — Serif N + Sun
// A bold custom serif N where the gold disc nests in the negative space.
// The mark IS the wordmark's initial.
// ============================================
function LogoMonogram() {
  return (
    <Frame label="05 · Monogram" tagline="The N becomes the sun's frame">
      <svg width="200" height="200" viewBox="0 0 200 200" style={{ overflow: 'visible' }}>
        {/* Outer ring/frame */}
        <circle cx="100" cy="100" r="92" fill="none" stroke={GOLD} strokeWidth="1.5" opacity="0.4"/>

        {/* Gold disc (sun) */}
        <circle cx="100" cy="100" r="58" fill={GOLD}/>

        {/* The N — drawn in navy on top of the disc, with serifs */}
        <g fill={NAVY}>
          {/* Left vertical */}
          <rect x="60" y="58" width="14" height="84"/>
          {/* Right vertical */}
          <rect x="126" y="58" width="14" height="84"/>
          {/* Diagonal */}
          <polygon points="74,58 88,58 140,142 126,142"/>
          {/* Serifs - top left */}
          <rect x="52" y="58" width="30" height="4"/>
          {/* Serifs - top right */}
          <rect x="118" y="58" width="30" height="4"/>
          {/* Serifs - bottom left */}
          <rect x="52" y="138" width="30" height="4"/>
          {/* Serifs - bottom right */}
          <rect x="118" y="138" width="30" height="4"/>
        </g>
      </svg>

      <Wordmark size={64} weight={500} letterSpacing="0.1em"/>
      <Subtitle text="LAWYERS" letterSpacing="0.5em" size={12}/>
      <ArabicWord size={26}/>
    </Frame>
  );
}

// ============================================
// 6. SEAL — Stamp of Truth
// Circular emblem like a notarial seal. Tradition + authority,
// but rendered with restraint and a modern sun at center.
// ============================================
function LogoSeal() {
  // Curved text along an arc
  return (
    <Frame label="06 · Seal" tagline="An emblem worth signing">
      <svg width="200" height="200" viewBox="0 0 200 200" style={{ overflow: 'visible' }}>
        <defs>
          <path id="seal-top" d="M 30 100 A 70 70 0 0 1 170 100"/>
          <path id="seal-bot" d="M 32 100 A 68 68 0 0 0 168 100"/>
        </defs>

        {/* Outer ring */}
        <circle cx="100" cy="100" r="92" fill="none" stroke={GOLD} strokeWidth="1.5"/>
        <circle cx="100" cy="100" r="86" fill="none" stroke={GOLD} strokeWidth="0.8" opacity="0.5"/>

        {/* Tick marks around the ring */}
        {Array.from({length: 36}).map((_, i) => {
          const a = (i * 10) * Math.PI / 180;
          const x1 = 100 + Math.cos(a) * 79;
          const y1 = 100 + Math.sin(a) * 79;
          const x2 = 100 + Math.cos(a) * 83;
          const y2 = 100 + Math.sin(a) * 83;
          return <line key={i} x1={x1} y1={y1} x2={x2} y2={y2} stroke={GOLD} strokeWidth="1" opacity="0.7"/>;
        })}

        {/* Curved name text along top */}
        <text fill={GOLD} style={{ fontFamily: "'Cinzel', serif", fontSize: '14px', letterSpacing: '6px' }}>
          <textPath href="#seal-top" startOffset="50%" textAnchor="middle">NOURA · LAWYERS</textPath>
        </text>

        {/* Established year along bottom */}
        <text fill={GOLD} style={{ fontFamily: "'Cinzel', serif", fontSize: '10px', letterSpacing: '6px' }} opacity="0.7">
          <textPath href="#seal-bot" startOffset="50%" textAnchor="middle">· EST · GCC ·</textPath>
        </text>

        {/* Central mark: sun + Arabic noon dot above */}
        <circle cx="100" cy="106" r="22" fill={GOLD}/>
        <circle cx="100" cy="78" r="4" fill={GOLD}/>

        {/* Bottom flank stars */}
        <g fill={GOLD} opacity="0.7">
          <polygon points="60,150 62,156 68,156 63,160 65,166 60,162 55,166 57,160 52,156 58,156" transform="scale(0.7) translate(35 50)"/>
          <polygon points="60,150 62,156 68,156 63,160 65,166 60,162 55,166 57,160 52,156 58,156" transform="scale(0.7) translate(135 50)"/>
        </g>
      </svg>

      <Wordmark size={56} weight={500} letterSpacing="0.12em"/>
      <Subtitle text="ATTORNEYS · LITIGATION" letterSpacing="0.32em" size={10}/>
      <ArabicWord size={24}/>
    </Frame>
  );
}

// ============================================
// Reference: the original logo as supplied
// ============================================
function LogoOriginal() {
  return (
    <div style={{
      position: 'absolute', inset: 0, background: '#000',
      display: 'flex', alignItems: 'center', justifyContent: 'center',
      gap: 28, padding: 40,
    }}>
      <ConceptLabel name="Reference · current" tagline="What we're evolving from" color="#5a4a25"/>
      <svg width="110" height="110" viewBox="0 0 110 110">
        <circle cx="55" cy="55" r="48" fill="#F1C24B"/>
      </svg>
      <div style={{ width: 2, height: 110, background: '#F1C24B' }}/>
      <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
        <div style={{ fontFamily: 'system-ui, sans-serif', fontWeight: 700, fontSize: 76, color: '#F1C24B', letterSpacing: '0.04em', lineHeight: 1 }}>NOURA</div>
        <div style={{ fontFamily: 'system-ui, sans-serif', fontWeight: 400, fontSize: 14, color: '#F1C24B', letterSpacing: '0.55em', textAlign: 'center' }}>LAWYERS</div>
      </div>
    </div>
  );
}

// ============================================
// System tile — shows ECLIPSE applied to brand touchpoints
// (card, signage, app icon) so the user can feel the system
// ============================================
function SystemPreview() {
  return (
    <div style={{
      position: 'absolute', inset: 0,
      background: 'linear-gradient(180deg, #14213a 0%, #0a1220 100%)',
      padding: 40,
      display: 'grid', gridTemplateColumns: '1.1fr 1fr', gap: 28,
      color: CREAM,
    }}>
      <ConceptLabel name="System preview" tagline="Eclipse direction in context"/>

      {/* Business card */}
      <div style={{ alignSelf: 'center' }}>
        <div style={{ fontFamily: "'Cinzel', serif", fontSize: 10, letterSpacing: '0.3em', color: GOLD_SOFT, marginBottom: 14 }}>BUSINESS CARD</div>
        <div style={{
          width: '100%', aspectRatio: '1.75',
          background: NAVY, border: `1px solid ${GOLD}33`,
          padding: 24,
          display: 'flex', flexDirection: 'column', justifyContent: 'space-between',
          position: 'relative', overflow: 'hidden',
        }}>
          <svg width="44" height="44" viewBox="0 0 170 170">
            <defs>
              <mask id="bc-ecl">
                <rect width="170" height="170" fill="white"/>
                <circle cx="115" cy="62" r="62" fill="black"/>
              </mask>
            </defs>
            <circle cx="85" cy="85" r="74" fill={GOLD} mask="url(#bc-ecl)"/>
          </svg>
          <div>
            <div style={{ fontFamily: "'Cormorant Garamond', serif", fontWeight: 600, fontSize: 22, color: CREAM, letterSpacing: '0.04em' }}>Layla Al-Hassan</div>
            <div style={{ fontFamily: "'Cinzel', serif", fontSize: 8, letterSpacing: '0.3em', color: GOLD, marginTop: 4 }}>SENIOR LITIGATOR</div>
          </div>
          <div style={{
            position: 'absolute', right: 18, bottom: 18,
            fontFamily: "'Cormorant Garamond', serif", fontWeight: 500, fontSize: 13, color: GOLD, letterSpacing: '0.2em'
          }}>NOURA</div>
        </div>
      </div>

      {/* App icon + signage */}
      <div style={{ display: 'flex', flexDirection: 'column', gap: 20, alignSelf: 'center' }}>
        <div>
          <div style={{ fontFamily: "'Cinzel', serif", fontSize: 10, letterSpacing: '0.3em', color: GOLD_SOFT, marginBottom: 14 }}>APP ICON</div>
          <div style={{
            width: 86, height: 86, borderRadius: 18,
            background: NAVY, display: 'flex', alignItems: 'center', justifyContent: 'center',
            boxShadow: '0 8px 24px rgba(0,0,0,0.5)',
            border: `1px solid ${GOLD}44`,
          }}>
            <svg width="44" height="44" viewBox="0 0 170 170">
              <defs>
                <mask id="ic-ecl">
                  <rect width="170" height="170" fill="white"/>
                  <circle cx="115" cy="62" r="62" fill="black"/>
                </mask>
              </defs>
              <circle cx="85" cy="85" r="74" fill={GOLD} mask="url(#ic-ecl)"/>
            </svg>
          </div>
        </div>

        <div>
          <div style={{ fontFamily: "'Cinzel', serif", fontSize: 10, letterSpacing: '0.3em', color: GOLD_SOFT, marginBottom: 14 }}>SIGNAGE · MONOTONE</div>
          <div style={{
            background: CREAM, padding: '20px 26px',
            display: 'flex', alignItems: 'center', gap: 16,
          }}>
            <svg width="36" height="36" viewBox="0 0 170 170">
              <defs>
                <mask id="sg-ecl">
                  <rect width="170" height="170" fill="white"/>
                  <circle cx="115" cy="62" r="62" fill="black"/>
                </mask>
              </defs>
              <circle cx="85" cy="85" r="74" fill={NAVY} mask="url(#sg-ecl)"/>
            </svg>
            <div style={{ width: 1, height: 30, background: NAVY }}/>
            <div>
              <div style={{ fontFamily: "'Cormorant Garamond', serif", fontWeight: 600, fontSize: 22, color: NAVY, letterSpacing: '0.06em', lineHeight: 1 }}>NOURA</div>
              <div style={{ fontFamily: "'Cinzel', serif", fontSize: 8, letterSpacing: '0.42em', color: NAVY, marginTop: 4 }}>LAWYERS</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}

Object.assign(window, {
  LogoEclipse, LogoHorizon, LogoNoon, LogoPrism, LogoMonogram, LogoSeal,
  LogoOriginal, SystemPreview,
});


// === app ===

const { useState } = React;

function App() {
  return (
    <DesignCanvas
      title="Noura Lawyers · Logo Exploration"
      subtitle="Six directions evolving the original mark — bilingual lockups, navy & gold"
      bg="#0a0a0a"
    >
      <DCSection id="reference" title="Starting point">
        <DCArtboard id="original" label="Original logo (as supplied)" width={900} height={520}>
          <LogoOriginal />
        </DCArtboard>
      </DCSection>

      <DCSection id="symbol-led" title="Symbol-led marks · light, distilled">
        <DCArtboard id="eclipse" label="01 · Eclipse — Light from shadow" width={760} height={620}>
          <LogoEclipse />
        </DCArtboard>
        <DCArtboard id="horizon" label="02 · Horizon — A new dawn" width={760} height={620}>
          <LogoHorizon />
        </DCArtboard>
        <DCArtboard id="noon" label="03 · Noon ن — Arabic heritage" width={760} height={620}>
          <LogoNoon />
        </DCArtboard>
      </DCSection>

      <DCSection id="structural" title="Structural marks · authority & clarity">
        <DCArtboard id="prism" label="04 · Prism — Clarity, separated" width={760} height={620}>
          <LogoPrism />
        </DCArtboard>
        <DCArtboard id="monogram" label="05 · Monogram — Serif N + sun" width={760} height={620}>
          <LogoMonogram />
        </DCArtboard>
        <DCArtboard id="seal" label="06 · Seal — Stamp of truth" width={760} height={620}>
          <LogoSeal />
        </DCArtboard>
      </DCSection>

      <DCSection id="system" title="In context">
        <DCArtboard id="system-preview" label="System preview — Eclipse applied" width={1100} height={620}>
          <SystemPreview />
        </DCArtboard>
      </DCSection>
    </DesignCanvas>
  );
}

ReactDOM.createRoot(document.getElementById('root')).render(<App />);
