/* ============================================================
   style.css — 公开页面样式
   简洁、干净、响应式设计。
   被 templates/base.html 引用。
   ============================================================ */

/* ---- CSS 变量 ------- */
:root {
    --color-primary: #2563eb;       /* 主色：蓝色 */
    --color-primary-hover: #1d4ed8;
    --color-text: #1a1a2e;          /* 正文颜色 */
    --color-text-secondary: #64748b; /* 次要文字 */
    --color-bg: #ffffff;            /* 背景色 */
    --color-bg-secondary: #f8fafc;  /* 卡片/分割背景 */
    --color-border: #e2e8f0;        /* 边框 */
    --color-success: #22c55e;       /* 绿色（发布状态） */
    --color-danger: #ef4444;        /* 红色（删除/警告） */
    --max-width: 900px;             /* 内容最大宽度 */
    --header-height: 64px;          /* 导航栏高度 */
}

/* ---- 基础重置 ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

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

img {
    max-width: 100%;
    height: auto;
}

/* ---- 导航栏 ---- */
.site-header {
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.site-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
}
.site-logo:hover {
    text-decoration: none;
}

.site-nav {
    display: flex;
    gap: 1.5rem;
}

.site-nav a {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.site-nav a:hover {
    color: var(--color-text);
    text-decoration: none;
    border-bottom-color: var(--color-primary);
}
.site-nav a.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* ---- 容器 ---- */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ---- 主内容区 ---- */
.main-content {
    min-height: calc(100vh - var(--header-height) - 120px);
    padding: 3rem 0;
}

/* ---- 页脚 ---- */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

/* ---- 页面标题 ---- */
.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-border);
}

/* ---- 博客卡片列表 ---- */
.post-card {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--color-border);
}
.post-card:first-child {
    padding-top: 0;
}

.post-card-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.post-card-title a {
    color: var(--color-text);
}
.post-card-title a:hover {
    color: var(--color-primary);
}

.post-card-meta {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

.post-card-excerpt {
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* ---- 博客详情 ---- */
.post-detail-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.post-detail-meta {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.post-content {
    line-height: 1.8;
    font-size: 1.05rem;
}
.post-content h2 { font-size: 1.5rem; margin: 2rem 0 1rem; }
.post-content h3 { font-size: 1.25rem; margin: 1.5rem 0 0.75rem; }
.post-content p { margin-bottom: 1rem; }
.post-content ul, .post-content ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.post-content li { margin-bottom: 0.25rem; }
.post-content pre {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.post-content code {
    background: var(--color-bg-secondary);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}
.post-content pre code {
    background: none;
    padding: 0;
}
.post-content blockquote {
    border-left: 4px solid var(--color-primary);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--color-text-secondary);
}
.post-content img {
    border-radius: 8px;
    margin: 1rem 0;
}

.post-content table,
.about-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.95rem;
}
.post-content th,
.post-content td,
.about-content th,
.about-content td {
    border: 1px solid var(--color-border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}
.post-content th,
.about-content th {
    background: var(--color-bg-secondary);
    font-weight: 600;
}
.post-content tr:nth-child(even),
.about-content tr:nth-child(even) {
    background: var(--color-bg-secondary);
}

/* ---- 作品集 ---- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1.5rem;
    background: var(--color-bg-secondary);
    transition: box-shadow 0.2s;
}
.project-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.project-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.project-card-desc {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.project-card-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.tech-tag {
    background: var(--color-border);
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

.project-card-links {
    display: flex;
    gap: 1rem;
}
.project-card-links a {
    font-size: 0.9rem;
}

/* ---- 软件仓库 ---- */
.repo-card {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s;
}
.repo-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.repo-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.repo-card-title {
    font-size: 1.15rem;
    font-weight: 600;
}
.repo-card-title a {
    color: var(--color-text);
}

.repo-card-version {
    font-size: 0.85rem;
    color: var(--color-primary);
    font-weight: 500;
}

.repo-card-desc {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* ---- 仓库详情 ---- */
.version-list {
    margin-top: 2rem;
}

.version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
}

.version-number {
    font-weight: 600;
    font-size: 1.05rem;
}

.version-date {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.version-notes {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.download-btn {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.download-btn:hover {
    background: var(--color-primary-hover);
    color: #fff;
    text-decoration: none;
}

/* ---- 首页 Hero（头像 + 标题） ---- */
.hero {
    text-align: center;
    padding: 2rem 0 2.5rem;
}

.hero .avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1.25rem;
    border: 3px solid var(--color-border);
}

.avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    background: var(--color-bg-secondary);
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}
.hero p {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    max-width: 600px;
    margin: 0 auto 0.5rem;
}

/* ---- 首页 2x2 卡片网格 ---- */
.home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.home-card {
    border-top: 3px solid var(--color-text);  /* 仅顶部有黑线 */
    padding: 1.25rem 0;
}

.home-card-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}
.home-card-title:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.home-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.dot {
    color: var(--color-text-secondary);
    margin-right: 0.25rem;
}

.home-card-item {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    padding: 0.15rem 0;
}
.home-card-item:hover {
    color: var(--color-text);
    text-decoration: none;
}

.home-card-empty {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    font-style: italic;
}

.home-card-brief {
    font-size: 0.95rem;
    color: var(--color-text);
    line-height: 1.6;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2.5rem 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
}

/* ---- 关于页 ---- */
.about-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--color-border);
}

.about-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--color-border);
    flex-shrink: 0;
}

.about-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    background: var(--color-bg-secondary);
}

.about-name-section h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.about-content {
    line-height: 1.8;
    font-size: 1.05rem;
}
.about-content h2 { font-size: 1.5rem; margin: 2rem 0 1rem; }
.about-content p { margin-bottom: 1rem; }

@media (max-width: 480px) {
    .about-header {
        flex-direction: column;
        text-align: center;
    }
}

/* ---- 空状态 ---- */
.empty-state {
    text-align: center;
    padding: 3rem 0;
    color: var(--color-text-secondary);
}

/* ---- 响应式 ---- */
@media (max-width: 640px) {
    .site-header .container {
        flex-direction: column;
        height: auto;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    .hero h1 { font-size: 1.8rem; }
    .hero .avatar { width: 90px; height: 90px; }
    .page-title { font-size: 1.5rem; }
    .post-detail-title { font-size: 1.5rem; }
    .project-grid { grid-template-columns: 1fr; }
    .home-grid { grid-template-columns: 1fr; }
}
