/* ============================================================
   tsffi.org — 分流首页 + 子页面 全局样式
   ============================================================ */

:root {
    --bg: #0b0b12;
    --bg-card: #13131f;
    --bg-hover: #1a1a2e;
    --border: #1f1f3a;
    --border-hover: #3a3a5a;
    --text: #c8c8d4;
    --text-dim: #6b6b88;
    --text-bright: #e8e8f0;
    --orange: #f97316;
    --orange-dim: #ea580c;
    --orange-glow: rgba(249, 115, 22, 0.15);
    --blue: #3b82f6;
    --blue-glow: rgba(59, 130, 246, 0.12);
    --green: #22c55e;
    --green-glow: rgba(34, 197, 94, 0.12);
    --red: #ef4444;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

/* --- Reset & base --- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--orange); text-decoration: none; transition: color .2s; }
a:hover { color: var(--orange-dim); }

code, pre {
    font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Courier New', monospace;
}

strong { color: var(--text-bright); font-weight: 600; }

/* --- Layout containers --- */
.splash-page, .sub-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Topbar --- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 36px;
    border-bottom: 1px solid var(--border);
    background: rgba(11,11,18,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-bright);
    font-weight: 700;
    font-size: 1.4em;
    letter-spacing: -0.02em;
}

.logo-icon {
    background: linear-gradient(135deg, var(--orange), var(--orange-dim));
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
}

.topbar-nav { display: flex; gap: 24px; }
.topbar-nav a {
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    transition: color .2s;
}
.topbar-nav a:hover { color: var(--text-bright); }
.topbar-nav .back-link { color: var(--orange); }
.topbar-nav .back-link:hover { color: var(--orange-dim); }

/* --- Hero --- */
.hero {
    text-align: center;
    padding: 64px 24px 36px;
    max-width: 720px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(2.2em, 6vw, 3.4em);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.hero-ts {
    background: linear-gradient(135deg, #3178c6, #5b9bd5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-x {
    color: var(--text-dim);
    font-weight: 300;
}

.hero-rs {
    background: linear-gradient(135deg, var(--orange), #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 1.15em;
    color: var(--text-dim);
    line-height: 1.7;
    margin-bottom: 12px;
}

/* --- Split cards grid --- */
.split {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto 56px;
    padding: 0 28px;
}

.split-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 30px;
    text-decoration: none;
    color: var(--text);
    transition: border-color .25s, box-shadow .25s, transform .25s;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.split-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
}

.card-platform::before {
    background: radial-gradient(ellipse at 30% 20%, var(--orange-glow), transparent 70%);
}
.card-org::before {
    background: radial-gradient(ellipse at 70% 80%, var(--blue-glow), transparent 70%);
}
.card-community::before {
    background: radial-gradient(ellipse at 50% 50%, var(--green-glow), transparent 70%);
}

.split-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

.split-card:hover::before { opacity: 1; }

.card-badge {
    display: inline-block;
    align-self: flex-start;
    background: rgba(249,115,22,0.12);
    color: var(--orange);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 18px;
}

.badge-org {
    background: rgba(59,130,246,0.12);
    color: var(--blue);
}

.badge-community {
    background: rgba(34,197,94,0.12);
    color: var(--green);
}

.card-icon {
    font-size: 2.5em;
    margin-bottom: 16px;
    line-height: 1;
}

.card-title {
    font-size: 1.45em;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 10px;
}

.card-desc {
    color: var(--text-dim);
    font-size: .94em;
    line-height: 1.7;
    margin-bottom: 18px;
    flex: 1;
}

.card-desc code {
    background: rgba(255,255,255,0.06);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: .9em;
}

.card-features {
    list-style: none;
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-features li {
    font-size: .88em;
    color: var(--text-dim);
    padding-left: 20px;
    position: relative;
}

.card-features li::before {
    content: '';
    position: absolute;
    left: 0;
    top: .6em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--orange);
}

.card-org .card-features li::before { background: var(--blue); }
.card-community .card-features li::before { background: var(--green); }

.card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: .95em;
    color: var(--orange);
    margin-top: auto;
    transition: gap .2s;
}

.card-org .card-cta { color: var(--blue); }
.card-community .card-cta { color: var(--green); }

.split-card:hover .card-cta { gap: 12px; }

.arrow { transition: transform .2s; }
.split-card:hover .arrow { transform: translateX(4px); }

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-dim);
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer a { color: var(--orange); }

/* ============================================================
   子页面 — 通用
   ============================================================ */

.sub-hero {
    text-align: center;
    padding: 48px 24px 28px;
    max-width: 680px;
    margin: 0 auto;
}

.sub-hero h1 {
    font-size: 2em;
    font-weight: 800;
    color: var(--text-bright);
    margin-bottom: 10px;
}

.sub-hero p {
    color: var(--text-dim);
    font-size: 1.05em;
    line-height: 1.7;
}

/* --- Content section --- */
.content {
    max-width: 880px;
    width: 100%;
    margin: 0 auto 60px;
    padding: 0 28px;
}

/* --- Code blocks --- */
.code-block {
    background: #0c0c1a;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    color: #a5b4fc;
    overflow-x: auto;
    position: relative;
    margin: 12px 0;
    line-height: 1.7;
}

.code-block .copy-btn {
    position: absolute;
    top: 8px; right: 8px;
    background: var(--border);
    color: var(--text-dim);
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.code-block .copy-btn:hover {
    background: var(--border-hover);
    color: var(--text-bright);
}

/* --- Info / feature cards --- */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin: 28px 0;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 20px;
    transition: border-color .2s;
}

.info-card:hover { border-color: var(--border-hover); }

.info-card h3 {
    font-size: 1.05em;
    color: var(--text-bright);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-card p {
    font-size: .9em;
    color: var(--text-dim);
    line-height: 1.6;
}

/* --- Section labels --- */
.section-label {
    color: var(--text-dim);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin: 32px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

/* --- API status badges --- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.badge-ready { background: #064e3b; color: #6ee7b7; }
.badge-wip   { background: #78350f; color: #fcd34d; }

/* --- 404 --- */
.notfound {
    text-align: center;
    padding: 80px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.notfound-emoji { font-size: 4em; margin-bottom: 16px; }
.notfound h1 { font-size: 2.5em; color: var(--text-bright); margin-bottom: 8px; }
.notfound p { color: var(--text-dim); margin-bottom: 28px; }
.notfound a {
    display: inline-block;
    padding: 10px 28px;
    background: var(--orange);
    color: #fff;
    border-radius: var(--radius);
    font-weight: 600;
    transition: opacity .2s;
}

.notfound a:hover { opacity: 0.9; color: #fff; }

/* --- Search box (platform page) --- */
.search-wrap {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 28px;
}

.search-box {
    display: flex;
    gap: 8px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 6px;
    transition: border-color .3s, box-shadow .3s;
}

.search-box:focus-within {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-glow);
}

.search-box input {
    flex: 1;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: var(--text-bright);
    font-size: 15px;
    outline: none;
    font-family: inherit;
}

.search-box input::placeholder {
    color: var(--text-dim);
    opacity: 0.6;
}

.search-box button {
    padding: 12px 26px;
    background: linear-gradient(135deg, var(--orange), var(--orange-dim));
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s;
    white-space: nowrap;
    font-family: inherit;
}

.search-box button:hover { opacity: 0.9; }
.search-box button:disabled { opacity: 0.5; cursor: not-allowed; }

.search-results {
    max-width: 640px;
    margin: 10px auto 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: none;
}

.search-results.active { display: block; }

.search-item {
    padding: 13px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .2s;
}

.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-hover); }

.search-item .name {
    color: var(--orange);
    font-weight: 600;
    font-size: .95em;
}

.search-item .desc {
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 3px;
    line-height: 1.4;
}

.search-item .meta {
    color: #525270;
    font-size: 12px;
    margin-top: 4px;
}

.search-item .recommend-header {
    padding: 10px 16px;
    background: #0c0c1a;
    color: var(--text-dim);
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

/* --- Result card --- */
.result-wrap {
    max-width: 740px;
    margin: 28px auto;
    padding: 0 28px;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}

.result-title {
    font-size: 1.35em;
    color: var(--orange);
    font-weight: 700;
}

.result-version {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 16px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    transition: opacity .2s;
}

.download-btn:hover { opacity: 0.9; color: #fff; }

.ffi-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
}

.ffi-item {
    background: #0c0c1a;
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 13px;
    color: #a5b4fc;
}

.loading-box {
    text-align: center;
    padding: 36px;
}

.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--orange);
    border-radius: 50%;
    width: 34px; height: 34px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 14px;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

.loading-box p {
    color: var(--text-dim);
    font-size: 14px;
}

.error-msg {
    background: #2d1515;
    border: 1px solid #7f1d1d;
    color: #fca5a5;
    padding: 16px;
    border-radius: var(--radius);
    font-size: 14px;
}

/* --- Example chips --- */
.example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
    color: var(--text);
    font-family: inherit;
}

.chip:hover {
    border-color: var(--orange);
    color: var(--orange);
}

/* --- Stats --- */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
}

.stat-num {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--orange);
}

.stat-label {
    color: var(--text-dim);
    font-size: 12px;
    margin-top: 4px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .topbar { padding: 14px 20px; }
    .logo { font-size: 1.2em; }
    .logo-icon { width: 32px; height: 32px; font-size: .95em; }
    .topbar-nav { gap: 16px; }

    .hero { padding: 40px 20px 24px; }
    .hero-title { font-size: 1.8em; gap: 12px; }
    .hero-sub { font-size: 1em; }

    .split {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 20px;
        max-width: 500px;
    }

    .split-card { padding: 28px 22px; }
    .card-title { font-size: 1.3em; }

    .content { padding: 0 20px; }
    .sub-hero { padding: 32px 20px 20px; }
    .sub-hero h1 { font-size: 1.6em; }

    .info-grid { grid-template-columns: 1fr; }

    .stats-bar { grid-template-columns: 1fr 1fr; }
    .search-wrap { padding: 0 20px; }
    .result-wrap { padding: 0 20px; }
}
