﻿/* ============================================================
   个人博客系统 — 前台样式表
   个人博客系统 v1.0.00
   风格：Neumorphism（新拟物派）
   光源固定左上，双光源阴影：暗右下 + 亮左上
   禁止纯白/纯黑背景、禁止 border-2、禁止 gradient
   ============================================================ */

/* ===== 设计 Token ===== */
:root {
    /* 背景 */
    --bg: #e0e5ec;
    --bg-soft: #f0f0f3;

    /* 阴影（双光源，固定左上 → 亮 -X/-Y，暗 +X/+Y）*/
    --shadow-dark: #b8bcc2;
    --shadow-light: #ffffff;

    /* 凸起（默认）*/
    --neumorph-raised:
        8px 8px 16px var(--shadow-dark),
        -8px -8px 16px var(--shadow-light);

    /* 凸起（小）*/
    --neumorph-raised-sm:
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);

    /* 凹陷（默认）*/
    --neumorph-inset:
        inset 6px 6px 12px var(--shadow-dark),
        inset -6px -6px 12px var(--shadow-light);

    /* 凹陷（深，默认输入框）*/
    --neumorph-inset-deep:
        inset 8px 8px 16px var(--shadow-dark),
        inset -8px -8px 16px var(--shadow-light);

    /* 凹陷（浅，输入框 focus）*/
    --neumorph-inset-light:
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);

    /* 强调色 */
    --accent: #6d5dfc;
    --accent-hover: #5a4be6;
    --accent-soft: #eceaff;

    /* 文字 */
    --text: #333333;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    /* 状态色 */
    --success: #10b981;
    --error:   #ef4444;
    --warning: #f59e0b;

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;

    /* 过渡 */
    --ease: all 0.3s ease-in-out;
}

/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC',
                  sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
}

/* ===== 通用容器 ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ===== 导航 ===== */
.nav {
    background: var(--bg);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: none;
    box-shadow: var(--neumorph-inset);
}
.nav-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.nav-logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
}
.nav-logo span { color: var(--accent); }
.nav-links {
    display: flex;
    gap: 8px;
    list-style: none;
    flex-wrap: wrap;
}
.nav-links a {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: var(--ease);
    /* 凸起按钮效果 */
    background: var(--bg);
    box-shadow: var(--neumorph-raised-sm);
}
.nav-links a:hover {
    color: var(--text);
    box-shadow: var(--neumorph-raised-sm);
    filter: brightness(0.98);
    /* hover 阴影缩小 */
    box-shadow:
        2px 2px 4px var(--shadow-dark),
        -2px -2px 4px var(--shadow-light);
}
.nav-links a:active {
    /* active 变凹陷 */
    box-shadow: var(--neumorph-inset-light);
}

/* ===== 卡片（凸起）===== */
.neumorph-card {
    background: var(--bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--neumorph-raised);
    padding: 24px;
    margin-bottom: 20px;
    transition: var(--ease);
    border: none;
}
.neumorph-card:hover {
    /* hover 阴影缩小（手指靠近遮光） */
    box-shadow:
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
}

/* ===== 凹陷容器 ===== */
.neumorph-inset {
    background: var(--bg);
    border-radius: var(--radius-md);
    box-shadow: var(--neumorph-inset);
    padding: 16px;
    border: none;
}

/* ===== 按钮 ===== */
.neumorph-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--neumorph-raised-sm);
    transition: var(--ease);
    font-family: inherit;
    user-select: none;
}
.neumorph-btn:hover:not(:disabled) {
    /* hover 阴影缩小 */
    box-shadow:
        2px 2px 4px var(--shadow-dark),
        -2px -2px 4px var(--shadow-light);
}
.neumorph-btn:active:not(:disabled) {
    /* active 变凹陷 */
    box-shadow: var(--neumorph-inset-light);
}
.neumorph-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow:
        2px 2px 4px var(--shadow-dark),
        -2px -2px 4px var(--shadow-light);
}
.neumorph-btn--sm {
    padding: 6px 14px;
    font-size: 0.75rem;
    box-shadow:
        3px 3px 6px var(--shadow-dark),
        -3px -3px 6px var(--shadow-light);
}
.neumorph-btn--primary {
    color: var(--accent);
    font-weight: 600;
}
.neumorph-btn.danger { color: var(--error); }

/* ===== 输入框 ===== */
.neumorph-input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    box-shadow: var(--neumorph-inset-deep);
    transition: var(--ease);
    outline: none;
}
.neumorph-input:focus {
    /* focus 凹陷变浅（通道开放）*/
    box-shadow: var(--neumorph-inset-light);
}
.neumorph-input::placeholder { color: var(--text-muted); }
textarea.neumorph-input {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}
select.neumorph-input {
    appearance: none;
    cursor: pointer;
    padding-right: 32px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3e%3cpath d='M8 11L3 6h10z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* ===== 标签 Chip ===== */
.neumorph-chip {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    background: var(--bg);
    box-shadow: var(--neumorph-raised-sm);
    transition: var(--ease);
    border: none;
}
.neumorph-chip:hover {
    color: var(--accent);
    box-shadow:
        2px 2px 4px var(--shadow-dark),
        -2px -2px 4px var(--shadow-light);
}

/* ===== 文章卡片 ===== */
.article-card {
    background: var(--bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--neumorph-raised);
    padding: 24px;
    margin-bottom: 20px;
    transition: var(--ease);
    border: none;
}
.article-card:hover {
    box-shadow:
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
}
.article-card a { text-decoration: none; color: inherit; }

.article-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    box-shadow: var(--neumorph-inset);
}
.article-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.4;
}
.article-title a:hover { color: var(--accent); }
.article-excerpt {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.7;
    margin-bottom: 12px;
}
.article-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-muted);
    align-items: center;
}
.article-meta .tag-list { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ===== 文章详情 ===== */
.article-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: none;
}
.article-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.3;
}
.article-cover-full {
    width: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--neumorph-inset);
    margin-bottom: 24px;
}
.article-content {
    background: var(--bg);
    border-radius: var(--radius-md);
    box-shadow: var(--neumorph-inset);
    padding: 32px;
    color: var(--text);
    line-height: 1.9;
}
.article-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 32px 0 16px;
    color: var(--text);
}
.article-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 24px 0 12px;
    color: var(--text);
}
.article-content p { margin-bottom: 16px; }
.article-content a { color: var(--accent); text-decoration: underline; }
.article-content ul, .article-content ol {
    margin-bottom: 16px;
    padding-left: 1.5em;
}
.article-content li { margin-bottom: 4px; }
.article-content code {
    background: var(--bg-soft);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.875em;
    box-shadow: var(--neumorph-inset-light);
}
.article-content pre {
    background: var(--bg-soft);
    border-radius: var(--radius-sm);
    box-shadow: var(--neumorph-inset);
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 16px;
}
.article-content pre code {
    background: none;
    padding: 0;
    box-shadow: none;
}
.article-content blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.article-content img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

/* ===== 评论 ===== */
.comment {
    background: var(--bg);
    border-radius: var(--radius-md);
    box-shadow: var(--neumorph-inset);
    padding: 16px;
    margin-bottom: 16px;
    transition: var(--ease);
}
.comment--reply {
    margin-left: 32px;
    margin-bottom: 12px;
    padding: 12px;
}
.comment-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.875rem;
}
.comment-head strong { color: var(--text); }
.comment-body {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.7;
    word-break: break-word;
}
.reply-list { margin-top: 12px; }

/* ===== 评论表单 ===== */
.comment-form {
    background: var(--bg);
    border-radius: var(--radius-md);
    box-shadow: var(--neumorph-raised);
    padding: 24px;
    margin-top: 24px;
}
.comment-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
.comment-form label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}
.comment-form .neumorph-input { margin-bottom: 12px; }

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 32px 0;
}
.pagination-info {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ===== 工具 ===== */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
}
.muted { color: var(--text-muted); font-size: 0.75rem; }
.small { font-size: 0.8125rem; }
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* ===== 加载 ===== */
.loading-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    box-shadow: var(--neumorph-raised-sm);
    animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--bg);
    color: var(--text);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--neumorph-raised);
    z-index: 9999;
    opacity: 0;
    transition: var(--ease);
    font-size: 0.875rem;
    pointer-events: none;
}
.toast--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast--success { color: var(--success); }
.toast--error   { color: var(--error); }
.toast--info    { color: var(--text); }

/* ===== 响应式 ===== */
@media (max-width: 600px) {
    .container { padding: 16px; }
    .neumorph-card { padding: 16px; }
    .article-header h1 { font-size: 1.5rem; }
    .article-content { padding: 20px; }
    .comment-form .form-row { grid-template-columns: 1fr; }
    .nav-links { gap: 4px; }
    .nav-links a { padding: 6px 10px; font-size: 0.75rem; }
}

/* ===== 强制 Neumorphism：禁止纯白 ===== */
body, .neumorph-card, .neumorph-inset, .article-card,
.article-content, .comment, .neumorph-btn, .neumorph-input,
.nav, .comment-form {
    background: var(--bg);
}
