/* ==========================================================================
   山风 (ShanFeng) - 侧边栏小工具全局美化 (极致对齐极简版)
   ========================================================================== */

/* 1. 小工具基础外框 (彻底去框，透明底，底部虚线分割) */
.sf-widget-box {
    margin-bottom: 30px;
    padding-bottom: 30px; 
    background: transparent; 
    border: none; 
    border-bottom: 1px dashed #E0E0E0; 
    border-radius: 0; 
    
    /* 👇 核心魔法：把 padding-left/right 换成 margin-left/right */
    margin-left: 30px;  /* 你的缩窄数值 */
    margin-right: 30px; /* 你的缩窄数值 */
}

/* 最后一个小工具不需要底部虚线，否则最下面会多出一条线 */
.sf-widget-box:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* 2. 小工具标题 (极简排版) */
.sf-widget-title {
    font-size: 15px; /* 稍微调小一点标题，显得更精致 */
    font-weight: 500;
    color: var(--sf-text-main);
    margin-top: 0;
    margin-bottom: 20px;
    padding-left: 0; 
    line-height: 1;
}

/* ==========================================================================
   山风小工具 1：最新评论 (左右分层，右上名字，右下内容)
   ========================================================================== */
.sf-widget-recent-comments {
    list-style: none;
    padding: 0;
    margin: 0;
}
/* 1. 外层容器：Flex 左右排版 */
.sf-widget-recent-comments li {
    display: flex;
    align-items: flex-start; /* 顶部对齐 */
    gap: 12px; /* 头像和右侧文字区域的间距 */
    margin-bottom: 20px;
}
.sf-widget-recent-comments li:last-child {
    margin-bottom: 0;
}

/* 2. 左侧头像 */
.comment-avatar {
    flex-shrink: 0; /* 防止头像被挤压变形 */
}
.comment-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #f5f5f5;
    border: 1px solid var(--sf-border-color);
}

/* 3. 右侧信息容器：Flex 上下排版 */
.comment-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column; /* 强制上下排列 */
    gap: 4px; /* 名字和评论内容的垂直间距，紧凑一点更好看 */
}

/* 4. 右上：名字行 */
.comment-author {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px; /* 名字字号 */
    color: #999999;
    
    /* 核心魔法：限制两行文本，超出显示省略号 */
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.comment-author strong {
    font-weight: 600; /* 名字稍微加粗，突出主体 */
    color: inherit;
}
.comment-author i {
    font-size: 14px;
    color: #999999;
    color: var(--sf-accent-red); /* 气泡图标颜色 */
}

/* 5. 右下：评论内容 (严格限制 2 行) */
.comment-text {
    font-size: 13px;
    color: #666666; /* 内容颜色稍微弱化 */
    line-height: 1.5;
    text-decoration: none;
    transition: color 0.2s ease;
    
    /* 核心魔法：限制两行文本，超出显示省略号 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.comment-text:hover {
    color: var(--sf-accent-red);
}
/* ==========================================================================
   山风小工具 2：热评文章
   ========================================================================== */
.sf-widget-hot-posts {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sf-widget-hot-posts li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.sf-widget-hot-posts li:last-child {
    margin-bottom: 0;
}
/* 缩略图，缩小尺寸防止撑破边栏 */
.hot-post-thumb {
    flex: 0 0 64px;
    height: 42px;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}
.hot-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.hot-post-thumb:hover img {
    transform: scale(1.08); /* 悬浮微微放大 */
}
.hot-post-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.hot-post-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--sf-text-main);
    text-decoration: none;
    line-height: 1.4;
    margin-bottom: 4px;
    /* 单行超出显示省略号 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}
.hot-post-title:hover {
    color: var(--sf-accent-red);
}
.hot-post-meta {
    font-size: 11px;
    color: var(--sf-text-muted);
}

.sf-single-sidebar .sf-widget-box {
    margin-bottom: 30px;
    padding-bottom: 30px; 
    background: transparent; 
    border: none; 
    border-bottom: 1px dashed #E0E0E0; 
    border-radius: 0; 
    
    /* 👇 核心魔法：把 padding-left/right 换成 margin-left/right */
    margin-left: 20px;  /* 你的缩窄数值 */
    margin-right: 20px; /* 你的缩窄数值 */
}

/* ==========================================================================
   山风小工具 3：图文推荐卡片 (少数派风格)
   ========================================================================== */
.sf-highlight-card-box {
    display: block;
    text-decoration: none;
    transition: opacity 0.3s ease;
}
.sf-highlight-card-box:hover {
    opacity: 0.85;
}
.highlight-main-title {
    font-size: 13px;
    font-weight: 400; /* 去掉加粗，保持轻盈 */
    line-height: 1.5;
    color: #111111;
    margin: 0 0 8px 0;
    
    /* 核心魔法：Webkit 弹性盒子两行截断 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.highlight-sub-title {
    font-size: 13px;
    color: #999999;
    margin: 0 0 15px 0;
     /* 核心魔法：Webkit 弹性盒子两行截断 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 3. 文字区底部分割线 */
.sf-highlight-card-box .highlight-text-wrap {
    border-bottom: 1px solid #EAECEF; /* 极淡的浅灰色线条，与你的主题边框色调一致 */
    padding-bottom: 15px !important;  /* 撑开文字和横线之间的距离，更有呼吸感 */
}

/* 细节修饰：鼠标悬停文字区时，不仅主标题不变色，还可以让横线微微加深，增加互动反馈 */
.sf-highlight-card-box .highlight-text-wrap:hover {
    border-bottom-color: #DEDEDE;
}

/* 当图片紧跟在文字后面时，强行增大间距 */
.highlight-text-wrap + .highlight-img-wrap {
    margin-top: 24px !important; /* 数值随你调，24px~30px 之间比较合适 */
}
.highlight-img {
    width: 100%;
    height: 81px; /* 强制锁定一个比较扁平、精致的高度 */
    border-radius: 12px;
    overflow: hidden;
    background: #f7f7f7;
}
.highlight-img img {
    width: 100%;
    height: 100%; /* 填满父容器 */
    object-fit: cover; /* 智能裁剪，保证图片不变形 */
    display: block;
}

/* ==========================================================================
   山风小工具 4：社交与底部菜单 (极致紧凑版)
   ========================================================================== */
/* 如果把这个放最下面，建议去掉它本身的底部虚线 */
.sf-widget-box:last-child {
    border-bottom: none !important;
}

.sf-social-footer-box {
    padding-top: 10px; 
    display: flex;
    flex-direction: column;
    align-items: center; 
    width: 100%; /* 限制最大宽度，防止内容溢出 */
    box-sizing: border-box;
}

.sf-social-icons {
    display: flex;
    flex-wrap: wrap; /* 核心防爆破：允许图标在空间不够时自动换行 */
    justify-content: center;
    gap: 15px; /* 从 24px 缩紧到 15px，更聚拢 */
    margin-bottom: 2px; 
}

.sf-social-icons a {
    color: #CFCFCF; 
    font-size: 18px; /* 从 22px 缩小到 18px，显得更精致克制 */
    transition: transform 0.3s ease, color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 鼠标悬停变色 */
.sf-social-icons a:hover {
    color: #888888;
    transform: translateY(-2px);
}

.sf-footer-links {
    display: flex;
    flex-wrap: wrap; /* 核心防爆破：允许菜单项折行 */
    justify-content: center;
    gap: 12px; /* 从 16px 缩紧到 12px */
    width: 100%;
}

.sf-footer-links a {
    font-size: 11px; /* 从 13px 缩小到 11px，作为底部附加信息，越小越有高级感 */
    color: #B0B0B0; 
    text-decoration: none;
    transition: color 0.3s ease;
    white-space: nowrap; /* 保证单个词语绝对不断行，比如“关于我们”不会变成两行 */
}

.sf-footer-links a:hover {
    color: #555555;
}

/* ==========================================================
   首页右侧边栏：社交卡片弹性沉底 (绝不重叠覆盖)
   ========================================================== */

/* 1. 对边栏母体开启 Flex，并赋予它至少一个屏幕的高度 */
.sf-right-sidebar {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 100px); 
}

/* 2. 核心魔法：把包含社交卡片的小工具，一把推到边栏的最下面！ */
.sf-right-sidebar > *:has(.sf-social-footer-box) {
    margin-top: auto !important; 
}

/* ==========================================================================
   移动端 (手机/平板) 小工具响应式修复 (解除间距与高度封印)
   ========================================================================== */
@media (max-width: 1024px) {
    /* 1. 核心修复：解除电脑端的强制高度，让它顺应内容自然收缩，消灭底部巨大空白 */
    .sf-right-sidebar {
        min-height: auto !important; 
    }

    /* 2. 重置小工具的外边距，确保它和上方的文章列表绝对等宽 */
    .sf-widget-box {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-bottom: 30px !important; 
    }

    /* 3. 彻底清空最后一个小工具（通常是社交卡片）的底部留白 */
    .sf-widget-box:last-child {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    /* 4. 社交卡片自身顶部留白收缩 */
    .sf-social-footer-box {
        padding-top: 0 !important;
    }
}

/* ==========================================================================
   山风专属小工具：极简友情链接 (横排紧凑 14px 版)
   ========================================================================== */
.sf-widget-links-list {
    list-style: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    /* 核心微调：将垂直间距从 10px 缩减到 6px，水平间距保持 18px */
    gap: 0px 18px; 
}

.sf-widget-links-list li {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.sf-widget-links-list li a {
    display: inline-block;
    font-size: 13px !important; 
    font-weight: 400;
    line-height: 1.2; /* 进一步收紧行高 */
    padding: 0;
    color: var(--sf-text-muted, #8A8F98); 
    text-decoration: none;
    transition: color 0.2s ease;
}

/* 鼠标经过效果 */
.sf-widget-links-list li a:hover {
    color: var(--sf-text-main, #1D1E20);
}