---
import { getCollection } from "astro:content";
import BaseLayout from "../layouts/BaseLayout.astro";
import ResearchOrbit from "../components/ResearchOrbit.astro";
import ResearchIndex from "../components/ResearchIndex.astro";

const posts = await getCollection("posts", ({ data }) => data.status === "published");
const sites = await getCollection("sites", ({ data }) => data.status === "published");
const items = [...posts, ...sites].sort((a, b) => b.data.date.localeCompare(a.data.date));
---

<BaseLayout>
  <section class="hero">
    <div class="hero-copy">
      <p class="eyebrow">K1412 / OPEN RESEARCH ARCHIVE</p>
      <h1>技术研究，<br /><em>从证据走向理解。</em></h1>
      <p class="hero-intro">这里收录经过来源核验、机制梳理与实验检验的技术文章，也保留需要独立交互形态的专题研究站。</p>
      <div class="hero-actions">
        <a class="primary-action" href="#research">浏览研究</a>
        <a class="secondary-action" href="/method/">研究方法</a>
      </div>
      <dl class="hero-stats">
        <div><dt>{items.length}</dt><dd>公开成果</dd></div>
        <div><dt>{new Set(items.map((item) => item.data.topic)).size}</dt><dd>研究主题</dd></div>
        <div><dt>2026</dt><dd>当前快照</dd></div>
      </dl>
    </div>
    <ResearchOrbit />
  </section>

  <section class="thesis-band" aria-label="研究原则">
    <p>问题地图</p><span>→</span><p>一手来源</p><span>→</span><p>机制解释</p><span>→</span><p>边界实验</p><span>→</span><p>公开成果</p>
  </section>

  <ResearchIndex items={items} />

  <section class="method-callout">
    <div>
      <p class="eyebrow">METHOD / EVIDENCE</p>
      <h2>文章不是搜索结果的重排。</h2>
    </div>
    <div>
      <p>每项研究先建立问题与证据台账，再区分来源声称、源码观察、运行证据、实验结果和推断。能实验的问题先做小样本验证；不能验证的部分保留边界和不确定性。</p>
      <a class="text-link" href="/articles/research-publishing-method/">阅读全文 <span aria-hidden="true">→</span></a>
    </div>
  </section>
</BaseLayout>
