/* 引入 Google 字体 */
@import url('https://fonts.googleapis.com/css2?family=Kosugi+Maru&family=Noto+Sans+SC:wght@300;500;700&family=Quicksand:wght@500;700&display=swap');

:root {
    --primary-pink: #ffdae0;
    --primary-blue: #d4f1f9;
    --accent-color: #ff85a2;
    --text-color: #5a6066;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --card-shadow: 0 8px 30px rgba(255, 133, 162, 0.1);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
    --primary-pink: #4a2c31;
    --primary-blue: #2c3e50;
    --accent-color: #ff85a2;
    --text-color: #e0e0e0;
    --glass-bg: rgba(30, 30, 30, 0.8);
    --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    background: #121212;
}

#dark-mode-toggle {
    transition: transform 0.3s ease;
}

#dark-mode-toggle:hover {
    transform: rotate(30deg) scale(1.2);
}

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

body {
    font-family: 'Quicksand', 'Noto Sans SC', sans-serif;
    color: var(--text-color);
    background: 
        radial-gradient(circle at 20% 20%, rgba(255, 218, 224, 0.4) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(212, 241, 249, 0.4) 0%, transparent 40%),
        #fdfbfb;
    background-attachment: fixed;
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- 1. B站风格 Banner 区域 --- */
.banner-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.banner-layer {
    position: absolute;
    top: 0;
    left: -10%;
    width: 120%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.1s ease-out;
}

.layer-bg { z-index: 1; }
.layer-character { 
    z-index: 2; 
    background-size: contain; 
    background-repeat: no-repeat;
    background-position: center bottom;
}

.banner-content {
    z-index: 10;
    color: white;
    text-shadow: 0 2px 15px rgba(0,0,0,0.3);
    pointer-events: none;
}

/* --- 2. 导航栏 (毛玻璃) --- */
.navbar {
    position: sticky;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 10%;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* 阅读进度条 */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    z-index: 1001;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--primary-pink), var(--accent-color));
    width: 0%;
    transition: width 0.1s ease-out;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li a {
    text-decoration: none;
    color: var(--text-color);
    margin-left: 2rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-links li a:hover, .nav-links li a.active {
    color: var(--accent-color);
    transform: translateY(-2px);
}

/* --- 3. 布局容器 --- */
.container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
}

@media (max-width: 900px) {
    .main-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}

/* --- 4. 英雄展示区 --- */
.hero-section {
    text-align: center;
    padding-bottom: 50px;
}

.avatar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 5px solid white;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transition: var(--transition);
    animation: float 4s ease-in-out infinite;
}

.avatar:hover {
    transform: rotate(360deg) scale(1.1);
}

/* --- 5. 文章卡片 (合并所有样式) --- */
.post-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.post-card {
    background: var(--glass-bg);
    border-radius: 24px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    border: 2px solid #fff;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    cursor: pointer;           /* 合并：点击效果 */
    text-decoration: none;     /* 合并：防止链接下划线 */
    color: inherit;            /* 合并：继承颜色 */
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(255, 133, 162, 0.2);
}

.post-card:active {
    transform: scale(0.98);    /* 注意：active 会覆盖 hover 的 translateY，但这是按压反馈，符合预期 */
}

.post-img-container {
    position: relative;
    overflow: hidden;
}

.post-img {
    height: 220px;
    background-size: cover;
    background-position: center;
    transition: transform 0.6s ease;
}

.post-card:hover .post-img {
    transform: scale(1.05);
}

.category-tag {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--accent-color);
    color: white;
    padding: 4px 15px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: bold;
}

.post-info {
    padding: 25px;
}

.post-info h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: #444;
}

.post-meta {
    margin-top: 15px;
    font-size: 0.85rem;
    color: #999;
    border-top: 1px dashed #ddd;
    padding-top: 10px;
}

/* --- 6. 侧边栏 --- */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- 7. 归档页面时间轴 --- */
.timeline {
    position: relative;
    padding-left: 30px;
    margin-top: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 5px;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent-color), var(--primary-pink));
    border-radius: 2px;
}

.timeline-year {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-color);
    margin: 40px 0 20px -30px;
    position: relative;
    padding-left: 45px;
    display: flex;
    align-items: center;
}

.timeline-year::before {
    content: '';
    position: absolute;
    left: -3px;
    width: 10px;
    height: 10px;
    background: var(--accent-color);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--primary-pink);
    z-index: 2;
}

.timeline-item {
    position: relative;
    margin-bottom: 25px;
    padding-left: 20px;
    transition: var(--transition);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -31px;
    top: 10px;
    width: 8px;
    height: 8px;
    background: #fff;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    z-index: 2;
    transition: var(--transition);
}

.timeline-item:hover::before {
    background: var(--accent-color);
    transform: scale(1.3);
}

.timeline-date {
    display: block;
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 5px;
    font-weight: 500;
}

.timeline-title {
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid transparent;
}

.timeline-item:hover .timeline-title {
    color: var(--accent-color);
    transform: translateX(10px);
    background: #fff;
    border-color: var(--primary-pink);
    box-shadow: 0 4px 15px rgba(255, 133, 162, 0.1);
}

body.dark-mode .timeline-title {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .timeline-item:hover .timeline-title {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
}

.sidebar-box {
    background: var(--glass-bg);
    padding: 25px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 2px solid #fff;
    box-shadow: var(--card-shadow);
}

.sidebar-box h4 {
    margin-bottom: 15px;
    color: var(--accent-color);
    font-size: 1.1rem;
    position: relative;
    padding-left: 15px;
}

.sidebar-box h4::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 15px;
    background: var(--accent-color);
    border-radius: 2px;
}

/* 搜索框样式 */
.search-input-wrapper {
    display: flex;
    gap: 10px;
}

.search-input-wrapper input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--primary-pink);
    border-radius: 12px;
    outline: none;
    font-family: inherit;
    transition: var(--transition);
}

.search-input-wrapper input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(255, 133, 162, 0.1);
}

.search-input-wrapper button {
    background: var(--accent-color);
    border: none;
    color: white;
    padding: 10px 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.search-input-wrapper button:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(255, 133, 162, 0.3);
}

.sidebar-box ul { list-style: none; }
.sidebar-box ul li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

/* 侧边栏社交链接样式优化 */
.social-links a {
    display: inline-block;
    padding: 5px 15px;
    background: var(--primary-pink);
    color: white;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.8rem;
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--accent-color);
    box-shadow: 0 4px 12px rgba(255, 133, 162, 0.3);
}

/* --- 7. 动画与其它 --- */
.fade-in { animation: fadeIn 1.5s ease; }

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

footer {
    text-align: center;
    padding: 50px;
    font-size: 0.9rem;
    opacity: 0.6;
}

/* 自定义滚动条 */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb {
    background: var(--primary-pink);
    border-radius: 10px;
}

/* 回到顶部按钮 */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    cursor: pointer;
    z-index: 2000;
    opacity: 0;
    transition: 0.3s;
    transform: translateY(100px);
}

#back-to-top.show {
    opacity: 1;
    transform: translateY(0);
}

/* --- 友人帐专属样式 --- */
.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.friend-card {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    padding: 15px !important; /* 覆盖之前 sidebar-box 的内边距 */
    margin-bottom: 0 !important; /* 覆盖之前 sidebar-box 的边距 */
    transition: var(--transition) !important;
    border: 2px solid transparent !important;
}

.friend-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--primary-pink) !important;
    background: white !important;
}

.friend-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
    border: 2px solid #eee;
    transition: var(--transition);
}

.friend-card:hover .friend-avatar {
    transform: rotate(15deg);
    border-color: var(--accent-color);
}

.friend-info h4 {
    margin: 0 0 5px 0 !important;
    color: var(--text-color);
    border: none !important; /* 去掉侧边栏标题的左边框 */
    padding: 0 !important;
}

.friend-info p {
    font-size: 0.8rem;
    color: #888;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* 移动端适配：友人卡片变成两列或一列 */
@media (max-width: 500px) {
    .friends-grid {
        grid-template-columns: 1fr;
    }
}