/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f4f4f6;
    --text: #2c2c2c;
    --text-light: #888;
    --accent: #c8a97e;
    --accent-hover: #b8956a;
    --border: #e0e0e2;
    --card-bg: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --font-main: "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
    --font-ui: "Hiragino Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    font-size: 15px;
    line-height: 1.8;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ===== Navigation ===== */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(250, 249, 247, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 2rem; height: 56px;
}
.nav-logo {
    font-family: var(--font-ui);
    font-size: 1.1rem; font-weight: 300; letter-spacing: 0.15em;
    color: var(--text); margin-right: auto;
}
.nav-links { display: flex; gap: 0.25rem; }
.nav-links a {
    font-family: var(--font-ui);
    font-size: 0.82rem; font-weight: 300; letter-spacing: 0.08em;
    color: var(--text-light);
    padding: 0.35rem 0.75rem; border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.nav-links a:hover, .nav-links a.active {
    color: var(--text);
    background: rgba(200, 169, 126, 0.1);
}

/* ===== Sections ===== */
.page {
    display: none;
    padding: 3rem 2rem 4rem;
    max-width: 1200px; margin: 0 auto;
}
.page.active { display: block; }

.section-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.section-header h2 {
    font-family: var(--font-ui);
    font-size: 1.1rem; font-weight: 300; letter-spacing: 0.2em;
    color: var(--text);
}

/* ===== Photo Sections (眼中的世界) ===== */
.photo-section { margin-bottom: 4rem; }

.waterfall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.waterfall .photo-item { aspect-ratio: 9/16; overflow: hidden; border-radius: 2px; background: var(--border); cursor: pointer; transition: opacity 0.2s; }
.waterfall .photo-item:hover { opacity: 0.85; }
.waterfall .photo-item img { width: 100%; height: 100%; object-fit: cover; }

/* ===== Pagination ===== */
.load-more { text-align: center; margin-top: 2rem; }
.load-more button {
    font-family: var(--font-ui);
    font-size: 0.8rem; letter-spacing: 0.15em;
    color: var(--text-light); background: none;
    border: 1px solid var(--border); padding: 0.6rem 2rem;
    border-radius: 2px; cursor: pointer; transition: all 0.2s;
}
.load-more button:hover { color: var(--text); border-color: var(--accent); }
.load-more button.hidden { display: none; }

.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 0.3rem; margin-top: 2.5rem; flex-wrap: wrap;
}
.page-btn {
    font-family: var(--font-ui);
    font-size: 0.82rem; letter-spacing: 0.05em;
    color: var(--text-light); background: none;
    border: 1px solid var(--border);
    padding: 0.4rem 0.75rem; border-radius: 3px;
    cursor: pointer; transition: all 0.2s; min-width: 34px;
}
.page-btn:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.page-btn.active { color: var(--text); border-color: var(--accent); background: rgba(200,169,126,0.08); }
.page-btn:disabled { opacity: 0.35; cursor: default; }
.page-ellipsis { color: var(--text-light); padding: 0 0.2rem; font-size: 0.9rem; }

/* ===== Life Notes (浮生小记) ===== */
.life-notes { display: flex; flex-direction: column; gap: 0; }
.life-note { text-align: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.life-note:last-child { border-bottom: none; }
.life-note .note-photo { text-align: center; border-radius: 2px; overflow: hidden; margin-bottom: 1rem; }
.life-note .note-photo img { width: 100% !important; max-height: 65vh; object-fit: contain; margin-left: 0 !important; margin-right: auto !important; }
.life-note .note-text {
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    color: var(--text-light);
    line-height: 1.8;
}

/* ===== Essays (闲情偶记) ===== */
/*
  Layout: photo left + text right (grid).
  When no photo, photo area collapses and text takes full width.
  Text overflow below photo: not supported by pure CSS grid,
  so we use a fixed max-width on the photo column instead.
*/
.essays { display: flex; flex-direction: column; gap: 3rem; }

.essay {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem; align-items: start;
    padding: 2.5rem; background: var(--card-bg);
    border-radius: 3px; box-shadow: var(--shadow);
}

.essay .essay-photo {
    border-radius: 2px; overflow: hidden;
    width: 100%; max-width: 280px;
    /* Text wraps at this boundary; below photo area, content flushes left */
    align-self: start; position: sticky; top: 80px;
}
.essay .essay-photo img { width: 100%; object-fit: cover; }

/* No-photo case: full width text */
.essay.no-photo { grid-template-columns: 1fr; }
.essay.no-photo .essay-photo { display: none; }

.essay .essay-content { padding-top: 0.5rem; }
.essay .essay-date {
    font-family: var(--font-ui);
    font-size: 0.72rem; color: var(--text-light);
    letter-spacing: 0.1em; margin-bottom: 1rem;
}
.essay .essay-title {
    font-family: var(--font-ui);
    font-size: 1.05rem; font-weight: 400; letter-spacing: 0.05em;
    color: var(--text); margin-bottom: 1.2rem;
}
.essay .essay-text {
    font-size: 0.92rem; line-height: 2;
    color: var(--text); white-space: pre-wrap;
}

/* ===== Music (弦歌雅韵) ===== */
#music-list { max-width: 700px; }
.audio-player {
    background: var(--card-bg); border-radius: 3px;
    padding: 1.5rem 2rem; box-shadow: var(--shadow);
    margin-bottom: 2rem; border-left: 3px solid var(--accent);
}
.now-playing { margin-bottom: 1rem; display: flex; align-items: center; gap: 1rem; }
.now-playing-label {
    font-family: var(--font-ui);
    font-size: 0.7rem; letter-spacing: 0.15em; color: var(--text-light);
}
.now-playing-name { font-family: var(--font-ui); font-size: 0.85rem; color: var(--text); }
#main-audio { width: 100%; height: 40px; }
.music-tracks { display: flex; flex-direction: column; gap: 0.75rem; }
.music-track {
    display: flex; align-items: center; gap: 1rem;
    padding: 0.9rem 1.2rem; background: var(--card-bg);
    border-radius: 3px; box-shadow: var(--shadow);
    cursor: pointer; transition: all 0.2s; border: 1px solid transparent;
}
.music-track:hover { border-color: var(--accent); }
.music-track.playing { border-color: var(--accent); background: rgba(200,169,126,0.06); }
.music-track-name { font-family: var(--font-ui); font-size: 0.85rem; color: var(--text); flex: 1; }
.music-track-icon { font-size: 1rem; color: var(--accent); }

/* ===== Video (光影叙事) ===== */
.video-list { display: flex; flex-direction: column; gap: 2rem; }
.video-item { background: var(--card-bg); border-radius: 3px; overflow: hidden; box-shadow: var(--shadow); }
.video-embed { position: relative; padding-bottom: 56.25%; height: 0; }
.video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }
.video-title {
    font-family: var(--font-ui);
    font-size: 0.82rem; color: var(--text-light);
    letter-spacing: 0.08em; padding: 1rem 1.2rem;
}

/* ===== Footer ===== */
.site-footer {
    text-align: center; padding: 2rem;
    font-family: var(--font-ui);
    font-size: 0.72rem; letter-spacing: 0.15em;
    color: var(--text-light); border-top: 1px solid var(--border);
}

/* ===== Empty Hint ===== */
.empty-hint { text-align: center; color: var(--text-light); font-size: 0.88rem; padding: 3rem 0; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .navbar { padding: 0 1rem; }
    .nav-links { gap: 0; }
    .nav-links a { font-size: 0.72rem; padding: 0.3rem 0.5rem; }
    .page { padding: 2rem 1rem 3rem; }
    .waterfall { grid-template-columns: repeat(2, 1fr); }
    .essay { grid-template-columns: 1fr; }
    .essay .essay-photo { max-width: 100%; position: static; }
}
@media (max-width: 480px) {
    .nav-logo { font-size: 0.9rem; }
    .nav-links a { font-size: 0.65rem; padding: 0.25rem 0.4rem; }
    .waterfall { grid-template-columns: repeat(1, 1fr); }
}

/* ===== Lightbox ===== */
#lightbox {
    display: none; position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.92); align-items: center; justify-content: center;
}
#lightbox.show { display: flex; }
#lightbox img { max-width: 95vw; max-height: 95vh; }
#lightbox-close {
    position: absolute; top: 1.5rem; right: 2rem;
    background: none; border: none; color: #fff; font-size: 2.5rem; cursor: pointer;
    line-height: 1; padding: 0.5rem;
}
#lightbox-close:hover { opacity: 0.7; }
