/* 基础变量 */
:root {
    --bg-primary: #fcfaf7;
    --bg-sidebar: #f8f5f0;
    --text-main: #1a1a1a;
    --text-muted: #666666;
    --accent: #8b0000;
    --border: rgba(26, 26, 26, 0.08);
    --sidebar-w: 320px;
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #121212;
        --bg-sidebar: #0a0a0a;
        --text-main: #e0e0e0;
        --text-muted: #999999;
        --accent: #ff4d4d;
        --border: rgba(255, 255, 255, 0.1);
    }
    .inline-img { background: #1a1a1a; }
}

html, body {
    margin: 0; padding: 0; width: 100%; overflow-x: hidden;
    background-color: var(--bg-primary); color: var(--text-main);
    font-family: "Georgia", "Noto Serif SC", serif;
    -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; max-width: 100%; }

.app-wrapper {
    display: grid; grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh; width: 100%;
}

/* 侧边栏 */
.sidebar {
    position: sticky; top: 0; height: 100vh; padding: 60px 40px;
    border-right: 1px solid var(--border); background: var(--bg-sidebar);
    display: flex; flex-direction: column;
}

.sidebar-header { margin-bottom: 40px; }
.author-card { display: flex; flex-direction: column; gap: 20px; margin-bottom: 25px; }
.author-photo { width: 80px; height: 80px; border-radius: 50%; overflow: hidden; background: #eee; border: 1px solid var(--border); }
.author-photo img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); transition: filter 0.5s; }
.author-photo img:hover { filter: grayscale(0); }
.author-meta h1 { font-size: 1.6rem; font-weight: 900; margin: 0 0 5px 0; line-height: 1.1; }
.jp-name { font-size: 0.75rem; color: var(--text-muted); margin: 0 0 5px 0; }
.life-dates { font-size: 0.75rem; color: var(--accent); margin: 0; font-family: monospace; }
.sidebar .subtitle { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--text-muted); opacity: 0.5; }
.site-notice { font-size: 0.75rem; color: var(--text-muted); line-height: 1.6; margin-top: 15px; }

#work-list { flex: 1; overflow-y: auto; margin-right: -20px; padding-right: 20px; }
.category-header { font-size: 0.7rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.2em; color: var(--accent); margin: 40px 0 10px 0; padding-bottom: 5px; border-bottom: 1px solid rgba(139, 0, 0, 0.1); }
.work-item { padding: 15px 0; cursor: pointer; border-bottom: 1px solid var(--border); transition: all 0.4s var(--ease-out); display: flex; align-items: center; gap: 15px; }
.work-item:hover { color: var(--accent); padding-left: 10px; }
.work-item.active { color: var(--accent); font-weight: bold; }
.work-index { font-size: 0.7rem; opacity: 0.3; font-family: monospace; }
.work-year { font-size: 0.65rem; opacity: 0.4; margin-left: 8px; font-weight: normal; }

/* 内容区 */
.main-content { padding: 80px 10%; max-width: 1200px; }

.intro-section {
    margin-bottom: 80px;
    animation: fadeIn 1.2s var(--ease-out);
    text-align: left;
    max-width: 900px; /* 与网格宽度对齐 */
}

.description {
    font-size: 1.1rem;
    line-height: 1.8;
    width: 100%; /* 撑满容器 */
    margin: 0 0 35px 0;
    color: var(--text-main);
    letter-spacing: 0.01em;
    text-align: justify; /* 两端对齐 */
}

.quote {
    font-size: 1.35rem;
    line-height: 1.6;
    font-style: italic;
    border-left: 3px solid var(--accent);
    padding: 10px 0 10px 30px;
    margin: 50px 0 0 0;
    width: 100%; /* 撑满容器 */
}

/* 网格与导航 */
.category-nav-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 15px; 
    margin-top: 50px;
    max-width: 900px;
}
.nav-card { padding: 25px 20px; background: var(--bg-sidebar); border: 1px solid var(--border); cursor: pointer; text-align: center; transition: all 0.3s; }
.nav-card:hover { border-color: var(--accent); background: white; }
.nav-card .card-title { font-size: 1rem; font-weight: bold; display: block; }
.nav-card .card-count { font-size: 0.7rem; color: var(--text-muted); }

.work-navigation { display: flex; justify-content: space-between; gap: 20px; margin: 80px 0 40px 0; padding-top: 40px; border-top: 1px solid var(--border); }
.nav-prev, .nav-next { flex: 1; cursor: pointer; padding: 20px; background: var(--bg-sidebar); border: 1px solid var(--border); display: flex; flex-direction: column; }
.nav-prev:hover, .nav-next:hover { border-color: var(--accent); }
.nav-label { font-size: 0.65rem; color: var(--accent); font-weight: bold; margin-bottom: 8px; }
.nav-title { font-size: 1rem; font-weight: bold; }
.nav-next { text-align: right; }

.footer-note { margin-top: 60px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--text-muted); text-align: center; }

/* 响应式精修 */
@media (max-width: 1024px) {
    .app-wrapper { display: flex; flex-direction: column; }
    .sidebar { display: contents; }
    .sidebar-header { order: 1; padding: 20px 20px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border); }
    .author-card { flex-direction: row; align-items: center; gap: 15px; margin-bottom: 5px; }
    .author-photo { width: 50px; height: 55px; }
    .author-meta h1 { font-size: 1.2rem; }
    .main-content { order: 2; padding: 20px 20px; } /* 极大幅度减小顶部 padding */
    .intro-section { margin-bottom: 30px; }
    .description { font-size: 0.9rem; line-height: 1.5; margin-bottom: 12px; }
    .quote { font-size: 1rem; line-height: 1.45; padding-left: 18px; margin-top: 20px; }
    #work-list { order: 3; padding: 20px; background: var(--bg-sidebar); }
    .work-detail h2 { font-size: 1.8rem; }
    .category-nav-grid { grid-template-columns: 1fr; margin-top: 25px; gap: 10px; }
    .work-navigation { flex-direction: column; margin-top: 40px; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
