/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --text: #1e293b;
    --text-light: #64748b;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.container { max-width: 960px; margin: 0 auto; padding: 0 20px; width: 100%; }
main.container { flex: 1; padding-top: 30px; padding-bottom: 40px; }

/* Navbar */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; }
.nav-brand { font-size: 1.2em; font-weight: 700; color: var(--text); }
.nav-links { display: flex; gap: 24px; }
.nav-links a { color: var(--text-light); font-weight: 500; }
.nav-links a:hover { color: var(--primary); }
.nav-toggle { display: none; background: none; border: none; font-size: 1.5em; cursor: pointer; color: var(--text); }

/* Nav dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle { cursor: pointer; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    min-width: auto;
    z-index: 300;
    text-align: center;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-qrs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 8px;
}
.nav-dropdown-qr {
    text-align: center;
}
.nav-dropdown-qr img {
    display: block;
    margin: 0 auto 4px;
    border-radius: 4px;
    width: 100px;
    height: auto;
}
.nav-dropdown-qr span {
    font-size: 0.8em;
    color: var(--text-light);
}
.nav-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 10px 0;
}
.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text) !important;
    font-weight: 500;
    font-size: 0.9em;
    transition: background 0.15s;
}
.nav-dropdown-item:hover { background: #f1f5f9; color: var(--primary) !important; }
.nav-dropdown-icon { font-size: 1.1em; }

/* Hero (Homepage) */
.hero {
    text-align: center;
    padding: 60px 0 40px;
}
.hero-avatar {
    width: 120px; height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 20px;
    display: block;
}
.hero h1 { font-size: 2em; margin-bottom: 8px; }
.hero .tagline { color: var(--text-light); font-size: 1.1em; margin-bottom: 24px; }
.hero-bio { max-width: 600px; margin: 0 auto 30px; color: var(--text-light); }

/* About section */
.about-section {
    max-width: 560px;
    margin: 0 auto 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.about-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    text-align: left;
    transition: box-shadow 0.2s;
}
.about-item:hover {
    box-shadow: var(--shadow-md);
}
.about-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #eff6ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    flex-shrink: 0;
}
.about-text {
    flex: 1;
    min-width: 0;
}
.about-text h3 {
    font-size: 0.95em;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.4;
}
.about-text p {
    font-size: 0.85em;
    color: var(--text-light);
    line-height: 1.5;
    margin: 0;
}

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 30px; }
.tag {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    background: #eff6ff;
    color: var(--primary);
    font-size: 0.9em;
    font-weight: 500;
}

/* Social links */
.social-links { display: flex; gap: 16px; justify-content: center; margin-bottom: 40px; }
.social-links a {
    padding: 8px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 500;
    transition: all 0.2s;
}
.social-links a:hover { border-color: var(--primary); color: var(--primary); }

/* Services */
.section-title { font-size: 1.4em; margin-bottom: 20px; text-align: center; }
.services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.service-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.service-card h3 { margin-bottom: 8px; }
.service-card p { color: var(--text-light); font-size: 0.95em; }
.service-icon { font-size: 2em; margin-bottom: 12px; }

/* Recent content */
.recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.recent-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.recent-card h4 { margin-bottom: 8px; }
.recent-card h4 a { color: var(--text); }
.recent-card h4 a:hover { color: var(--primary); }
.recent-card .meta { color: var(--text-light); font-size: 0.85em; margin-bottom: 8px; }
.recent-card .summary { color: var(--text-light); font-size: 0.9em; }
.section-more { text-align: center; margin-top: 20px; }

/* Article list */
.article-list { display: flex; flex-direction: column; gap: 20px; }
.article-item {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}
.article-item h2 { font-size: 1.2em; margin-bottom: 8px; }
.article-item h2 a { color: var(--text); }
.article-item h2 a:hover { color: var(--primary); }
.article-item .meta { color: var(--text-light); font-size: 0.85em; margin-bottom: 10px; }
.article-item .summary { color: var(--text-light); }

/* Article detail */
.article-detail { max-width: 720px; margin: 0 auto; }
.article-detail h1 { font-size: 1.8em; margin-bottom: 12px; }
.article-detail .meta { color: var(--text-light); margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }

/* Markdown content */
.markdown-body { line-height: 1.8; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 1.5em 0 0.5em; }
.markdown-body p { margin-bottom: 1em; }
.markdown-body code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.markdown-body pre { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: var(--radius); overflow-x: auto; margin-bottom: 1em; }
.markdown-body pre code { background: none; padding: 0; color: inherit; }
.markdown-body ul, .markdown-body ol { padding-left: 2em; margin-bottom: 1em; }
.markdown-body blockquote { border-left: 4px solid var(--primary); padding-left: 16px; color: var(--text-light); margin-bottom: 1em; }
.markdown-body img { max-width: 100%; border-radius: var(--radius); }
.markdown-body table { width: 100%; border-collapse: collapse; margin-bottom: 1em; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.markdown-body th { background: #f1f5f9; }

/* Wiki */
.wiki-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.wiki-cat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s;
}
.wiki-cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.wiki-cat-card .icon { font-size: 2em; margin-bottom: 8px; }
.wiki-cat-card h3 a { color: var(--text); }
.wiki-cat-card .count { color: var(--text-light); font-size: 0.85em; }

.wiki-page { max-width: 720px; margin: 0 auto; }
.wiki-page h1 { font-size: 1.8em; margin-bottom: 8px; }
.breadcrumb { color: var(--text-light); font-size: 0.9em; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }

.wiki-page-list { list-style: none; }
.wiki-page-list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.wiki-page-list li:last-child { border-bottom: none; }
.wiki-page-list a { color: var(--text); font-weight: 500; }
.wiki-page-list a:hover { color: var(--primary); }

/* Search */
.search-box { margin-bottom: 30px; }
.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1em;
    outline: none;
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* Pagination */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 30px; }
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.9em;
}
.pagination .active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }

/* Footer */
.footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9em;
    margin-top: auto;
}
.footer-links { margin-bottom: 12px; display: flex; gap: 20px; justify-content: center; }
.footer-links a { color: var(--text-light); font-weight: 500; }
.footer-links a:hover { color: var(--primary); }
.footer-note { font-size: 0.8em; color: #94a3b8; margin-top: 6px; }
.footer-wechat-link { color: #07c160; font-weight: 600; }
.footer-wechat-link:hover { color: #06ad56; }

/* Side float buttons */
.side-float {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
}
.side-float-btns {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.side-float-item {
    position: relative;
}
.side-float-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}
.side-float-icon:hover { transform: scale(1.1); }
.side-float-qr {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%) scale(0.8);
    background: var(--white);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    white-space: nowrap;
}
.side-float-qr img {
    display: block;
    width: 160px;
    height: auto;
    border-radius: 4px;
}
.side-float-qr p {
    margin: 8px 0 0;
    font-size: 0.85em;
    color: var(--text-light);
}
.side-float-qr.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
}
@media (hover: hover) {
    .side-float-item:hover .side-float-qr {
        opacity: 1;
        visibility: visible;
        transform: translateY(-50%) scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-links { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--white); padding: 16px 20px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
    .nav-links.active { display: flex; }
    .nav-dropdown-menu { position: static; box-shadow: none; padding: 8px 0 0 16px; display: none; }
    .nav-dropdown.open .nav-dropdown-menu { display: block; }
    .nav-dropdown:hover .nav-dropdown-menu { display: none; }
    .nav-dropdown-toggle { display: block; }
    .hero h1 { font-size: 1.5em; }
    .hero { padding: 24px 0 16px; }
    .about-section { gap: 10px; }
    .about-item { padding: 14px 16px; gap: 14px; }
    .about-icon { width: 38px; height: 38px; font-size: 1.1em; }
    .about-text h3 { font-size: 0.92em; }
    .about-text p { font-size: 0.82em; }
    .tags { gap: 6px; }
    .tag { font-size: 0.8em; padding: 3px 10px; }
    .social-links { flex-wrap: wrap; }
    .social-links a { font-size: 0.9em; padding: 6px 14px; }
    .services { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .service-card { padding: 16px; }
    .service-icon { font-size: 1.5em; margin-bottom: 8px; }
    .service-card h3 { font-size: 0.9em; }
    .service-card p { font-size: 0.8em; }
    .side-float { right: 10px; }
    .side-float-icon { width: 38px; height: 38px; font-size: 0.6em; }
    .side-float-qr { right: 48px; }
    .side-float-qr img { width: 140px; }
    .side-float-btns { gap: 8px; }
}
