/* 首页（作品集）样式
   米白方格纸底，配色参考星星人：暖黄、腮红粉、奶油色，墨黑做文字和小标签 */

:root {
    --paper: #f3eee2;
    --grid: #e4dccb;
    --ink: #1f1d1a;
    --muted: #5f5850;
    --yellow: #f6c64a;
    --yellow-soft: #fbe7a6;
    --pink: #f2a9a0;
    --pink-soft: #f9d8d1;
    --cream: #fffaf0;
    --link: #c2513a;
    --radius: 14px;

    --font-display: 'Inter Tight', 'PingFang SC', 'Noto Sans SC', system-ui, sans-serif;
    --font-sans: 'Inter', 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #1d1b18;
        --grid: #2a2723;
        --ink: #f2ece0;
        --muted: #b3a999;
        --yellow-soft: #5a4a1c;
        --pink-soft: #4a2f2b;
        --cream: #26231f;
        --link: #f2a58f;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-color: var(--paper);
    /* 方格纸 */
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 36px 36px;
}

a {
    color: inherit;
    text-decoration: none;
}

.layout {
    max-width: 1320px;
    margin: 0 auto;
    padding: 48px 32px 80px;
}

/* 苹果树下面：左边项目，右边博客和联系方式 */
.lower {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 56px;
    align-items: start;
}

/* 右侧栏跟着滚动停在顶部 */
.sidebar {
    position: sticky;
    top: 32px;
}

/* 左上角的中英切换：和联系方式一样的小贴纸样式 */
.layout {
    position: relative;
}

.lang-corner {
    position: absolute;
    top: 20px;
    left: 32px;
    z-index: 3;
}

.lang-corner .lang-toggle {
    padding: 5px 14px;
    border: 1.5px solid var(--ink);
    background: var(--cream);
    color: var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
    opacity: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.lang-corner .lang-toggle:hover,
.lang-corner .lang-toggle:focus-visible {
    outline: none;
    background: var(--yellow-soft);
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink);
}

/* 名字 + 右边的星星人 */
.title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
}

.mascot {
    display: block;
    width: clamp(88px, 11vw, 140px);
    height: auto;
}

/* 博客入口：大一点的标题，黄色荧光笔下划线，箭头悬停时往右跑 */
.blog-link {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    background: linear-gradient(transparent 58%, var(--yellow) 58%, var(--yellow) 90%, transparent 90%);
}

.blog-arrow {
    display: inline-block;
    transition: transform 0.2s ease;
}

.blog-link:hover .blog-arrow,
.blog-link:focus-visible .blog-arrow {
    transform: translateX(5px);
}

.post-list {
    list-style: none;
    margin-top: 14px;
}

.post-list li + li {
    margin-top: 12px;
}

.post-list a {
    display: block;
    font-size: 15px;
    line-height: 1.4;
}

.post-list a:hover .post-title {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-date {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--muted);
}

.sidebar-footer {
    margin-top: 40px;
    padding-top: 14px;
    border-top: 1px solid var(--ink);
}

.social-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 10px;
    list-style: none;
}

/* 联系方式：圆形小贴纸，悬停时各有各的小动作 */
.social-link {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--ink);
    background: var(--cream);
    color: var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.social-link svg {
    width: 18px;
    height: 18px;
}

.social-link:hover,
.social-link:focus-visible {
    outline: none;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink);
    color: #1f1d1a;
}

.social-github:hover,
.social-github:focus-visible {
    background: var(--yellow);
}

.social-github:hover svg {
    animation: wiggle 0.5s ease-in-out;
}

.social-linkedin:hover,
.social-linkedin:focus-visible {
    background: #a9d3e3;
}

.social-linkedin:hover svg {
    animation: hop 0.5s ease-out;
}

.social-instagram:hover,
.social-instagram:focus-visible {
    background: var(--pink);
}

.social-instagram:hover svg {
    animation: spin 0.6s ease-in-out;
}

.social-youtube:hover,
.social-youtube:focus-visible {
    background: #ff6b5e;
}

.social-youtube:hover svg {
    animation: hop 0.5s ease-out;
}

.social-bilibili:hover,
.social-bilibili:focus-visible {
    background: #8fd0ec;
}

.social-bilibili:hover svg {
    animation: wiggle 0.5s ease-in-out;
}

.social-xiaohongshu:hover,
.social-xiaohongshu:focus-visible {
    background: #ff8a8a;
}

.social-xiaohongshu:hover svg {
    animation: spin 0.6s ease-in-out;
}

@keyframes wiggle {
    0%, 100% { rotate: 0deg; }
    25% { rotate: -14deg; }
    75% { rotate: 14deg; }
}

@keyframes hop {
    0%, 100% { translate: 0 0; }
    40% { translate: 0 -5px; }
}

@keyframes spin {
    to { rotate: 360deg; }
}

.page-head {
    text-align: center;
    margin-bottom: 40px;
}

.page-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(48px, 7vw, 88px);
    line-height: 1.05;
    letter-spacing: -0.035em;
}

.page-sub {
    margin-top: 16px;
    font-size: 17px;
    line-height: 1.6;
    color: var(--muted);
}

.page-sub-hint {
    margin-top: 4px;
}

.grid-title {
    margin-bottom: 28px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 28px;
    letter-spacing: -0.02em;
}

/* 项目卡片：圆角图 + 标题 + 2–3 句简介 + 一个链接 */
.project-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 48px 32px;
    align-items: start;
}

.project-cover {
    display: block;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--cream);
}

.project-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 没有封面图时：纯色底 + 项目名 */
.cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
    background: var(--cover);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 26px;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-align: center;
    color: #1f1d1a;
}

.project-card {
    display: block;
    text-align: center;
}

.project-cover {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

a.project-card:hover .project-cover,
a.project-card:focus-visible .project-cover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(31, 29, 26, 0.14);
}

a.project-card:focus-visible {
    outline: none;
}

.project-title {
    margin-top: 14px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 19px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

a.project-card:hover .project-title {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.load-more-row {
    margin-top: 48px;
    text-align: center;
}

.load-more {
    padding: 10px 24px;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    background: var(--yellow-soft);
    color: var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.load-more:hover,
.load-more:focus-visible {
    outline: none;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink);
}

.load-more[hidden] {
    display: none;
}

/* 响应式 */
@media (max-width: 1100px) {
    .project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    .layout {
        padding: 40px 16px 48px;
    }

    .lower {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .sidebar {
        position: static;
    }

    .latest {
        margin-top: 28px;
    }

    .sidebar-footer {
        margin-top: 32px;
    }

    .page-head {
        margin-bottom: 32px;
    }

    .lang-corner {
        top: 12px;
        left: 16px;
    }
}

@media (max-width: 520px) {
    .project-grid {
        grid-template-columns: 1fr;
    }
}

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