/* 案例故事左侧导航 */
.case-layout {
    display: flex;
    gap: 3rem;
    height: 100%;
    width: 100%;
    align-items: center; /* 垂直居中 */
}

.case-sidebar {
    width: 24rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding-right: 3rem;
    position: relative;
    max-height: 80%; /* 限制最大高度为容器的 70% */
    overflow-y: auto;
    /* 优化滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
}

.case-sidebar::-webkit-scrollbar {
    width: 0.4rem;
}

.case-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.case-sidebar::-webkit-scrollbar-thumb {
    background-color: #e5e7eb;
    border-radius: 0.2rem;
}

.case-sidebar::-webkit-scrollbar-thumb:hover {
    background-color: #d1d5db;
}

.sidebar-items-container {
    position: relative;
    margin: auto 0;
    padding: 1.5rem 0;
}

.sidebar-vertical-line {
    position: absolute;
    left: 1.6rem;
    /* 3.2rem图标宽度的一半 */
    top: 1.5rem;
    bottom: 1.5rem;
    width: 0.2rem;
    background-color: #e5e7eb;
    transform: translateX(-50%);
    z-index: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 0.4rem 0;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0.8rem;
    position: relative;
    z-index: 1;
    text-decoration: none;
}

.sidebar-item.active {
    color: #1a1a1a;
    font-weight: 600;
}

.sidebar-item:hover {
    color: #23a7fd;
}

.sidebar-icon {
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-item.active .sidebar-icon {
    opacity: 1;
}

.sidebar-icon img {
    width: 3.2rem;
    height: 3.2rem;
    object-fit: contain;
}

.sidebar-text {
    font-size: 1.4rem;
    color: #989ea8;
    transition: color 0.3s ease;
}

.sidebar-item.active .sidebar-text {
    color: #1a1a1a;
    font-size: 2.5rem;
}

.case-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 案例故事区域 */
.case-stories {
    padding: 6.8rem 0;
    background-color: #f7f8fb;
    height: 100vh;
}

.stories-content {
    height: calc(100vh - 7.8rem);
    display: flex;
    align-items: center;
}

.case-stories .section-title {
    font-size: 3.6rem;
    font-weight: 700;
    margin-bottom: 4rem;
    color: #333;
}

.cases-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
}

.case-card {
    background: #fff;
    border-radius: 2.4rem;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    position: relative;
}

.case-card:hover {
    transform: translateY(-1.2rem);
}

.case-image {
    width: 100%;
    height: 22rem;
    overflow: hidden;
    position: relative;
}

.case-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.case-content {
    padding: 2.4rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    margin-top: -3rem;
    border-radius: 2.4rem 2.4rem 0 0;
    position: relative;
    z-index: 2;
}

.case-content h3 {
    font-size: 2.4rem;
    color: #333;
    margin-bottom: 0.8rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.case-content p {
    font-size: 1.4rem;
    line-height: 1.8;
    color: #666;
    margin-bottom: 4rem;
    text-align: justify;
    flex: 1;
    opacity: 0.9;

    /* 限制显示6行 */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 6;
    overflow: hidden;

    /* 为了更好的兼容性，可以设置max-height */
    max-height: calc(1.8em * 6);
    /* 行高 * 行数 */
}

.case-footer {
    margin-top: auto;
}

.gradient-line {
    height: 0.2rem;
    width: 100%;
    background: linear-gradient(90deg, #23a7fd 0%, #fd1ae2 100%);
    margin-bottom: 2.5rem;
    border-radius: 0.1rem;
    opacity: 0.8;
}

.case-footer .case-detail {
    display: inline-flex;
    align-items: center;
    color: #8C8C8C;
    text-decoration: none;
    font-size: 1.4rem;
    transition: all 0.3s ease;
    background: #EDF0F5;
    padding: 1rem 2.4rem;
    border-radius: 3rem;
    width: fit-content;
    font-weight: 500;
}

.case-detail:hover {
    color: #666;
    background: #E5E8ED;
}

.case-detail .arrow {
    margin-left: 0.8rem;
    font-size: 1.2rem;
    line-height: 1;
    font-weight: 400;
}

@media (max-width: 102.4rem) {
    .cases-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 76.8rem) {
    .cases-grid {
        grid-template-columns: 1fr;
    }
}

/* 案例容器和轨道 */
.cases-container {
    overflow: hidden;
    padding: 1.2rem 0;
}

.cases-track {
    display: flex;
    transition: transform 0.55s ease;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

.cases-page {
    flex: 0 0 100%;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
}

/* 确保所有案例卡片高度一致 */
.case-card {
    height: 50rem;
}

/* 分页样式已在 styles.css 统一定义 */
.pagination {
    margin-top: 3rem;
}

/* 响应式调整 */
@media (max-width: 102.4rem) {
    .cases-page {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 76.8rem) {
    .cases-page {
        grid-template-columns: 1fr;
    }
}