/* ==================== 全局样式 ==================== */
.category-card {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}
.category-card {
    transition: none; /* 移动端默认无过渡，下面媒体查询会覆盖 */
}
@media (hover: hover) and (pointer: fine) {
    .category-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(99, 102, 241, 0.2);
    }
}

.section-divider {
    border-left: 3px solid #6366f1;
    padding-left: 1rem;
}

.sidebar-card {
    transition: box-shadow 0.2s;
}
.sidebar-card {
    transition: none;
}
@media (hover: hover) and (pointer: fine) {
    .sidebar-card:hover {
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    }
}

.post-row {
    transition: background-color 0.15s;
}
.post-row:hover {
    background-color: #f1f5f9;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.pin-badge {
    background-color: #fee2e2;
    color: #b91c1c;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    font-weight: 500;
    display: inline-block;
    margin-bottom: 2px;
}

.external-icon {
    transition: transform 0.2s;
}
a:hover .external-icon {
    transform: translate(2px, -2px);
}

.nav-link {
    position: relative;
    white-space: nowrap;
}

/* 桌面端（支持 hover 的设备）才生成下划线伪元素 */
@media (hover: hover) and (pointer: fine) {
    .nav-link::after {
        content: '';
        position: absolute;
        bottom: -4px;
        left: 50%;
        width: 60%;
        height: 2px;
        background-color: #6366f1;
        border-radius: 2px;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateX(-50%) scaleX(0);
    }
    .nav-link:hover::after {
        transform: translateX(-50%) scaleX(1);
    }
}

/* 移动端：确保没有任何下划线相关样式 */
@media (hover: none), (pointer: coarse) {
    .nav-link::after {
        display: none !important;
    }
}

/* 时间轴辅助样式 */
#activity-list .flex.gap-3 {
    margin-bottom: 0;
}
#activity-list .w-px {
    background-color: #e5e7eb;
}
#activity-list .text-xs.text-muted {
    white-space: nowrap;
}

/* ==================== 文章内表格样式（移动端智能换行，必要时滚动） ==================== */
.post-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    width: 100%;
    max-width: 100%;
    margin: 1.5rem 0;
}

.post-content th,
.post-content td {
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    text-align: left;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 60px;
}

.post-content th {
    background-color: #f3f4f6;
    font-weight: 600;
}

.post-content tbody tr:hover {
    background-color: #f9fafb;
}

/* ==================== 标签容器换行限制 ==================== */
.tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    max-width: 170px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .tags-wrapper {
        max-width: 140px;
    }
}

/* ==================== 动画性能优化 ==================== */
/* 提示浏览器这些元素可能会发生变换，优化合成层 */
.fade-in-up {
    will-change: transform, opacity;
}

/* ==================== 时间轴样式（三者严格对齐） ==================== */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    position: relative;
    margin-bottom: 24px;
    z-index: 2;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

/* 日期列 - 固定宽度，右对齐，垂直居中 */
.timeline-date {
    width: 80px;
    flex-shrink: 0;
    text-align: right;
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 24px;
    white-space: nowrap;
}

/* 圆点包裹层 - 固定宽度，居中，与文字同高 */
.timeline-dot-wrapper {
    width: 40px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    height: 24px;
}

/* 圆点 - 固定大小，垂直居中 */
.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border-width: 2px;
    border-style: solid;
    background-color: white;
    position: relative;
    z-index: 3;
}

/* 内容区 - 与圆点同高 */
.timeline-content {
    flex: 1;
    min-width: 0;
    line-height: 24px;
}

/* 内容区内的文字样式 */
.timeline-content .text-sm {
    line-height: 24px;
    display: inline-block;
    vertical-align: middle;
}

/* 卡片模式下的内容区（activities页面） */
.timeline-content .bg-white.rounded-xl {
    line-height: normal;
}

.timeline-content .bg-white.rounded-xl .text-sm {
    line-height: 1.5;
}

/* 移动端适配 */
@media (max-width: 640px) {
    .timeline-date {
        width: 60px;
        font-size: 0.7rem;
        line-height: 22px;
    }
    .timeline-dot-wrapper {
        width: 30px;
        height: 22px;
    }
    .timeline-content {
        line-height: 22px;
    }
    .timeline-content .text-sm {
        line-height: 22px;
    }
    .timeline-item {
        margin-bottom: 20px;
    }
}

/* 全局 footer 置底 */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
main {
    flex: 1;
}

/* 文章详情页标题独立区域，避免与面包屑冲突 */
.post-container h1 {
    display: block;
    clear: both;
    word-break: break-word;
}

.breadcrumb {
    display: block;
    margin-bottom: 1rem;
}

/* 移动端禁用卡片动画，减轻发热 */
@media (hover: none) and (pointer: coarse) {
    .project-card,
    .project-card *,
    .group,
    .group *,
    [class*="hover:"] {
        transition: none !important;
        transform: none !important;
    }
    .project-card:hover,
    .group:hover,
    .group:active {
        box-shadow: none !important;
        border-color: inherit !important;
        transform: none !important;
    }
    /* 卡片内所有悬停效果禁用 */
    .project-card a,
    .group a {
        transition: none !important;
    }
    .project-card a:hover,
    .group a:hover {
        color: inherit !important;
    }
}