/* 书源仓库 - minimalist-ui 风格 */
:root {
    --canvas: #F7F6F3;
    --surface: #FFFFFF;
    --border: #EAEAEA;
    --ink: #2F3437;
    --ink-2: #787774;
    --ink-3: #A9A7A2;
    --accent: #111111;
    --pale-blue-bg: #E1F3FE; --pale-blue-tx: #1F6C9F;
    --pale-green-bg: #EDF3EC; --pale-green-tx: #346538;
    --pale-yellow-bg: #FBF3DB; --pale-yellow-tx: #956400;
    --pale-red-bg: #FDEBEC; --pale-red-tx: #9F2F2D;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    background: var(--canvas);
    color: var(--ink);
    font-family: 'SF Pro Display', 'Geist Sans', 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.site-header {
    max-width: 1280px;
    margin: 0 auto;
    padding: 72px 24px 40px;
}
.site-title {
    font-family: 'Lyon Text', 'Newsreader', 'Playfair Display', 'Songti SC', 'SimSun', serif;
    font-size: 56px;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
}
.site-meta { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.count-badge {
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 3px 12px;
    border-radius: 9999px;
}
.site-sub { color: var(--ink-2); font-size: 15px; }
.site-desc { color: var(--ink-2); font-size: 14px; margin-top: 10px; max-width: 640px; }

/* ── 精选合集 ── */
.heji-section { max-width: 1280px; margin: 0 auto; padding: 0 24px 40px; }
.section-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.heji-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.heji-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: box-shadow 200ms ease, transform 200ms ease;
}
.heji-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.heji-name { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.heji-meta { color: var(--ink-2); font-size: 13px; margin: 6px 0 18px; }
.heji-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── 按钮 ── */
.btn {
    display: inline-block;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 8px 18px;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 150ms ease, transform 100ms ease;
    -webkit-user-select: none; user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn-dark { background: var(--accent); color: #fff; }
.btn-dark:hover { background: #333; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { background: #F0EFEC; }

/* ── Tab 切换 ── */
.tab-row {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}
.tab-row-sub { margin-top: 14px; margin-bottom: 10px; }
.tab-row-sub .tab-btn { font-size: 13px; padding: 7px 16px; }
.tab-btn {
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--ink-2);
    cursor: pointer;
    font-family: inherit;
    transition: color 150ms ease, border-color 150ms ease;
    margin-bottom: -1px;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-count {
    font-size: 11px;
    color: var(--ink-3);
    font-weight: 400;
    margin-left: 4px;
}

/* ── 合集卡片 ── */
.heji-grid-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    min-width: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow 200ms ease, transform 200ms ease;
    animation: cardIn 400ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.heji-grid-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.05); }
.heji-card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-all;
}
.heji-card-sub { color: var(--ink-2); font-size: 12px; }

/* ── 合集弹层 ── */
.heji-meta-box { margin-bottom: 16px; }
.heji-meta-line { font-size: 13px; color: var(--ink-2); margin-bottom: 12px; line-height: 1.8; }
.heji-source-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    max-height: 34vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: #FBFAF8;
}
.heji-source-item {
    font-size: 12px;
    color: var(--ink);
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: background 150ms ease;
}
.heji-source-item:hover { background: #F0EFEC; }

/* ── 筛选区 ── */
.filter-section {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px 32px;
}
.search-row { margin-bottom: 14px; }
.search-input {
    width: 100%;
    max-width: 560px;
    font-size: 15px;
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.search-input:focus { border-color: #C9C7C2; box-shadow: 0 0 0 3px rgba(0,0,0,0.03); }
.filter-row { display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }
.filter-group { display: flex; align-items: center; gap: 10px; }
.filter-label { font-size: 12px; color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase; }
.filter-tags { display: flex; gap: 6px; overflow-x: auto; }
.tag-btn {
    font-size: 12px;
    padding: 5px 14px;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
    transition: all 150ms ease;
    font-family: inherit;
}
.tag-btn:hover { border-color: #C9C7C2; color: var(--ink); }
.tag-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── 卡片网格 ── */
.card-grid {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px 24px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    min-width: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow 200ms ease, transform 200ms ease, opacity 400ms ease;
    animation: cardIn 400ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.05); }
.card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-all;
}
.card-domain {
    font-family: 'Geist Mono', 'SF Mono', 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: rtl;
    text-align: left;
}
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.tag {
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 9999px;
    white-space: nowrap;
}
.tag-ver { background: #F0EFEC; color: var(--ink-2); }
.tag-f { background: var(--pale-blue-bg); color: var(--pale-blue-tx); }
.tag-s { background: var(--pale-green-bg); color: var(--pale-green-tx); }
.tag-i { background: var(--pale-yellow-bg); color: var(--pale-yellow-tx); }
.tag-v { background: var(--pale-red-bg); color: var(--pale-red-tx); }
.tag-down { background: var(--pale-green-bg); color: var(--pale-green-tx); }
.tag-time { background: #F0EFEC; color: var(--ink-3); }

/* ── 加载 / 空状态 ── */
.load-more {
    max-width: 1280px;
    margin: 0 auto;
    padding: 8px 24px 40px;
    text-align: center;
    color: var(--ink-3);
    font-size: 13px;
}
.empty-hint {
    max-width: 1280px;
    margin: 40px auto;
    padding: 0 24px;
    text-align: center;
    color: var(--ink-2);
    font-size: 15px;
}

/* ── Footer ── */
.site-footer {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
    border-top: 1px solid var(--border);
    color: var(--ink-3);
    font-size: 12px;
}

/* ── 弹层 ── */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 200ms ease both;
}
.modal-mask[hidden] { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--surface);
    border-radius: 12px;
    max-width: 720px;
    width: 100%;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 300ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-title {
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--ink-2);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.modal-close:hover { background: #F0EFEC; color: var(--ink); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.json-view {
    background: #FBFAF8;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-family: 'Geist Mono', 'SF Mono', 'JetBrains Mono', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: var(--ink);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 50vh;
    overflow-y: auto;
}

/* ── 响应式 ── */
@media (max-width: 1100px) {
    .card-grid { grid-template-columns: repeat(3, 1fr); }
    .site-title { font-size: 44px; }
}
@media (max-width: 768px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .heji-grid { grid-template-columns: 1fr; }
    .site-header { padding: 48px 16px 28px; }
    .site-title { font-size: 36px; }
    .filter-section, .heji-section, .card-grid { padding-left: 16px; padding-right: 16px; }
    .filter-row { gap: 16px; }
    .heji-source-list { grid-template-columns: 1fr; }
}

/* ── 页脚 ── */
.site-footer {
    text-align: center;
    padding: 40px 16px 48px;
    color: var(--text-2);
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}
.site-footer a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}
.site-footer a:hover {
    color: var(--accent, inherit);
}
