/* ============================================================
   前台（个人主页）样式 —— 纸感编辑风 Paper Editorial
   零外部资源：系统字体栈 + 内联 SVG
   ============================================================ */

:root {
    /* 色板（浅色） */
    --paper: #F5F3EF;
    --surface: #FFFFFF;
    --surface-2: #FAF8F5;
    --ink: #1B1A18;
    --ink-2: #57534D;
    --ink-3: #8B867E;
    --line: #E7E3DC;
    --accent: #C0512F; /* 由页面内联 style 按 theme_color 覆盖 */

    /* 圆角 */
    --radius-lg: 14px;
    --radius: 12px;
    --radius-sm: 9px;

    /* 字体 */
    --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", SimSun, Georgia, "Times New Roman", serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Segoe UI", "Microsoft YaHei", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* 阴影：只允许两层以内的极浅阴影 */
    --shadow-1: 0 1px 2px rgba(27, 26, 24, .04);
    --shadow-2: 0 8px 24px rgba(27, 26, 24, .07);
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #131211;
        --surface: #1B1A18;
        --surface-2: #22201D;
        --ink: #ECE9E2;
        --ink-2: #A9A39A;
        --ink-3: #7D776E;
        --line: #2D2B27;
    }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--accent); }

.page {
    max-width: 460px;
    margin: 0 auto;
    padding: 64px 20px 48px;
}

@media (max-width: 640px) {
    .page { padding: 44px 18px 40px; }
}

/* ---------------- 资料区 ---------------- */

.profile {
    text-align: center;
    margin: 0 0 34px;
}

.avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    margin: 0 auto 18px;
    background: var(--surface-2);
    color: var(--ink-2);
    border: 1px solid var(--line);
    box-shadow: 0 0 0 4px var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 34px;
    font-weight: 600;
    line-height: 1;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.name {
    font-family: var(--font-serif);
    font-size: 26px;
    line-height: 1.35;
    font-weight: 600;
    letter-spacing: .01em;
    margin: 0 0 10px;
}

.bio {
    margin: 0 auto;
    max-width: 34em;
    color: var(--ink-2);
    font-size: 14.5px;
    line-height: 1.9;
    white-space: pre-line;
}

/* ---------------- 按钮列表 ---------------- */

.links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    height: 56px;
    padding: 0 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 180ms cubic-bezier(.2, .7, .3, 1),
                transform 180ms cubic-bezier(.2, .7, .3, 1),
                box-shadow 180ms cubic-bezier(.2, .7, .3, 1);
    animation: link-in 320ms cubic-bezier(.2, .7, .3, 1) backwards;
}

@keyframes link-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.links .link:nth-child(1)  { animation-delay: 0ms; }
.links .link:nth-child(2)  { animation-delay: 40ms; }
.links .link:nth-child(3)  { animation-delay: 80ms; }
.links .link:nth-child(4)  { animation-delay: 120ms; }
.links .link:nth-child(5)  { animation-delay: 160ms; }
.links .link:nth-child(6)  { animation-delay: 200ms; }
.links .link:nth-child(7)  { animation-delay: 240ms; }
.links .link:nth-child(8)  { animation-delay: 280ms; }
.links .link:nth-child(9)  { animation-delay: 320ms; }
.links .link:nth-child(10) { animation-delay: 360ms; }
.links .link:nth-child(n+11) { animation-delay: 400ms; }

@media (prefers-reduced-motion: reduce) {
    .link { animation: none; }
}

.link .ico,
.link .tail {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.link .ico { color: var(--ink-2); font-size: 17px; line-height: 1; transition: color 180ms cubic-bezier(.2, .7, .3, 1); }
.link .ico svg { width: 20px; height: 20px; }
.link .ico img { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; }

.link .label {
    flex: 1;
    min-width: 0;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link .tail { color: var(--ink-3); transition: color 180ms cubic-bezier(.2, .7, .3, 1); }
.link .tail svg { width: 14px; height: 14px; }

.link:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-2);
}

.link:hover .ico,
.link:hover .tail { color: var(--accent); }

.link:active { transform: scale(.99); }

.link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.empty {
    text-align: center;
    color: var(--ink-3);
    font-size: 13px;
    margin: 8px 0;
}

.foot {
    margin-top: 44px;
    text-align: center;
    color: var(--ink-3);
    font-size: 12px;
    line-height: 1.9;
    white-space: pre-line;
}

/* ---------------- 文章页（纸上排版） ---------------- */

.page.article { max-width: 660px; }

.article .back {
    display: inline-flex;
    align-items: center;
    color: var(--ink-3);
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 30px;
    transition: color 180ms cubic-bezier(.2, .7, .3, 1),
                transform 180ms cubic-bezier(.2, .7, .3, 1);
}

.article .back:hover { color: var(--ink); transform: translateX(-2px); }
.article .back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.post h1 {
    font-family: var(--font-serif);
    font-size: 28px;
    line-height: 1.4;
    font-weight: 600;
    letter-spacing: .01em;
    margin: 0;
}

.post .meta {
    color: var(--ink-3);
    font-size: 12px;
    margin: 22px 0;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
}

.content {
    font-size: 15.5px;
    line-height: 1.95;
    color: var(--ink);
    word-break: break-word;
}

.content p { margin: 0 0 18px; }

.content h1, .content h2, .content h3,
.content h4, .content h5, .content h6 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.45;
    margin: 34px 0 14px;
}

.content h1 { font-size: 23px; }
.content h2 { font-size: 20px; }
.content h3 { font-size: 17px; }
.content h4, .content h5, .content h6 { font-size: 15.5px; }

.content ul, .content ol { padding-left: 24px; margin: 0 0 18px; }
.content li { margin: 5px 0; }

.content blockquote {
    margin: 0 0 18px;
    padding: 2px 0 2px 16px;
    border-left: 2px solid var(--accent);
    color: var(--ink-2);
}

.content code {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 1px 6px;
    font-size: .9em;
    font-family: var(--font-mono);
}

.content pre {
    background: #1B1A18;
    color: #ECE9E2;
    border-radius: 12px;
    padding: 16px 18px;
    overflow: auto;
    font-size: 13px;
    line-height: 1.7;
    margin: 0 0 18px;
}

.content pre code {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

@media (prefers-color-scheme: dark) {
    .content pre { background: var(--surface); }
}

.content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.content hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 28px 0;
}

.content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.content strong { font-weight: 600; }

/* ---------------- 404 ---------------- */

.notfound {
    text-align: center;
    padding: 64px 0 0;
}

.notfound h1 {
    font-family: var(--font-serif);
    font-size: 72px;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: .02em;
    margin: 0 0 12px;
}

.notfound p {
    color: var(--ink-2);
    font-size: 14.5px;
    margin: 0 0 30px;
}

.btn {
    display: inline-block;
    padding: 11px 26px;
    background: var(--ink);
    color: var(--paper);
    border: 1px solid var(--ink);
    border-radius: 999px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: transform 180ms cubic-bezier(.2, .7, .3, 1),
                box-shadow 180ms cubic-bezier(.2, .7, .3, 1);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-2);
}

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
