/* static/css/style.css */

/* --- Fonts Setup --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&display=swap');

:root {
    --bg-body: #f7f7f8;
    --bg-card: #ffffff;
    --bg-alt: #f0f0f2;
    --text-main: #000000;
    --text-muted: #555555;
    --text-light: #999999;
    --accent: #000000;
    --border-light: #e0e0e0;
    --shadow-sm: 6px 6px 0px rgba(17, 17, 17, 0.15);
    --shadow-md: 8px 8px 0px rgba(17, 17, 17, 0.2);
    --shadow-hover: 12px 12px 0px rgba(17, 17, 17, 0.25);
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --container-width: 1080px;
    --transition-fast: all 0.2s ease;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-slow: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

::selection {
    background-color: var(--accent);
    color: #fff;
}

a { 
    text-decoration: none; 
    color: inherit; 
    transition: var(--transition-fast); 
}

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

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.2;
}

/* --- Layout --- */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

main {
    flex: 1;
}

/* --- Header / Nav --- */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1.2rem 0;
    transition: var(--transition);
}

header.scrolled {
    padding: 0.8rem 0;
    box-shadow: var(--shadow-sm);
}

.nav-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 36px;
    align-items: center;
}

.nav-links a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    position: relative;
    padding-bottom: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 1px;
    background-color: var(--accent);
    transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--accent);
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 100%;
}

.menu-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-main);
}

/* --- Hero Section --- */
.hero {
    padding: 120px 0 80px;
    text-align: center;
    background-color: #ffffff;
    position: relative;
    border-radius: 24px;
    margin: 40px auto 80px;
    width: calc(100% - 40px);
    max-width: 1200px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.05), 0 2px 6px rgba(0, 0, 0, 0.02);
    border: 1px solid #f0f0f2;
}

.hero::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: #111111;
    margin: 50px auto 0;
    border-radius: 3px;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 5.5rem;
    font-weight: 800;
    letter-spacing: -3px;
    margin-bottom: 24px;
    text-transform: uppercase;
    color: #111111;
}

.hero p {
    font-size: 1.35rem;
    color: #555555;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
    font-family: var(--font-heading);
    font-style: italic;
    letter-spacing: 0.5px;
}

/* --- Post Grid & Cards --- */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 60px 48px;
    margin-bottom: 120px;
}

.post-card {
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    padding: 24px;
    border: 2px solid var(--text-main);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.post-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translate(-4px, -4px);
}

.card-image {
    position: relative;
    width: calc(100% + 48px);
    margin: -24px -24px 24px -24px;
    padding-top: 66.66%; /* 3:2 */
    overflow: hidden;
    background-color: var(--bg-alt);
    border-bottom: 2px solid var(--text-main);
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    filter: grayscale(100%) contrast(1.1);
}

.post-card:hover .card-image img {
    transform: scale(1.03);
    filter: grayscale(0%) contrast(1);
}

.card-meta {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    font-family: var(--font-body);
}

.card-title {
    font-size: 1.7rem;
    margin-bottom: 16px;
    line-height: 1.3;
}

.card-title a {
    color: var(--text-main);
    background-image: linear-gradient(transparent calc(100% - 1px), var(--accent) 1px);
    background-repeat: no-repeat;
    background-size: 0% 100%;
    transition: background-size 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-card:hover .card-title a {
    background-size: 100% 100%;
}

.card-excerpt {
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
    flex-grow: 1;
}

.card-btn {
    align-self: flex-start;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: inline-flex;
    align-items: center;
    color: var(--text-main);
    padding-bottom: 4px;
    border-bottom: 1px solid transparent;
}

.card-btn::after {
    content: '→';
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.post-card:hover .card-btn {
    border-bottom-color: var(--accent);
}

.post-card:hover .card-btn::after {
    transform: translateX(6px);
}

/* --- Article Detail Page --- */
.article-container {
    max-width: 800px;
    margin: 80px auto 120px;
    background: var(--bg-card);
    padding: 60px 48px;
    border: 2px solid var(--text-main);
    box-shadow: var(--shadow-md);
    /* 让内容极少的自白也能撑起基础高度，视觉更稳定 */
    min-height: 50vh; 
    display: flex;
    flex-direction: column;
}

.article-header {
    text-align: center;
    margin-bottom: 60px;
}

.article-title {
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 24px;
    letter-spacing: -1px;
}

.article-meta {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-family: var(--font-heading);
    font-style: italic;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 40px;
    letter-spacing: 0.5px;
}

.article-body {
    font-size: 1.2rem;
    line-height: 2;
    color: #1a1a1a;
    flex: 1;
}

.article-body p {
    margin-bottom: 2rem;
}

/* 取消了首字下沉，以防止因为中文标点而导致排版错乱 */

/* --- Projects Page --- */
.page-header {
    padding: 100px 0 60px;
    border-bottom: 1px solid var(--accent);
    margin-bottom: 60px;
}

.page-header h1 {
    font-size: 4rem;
    margin-bottom: 16px;
    letter-spacing: -1.5px;
    text-transform: uppercase;
}

.page-header p {
    font-size: 1.3rem;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-style: italic;
}

.project-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px;
    border: 2px solid var(--text-main);
    box-shadow: var(--shadow-sm);
    background-color: var(--bg-card);
    margin-bottom: 32px;
    transition: var(--transition);
}

.project-row:hover {
    background-color: #fff;
    box-shadow: var(--shadow-hover);
    transform: translate(-4px, -4px);
}

.project-tags {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.project-tags span {
    border: 1px solid var(--text-main);
    color: var(--text-main);
    padding: 4px 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 0;
    background: transparent;
    font-weight: 500;
}

.project-title {
    font-size: 2rem;
    margin-bottom: 12px;
}

.project-desc {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 600px;
    line-height: 1.7;
}

.project-actions {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}

.btn-outline, .btn-solid {
    padding: 12px 24px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: inline-block;
    transition: var(--transition);
    border-radius: 0;
    cursor: pointer;
}

.btn-outline {
    border: 1px solid var(--accent);
    color: var(--accent);
    background: transparent;
}

.btn-outline:hover {
    background: var(--accent);
    color: #fff;
}

.btn-solid {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}

.btn-solid:hover {
    background: transparent;
    color: var(--accent);
}

/* --- Notes Page --- */
.notes-stream {
    position: relative;
    max-width: 760px;
    margin: 0 auto 120px;
}

.notes-stream::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 20px;
    width: 1px;
    background: var(--border-light);
}

.note-item {
    position: relative;
    padding-left: 64px;
    margin-bottom: 80px;
}

.note-dot {
    position: absolute;
    left: 15px;
    top: 8px;
    width: 11px;
    height: 11px;
    background: var(--bg-body);
    border: 2px solid var(--accent);
    border-radius: 50%;
    z-index: 1;
    transition: var(--transition);
}

.note-item:hover .note-dot {
    background: var(--accent);
    transform: scale(1.3);
}

.note-header {
    margin-bottom: 16px;
}

.note-title {
    font-size: 1.5rem;
    margin: 0 0 8px 0;
}

.note-date {
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
}

.note-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
    background: var(--bg-card);
    padding: 36px;
    border: 2px solid var(--text-main);
    box-shadow: var(--shadow-sm);
    border-radius: 0;
    transition: var(--transition);
}

.note-item:hover .note-content {
    background: #fff;
    box-shadow: var(--shadow-hover);
    transform: translate(-4px, -4px);
    border-color: var(--text-main);
}

/* --- Reveal Animations --- */
.js-enabled .reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: var(--transition-slow);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/*
 * 文章正文容器永远不参与 "初始隐藏 + 入场动画"。
 * 原因：超长文章（行数多）容器高度远大于视口，IntersectionObserver
 * 永远拿不到 .active，整棵子树会被 opacity:0 隐藏 -> 正文不显示。
 * 段落级别的 .reveal 动画依然保留，主题视觉不变。
 */
.js-enabled .article-container.reveal {
    opacity: 1;
    transform: none;
}

/* --- Footer --- */
footer {
    background: #111111;
    border-top: 1px solid #222222;
    padding: 60px 0;
    text-align: center;
    margin-top: auto;
}

footer p {
    color: #888888;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .nav-links {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 40px 0;
        gap: 24px;
        box-shadow: var(--shadow-md);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
        z-index: 99;
        border-bottom: 1px solid var(--border-light);
    }
    
    .nav-links.nav-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .hero h1 { font-size: 3.5rem; }
    .hero p { font-size: 1.15rem; padding: 0 20px; }
    
    .article-title { font-size: 2.5rem; }
    .page-header h1 { font-size: 3rem; }
    
    .project-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
        padding: 24px;
    }
    .project-row:hover {
        padding-left: 24px;
        padding-right: 24px;
        background: #fff;
    }
    
    .note-item {
        padding-left: 40px;
    }
    .notes-stream::before {
        left: 8px;
    }
    .note-dot {
        left: 3px;
    }
    .note-content {
        padding: 24px;
    }
}
