// Variant A — "Trust" (conservative)
// LayerX / Sansan inspired. White bg, high-contrast black, single deep accent.
// Editorial serif accent on a couple of display moments; otherwise restrained.

function VariantTrust() {
  const [faqOpen, setFaqOpen] = useState(0);
  return (
    <div className="v-trust">
      <Nav />
      <Hero />
      <Metrics />
      <Features />
      <Scoring />
      <Steps />
      <Areas />
      <Faq faqOpen={faqOpen} setFaqOpen={setFaqOpen} />
      <FinalCTA />
      <Footer />
    </div>
  );
}

// ── Nav ──────────────────────────────────────────────────────
function Nav() {
  return (
    <header style={{
      position: 'sticky', top: 0, zIndex: 30,
      background: 'rgba(253,252,249,0.88)',
      backdropFilter: 'saturate(140%) blur(10px)',
      borderBottom: '1px solid var(--hairline)',
    }}>
      <div style={{
        maxWidth: 1200, margin: '0 auto',
        padding: '16px clamp(20px, 4vw, 48px)',
        display: 'flex', alignItems: 'center', justifyContent: 'space-between',
      }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
          <div style={{
            width: 24, height: 24, background: 'var(--fg)',
            display: 'grid', placeItems: 'center', color: 'var(--bg)',
            fontFamily: 'var(--font-mono)', fontSize: 11, fontWeight: 700,
          }}>M</div>
          <span style={{ fontSize: 15, fontWeight: 600, letterSpacing: -0.2 }}>
            関東マンショントーク
          </span>
        </div>
        <nav style={{ display: 'flex', alignItems: 'center', gap: 28, fontSize: 14 }}>
          <a href="#features" style={navLink}>特徴</a>
          <a href="#scoring" style={navLink}>AIスコア</a>
          <a href="#steps" style={navLink}>使い方</a>
          <a href="#faq" style={navLink}>FAQ</a>
          <LineCTA label="無料ではじめる" size="sm" />
        </nav>
      </div>
    </header>
  );
}
const navLink = { color: 'var(--fg)', textDecoration: 'none', opacity: 0.75, transition: 'opacity .15s' };

// ── Hero ─────────────────────────────────────────────────────
function Hero() {
  return (
    <Section id="hero" style={{ paddingTop: 72, paddingBottom: 80 }}>
      <div style={{
        display: 'grid',
        gridTemplateColumns: 'minmax(0, 1.1fr) minmax(0, 0.9fr)',
        gap: 'clamp(32px, 5vw, 72px)',
        alignItems: 'center',
      }}>
        <div>
          <div style={{
            display: 'inline-flex', alignItems: 'center', gap: 8,
            fontSize: 12, color: 'var(--muted)', fontFamily: 'var(--font-mono)',
            padding: '6px 12px', border: '1px solid var(--hairline)',
            borderRadius: 100, marginBottom: 28,
          }}>
            <span style={{ width: 6, height: 6, background: 'var(--accent)', borderRadius: '50%' }}/>
            首都圏エリアで提供開始
          </div>
          <h1 style={{
            fontSize: 'clamp(40px, 5.5vw, 68px)',
            lineHeight: 1.12,
            letterSpacing: -0.02,
            fontWeight: 600,
            margin: '0 0 28px',
          }}>{COPY.heroTitles.trust}</h1>
          <p style={{
            fontSize: 'clamp(15px, 1.15vw, 17px)',
            lineHeight: 1.8, color: 'var(--muted)',
            margin: '0 0 36px', maxWidth: 520,
          }}>{COPY.heroLead.trust}</p>
          <div style={{ display: 'flex', alignItems: 'center', gap: 16, flexWrap: 'wrap' }}>
            <LineCTA label={COPY.cta} size="lg" />
          </div>
        </div>
        <div>
          <LineMockup />
        </div>
      </div>
    </Section>
  );
}

// ── LINE mockup — a chat preview UI ──────────────────────────
function LineMockup() {
  return (
    <div style={{
      background: '#eef2f5', borderRadius: 24, padding: 16,
      boxShadow: '0 1px 2px rgba(15,30,45,0.06), 0 20px 40px -20px rgba(15,30,45,0.25)',
      border: '1px solid var(--hairline)',
      maxWidth: 420, marginLeft: 'auto',
    }}>
      <div style={{
        background: '#fff', borderRadius: 16, overflow: 'hidden',
      }}>
        {/* LINE-style header bar */}
        <div style={{
          padding: '14px 16px', borderBottom: '1px solid #eee',
          display: 'flex', alignItems: 'center', gap: 12,
          fontSize: 14, fontWeight: 600,
        }}>
          <div style={{
            width: 32, height: 32, borderRadius: '50%',
            background: 'var(--fg)', color: 'var(--bg)',
            display: 'grid', placeItems: 'center',
            fontSize: 13, fontWeight: 700,
          }}>M</div>
          <div>
            <div>マンショントーク</div>
            <div style={{ fontSize: 11, fontWeight: 400, color: 'var(--muted)' }}>オンライン</div>
          </div>
        </div>
        {/* Messages */}
        <div style={{
          padding: '20px 16px', background: '#f3f5f7',
          display: 'flex', flexDirection: 'column', gap: 10,
          minHeight: 360,
        }}>
          <ChatBubble side="left">
            希望エリアを選んでください。
          </ChatBubble>
          <ChatBubble side="right">港区・目黒区・品川区</ChatBubble>
          <ChatBubble side="left">予算の上限は？</ChatBubble>
          <ChatBubble side="right">1.2億円まで</ChatBubble>
          <ChatBubble side="left" wide>
            <div style={{ fontWeight: 600, marginBottom: 6 }}>条件に合う3件が見つかりました</div>
            <div style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.6 }}>
              資産性スコア順に並んでいます。詳細はカードをタップしてください。
            </div>
            <div style={{ marginTop: 10, display: 'flex', flexDirection: 'column', gap: 8 }}>
              <PropertyCard title="(仮)白金ザ・レジデンス" area="港区白金" score="A" />
              <PropertyCard title="(仮)目黒スカイテラス" area="目黒区上目黒" score="A-" />
              <PropertyCard title="(仮)品川ベイタワーズ" area="港区港南" score="B+" />
            </div>
          </ChatBubble>
        </div>
      </div>
    </div>
  );
}
function ChatBubble({ children, side, wide }) {
  const left = side === 'left';
  return (
    <div style={{
      alignSelf: left ? 'flex-start' : 'flex-end',
      maxWidth: wide ? '92%' : '80%',
      background: left ? '#fff' : '#8fd14f',
      color: left ? 'var(--fg)' : '#133a00',
      fontSize: 13, lineHeight: 1.5,
      padding: '10px 14px',
      borderRadius: left ? '4px 14px 14px 14px' : '14px 4px 14px 14px',
      boxShadow: '0 1px 1px rgba(0,0,0,0.04)',
    }}>
      {children}
    </div>
  );
}
function PropertyCard({ title, area, score }) {
  return (
    <div style={{
      background: '#fafaf7', border: '1px solid #eaeae4', borderRadius: 8,
      padding: '10px 12px', display: 'flex', alignItems: 'center', gap: 12,
    }}>
      <div style={{
        width: 38, height: 38, flexShrink: 0,
        background: 'repeating-linear-gradient(45deg, #d9d4c7 0 6px, #e6e2d5 6px 12px)',
        borderRadius: 4,
      }}/>
      <div style={{ flex: 1, minWidth: 0 }}>
        <div style={{ fontSize: 12, fontWeight: 600, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{title}</div>
        <div style={{ fontSize: 10, color: 'var(--muted)' }}>{area}</div>
      </div>
      <div style={{
        width: 28, height: 28, borderRadius: 4,
        background: 'var(--accent)', color: 'var(--accent-on)',
        display: 'grid', placeItems: 'center',
        fontFamily: 'var(--font-mono)', fontSize: 11, fontWeight: 700,
      }}>{score}</div>
    </div>
  );
}

// ── Metrics row ──────────────────────────────────────────────
function Metrics() {
  const items = [
    { v: '関東全域', l: '対象エリア' },
    { v: '最短3分', l: '提案までの時間' },
    { v: '24時間', l: 'LINEで受付' },
    { v: '¥0', l: '利用料金' },
  ];
  return (
    <Section style={{ padding: '40px 0 60px', borderTop: '1px solid var(--hairline)', borderBottom: '1px solid var(--hairline)' }}>
      <div style={{
        display: 'grid',
        gridTemplateColumns: 'repeat(auto-fit, minmax(180px, 1fr))',
        gap: 24,
      }}>
        {items.map((it, i) => (
          <div key={i} style={{
            padding: i === 0 ? '0' : '0 0 0 24px',
            borderLeft: i === 0 ? 'none' : '1px solid var(--hairline)',
          }}>
            <div style={{
              fontFamily: 'var(--font-serif)', fontSize: 40,
              fontWeight: 400, letterSpacing: -0.5,
              lineHeight: 1,
            }}>{it.v}</div>
            <div style={{ marginTop: 10, fontSize: 13, color: 'var(--muted)', fontFamily: 'var(--font-mono)' }}>{it.l}</div>
          </div>
        ))}
      </div>
    </Section>
  );
}

// ── Features ─────────────────────────────────────────────────
function Features() {
  return (
    <Section id="features" eyebrow="Features / 特徴">
      <h2 style={sectionHeadline}>
        強引な営業ではなく、<br/>情報の精度で選ばれる。
      </h2>
      <div style={{
        marginTop: 64,
        display: 'grid',
        gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))',
        gap: 0,
        borderTop: '1px solid var(--hairline)',
      }}>
        {FEATURES.map((f, i) => (
          <div key={i} style={{
            padding: '36px 28px 36px 0',
            borderRight: i < FEATURES.length - 1 ? '1px solid var(--hairline)' : 'none',
            paddingLeft: i === 0 ? 0 : 28,
          }}>
            <div style={{
              fontFamily: 'var(--font-mono)', fontSize: 12, color: 'var(--accent)',
              marginBottom: 20,
            }}>{f.no}</div>
            <h3 style={{ fontSize: 22, fontWeight: 600, margin: '0 0 16px', letterSpacing: -0.3, lineHeight: 1.4 }}>
              {f.title}
            </h3>
            <p style={{ fontSize: 14.5, lineHeight: 1.8, color: 'var(--muted)', margin: 0 }}>{f.body}</p>
          </div>
        ))}
      </div>
    </Section>
  );
}

// ── Scoring / AI ─────────────────────────────────────────────
function Scoring() {
  return (
    <Section id="scoring" eyebrow="Scoring / AIが見ている情報"
      style={{ background: 'var(--bg-soft)' }}>
      <div style={{
        display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 1fr)',
        gap: 'clamp(32px, 5vw, 64px)', alignItems: 'start',
      }}>
        <div style={{ position: 'sticky', top: 100 }}>
          <h2 style={sectionHeadline}>
            感覚ではなく、<br/>
            <span>6つの軸</span>で評価。
          </h2>
          <p style={{ marginTop: 28, fontSize: 15.5, lineHeight: 1.9, color: 'var(--muted)', maxWidth: 440 }}>
            住まい選びは直感だけでは難しい買い物です。マンショントークは、プロが長年積み重ねてきた判断軸をアルゴリズムに落とし込み、誰もが同じ基準で比較できるようにしました。
          </p>
        </div>
        <div>
          {SCORING.map((s, i) => (
            <div key={i} style={{
              borderTop: '1px solid var(--hairline)',
              padding: '24px 0',
              display: 'grid', gridTemplateColumns: '32px 1fr', gap: 20,
            }}>
              <div style={{
                fontFamily: 'var(--font-mono)', fontSize: 12, color: 'var(--muted)',
                paddingTop: 3,
              }}>{String(i + 1).padStart(2, '0')}</div>
              <div>
                <div style={{ fontSize: 17, fontWeight: 600, marginBottom: 6 }}>{s.label}</div>
                <div style={{ fontSize: 14, color: 'var(--muted)', lineHeight: 1.75 }}>{s.body}</div>
              </div>
            </div>
          ))}
          <div style={{ borderTop: '1px solid var(--hairline)' }}/>
        </div>
      </div>

      {/* Trust sources + disclaimer */}
      <div style={{ marginTop: 72, paddingTop: 48, borderTop: '1px solid var(--hairline)' }}>
        <div style={{
          fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: 2,
          color: 'var(--muted)', textTransform: 'uppercase', marginBottom: 32,
        }}>
          Data sources / 信頼性の根拠
        </div>
        <div style={{
          display: 'grid',
          gridTemplateColumns: 'repeat(auto-fit, minmax(260px, 1fr))',
          gap: 32,
        }}>
          {TRUST_SOURCES.map((t, i) => (
            <div key={i}>
              <div style={{ fontSize: 15, fontWeight: 600, marginBottom: 10 }}>{t.label}</div>
              <div style={{ fontSize: 13.5, color: 'var(--muted)', lineHeight: 1.8 }}>{t.body}</div>
            </div>
          ))}
        </div>
        <div style={{
          marginTop: 40, padding: '20px 24px',
          background: 'var(--bg)', border: '1px solid var(--hairline)',
          borderLeft: '3px solid var(--accent)',
          fontSize: 13, lineHeight: 1.8, color: 'var(--muted)',
        }}>
          <strong style={{ color: 'var(--fg)' }}>ご注意：</strong>{DISCLAIMER}
        </div>
      </div>
    </Section>
  );
}

// ── Steps ────────────────────────────────────────────────────
function Steps() {
  return (
    <Section id="steps" eyebrow="How it works / 使い方">
      <h2 style={sectionHeadline}>
        LINEのトーク画面だけで、完結する。
      </h2>
      <div style={{
        marginTop: 64,
        display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)',
        gap: 24,
      }} className="steps-grid">
        {STEPS.map((s, i) => (
          <div key={i} style={{ position: 'relative' }}>
            <div style={{
              display: 'flex', alignItems: 'center', gap: 12,
              marginBottom: 20,
            }}>
              <div style={{
                width: 40, height: 40, borderRadius: '50%',
                border: '1px solid var(--hairline)',
                display: 'grid', placeItems: 'center',
                fontFamily: 'var(--font-mono)', fontSize: 12, fontWeight: 600,
              }}>{s.no}</div>
              {i < STEPS.length - 1 && (
                <div style={{ flex: 1, height: 1, background: 'var(--hairline)' }}/>
              )}
            </div>
            <h3 style={{ fontSize: 18, fontWeight: 600, margin: '0 0 10px' }}>{s.title}</h3>
            <p style={{ fontSize: 14, color: 'var(--muted)', lineHeight: 1.75, margin: 0 }}>{s.body}</p>
          </div>
        ))}
      </div>
      <style>{`
        @media (max-width: 820px) {
          .steps-grid { grid-template-columns: 1fr 1fr !important; }
        }
      `}</style>
    </Section>
  );
}

// ── Areas ────────────────────────────────────────────────────
function Areas() {
  const prefs = Object.keys(AREAS);
  return (
    <section id="areas" style={{
      borderTop: '1px solid var(--hairline)',
      borderBottom: '1px solid var(--hairline)',
      background: 'var(--bg-soft)',
      padding: '28px 0',
    }}>
      <div style={{
        maxWidth: 1200, margin: '0 auto',
        padding: '0 clamp(20px, 4vw, 48px)',
        display: 'flex', alignItems: 'center', gap: 'clamp(20px, 4vw, 48px)',
        flexWrap: 'wrap',
      }}>
        <div style={{
          fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: 2,
          color: 'var(--muted)', textTransform: 'uppercase', flexShrink: 0,
        }}>
          Coverage / 対応エリア
        </div>
        <div style={{
          width: 1, alignSelf: 'stretch', background: 'var(--hairline)',
        }} className="areas-div"/>
        <div style={{ fontSize: 15, fontWeight: 600, letterSpacing: -0.2, flexShrink: 0 }}>
          関東圏 1都6県・全市区町村
        </div>
        <div style={{
          fontSize: 13, color: 'var(--muted)', lineHeight: 1.6,
          flex: 1, minWidth: 200,
        }}>
          {prefs.join(' / ')}
        </div>
      </div>
      <style>{`
        @media (max-width: 820px) { .areas-div { display: none; } }
      `}</style>
    </section>
  );
}

// ── FAQ ──────────────────────────────────────────────────────
function Faq({ faqOpen, setFaqOpen }) {
  return (
    <Section id="faq" eyebrow="FAQ / よくある質問">
      <div style={{ display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 1.4fr)', gap: 48, alignItems: 'start' }} className="areas-grid">
        <h2 style={sectionHeadline}>
          疑問は、<br/>先に解消を。
        </h2>
        <div>
          {FAQS.map((f, i) => (
            <FAQItem key={i} q={f.q} a={f.a} open={faqOpen === i} onToggle={() => setFaqOpen(faqOpen === i ? -1 : i)} />
          ))}
          <div style={{ borderTop: '1px solid var(--hairline)' }}/>
        </div>
      </div>
    </Section>
  );
}

// ── Final CTA ────────────────────────────────────────────────
function FinalCTA() {
  return (
    <Section style={{ padding: 'clamp(80px, 10vw, 140px) 0' }}>
      <div style={{
        background: 'var(--fg)', color: 'var(--bg)',
        padding: 'clamp(48px, 7vw, 96px) clamp(32px, 5vw, 72px)',
        borderRadius: 'var(--radius-card)',
        display: 'grid', gridTemplateColumns: 'minmax(0, 1.3fr) minmax(0, 1fr)',
        gap: 48, alignItems: 'end',
      }} className="cta-grid">
        <div>
          <div style={{ fontSize: 12, color: 'rgba(255,255,255,0.5)', fontFamily: 'var(--font-mono)', marginBottom: 20, letterSpacing: 2 }}>
            START
          </div>
          <h2 style={{ fontSize: 'clamp(34px, 4.5vw, 56px)', fontWeight: 600, margin: 0, lineHeight: 1.15, letterSpacing: -0.02 }}>
            首都圏の住まい選び、<br/>
            LINEからはじめませんか。
          </h2>
          <p style={{ marginTop: 24, color: 'rgba(255,255,255,0.65)', fontSize: 15, lineHeight: 1.8, maxWidth: 520 }}>
            友だち登録すると、条件ヒアリングが自動で始まります。情報収集段階のご利用でも、もちろん歓迎です。
          </p>
        </div>
        <div style={{ display: 'flex', flexDirection: 'column', gap: 16, alignItems: 'flex-start' }}>
          <LineCTA label={COPY.cta} size="lg" />
        </div>
      </div>
      <style>{`
        @media (max-width: 820px) { .cta-grid { grid-template-columns: 1fr !important; } }
      `}</style>
    </Section>
  );
}

// ── Footer ───────────────────────────────────────────────────
function Footer() {
  return (
    <footer style={{
      borderTop: '1px solid var(--hairline)',
      padding: '48px 0 32px',
    }}>
      <div style={{
        maxWidth: 1200, margin: '0 auto',
        padding: '0 clamp(20px, 4vw, 48px)',
        display: 'grid', gridTemplateColumns: '1fr auto', gap: 24, alignItems: 'start',
      }}>
        <div>
          <div style={{ fontSize: 14, fontWeight: 600 }}>住まいトーク株式会社</div>
          <div style={{ marginTop: 8, fontSize: 12, color: 'var(--muted)', lineHeight: 1.8 }}>
            〒105-0013 東京都港区浜松町2-2-15 浜松町ダイヤビル2F<br/>
            代表取締役CEO 久米 泰弘 / 設立 2018年10月<br/>
            事業内容：不動産テック事業（AIを活用したマンション情報提供サービスの企画・開発・運営）<br/>
            お問い合わせ：<a href="mailto:info@sumaitalk.com" style={{ color: 'inherit' }}>info@sumaitalk.com</a>
          </div>
        </div>
        <div style={{ display: 'flex', gap: 24, fontSize: 12, color: 'var(--muted)' }}>
          <a href="https://corp.sumaitalk.com/" target="_blank" rel="noopener" style={{ color: 'inherit' }}>運営会社</a>
          <a href="terms.html" style={{ color: 'inherit' }}>利用規約</a>
          <a href="privacy.html" style={{ color: 'inherit' }}>プライバシー</a>
        </div>
      </div>
      <div style={{ maxWidth: 1200, margin: '24px auto 0', padding: '0 clamp(20px, 4vw, 48px)', fontSize: 11, color: 'var(--muted)', lineHeight: 1.7 }}>
        本ページは情報提供を目的としており、投資助言ではありません。掲載情報は将来の資産価値や投資成果を保証するものではありません。
      </div>
      <div style={{ maxWidth: 1200, margin: '16px auto 0', padding: '0 clamp(20px, 4vw, 48px)', fontSize: 11, color: 'var(--muted)', fontFamily: 'var(--font-mono)' }}>
        © 2026 Sumaitalk, Inc.
      </div>
    </footer>
  );
}

// shared headline style
const sectionHeadline = {
  fontSize: 'clamp(30px, 3.6vw, 44px)',
  fontWeight: 600,
  letterSpacing: -0.015,
  lineHeight: 1.25,
  margin: 0,
};

Object.assign(window, { VariantTrust, Nav, Hero, LineMockup, Metrics, Features, Scoring, Steps, Areas, Faq, FinalCTA, Footer, sectionHeadline });
