/* ============================================================
   开源替代 — 样式表
   主色：暖橙红 #f97316  | 中性暖灰基底 | 深色模式石板灰
   字体：Sora(标题) + Plus Jakarta Sans(正文) + JetBrains Mono(数字)
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
    --accent: #f97316;
    --accent-2: #fb923c;
    --accent-ink: #ffffff;
    --green: #10b981;

    --bg: #faf8f5;
    --bg-soft: #f3efe9;
    --surface: #ffffff;
    --surface-2: #fbf9f6;
    --border: #ebe5dc;
    --border-strong: #ddd4c7;

    --ink: #1c1917;
    --ink-2: #44403c;
    --ink-3: #78716c;
    --ink-4: #a8a29e;

    --shadow-sm: 0 1px 2px rgba(28,25,23,.05), 0 1px 3px rgba(28,25,23,.06);
    --shadow-md: 0 4px 16px rgba(28,25,23,.07), 0 2px 6px rgba(28,25,23,.05);
    --shadow-lg: 0 18px 50px -12px rgba(28,25,23,.18);

    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 22px;

    --maxw: 1180px;
    --header-h: 66px;

    --font-display: 'Sora', system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="dark"] {
    --bg: #0d0f14;
    --bg-soft: #14171e;
    --surface: #171a21;
    --surface-2: #1c2029;
    --border: #262b35;
    --border-strong: #333a47;

    --ink: #f5f5f4;
    --ink-2: #d6d3d1;
    --ink-3: #a8a29e;
    --ink-4: #78716c;

    --accent: #fb923c;
    --accent-2: #f97316;
    --green: #34d399;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 6px 20px rgba(0,0,0,.4);
    --shadow-lg: 0 22px 60px -16px rgba(0,0,0,.65);
}

/* ---------- 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background .3s ease, color .3s ease;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font: inherit; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 56px 0; }
@media (max-width: 720px) { .section { padding: 40px 0; } }

/* ---------- 背景氛围 ---------- */
.bg-grid {
    position: fixed; inset: 0; z-index: -2; pointer-events: none;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 46px 46px;
    opacity: .35;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}
[data-theme="dark"] .bg-grid { opacity: .22; }
.bg-glow {
    position: fixed; top: -260px; left: 50%; transform: translateX(-50%);
    width: 1100px; height: 700px; z-index: -1; pointer-events: none;
    background: radial-gradient(closest-side, rgba(249,115,22,.20), transparent 70%);
    filter: blur(20px);
}
[data-theme="dark"] .bg-glow { background: radial-gradient(closest-side, rgba(251,146,60,.16), transparent 70%); }

/* ---------- 头部导航 ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    border-bottom: 1px solid transparent;
    transition: border-color .25s, background .25s;
}
.site-header.scrolled { border-bottom-color: var(--border); }
.header-inner {
    height: var(--header-h);
    display: flex; align-items: center; gap: 18px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-family: var(--font-display); font-size: 18px; letter-spacing: -.02em; flex-shrink: 0; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px;
    display: grid; place-items: center;
    background: linear-gradient(140deg, var(--accent), var(--accent-2));
    color: var(--accent-ink); box-shadow: 0 4px 12px rgba(249,115,22,.4);
}
.brand-mark.sm { width: 30px; height: 30px; border-radius: 8px; }
.main-nav { display: flex; gap: 4px; margin-left: 8px; }
.main-nav a {
    padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px;
    color: var(--ink-2); transition: .2s;
}
.main-nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav-search {
    margin-left: auto; position: relative; width: 340px; max-width: 38vw;
}
.nav-search .search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.nav-search input {
    width: 100%; height: 40px; padding: 0 70px 0 40px;
    border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface); color: var(--ink); outline: none;
    transition: .2s; font-size: 14px;
}
.nav-search input::placeholder { color: var(--ink-4); }
.nav-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(249,115,22,.14); }
.kbd {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    font-family: var(--font-mono); font-size: 12px; color: var(--ink-3);
    border: 1px solid var(--border-strong); border-radius: 6px; padding: 1px 7px; background: var(--bg-soft);
}
.header-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
    color: var(--ink-2); border: 1px solid transparent; transition: .2s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--ink); }
.theme-toggle .ico-moon { display: none; }
[data-theme="dark"] .theme-toggle .ico-sun { display: none; }
[data-theme="dark"] .theme-toggle .ico-moon { display: block; }
.menu-toggle { display: none; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 11px 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
    background: var(--accent); color: var(--accent-ink);
    transition: transform .15s, box-shadow .2s, background .2s;
    box-shadow: 0 4px 14px rgba(249,115,22,.32);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(249,115,22,.42); }
.btn-sm { padding: 8px 14px; font-size: 13px; box-shadow: none; }
.btn-ghost { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); box-shadow: none; }
.btn-ghost:hover { background: var(--bg-soft); color: var(--ink); box-shadow: none; }

/* ---------- Hero ---------- */
.hero { padding: 78px 0 40px; text-align: center; position: relative; }
.hero-badges { display: inline-flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 26px; }
.pill {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
    background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); box-shadow: var(--shadow-sm);
}
.pill-live { color: var(--accent); border-color: rgba(249,115,22,.3); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.pill-live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(249,115,22,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(249,115,22,.5);} 70%{box-shadow:0 0 0 8px rgba(249,115,22,0);} 100%{box-shadow:0 0 0 0 rgba(249,115,22,0);} }

.hero-title {
    font-family: var(--font-display); font-weight: 800;
    font-size: clamp(40px, 6vw, 72px); line-height: 1.04; letter-spacing: -.035em;
    margin-bottom: 22px;
}
.hero-title .grad {
    background: linear-gradient(120deg, var(--accent) 10%, #f43f5e 90%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
    font-size: clamp(16px, 2vw, 19px); color: var(--ink-3); max-width: 620px; margin: 0 auto 34px;
}
.hero-search {
    max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
    padding: 8px 8px 8px 22px; box-shadow: var(--shadow-md); transition: .2s;
}
.hero-search:focus-within { border-color: var(--accent); box-shadow: var(--shadow-md), 0 0 0 4px rgba(249,115,22,.14); }
.hero-search svg { color: var(--ink-3); flex-shrink: 0; }
.hero-search input { flex: 1; border: none; outline: none; background: transparent; color: var(--ink); font-size: 16px; height: 40px; }
.hero-search input::placeholder { color: var(--ink-4); }
.hero-search button { flex-shrink: 0; }
.hero-suggest { margin-top: 18px; font-size: 13px; color: var(--ink-3); display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-suggest a { color: var(--accent); font-weight: 600; }
.hero-suggest a:hover { text-decoration: underline; }

.hero-stats {
    margin: 56px auto 0; max-width: 560px; display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 22px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.stat { text-align: center; flex: 1; }
.stat b { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.stat span { font-size: 13px; color: var(--ink-3); }
.stat-sep { width: 1px; align-self: stretch; background: var(--border); margin: 4px 0; }

/* ---------- 区块标题 ---------- */
.section-head { text-align: center; margin-bottom: 32px; }
.section-head.left { text-align: left; }
.section-head h2 { font-family: var(--font-display); font-size: clamp(24px, 3vw, 32px); font-weight: 700; letter-spacing: -.025em; }
.section-head p { color: var(--ink-3); margin-top: 8px; font-size: 15px; }

/* ---------- 分类卡片 ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.cat-card {
    position: relative; padding: 20px; border-radius: var(--radius); background: var(--surface);
    border: 1px solid var(--border); transition: .22s; overflow: hidden;
}
.cat-card::before { content:""; position:absolute; inset:0; background: linear-gradient(135deg, rgba(249,115,22,.07), transparent 60%); opacity:0; transition:.22s; }
.cat-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.cat-card:hover::before { opacity: 1; }
.cat-count { position: absolute; top: 16px; right: 16px; font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ink-4); }
.cat-name { display: block; font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.cat-desc { display: block; font-size: 13px; color: var(--ink-3); line-height: 1.5; }

/* ---------- 字母索引 ---------- */
.alpha-index {
    position: sticky; top: calc(var(--header-h) + 8px); z-index: 20;
    display: flex; flex-wrap: wrap; gap: 3px; justify-content: center;
    padding: 8px; margin-bottom: 28px; border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: blur(10px); border: 1px solid var(--border); width: fit-content; margin-left: auto; margin-right: auto;
}
.alpha-index a {
    width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
    font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--ink-3); transition: .15s;
}
.alpha-index a:hover { background: var(--accent); color: var(--accent-ink); }

/* ---------- 目录列表 ---------- */
.directory { display: grid; grid-template-columns: 1fr; gap: 18px; }
.letter-block { display: grid; grid-template-columns: 64px 1fr; gap: 20px; align-items: start; scroll-margin-top: 130px; }
.letter-sticky {
    position: sticky; top: 140px;
    font-family: var(--font-display); font-weight: 800; font-size: 38px;
    color: var(--accent); letter-spacing: -.04em; opacity: .9;
}
.software-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }

/* ---------- 商业软件卡片 ---------- */
.software-card {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
    transition: .18s; position: relative; overflow: hidden;
}
.software-card::after {
    content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background: var(--brand); transform: scaleY(0); transform-origin:center; transition:.18s;
}
.software-card:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow-md); }
.software-card:hover::after { transform: scaleY(1); }
.sc-body { display: flex; flex-direction: column; min-width: 0; }
.sc-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-count { font-size: 12px; color: var(--ink-3); font-family: var(--font-mono); }

/* ---------- 头像 ---------- */
.avatar {
    flex-shrink: 0; border-radius: 9px; display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 700; width: 38px; height: 38px; font-size: 17px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.avatar.lg { width: 52px; height: 52px; font-size: 22px; border-radius: 12px; }
.avatar.xl { width: 84px; height: 84px; font-size: 36px; border-radius: 18px; }

/* ---------- 工具卡片 ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.tool-card {
    padding: 22px; border-radius: var(--radius); background: var(--surface);
    border: 1px solid var(--border); transition: .22s; position: relative; overflow: hidden;
    display: flex; flex-direction: column; gap: 14px;
}
.tool-card::before { content:""; position:absolute; top:-40%; right:-30%; width:200px; height:200px; border-radius:50%; background: var(--brand); opacity:.05; filter: blur(20px); transition:.3s; }
.tool-card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.tool-card:hover::before { opacity: .1; }
.tc-head { display: flex; gap: 14px; align-items: center; }
.tc-title h3 { font-size: 17px; font-weight: 700; font-family: var(--font-display); letter-spacing: -.01em; }
.tc-title h3 a:hover { color: var(--accent); }
.tc-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.tc-desc { color: var(--ink-3); font-size: 14px; flex: 1; }
.tc-foot { display: flex; gap: 8px; margin-top: auto; }

.chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 7px;
    font-size: 11.5px; font-weight: 600; background: var(--bg-soft); color: var(--ink-3);
    border: 1px solid var(--border);
}
.chip-lang { font-family: var(--font-mono); color: var(--accent); border-color: rgba(249,115,22,.25); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.chip-star { color: #d97706; background: color-mix(in srgb, #f59e0b 12%, transparent); border-color: rgba(245,158,11,.25); }
[data-theme="dark"] .chip-star { color: #fbbf24; }
.chip-star svg { color: #f59e0b; }

/* ---------- 详情页 ---------- */
.detail-hero { padding: 40px 0 30px; border-bottom: 1px solid var(--border); background:
    radial-gradient(ellipse 60% 100% at 0% 0%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 60%),
    radial-gradient(ellipse 60% 100% at 100% 0%, color-mix(in srgb, var(--brand) 7%, transparent), transparent 60%); }
.detail-hero-inner { scroll-margin-top: 90px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); margin-bottom: 26px; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--ink-4); }
.crumbs .current { color: var(--ink-2); font-weight: 600; }
.detail-head { display: flex; gap: 26px; align-items: flex-start; }
.detail-name { font-family: var(--font-display); font-size: clamp(30px, 4vw, 46px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.detail-tag { color: var(--accent); font-weight: 600; margin-bottom: 6px; font-size: 15px; }
.detail-desc { color: var(--ink-3); max-width: 640px; margin-top: 10px; font-size: 15px; }
.tool-eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--green); margin-bottom: 6px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.detail-meta .chip { font-size: 12px; padding: 4px 10px; }
.detail-actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; flex-wrap: wrap; }
.count-badge { font-size: 13px; color: var(--ink-3); font-weight: 600; padding-left: 4px; }

/* ---------- 通用页面头 ---------- */
.page-head { padding-top: 50px; }
.page-title { font-family: var(--font-display); font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.03em; }
.page-sub { color: var(--ink-3); margin-top: 10px; font-size: 16px; }
.count-pill { display: inline-block; margin-top: 16px; }
.hero-search.inline { max-width: none; margin-top: 24px; }

/* ---------- 关于页 ---------- */
.prose { max-width: 880px; }
.about-grid { display: grid; grid-template-columns: 1fr 260px; gap: 40px; align-items: start; }
.about-text h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin: 28px 0 12px; }
.about-text h2:first-child { margin-top: 0; }
.about-text p { color: var(--ink-2); margin-bottom: 14px; }
.about-text ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.about-text li { padding-left: 26px; position: relative; color: var(--ink-2); }
.about-text li::before { content:""; position:absolute; left:0; top:9px; width:14px; height:14px; border-radius:5px; background: color-mix(in srgb, var(--accent) 15%, transparent); border: 2px solid var(--accent); }
.about-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; position: sticky; top: 90px; }
.about-stat { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); text-align: center; }
.about-stat b { display: block; font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--accent); }
.about-stat span { font-size: 12px; color: var(--ink-3); }

/* ---------- 空状态 / 404 ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--ink-3); }
.notfound { text-align: center; padding: 100px 20px; }
.nf-code { font-family: var(--font-display); font-size: 120px; font-weight: 800; color: var(--accent); letter-spacing: -.05em; line-height: 1; }
.notfound h1 { font-family: var(--font-display); font-size: 26px; margin: 14px 0 8px; }
.notfound p { color: var(--ink-3); margin-bottom: 22px; }

/* ---------- 页脚 ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; padding: 56px 24px 40px; }
.footer-brand { display: flex; gap: 14px; align-items: flex-start; }
.footer-brand strong { font-family: var(--font-display); font-size: 16px; }
.footer-brand p { color: var(--ink-3); font-size: 13.5px; margin-top: 6px; max-width: 320px; }
.footer-links { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.footer-col h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 12px; font-weight: 700; }
.footer-col a { display: block; color: var(--ink-2); font-size: 14px; padding: 4px 0; transition: .15s; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 20px 24px; border-top: 1px solid var(--border); color: var(--ink-3); font-size: 13px; }

/* ---------- 入场动画 ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.hero-badges { animation: rise .6s both; }
.hero-title { animation: rise .6s .06s both; }
.hero-sub { animation: rise .6s .12s both; }
.hero-search { animation: rise .6s .18s both; }
.hero-suggest { animation: rise .6s .24s both; }
.hero-stats { animation: rise .6s .3s both; }
.software-card, .tool-card, .cat-card { animation: rise .5s both; }
.tool-card:nth-child(2){animation-delay:.04s}.tool-card:nth-child(3){animation-delay:.08s}
.tool-card:nth-child(4){animation-delay:.12s}.tool-card:nth-child(5){animation-delay:.16s}
.tool-card:nth-child(6){animation-delay:.2s}.tool-card:nth-child(7){animation-delay:.24s}
.tool-card:nth-child(8){animation-delay:.28s}

/* ---------- 响应式 ---------- */
@media (max-width: 920px) {
    .about-grid { grid-template-columns: 1fr; }
    .about-stats { position: static; grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 860px) {
    .main-nav { display: none; }
    .nav-search { width: auto; flex: 1; max-width: none; }
    .detail-head { flex-direction: column; gap: 18px; }
    .footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .menu-toggle { display: grid; }
    .main-nav {
        position: fixed; top: var(--header-h); left: 0; right: 0;
        flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border);
        padding: 14px 24px; gap: 4px; transform: translateY(-130%); transition: .3s; z-index: 40;
    }
    .main-nav.open { transform: none; }
    .main-nav a { padding: 12px 14px; }
    .hero { padding: 50px 0 30px; }
    .hero-stats { flex-direction: column; gap: 6px; }
    .stat-sep { display: none; }
    .letter-block { grid-template-columns: 1fr; gap: 8px; }
    .letter-sticky { position: static; font-size: 28px; }
    .about-stats { grid-template-columns: 1fr 1fr; }
    .kbd { display: none; }
    .footer-bottom { flex-direction: column; }
}
@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .hero-search { padding: 6px; }
    .hero-search button span { display: none; }
}
