/* =============================================
   ResourceHub v3 — Card Store Layout
   资源卡片商店模式，非论坛列表
============================================= */

:root {
    --accent: #4f46e5;
    --bg: #f8fafc;
    --panel: #ffffff;
    --text: #0f172a;
    --text-2: #334155;
    --text-3: #64748b;
    --text-4: #94a3b8;
    --line: #e2e8f0;
    --line-soft: #f1f5f9;
    --green: #10b981;   --green-bg: #d1fae5;
    --amber: #f59e0b;   --amber-bg: #fef3c7;
    --blue: #3b82f6;    --blue-bg: #dbeafe;
    --purple: #8b5cf6;  --purple-bg: #ede9fe;
    --rose: #f43f5e;    --rose-bg: #ffe4e6;
    --r: 12px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    
    /* Modern UI additions */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.04), 0 2px 4px -2px rgb(0 0 0 / 0.04);
    --shadow-hover: 0 12px 20px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font: 14px/1.6 var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; transition: color .15s; }
img { display: block; max-width: 100%; }
input, button, textarea { font: inherit; }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 20px; }


/* ═══════════════ HEADER ═══════════════ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: var(--shadow-sm);
}

.hd-row {
    height: 64px;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Logo */
.hd-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.hd-logo i {
    width: 28px; height: 28px;
    display: grid; place-items: center;
    background: var(--text);
    color: #fff;
    border-radius: 6px;
    font-style: normal;
    font-size: 13px;
    font-weight: 700;
}

.hd-logo b {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

/* Nav */
.hd-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.hd-nav a {
    position: relative;
    display: inline-flex;
    height: 64px;
    align-items: center;
    padding: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-2);
    border-radius: 0;
    white-space: nowrap;
    letter-spacing: 0;
    transition: color .16s ease;
}

.hd-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    height: 2px;
    background: var(--accent);
    border-radius: 999px;
    opacity: 0;
    transform: scaleX(.35);
    transition: opacity .16s ease, transform .16s ease;
}

.hd-nav a:hover {
    color: var(--accent);
    background: transparent;
}

.hd-nav a:hover::after,
.hd-nav a.cur::after {
    opacity: 1;
    transform: scaleX(1);
}

.hd-nav a.cur {
    color: var(--accent);
    font-weight: 700;
    background: transparent;
    box-shadow: none;
}

/* Search */
.hd-search {
    flex: 1;
    min-width: 0;
    height: 40px;
    display: flex;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--line-soft);
    overflow: hidden;
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hd-search:focus-within { 
    border-color: transparent; 
    background: #fff;
    box-shadow: 0 0 0 2px var(--accent), var(--shadow-sm); 
}

.hd-search input {
    flex: 1; min-width: 0;
    padding: 0 12px;
    border: 0; outline: 0;
    background: transparent;
    font-size: 13px;
}

.hd-search button {
    padding: 0 14px;
    border: 0;
    background: transparent;
    color: var(--text-3);
    font-size: 13px;
    cursor: pointer;
}

.hd-search button:hover { color: var(--accent); }

/* User */
.hd-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.hd-user a {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.hd-user .u-login,
.hd-user .u-register {
    color: var(--text-3);
}

.hd-user .u-login:hover,
.hd-user .u-register:hover {
    color: var(--accent);
}

/* Mobile */
.hd-menu {
    display: none;
    width: 30px; height: 30px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

.hd-menu span {
    display: block;
    width: 14px; height: 2px;
    margin: 3px auto;
    background: var(--text-2);
}

/* Top notice */
.top-bar {
    font-size: 13px;
    color: var(--text-3);
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    padding: 5px 0;
    text-align: center;
}

.top-bar em {
    display: inline-block;
    padding: 1px 6px;
    margin-right: 6px;
    font-style: normal;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: var(--blue-bg);
    border-radius: 3px;
    vertical-align: middle;
}


/* ═══════════════ HERO ═══════════════ */
.hero {
    background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--line);
    padding: 44px 0 34px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Subtle background accent for Hero */
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.08) 0%, rgba(255,255,255,0) 70%);
    pointer-events: none;
    z-index: 0;
}

.hero .wrap {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0;
}

.hero p {
    font-size: 16px;
    color: var(--text-3);
    margin: 4px 0 14px;
}

.hero-search {
    max-width: 640px;
    height: 48px;
    margin: 0 auto;
    display: flex;
    border: 1px solid var(--line);
    border-radius: 28px;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow-md);
    transition: all .2s ease;
}

.hero-search:focus-within { 
    border-color: transparent;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2), var(--shadow-hover);
}

.hero-search input {
    flex: 1; min-width: 0;
    padding: 0 20px;
    border: 0; outline: 0;
    font-size: 16px;
    background: transparent;
}

.hero-search button {
    padding: 0 24px;
    border: 0;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease;
}

.hero-search button:hover { opacity: .85; }

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}

.hero-tags a {
    padding: 3px 10px;
    font-size: 12px;
    color: var(--text-3);
    background: var(--line-soft);
    border-radius: var(--r);
}

.hero-tags a:hover { color: var(--accent); background: var(--blue-bg); }

/* ═══════════════ FILTER BAR ═══════════════ */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 0 12px;
}

.resource-head {
    border-bottom: 1px solid var(--line);
    margin-bottom: 16px;
}

.resource-head h2 {
    margin: 0;
    color: var(--text);
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 0;
}

.link-latest {
    color: var(--text-3);
    font-size: 13px;
    font-weight: 600;
}

.link-latest:hover {
    color: var(--accent);
}

.recommend-section,
.related-section {
    margin-top: 20px;
}

.recommend-grid,
.related-grid {
    margin-bottom: 24px;
}

/* ═══════════════ CARD GRID ═══════════════ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding-bottom: 20px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.card:hover {
    border-color: rgba(79, 70, 229, 0.3);
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

/* Cover */
.card-cover {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: var(--line-soft);
}

.card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .card-cover img {
    transform: scale(1.06);
}

/* Placeholder when no cover image */
.card-cover .cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    opacity: .8;
}

.cover-ph-blue   { background: var(--blue); }
.cover-ph-green  { background: var(--green); }
.cover-ph-amber  { background: var(--amber); }
.cover-ph-purple { background: var(--purple); }
.cover-ph-rose   { background: var(--rose); }
.cover-ph-gray   { background: var(--text-4); }

/* Card body */
.card-body {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.card:hover .card-title { color: var(--accent); }

.card-info {
    font-size: 12px;
    color: var(--text-4);
    margin-bottom: 4px;
}

/* Card footer */
.card-foot {
    padding: 8px 14px;
    border-top: 1px solid var(--line-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-4);
}

.card-foot span { display: inline-flex; align-items: center; gap: 3px; }


/* ═══════════════ PAGINATION ═══════════════ */
.pager {
    padding: 30px 0 60px;
    text-align: center;
}

.pager ol {
    display: inline-flex;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.pager li { display: inline-block; }
.pager li a,
.pager li span {
    min-width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 14px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-3);
    transition: all .2s ease;
}

.pager li a:hover { 
    color: var(--accent); 
    background: rgba(79, 70, 229, 0.08); /* 柔和悬浮 */
    border-radius: 20px;
}

.pager li.current a,
.pager li.current span { 
    color: var(--accent); 
    background: rgba(79, 70, 229, 0.12);
    border-radius: 20px;
}


/* ═══════════════ TICKER ═══════════════ */
.ticker {
    margin-top: 14px;
    padding: 8px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.ticker-tag {
    flex-shrink: 0;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--green);
    background: var(--green-bg);
    border-radius: 3px;
}

.ticker-track {
    flex: 1; min-width: 0;
    position: relative;
    height: 20px;
    overflow: hidden;
}

.ticker-track a {
    display: block;
    line-height: 20px;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: absolute;
    width: 100%; left: 0;
    opacity: 0;
    transition: opacity .4s;
}

.ticker-track a.is-active { opacity: 1; }
.ticker-track a:hover { color: var(--accent); }


/* ═══════════════ POST DETAIL ═══════════════ */
.post-layout {
    padding: 24px 0 40px;
}

.post-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 24px;
    align-items: start;
}

.post-main {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
}

/* Breadcrumb */
.post-crumb {
    padding: 12px 20px 0;
    font-size: 12px;
    color: var(--text-4);
}

.post-crumb a:hover { color: var(--accent); }

/* Post header */
.post-hd {
    padding: 8px 20px 14px;
    border-bottom: 1px solid var(--line);
}

.post-hd h1 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.35;
}

.post-hd-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 12px;
    color: var(--text-4);
}

/* Cover */
.post-cover {
    padding: 20px 20px 0;
}

.post-cover img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: var(--r);
}

/* Content */
.post-body {
    padding: 20px;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-2);
}

.post-body > *:first-child { margin-top: 0; }
.post-body h2, .post-body h3 { color: var(--text); margin-top: 1.8em; }
.post-body a { color: var(--accent); }
.post-body pre { overflow: auto; padding: 14px; background: #1e1e1e; color: #d4d4d4; border-radius: var(--r); font-size: 13px; }
.post-body code { padding: 2px 5px; background: var(--line-soft); border-radius: 3px; font-size: .9em; }
.post-body pre code { padding: 0; background: none; }
.post-body blockquote { margin: 1em 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--blue-bg); }
.post-body img { border-radius: var(--r); margin: 1em 0; }

/* Notice */
.post-notice {
    margin: 0 20px 20px;
    padding: 12px 14px;
    background: var(--amber-bg);
    border: 1px solid #fde68a;
    border-radius: var(--r);
    font-size: 13px;
}

.post-notice strong { display: block; margin-bottom: 2px; color: var(--amber); }
.post-notice p { margin: 0; color: var(--text-3); }

/* Comments */
.post-comments {
    margin: 0 20px 20px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
}

.post-comments h2 { font-size: 16px; margin: 0 0 12px; }
.comment-list { padding-left: 18px; }

.comment-form label { display: block; margin-bottom: 3px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.comment-form input, .comment-form textarea {
    width: 100%; padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    outline: 0;
    transition: border-color .15s;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent); }
.comment-form button {
    height: 34px; padding: 0 16px;
    font-size: 13px; font-weight: 600;
    color: #fff; background: var(--accent);
    border: 0; border-radius: var(--r);
    cursor: pointer;
}

/* ── Download sidebar (sticky) ── */
.post-side {
    position: sticky;
    top: 88px;
    display: grid;
    gap: 16px;
}

.dl-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.dl-panel-title {
    padding: 14px 16px 12px;
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fff, #fbfdff);
}

.dl-channel-list {
    display: grid;
    gap: 12px;
    padding: 14px 14px 12px;
}

.dl-channel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 62px;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: #fbfdff;
    border: 1px solid var(--line);
    border-radius: 12px;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.dl-channel:hover {
    background: #fff;
    border-color: rgba(79, 70, 229, .24);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
}

.dl-channel strong {
    display: block;
    color: var(--text);
    font-size: 15px;
    line-height: 1.35;
}

.dl-channel p {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 8px 0 0;
    color: var(--text-3);
    font-size: 13px;
    line-height: 1.5;
}

.dl-channel code {
    padding: 0;
    color: var(--text-2);
    background: transparent;
    border: 0;
    border-radius: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
}

.dl-channel p span {
    color: var(--text-4);
}

.copy-code {
    padding: 0;
    color: var(--text-4);
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 12px;
}

.copy-code:hover {
    color: var(--accent);
}

.dl-channel > a {
    min-width: 58px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    background: #fff;
    border: 1px solid rgba(79, 70, 229, .28);
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    transition: background .16s ease, border-color .16s ease;
}

.dl-channel > a:hover {
    background: rgba(79, 70, 229, .06);
    border-color: rgba(79, 70, 229, .45);
}

.dl-raw {
    padding: 12px;
    color: var(--text-2);
    background: #fbfdff;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.7;
    word-break: break-all;
}

.dl-trust-badge {
    padding: 0 14px 14px;
}

.dl-trust-badge span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #0f766e;
    background: #ecfdf5;
    border: 1px solid #d1fae5;
    padding: 7px 10px;
    border-radius: 10px;
}

/* Tags panel */
.tag-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px;
}

.tag-panel-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-4);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud a {
    padding: 3px 8px; font-size: 12px;
    color: var(--text-3);
    border: 1px solid var(--line);
    border-radius: var(--r);
}
.tag-cloud a:hover { color: var(--accent); border-color: var(--accent); }


/* ═══════════════ PAGE ═══════════════ */
.page-wrap { padding: 24px 0 40px; }
.page-box {
    width: 100%;
    margin: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 24px;
}
.page-box h1 { font-size: 22px; margin: 0 0 16px; }

.page-box .post-comments {
    margin: 22px 0 0;
}


/* ═══════════════ FOOTER ═══════════════ */
.site-footer {
    background: var(--text);
    color: var(--text-4);
    font-size: 13px;
}

.ft-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 0 10px;
}

.ft-row strong { color: #fff; }
.ft-row p { margin: 2px 0 0; }
.ft-nav { display: flex; gap: 12px; }
.ft-nav a:hover { color: #fff; }
.ft-copy { padding: 0 0 16px; font-size: 12px; opacity: .5; }

/* Back top */
.back-top {
    position: fixed;
    right: 20px; bottom: 20px;
    width: 34px; height: 34px;
    display: none; place-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r);
    cursor: pointer;
    font-size: 13px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.back-top.is-visible { display: grid; }

/* Empty */
.empty { padding: 60px 20px; text-align: center; }
.empty h2 { font-size: 16px; color: var(--text-3); margin: 0 0 4px; }
.empty p { color: var(--text-4); font-size: 13px; margin: 0; }

/* Archive title */
.arc-title {
    padding: 20px 0 0;
    margin-bottom: -8px;
}
.arc-title h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}


/* ═══════════════ RESPONSIVE ═══════════════ */
@media (max-width: 980px) {
    .hd-nav, .hd-search, .hd-user { display: none; }
    .hd-menu { display: block; }
    .card-grid { grid-template-columns: repeat(2, 1fr); }
    .post-grid { grid-template-columns: 1fr; }
    .post-side { position: static; }
}

@media (max-width: 640px) {
    .wrap { padding: 0 14px; }
    .card-grid { grid-template-columns: 1fr; }
    .card-cover {
        height: auto;
        aspect-ratio: 16 / 10;
    }
    .card-body {
        padding: 14px 15px;
    }
    .card-title {
        font-size: 18px;
        line-height: 1.45;
    }
    .card-info {
        font-size: 13px;
        line-height: 1.6;
    }
    .card-foot {
        padding: 10px 15px;
    }
    .hero { padding: 20px 0 18px; }
    .hero-search { height: 42px; }
    .post-hd { padding: 8px 14px 12px; }
    .post-body, .post-cover { padding-left: 14px; padding-right: 14px; }
    .post-notice, .post-comments { margin-left: 14px; margin-right: 14px; }
    .ft-row { flex-direction: column; align-items: flex-start; }
}
