// Datakor wordmark — trail-line mark + bold wordmark + sublabel underneath.
// No italics anywhere. Sublabel is indented to align with the wordmark
// start, so the mark+wordmark and sublabel form a cohesive lockup.

const DatakorMark = ({ height = 32, color = 'currentColor' }) => {
  const w = Math.round(height * 1.05);
  return (
    <svg width={w} height={height} viewBox="0 0 44 42" fill="none"
         aria-hidden="true" style={{ flex: '0 0 auto', display: 'block' }}>
      <line x1="3"   y1="12" x2="32"  y2="12"
            stroke={color} strokeWidth="4.5" strokeLinecap="round" />
      <line x1="9"   y1="22" x2="38"  y2="22"
            stroke={color} strokeWidth="4.5" strokeLinecap="round" />
      <line x1="15"  y1="32" x2="41"  y2="32"
            stroke={color} strokeWidth="4.5" strokeLinecap="round" />
    </svg>
  );
};

const DatakorWordmark = ({ size = 'md', inverse = false, sublabel }) => {
  // mark is sized to roughly match the wordmark cap-height so they sit flush.
  const cfg = {
    sm: { word: 22, sub: 8.5, mark: 22, gap: 7,  subGap: 4 },
    md: { word: 30, sub: 9.5, mark: 28, gap: 9,  subGap: 5 },
    lg: { word: 40, sub: 11,  mark: 36, gap: 11, subGap: 6 },
    xl: { word: 56, sub: 13,  mark: 50, gap: 13, subGap: 8 },
  }[size] || { word: 30, sub: 9.5, mark: 28, gap: 9, subGap: 5 };

  const main   = inverse ? '#fff' : 'var(--ink)';
  const accent = 'var(--brand)';
  const sub    = inverse ? 'rgba(255,255,255,0.72)' : 'var(--muted)';

  const finalSub = sublabel ?? 'Siber Güvenlik · Yönetilen IT';
  const indent   = cfg.mark + cfg.gap; // sublabel sits under wordmark, indented past mark

  return (
    <div aria-label="Datakor — Bilgim Grup" style={{
      display: 'inline-flex', flexDirection: 'column',
      gap: cfg.subGap, lineHeight: 1,
    }}>
      <div style={{
        display: 'flex', alignItems: 'center', gap: cfg.gap, lineHeight: 1,
      }}>
        <DatakorMark height={cfg.mark} color={main} />
        <div style={{
          fontFamily: 'var(--display)',
          fontWeight: 800,
          fontSize: cfg.word,
          letterSpacing: '-0.03em',
          color: main,
          lineHeight: 1,
        }}>
          Datakor<span style={{ color: accent }}>.</span>
        </div>
      </div>
      <div style={{
        fontFamily: 'var(--sans)',
        fontWeight: 700,
        fontSize: cfg.sub,
        color: sub,
        letterSpacing: '0.18em',
        textTransform: 'uppercase',
        lineHeight: 1,
        marginLeft: indent,
      }}>
        {finalSub}
      </div>
    </div>
  );
};

// Reusable phone icon — cleaner than the ☎ unicode glyph (whose baseline
// varies wildly per font and causes optical misalignment in buttons).
const PhoneIcon = ({ size = 16, color = 'currentColor' }) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill="none"
       stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"
       aria-hidden="true" style={{ display: 'block', flex: '0 0 auto' }}>
    <path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92z"/>
  </svg>
);

const MailIcon = ({ size = 16, color = 'currentColor' }) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill="none"
       stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"
       aria-hidden="true" style={{ display: 'block', flex: '0 0 auto' }}>
    <rect x="3" y="5" width="18" height="14" rx="2"/>
    <path d="M3 7l9 6 9-6"/>
  </svg>
);

const WhatsIcon = ({ size = 16, color = 'currentColor' }) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill="none"
       aria-hidden="true" style={{ display: 'block', flex: '0 0 auto' }}>
    <path d="M12 2a10 10 0 0 0-8.6 15l-1.3 4.7 4.8-1.3A10 10 0 1 0 12 2zm5.4 14.2c-.2.6-1.3 1.2-1.8 1.3-.5.1-1 .1-3.2-.7-2.7-1-4.4-3.8-4.5-4-.1-.2-1.1-1.5-1.1-2.8 0-1.4.7-2 .9-2.3.2-.3.5-.3.6-.3h.5c.2 0 .4 0 .6.5.2.5.7 1.8.8 1.9.1.1.1.3 0 .5l-.3.4-.3.3c-.1.1-.2.3-.1.5.1.2.5 1 1.2 1.6.9.8 1.6 1 1.8 1.2.2.1.4.1.5-.1.1-.2.6-.7.8-1 .2-.3.4-.2.6-.1.3.1 1.6.8 1.9.9.3.1.5.2.6.3.1.1.1.6-.1 1.2z" fill={color}/>
  </svg>
);

Object.assign(window, { DatakorWordmark, DatakorMark, PhoneIcon, MailIcon, WhatsIcon });
