// directionDocs.jsx — styled documentation placeholder, matching D v3.
// Content is grounded in the real UI (modes, trigger/replace rules, contexts,
// BYO-key AI) and clearly marked as a work in progress.
function DocsPage() {
  const P = VXP;
  const kicker = { fontFamily: P.mono, fontSize: 12.5, color: P.coral, letterSpacing: 0.4, marginBottom: 12, textTransform: 'uppercase' };
  const h2 = { fontFamily: P.display, fontWeight: 700, fontSize: 26, letterSpacing: -0.5, margin: '0 0 14px', scrollMarginTop: 20 };
  const body = { fontSize: 16.5, lineHeight: 1.7, color: P.mute, margin: '0 0 14px', maxWidth: 620 };
  const nav = COPY.docs.sidebar;

  const Sec = ({ id, k, title, children }) => (
    <section id={id} style={{ marginBottom: 48 }}>
      {k && <div style={kicker}>{k}</div>}
      <h2 style={h2}>{title}</h2>
      {children}
    </section>
  );

  return (
    <div style={{ width: '100%', background: P.ink, color: P.text, fontFamily: P.body }}>
      {/* nav */}
      <nav style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '22px 56px', borderBottom: `1px solid ${P.line}` }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
          <img src="assets/vx-icon.png" alt="vx" width="30" height="30" style={{ display: 'block', borderRadius: 8, border: `1px solid rgba(255,255,255,0.08)` }} />
          <span style={{ fontFamily: P.display, fontWeight: 700, fontSize: 20, letterSpacing: -0.5 }}>vx</span>
          <span style={{ fontFamily: P.mono, fontSize: 13, color: P.faint, marginLeft: 4 }}>/ docs</span>
        </div>
        <div style={{ display: 'flex', alignItems: 'center', gap: 26, fontSize: 15, color: P.mute }}>
          <a className="vx-link" style={{ color: P.mute }} href="index.html">{COPY.site.nav.overview}</a>
          <a className="vx-link" style={{ color: P.mute }} href="https://github.com/tonydelanuez/vx">{COPY.site.nav.github}</a>
          <a href="https://github.com/tonydelanuez/vx/releases" style={{ color: P.text, textDecoration: 'none', borderBottom: `2px solid ${P.coral}`, paddingBottom: 2 }}>{COPY.site.nav.download}</a>
        </div>
      </nav>

      <div style={{ display: 'grid', gridTemplateColumns: '248px 1fr', gap: 0 }}>
        {/* sidebar */}
        <aside style={{ borderRight: `1px solid ${P.line}`, padding: '48px 28px 60px' }}>
          {nav.map((g) => (
            <div key={g.group} style={{ marginBottom: 26 }}>
              <div style={{ fontFamily: P.mono, fontSize: 11.5, color: P.faint, textTransform: 'uppercase', letterSpacing: 0.6, marginBottom: 12 }}>{g.group}</div>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 9 }}>
                {g.items.map(([label, id]) => (
                  <a key={id} href={'#' + id} style={{ fontSize: 14.5, color: P.mute, textDecoration: 'none' }} className="vx-link">{label}</a>
                ))}
              </div>
            </div>
          ))}
        </aside>

        {/* content */}
        <main style={{ padding: '52px 64px 64px', maxWidth: 760 }}>
          <h1 style={{ fontFamily: P.display, fontWeight: 700, fontSize: 40, letterSpacing: -1.2, margin: '0 0 14px' }}>{COPY.docs.title}</h1>
          <div style={{ display: 'inline-flex', alignItems: 'center', gap: 9, padding: '8px 14px', borderRadius: 10, border: `1px solid ${P.line2}`, fontFamily: P.mono, fontSize: 13, color: P.mute, marginBottom: 44 }}>
            <span style={{ width: 7, height: 7, borderRadius: 99, background: P.coral }} />
            {COPY.docs.wipBadge}
          </div>

          <Sec id="install" k={COPY.docs.install.kicker} title={COPY.docs.install.title}>
            <p style={body}>{COPY.docs.install.body}</p>
          </Sec>

          <Sec id="basics" title={COPY.docs.basics.title}>
            <p style={body}>{COPY.docs.basics.body}</p>
          </Sec>

          <Sec id="modes" k={COPY.docs.modes.kicker} title={COPY.docs.modes.title}>
            <p style={body}>{COPY.docs.modes.body}</p>
          </Sec>

          <Sec id="rules" title={COPY.docs.rules.title}>
            <p style={body}>{COPY.docs.rules.body}</p>
          </Sec>

          <Sec id="contexts" title={COPY.docs.contexts.title}>
            <p style={body}>{COPY.docs.contexts.body}</p>
          </Sec>

          <Sec id="ai" k={COPY.docs.ai.kicker} title={COPY.docs.ai.title}>
            <p style={body}>{COPY.docs.ai.body}</p>
          </Sec>

          <Sec id="format" k={COPY.docs.format.kicker} title={COPY.docs.format.title}>
            <p style={body}>{COPY.docs.format.body}</p>
            <div style={{ border: `1px solid ${P.line}`, borderRadius: 12, overflow: 'hidden', maxWidth: 520, marginTop: 4 }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '10px 16px', borderBottom: `1px solid ${P.line}`, background: P.ink850 }}>
                <span style={{ width: 9, height: 9, borderRadius: 99, background: P.faint }} />
                <span style={{ fontFamily: P.mono, fontSize: 12.5, color: P.faint }}>{COPY.docs.format.sampleFilename}</span>
              </div>
              <pre style={{ margin: 0, padding: '16px 18px', fontFamily: P.mono, fontSize: 13, lineHeight: 1.85, color: P.text, background: P.ink900 }}>{`rules:
  - trigger: `}<span style={{ color: P.coral }}>{'"open brace"'}</span>{`
    replace: `}<span style={{ color: P.green }}>{'"{"'}</span>{`
  - trigger: `}<span style={{ color: P.coral }}>{'"new line"'}</span>{`
    replace: `}<span style={{ color: P.green }}>{'"\\\\n"'}</span>{``}</pre>
            </div>
          </Sec>

          <Sec id="requirements" title={COPY.docs.requirements.title}>
            <p style={{ ...body, marginBottom: 0 }}>{COPY.docs.requirements.body}</p>
          </Sec>
        </main>
      </div>

      <footer style={{ borderTop: `1px solid ${P.line}`, padding: '24px 56px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
          <img src="assets/vx-icon.png" alt="vx" width="24" height="24" style={{ display: 'block', borderRadius: 6, border: `1px solid rgba(255,255,255,0.08)` }} />
          <span style={{ fontSize: 14, color: P.faint }}>{COPY.site.footerBuilt}</span>
        </div>
        <div style={{ display: 'flex', gap: 22, fontSize: 14 }}>
          <a className="vx-link" style={{ color: P.mute }} href="index.html">{COPY.site.nav.overview}</a>
          <a className="vx-link" style={{ color: P.mute }} href="https://github.com/tonydelanuez/vx">{COPY.site.nav.github}</a>
          <a className="vx-link" style={{ color: P.mute }} href="https://x.com/tdoot_">{COPY.site.footerTwitter}</a>
        </div>
      </footer>
    </div>
  );
}

window.DocsPage = DocsPage;
