// screens-landing.jsx — 출입통제 랜딩 (첫화면)

function LandingHome() {
  return (
    <div style={{ width: '100%', height: '100%', background: 'var(--paper-1)', color: 'var(--ink-0)', fontFamily: 'var(--font-sans)', display: 'flex', flexDirection: 'column', overflow: 'hidden' }}>
      {/* Top nav */}
      <header style={{ padding: '20px 56px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
        <Brandmark size={24} />
        <nav style={{ display: 'flex', gap: 28, fontSize: 13, color: 'var(--ink-2)' }}>
          <a href={ROUTES.apply} style={{ color: 'var(--ink-0)', fontWeight: 500, textDecoration: 'none' }}>방문 신청</a>
          <a href={ROUTES.mQR} style={{ color: 'inherit', textDecoration: 'none' }}>내 방문증</a>
          <a href={ROUTES.kiosk} style={{ color: 'inherit', textDecoration: 'none' }}>단말기</a>
          <a href="/screens.html" style={{ color: 'inherit', textDecoration: 'none' }}>전체 화면</a>
        </nav>
        <div style={{ display: 'flex', gap: 8 }}>
          <button style={{ background: 'transparent', border: '0.5px solid var(--paper-stroke)', padding: '8px 14px', borderRadius: 7, fontSize: 12, color: 'var(--ink-1)', cursor: 'pointer', fontFamily: 'inherit' }}>한 / EN</button>
          <a href={ROUTES.admin} style={{ background: 'var(--ink-0)', color: 'var(--paper-0)', border: 'none', padding: '8px 14px', borderRadius: 7, fontSize: 12, fontWeight: 500, cursor: 'pointer', fontFamily: 'inherit', textDecoration: 'none' }}>관리자 로그인</a>
        </div>
      </header>

      {/* Hero */}
      <main style={{ flex: 1, padding: '36px 56px 24px', display: 'grid', gridTemplateColumns: '1.2fr 1fr', gap: 56, alignItems: 'stretch', overflow: 'hidden', minHeight: 0 }}>
        {/* Left: copy + entry */}
        <div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'space-between' }}>
          <div>
            {/* eyebrow */}
            <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 24 }}>
              <span style={{ width: 22, height: '0.5px', background: 'var(--ink-2)' }} />
              <span style={{ fontSize: 11, letterSpacing: '0.3em', textTransform: 'uppercase', color: 'var(--ink-2)' }}>한솔타워 · 출입통제</span>
            </div>

            {/* hero title — Korean serif */}
            <h1 className="serif" style={{ fontSize: 68, fontWeight: 500, lineHeight: 1.05, letterSpacing: '-0.025em', margin: 0, color: 'var(--ink-0)' }}>
              한 장의 QR로,<br/>
              <span style={{ position: 'relative', display: 'inline-block' }}>
                모든 문이
                <svg width="100%" height="14" viewBox="0 0 200 14" preserveAspectRatio="none" style={{ position: 'absolute', left: 0, bottom: -4 }}>
                  <path d="M2 9 Q50 3 100 7 T198 5" fill="none" stroke="var(--celadon)" strokeWidth="2" strokeLinecap="round" />
                </svg>
              </span> 열립니다.
            </h1>
            <p style={{ fontSize: 15, color: 'var(--ink-2)', lineHeight: 1.7, marginTop: 28, maxWidth: 480 }}>
              건물 출입 · 회의실 입실 · 구내식당 식권 · 행사 입장까지.<br/>
              하나의 QR로 안전하게, 흔적 없이.
            </p>
          </div>

          {/* Entry tiles */}
          <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 14, marginTop: 36 }}>
            <EntryTile primary icon="qr" title="방문 신청하기" sub="3분 · QR 자동 발급" href={ROUTES.apply}>
              <div style={{ marginTop: 8, fontSize: 11, color: 'rgba(251,249,244,0.7)' }}>오늘 신청 → 호스트 승인 → 즉시 QR</div>
            </EntryTile>
            <EntryTile icon="users" title="직원 · 상주인" sub="회사 메일 인증" href={ROUTES.applyW}>
              <div style={{ marginTop: 8, fontSize: 11, color: 'var(--ink-3)' }}>장기 QR · 식권 · 주차 통합</div>
            </EntryTile>
          </div>
        </div>

        {/* Right: visual card stack */}
        <div style={{ position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
          {/* background grid */}
          <div style={{ position: 'absolute', inset: 0, opacity: 0.4,
            backgroundImage: 'linear-gradient(var(--paper-stroke) 0.5px, transparent 0.5px), linear-gradient(90deg, var(--paper-stroke) 0.5px, transparent 0.5px)',
            backgroundSize: '24px 24px',
            maskImage: 'radial-gradient(ellipse at center, black 30%, transparent 75%)',
          }} />

          {/* main QR card (foreground) */}
          <div style={{
            position: 'relative', zIndex: 3, width: 320,
            background: 'var(--paper-0)', borderRadius: 18, padding: 28,
            border: '0.5px solid var(--paper-stroke)',
            boxShadow: 'var(--shadow-3)',
            transform: 'rotate(-3deg)',
          }}>
            <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 16 }}>
              <span style={{ fontSize: 11, color: 'var(--ink-3)', letterSpacing: '0.04em' }}>VISITOR QR</span>
              <span style={{ display: 'flex', alignItems: 'center', gap: 6, fontSize: 11, color: 'var(--celadon-deep)' }}>
                <span style={{ width: 6, height: 6, borderRadius: 100, background: 'var(--celadon)' }} />ACTIVE
              </span>
            </div>
            <div style={{ position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '6px 0' }}>
              <QRBlock size={240} seed="LANDING-VST" dark="var(--ink-0)" />
              <div style={{ position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%,-50%)', background: 'var(--paper-0)', padding: 8, borderRadius: 10 }}>
                <Seal size={42} label="出" />
              </div>
            </div>
            <div style={{ marginTop: 16, paddingTop: 14, borderTop: '0.5px solid var(--paper-stroke)' }}>
              <div style={{ fontSize: 13, fontWeight: 500 }}>김도현 · 한솔디자인</div>
              <div className="mono" style={{ fontSize: 11, color: 'var(--ink-3)', marginTop: 3 }}>VST-7892 · 5/8 14:30—17:30</div>
            </div>
          </div>

          {/* back card — kakao notification */}
          <div style={{
            position: 'absolute', zIndex: 2, top: '12%', right: '4%', width: 220,
            background: 'var(--paper-0)', borderRadius: 14, padding: 16,
            border: '0.5px solid var(--paper-stroke)', boxShadow: 'var(--shadow-2)',
            transform: 'rotate(6deg)',
          }}>
            <div style={{ background: '#FAE100', borderRadius: 4, padding: '2px 8px', fontSize: 10, fontWeight: 600, display: 'inline-block', marginBottom: 8 }}>알림톡</div>
            <div className="serif" style={{ fontSize: 13, fontWeight: 500, marginBottom: 6 }}>방문 QR이 발급되었습니다</div>
            <div style={{ fontSize: 11, color: 'var(--ink-2)', lineHeight: 1.5 }}>약속 시간 30분 전부터 사용 가능합니다.</div>
          </div>

          {/* back card — gate scan */}
          <div style={{
            position: 'absolute', zIndex: 1, bottom: '8%', left: '0%', width: 240,
            background: '#1B1916', color: '#EFEBE0', borderRadius: 14, padding: 16,
            boxShadow: 'var(--shadow-3)',
            transform: 'rotate(-8deg)',
          }}>
            <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 10 }}>
              <div style={{ width: 28, height: 28, borderRadius: 100, background: '#8FB1A4', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                <Icon name="check" size={16} color="#15140F" />
              </div>
              <div>
                <div style={{ fontSize: 12, fontWeight: 600 }}>입장 승인</div>
                <div style={{ fontSize: 10, color: '#807A6F' }}>본관 정문 · 14:32</div>
              </div>
            </div>
            <div style={{ fontSize: 11, color: '#A6A095', lineHeight: 1.5 }}>5F 회의실 304<br/>박정민 책임 미팅</div>
          </div>
        </div>
      </main>

      {/* Bottom — feature strip */}
      <footer style={{ padding: '24px 56px', borderTop: '0.5px solid var(--paper-stroke)', background: 'var(--paper-0)', display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 32 }}>
        {[
          { i:'building', t:'건물 정문 · 게이트', s:'정문 · 후문 · 주차장' },
          { i:'users',    t:'회의실 · 행사장', s:'예약 시 자동 발급' },
          { i:'food',     t:'구내식당 식권', s:'1일 1매 · 중복차단' },
          { i:'shield',   t:'동적 QR · 30초 갱신', s:'캡쳐·복제 방지' },
        ].map((f, i) => (
          <div key={i} style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
            <Icon name={f.i} size={18} color="var(--ink-1)" />
            <div style={{ fontSize: 13, fontWeight: 500, color: 'var(--ink-0)', marginTop: 4 }}>{f.t}</div>
            <div style={{ fontSize: 11.5, color: 'var(--ink-3)' }}>{f.s}</div>
          </div>
        ))}
      </footer>
    </div>
  );
}

function EntryTile({ primary, icon, title, sub, children, href }) {
  const Tag = href ? 'a' : 'div';
  return (
    <Tag href={href} style={{
      padding: '20px 22px',
      background: primary ? 'var(--ink-0)' : 'var(--paper-0)',
      color: primary ? 'var(--paper-0)' : 'var(--ink-0)',
      border: primary ? 'none' : '0.5px solid var(--paper-stroke)',
      borderRadius: 14, cursor: 'pointer',
      display: 'flex', flexDirection: 'column', gap: 4,
      position: 'relative', overflow: 'hidden',
      textDecoration: 'none',
    }}>
      <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 8 }}>
        <Icon name={icon} size={18} color={primary ? 'var(--paper-0)' : 'var(--ink-1)'} />
        <Icon name="arrow" size={15} color={primary ? 'var(--paper-0)' : 'var(--ink-2)'} />
      </div>
      <div style={{ fontSize: 16, fontWeight: 600, letterSpacing: '-0.005em' }}>{title}</div>
      <div style={{ fontSize: 11.5, color: primary ? 'rgba(251,249,244,0.7)' : 'var(--ink-3)' }}>{sub}</div>
      {children}
    </Tag>
  );
}

Object.assign(window, { LandingHome, EntryTile });
