// ════════════════════════════════════════════════════════════════════════
// SITE ABOUT — the human story behind Kannada Gothu, in two movements:
//   Story  (#about) — two sides of modern Bengaluru, one app
//   Vision (#vision) — more than an app: a bridge  (red gradient band)
// Uses the shared system (T, F, Icon, Rangoli, Eyebrow, Wordmark, kannadaFamily).
// ════════════════════════════════════════════════════════════════════════

// ── Co-founder poster (tilted polaroid + text on the page) used in the Story ─
function Snapshot({ photo, pos, name, tilt, size }) {
  return (
    <div className="kb-snap" style={{ '--tilt': `${tilt}deg`, position: 'relative', width: size, maxWidth: '100%', flexShrink: 0, boxSizing: 'border-box',
      background: T.card, padding: 8, borderRadius: 10, boxShadow: '0 4px 0 rgba(27,29,14,0.10)' }}>
      <div aria-hidden style={{ position: 'absolute', top: -11, left: '50%', width: size * 0.38, height: 22, transform: 'translateX(-50%) rotate(-2deg)',
        zIndex: 2, background: 'rgba(255,210,77,0.8)' }} />
      <div style={{ aspectRatio: '1 / 1', borderRadius: 6, overflow: 'hidden', background: T.low }}>
        <img src={photo} alt={name} loading="lazy" style={{ width: '100%', height: '100%', objectFit: 'cover', objectPosition: pos, display: 'block' }} />
      </div>
    </div>
  );
}

function FounderPoster({ name, label, note, photo, pos, tilt, accent }) {
  return (
    <div style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'flex-start', gap: 22, minWidth: 0 }}>
      <Snapshot photo={photo} pos={pos} name={name} tilt={tilt * 2} size={240} />
      <div style={{ flex: '1 1 200px', minWidth: 0, paddingTop: 8 }}>
        <div style={{ display: 'inline-block', fontFamily: F.display, fontWeight: 800, fontSize: 12.5, background: T.goldBright, color: T.redLipDeep,
          borderRadius: 999, padding: '3px 10px 1px', boxShadow: '0 2px 0 ' + T.goldLip }}>Co-founder</div>
        <div style={{ fontFamily: F.display, fontWeight: 800, fontSize: 30, color: T.ink, letterSpacing: -0.6, lineHeight: 1, marginTop: 10 }}>{name}</div>
        <div style={{ fontFamily: F.ui, fontSize: 14, fontWeight: 600, color: accent, marginTop: 6 }}>{label}</div>
        <p style={{ fontFamily: F.ui, fontSize: 14.5, lineHeight: 1.5, color: T.sub, margin: '10px 0 0', textWrap: 'pretty' }}>{note}</p>
      </div>
    </div>
  );
}

// ── STORY ───────────────────────────────────────────────────────────────────
function Story({ tw }) {
  return (
    <div id="about" style={{ scrollMarginTop: 68, position: 'relative', overflow: 'hidden' }}>
      <KolamBg />
      {tw.motif && (
        <div aria-hidden style={{ position: 'absolute', left: -90, bottom: -60, zIndex: 0, pointerEvents: 'none' }}>
          <Rangoli size={300} color={T.red} opacity={0.05} />
        </div>
      )}
      <div className="kb-wrap" style={{ maxWidth: 1180, margin: '0 auto', padding: '92px 28px', position: 'relative', zIndex: 1 }}>
        <div style={{ maxWidth: 720, margin: '0 auto', textAlign: 'center' }}>
          <Eyebrow color={T.red} style={{ whiteSpace: 'nowrap' }}>Meet the founders</Eyebrow>
          <p style={{ fontFamily: F.display, fontWeight: 800, letterSpacing: -0.4,
            fontSize: 'clamp(24px, 3.2vw, 38px)', lineHeight: 1.18, color: T.ink, margin: '18px 0 0', textWrap: 'balance' }}>
            We're <span style={{ color: T.red }}>Sameecha and Aashmika</span> — two sides of modern Bengaluru.
            One of us grew up speaking Kannada, one struggled to learn it. So we built the app we wished had existed.
          </p>
        </div>

        {/* the two founders */}
        <div className="kb-founders">
          <FounderPoster name="Sameecha" label="Grew up speaking it" accent={T.red} tilt={-1.6}
            photo="people/sameecha.jpeg" pos="50% 30%"
            note="A Kannadiga raised in the UK, learning Kannada from his parents. For him, the language is culture, identity and heritage." />
          <FounderPoster name="Aashmika" label="Always wanted to learn it" accent={T.goldDark} tilt={1.4}
            photo="people/aashmika.png" pos="40% 35%"
            note="Bengaluru-born and Bangalorean at heart, she could never find an approachable way in. So she became the reason to build one." />
        </div>
      </div>
    </div>
  );
}

// ── VISION  (red gradient band) ──────────────────────────────────────────────
function Vision({ tw }) {
  const pairs = [
    ['North India', 'South India'],
    ['Newcomers', 'Locals'],
    ['Heritage', 'Technology'],
    ['Wanting to belong', 'The confidence to start'],
  ];
  return (
    <div id="vision" style={{ scrollMarginTop: 68, background: BRAND_GRADIENT, color: '#fff', position: 'relative', overflow: 'hidden' }}>
      {tw.motif && (
        <>
          <div aria-hidden style={{ position: 'absolute', right: -70, top: -50, zIndex: 0, pointerEvents: 'none' }}>
            <Rangoli size={340} color="#fff" opacity={0.07} />
          </div>
          <div aria-hidden style={{ position: 'absolute', left: -90, bottom: -90, zIndex: 0, pointerEvents: 'none' }}>
            <Rangoli size={300} color={T.goldBright} opacity={0.08} />
          </div>
        </>
      )}
      <div className="kb-wrap" style={{ maxWidth: 1080, margin: '0 auto', padding: '88px 28px 92px', position: 'relative', zIndex: 1 }}>
        <div style={{ maxWidth: 720 }}>
          <Eyebrow color={T.goldBright} style={{ whiteSpace: 'nowrap' }}>Our vision</Eyebrow>
          <h2 style={{ fontFamily: F.display, fontWeight: 800, letterSpacing: -0.6,
            fontSize: 'clamp(30px, 4.2vw, 50px)', lineHeight: 1.04, color: '#fff', margin: '18px 0 0', textWrap: 'balance' }}>
            More than a language app. <span style={{ color: T.goldBright }}>A bridge.</span>
          </h2>
          <p style={{ fontFamily: F.ui, fontSize: 'clamp(16px, 1.5vw, 18.5px)', lineHeight: 1.55, color: 'rgba(255,255,255,0.84)', margin: '18px 0 0' }}>
            Built around real conversations and the language people actually speak, not memorisation and
            textbooks. We want Kannada Gothu to connect the two halves of a fast-changing city.
          </p>
        </div>

        {/* the bridges */}
        <div className="kb-bridges">
          {pairs.map(([a, b], i) => (
            <div key={i} style={{ display: 'flex', alignItems: 'center', gap: 14, background: 'rgba(255,255,255,0.08)',
              borderRadius: 16, padding: '16px 18px', border: '1px solid rgba(255,255,255,0.14)' }}>
              <span style={{ flex: 1, fontFamily: F.display, fontWeight: 700, fontSize: 'clamp(15px, 1.7vw, 18px)', color: '#fff', letterSpacing: -0.2, lineHeight: 1.15 }}>{a}</span>
              <Icon name="forward" size={20} color={T.goldBright} sw={2.4} />
              <span style={{ flex: 1, textAlign: 'right', fontFamily: F.display, fontWeight: 700, fontSize: 'clamp(15px, 1.7vw, 18px)', color: T.goldBright, letterSpacing: -0.2, lineHeight: 1.15 }}>{b}</span>
            </div>
          ))}
        </div>

        {/* mission pull-quote */}
        <div style={{ marginTop: 44, paddingTop: 38, borderTop: '1px solid rgba(255,255,255,0.16)', textAlign: 'center', maxWidth: 860, marginLeft: 'auto', marginRight: 'auto' }}>
          <div style={{ fontFamily: F.ui, fontSize: 12, fontWeight: 700, letterSpacing: 1.8, textTransform: 'uppercase', color: 'rgba(255,255,255,0.6)', marginBottom: 16 }}>The mission is simple</div>
          <p style={{ fontFamily: F.display, fontWeight: 700, fontSize: 'clamp(24px, 3.2vw, 38px)', lineHeight: 1.22, color: '#fff', letterSpacing: -0.4, margin: 0, textWrap: 'balance' }}>
            Help everyone learn Kannada,{' '}
            <span style={{ color: T.goldBright }}>swalpa swalpa</span>
            , little by little, one conversation at a time.
          </p>
        </div>
      </div>
    </div>
  );
}

Object.assign(window, { Story, Vision, Snapshot });
