/* ============================================================
 * version-timeline.css
 * 更新记录页（main_version.html）专用样式
 * 设计参考：Ant Design Vue Timeline（极简轴线 + 空心圆点）
 * - 纯原生 CSS，零外部依赖
 * - 设计令牌取自 /static/css/01-design-tokens.css
 * - 响应式三档断点：<768 / 768-1023 / >=1024
 * - 兼容最新版 Chrome / Firefox / Safari / Edge
 * ============================================================ */

/* ---------- 页面骨架（与 hamburger + top-bar 协作） ---------- */
.page-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    min-width: 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.content-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 70px 24px 32px;
    /* 平滑滚动（含 anchor 跳转、scrollIntoView 等） */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.container {
    max-width: 920px;
    margin: 0 auto;
}

/* ---------- 顶部标题区 ---------- */
.page-header {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.page-title {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0.5px;
}

.page-subtitle {
    font-size: var(--text-base);
    color: var(--text-secondary);
}

/* ============================================================
 * Ant Design 风格 Timeline
 * 结构：
 *   ul.timeline
 *     li.timeline-item
 *       span.timeline-item-tail   <- 连接线
 *       span.timeline-item-head   <- 圆点
 *       div.timeline-item-content <- 内容（含 header + 卡片）
 * ============================================================ */

.timeline {
    position: relative;
    margin: 0;
    padding: 4px 0 0;
    list-style: none;
}

/* ---------- Timeline Item（节点） ---------- */
.timeline-item {
    position: relative;
    padding: 0 0 28px 28px;
    /* 左侧留出轴线空间 */
    font-size: var(--text-base);
    line-height: 1.5715;
    list-style: none;

    /* 入场动画初始态：JS 在进入视口时移除 .is-pending */
    transition:
        opacity 0.5s ease,
        transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.timeline-item.is-pending {
    opacity: 0;
    transform: translateY(20px);
}

/* 连接线（轴线尾部）—— 顶/底渐变淡出，营造"无始无终"的视觉
 * 注意：用 background + linear-gradient 替代 border-left，
 *      以便顶部/底部能做透明度过渡。 */
.timeline-item-tail {
    position: absolute;
    top: 12px;
    left: 5px;
    width: 2px;
    height: calc(100% - 14px);
    background: linear-gradient(180deg,
            rgba(229, 231, 235, 0) 0,
            var(--border) 6px,
            var(--border) calc(100% - 6px),
            rgba(229, 231, 235, 0) 100%);
    border-radius: 2px;
}

/* 首项：顶部完全淡出（轴线从虚无中"流出"） */
.timeline-item:first-child .timeline-item-tail {
    background: linear-gradient(180deg,
            rgba(229, 231, 235, 0) 0,
            var(--border) 14px,
            var(--border) 100%);
}

/* 倒数第二项：底部加大淡出区域，让末端更柔和（最后一项 tail 已隐藏） */
.timeline-item:nth-last-child(2) .timeline-item-tail {
    background: linear-gradient(180deg,
            rgba(229, 231, 235, 0) 0,
            var(--border) 6px,
            var(--border) calc(100% - 14px),
            rgba(229, 231, 235, 0) 100%);
}

/* 最后一个节点不显示连接线 */
.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item:last-child .timeline-item-tail {
    display: none;
}

/* ---------- Head（圆点） ---------- */
/* Ant Design 默认：空心圆，边框为颜色色值，hover 时实心 */
.timeline-item-head {
    position: absolute;
    top: 4px;
    left: 0;
    width: 12px;
    height: 12px;
    background-color: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: 50%;
    box-sizing: border-box;
    transition:
        transform 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.25s ease;
}

/* 颜色变体（对齐 Ant Design 的 blue/green/red/gray） */
.timeline-item-head-blue {
    border-color: var(--primary);
}

.timeline-item-head-green {
    border-color: var(--success);
}

.timeline-item-head-red {
    border-color: var(--error);
}

.timeline-item-head-gray {
    border-color: var(--gray-400, #9ca3af);
}

/* 最新版本（首项）—— 实心 + 脉冲动画，凸显"最新" */
.timeline-item.is-latest .timeline-item-head {
    background-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30, 159, 255, 0.12);
    animation: timeline-head-pulse 2.2s ease-in-out infinite;
}

@keyframes timeline-head-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 4px rgba(30, 159, 255, 0.12);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(30, 159, 255, 0.18);
    }
}

/* hover / focus 时圆点放大并填充 */
.timeline-item:hover .timeline-item-head,
.timeline-item:focus-within .timeline-item-head {
    transform: scale(1.15);
    background-color: var(--primary);
}

.timeline-item:hover .timeline-item-head-green,
.timeline-item:focus-within .timeline-item-head-green {
    background-color: var(--success);
}

.timeline-item:hover .timeline-item-head-red,
.timeline-item:focus-within .timeline-item-head-red {
    background-color: var(--error);
}

/* ---------- Content（内容区） ---------- */
.timeline-item-content {
    position: relative;
    top: -7.001px;
    /* Ant Design 经典数值：让内容首行与圆点中心对齐 */
    margin: 0;
    word-break: break-word;
}

/* Header：版本号 + 日期标签 */
.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.timeline-version {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* "最新"角标 */
.timeline-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: var(--font-medium);
    color: #fff;
    background: linear-gradient(135deg, #1e9fff, #0073d1);
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.timeline-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    transition: color 0.2s ease;
}

.timeline-date i {
    font-size: 14px;
    line-height: 1;
}

.timeline-item:hover .timeline-date {
    color: var(--primary);
}

/* ---------- 内容卡片 ---------- */
.timeline-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition:
        box-shadow 0.3s ease,
        border-color 0.3s ease,
        transform 0.3s ease;
    outline: none;
}

/* 卡片左侧高亮指示条（hover 时展开） */
.timeline-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.3s ease;
}

.timeline-card:hover,
.timeline-card:focus-visible {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.timeline-card:hover::before,
.timeline-card:focus-visible::before {
    transform: scaleY(1);
}

/* 键盘 focus 时的清晰描边（无障碍） */
.timeline-card:focus-visible {
    box-shadow:
        var(--shadow-md),
        0 0 0 3px rgba(30, 159, 255, 0.25);
}

/* ---------- 内容列表 ---------- */
.timeline-card ul {
    margin: 0;
    padding-left: var(--spacing-md);
    list-style: none;
}

.timeline-card li {
    position: relative;
    font-size: var(--text-base);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--spacing-sm);
    padding-left: var(--spacing-md);
    transition: color 0.2s ease, transform 0.2s ease;
}

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

.timeline-card li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
    transition: transform 0.2s ease, background 0.2s ease;
}

.timeline-card li:hover {
    color: var(--text-primary);
    transform: translateX(2px);
}

.timeline-card li:hover::before {
    transform: scale(1.5);
    background: var(--primary-hover, var(--primary));
}

/* ---------- 回顶部按钮 ---------- */
.timeline-backtop {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition:
        opacity 0.25s ease,
        transform 0.25s ease,
        visibility 0.25s;
    z-index: 50;
}

.timeline-backtop.is-visible {
    opacity: 0.92;
    visibility: visible;
    transform: translateY(0);
}

.timeline-backtop:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.timeline-backtop:focus-visible {
    outline: none;
    box-shadow:
        var(--shadow-md),
        0 0 0 3px rgba(30, 159, 255, 0.35);
}

/* ============================================================
 * 响应式断点（统一三档）
 * ============================================================ */

/* 桌面 (>=1024px) */
@media (min-width: 1024px) {
    .content-area {
        padding: 80px 32px 40px;
    }

    .container {
        max-width: 960px;
    }
}

/* 平板 (768-1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .content-area {
        padding: 72px 20px 24px;
    }

    .container {
        max-width: 720px;
    }
}

/* 手机 (<768px) */
@media (max-width: 767px) {
    .content-area {
        padding: 64px 14px 20px;
    }

    .container {
        max-width: 100%;
    }

    .page-header {
        margin-bottom: var(--spacing-lg);
    }

    .page-title {
        font-size: var(--text-2xl);
    }

    .timeline-item {
        padding-left: 24px;
        padding-bottom: 22px;
    }

    .timeline-item-tail {
        top: 11px;
        left: 4px;
        height: calc(100% - 12px);
    }

    .timeline-item-head {
        width: 10px;
        height: 10px;
        top: 5px;
    }

    .timeline-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .timeline-version {
        font-size: var(--text-lg);
    }

    .timeline-date {
        padding-left: 0;
    }

    .timeline-card {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .timeline-card li {
        font-size: var(--text-sm);
        padding-left: var(--spacing-sm);
    }

    .timeline-card li::before {
        top: 8px;
        width: 4px;
        height: 4px;
    }

    .timeline-backtop {
        right: 16px;
        bottom: 16px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* ============================================================
 * 辅助断点
 * ============================================================ */

/* 触摸设备：去掉 hover 上浮，避免点击残留状态 */
@media (hover: none) and (pointer: coarse) {

    .timeline-card:hover,
    .timeline-item:hover .timeline-item-head {
        transform: none;
    }
}

/* 用户偏好减少动画 */
@media (prefers-reduced-motion: reduce) {

    .timeline-item,
    .timeline-item-head,
    .timeline-card,
    .timeline-card li,
    .timeline-card li::before,
    .timeline-backtop {
        transition: none !important;
        animation: none !important;
    }

    .timeline-item.is-pending {
        opacity: 1;
        transform: none;
    }

    .content-area {
        scroll-behavior: auto;
    }
}
