/* ===== 主容器 ===== */
#works-contents {
    max-width: 1600px;
    margin: 80px auto 0;
    width: 100%;
}

/* ===== 主輪播區域 ===== */
.works-showcase {
    position: relative;
    margin-bottom: 50px;
}

.worksSwiper {
    padding: 40px 80px;
    overflow: visible;
}

/* 🔥 修正：確保所有 slide 高度一致 */
.worksSwiper .swiper-slide {
    height: auto;
    display: flex;
}

/* 作品卡片 - 固定高度 */
.works-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 700px; /* 🔥 設定最小高度 */
}

.works-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 0;
}

.works-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--c-cyan);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(0, 217, 255, 0.3);
}

.works-card:hover::before {
    opacity: 1;
}

/* 圖片區域 - 固定高度 */
.works-image {
    position: relative;
    width: 100%;
    height: 500px; /* 🔥 固定高度 */
    flex-shrink: 0;
    overflow: hidden;
}

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

.works-card:hover .works-image img {
    transform: scale(1.1);
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.3) 50%,
        rgba(0, 0, 0, 0.8) 100%
    );
    pointer-events: none;
}

/* 內容區域 - 彈性布局 */
.works-content {
    padding: 30px;
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* 🔥 允許內容縮小 */
}

.works-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.works-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.2);
}

.works-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--white);
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 217, 255, 0.3);
}

/* 🔥 描述區域 - 可滾動 */
.works-description {
    font-size: 15px;
    line-height: 1.8;
    color: rgba(230, 241, 255, 0.85);
    margin-bottom: 20px;
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    max-height: 150px; /* 🔥 限制最大高度 */
}

/* 自定義滾動條 */
.works-description::-webkit-scrollbar {
    width: 6px;
}

.works-description::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.works-description::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.3);
    border-radius: 3px;
}

.works-description::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 217, 255, 0.5);
}

/* 🔥 底部按鈕區域 - 改為橫向排列 */
.works-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    margin-top: auto;
}

/* 作品連結 - 統一樣式 */
.works-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 25px;
    border: 1px solid var(--c-cyan);
    border-radius: 25px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.works-link::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.works-link span,
.works-link i {
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

/* 🔥 查看作品按鈕 (主要樣式) */
.works-link-demo {
    background: linear-gradient(135deg, var(--c-cyan), var(--c-blue));
    color: var(--white);
    border-color: var(--c-cyan);
}

.works-link-demo::before {
    background: linear-gradient(135deg, var(--c-blue), var(--c-cyan));
}

.works-link-demo:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 217, 255, 0.5);
    border-color: var(--white);
    color: var(--light);
}

.works-link-demo:hover::before {
    opacity: 1;
}

.works-link-demo:hover i {
    transform: translateY(-2px) translateX(2px);
}

/* 🔥 查看詳情按鈕 (次要樣式) */
.works-link-detail {
    background: rgba(0, 217, 255, 0.1);
    color: var(--c-cyan);
}

.works-link-detail::before {
    background: linear-gradient(135deg, var(--c-cyan), var(--c-blue));
}

.works-link-detail:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(0, 217, 255, 0.4);
    color: var(--light);
}

.works-link-detail:hover::before {
    opacity: 0.2;
}

.works-link-detail:hover i {
    transform: translateX(5px);
}

/* ===== 導航按鈕 ===== */
.swiper-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    z-index: 10;
}

.swiper-button-prev,
.swiper-button-next {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(0, 217, 255, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-cyan);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.swiper-button-prev::before,
.swiper-button-next::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--c-cyan), var(--c-blue));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50%;
}

.swiper-button-prev i,
.swiper-button-next i {
    position: relative;
    z-index: 1;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--c-cyan);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 217, 255, 0.4);
}

.swiper-button-prev:hover::before,
.swiper-button-next:hover::before {
    opacity: 0.3;
}

.swiper-button-prev.swiper-button-disabled,
.swiper-button-next.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ===== 分頁器 ===== */
.swiper-pagination {
    position: relative;
    margin-top: 30px;
}

.swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
    transition: all 0.3s ease;
}

.swiper-pagination-bullet-active {
    background: var(--c-cyan);
    width: 30px;
    border-radius: 6px;
    box-shadow: 0 0 15px var(--c-cyan);
}

/* ===== 縮圖輪播 ===== */
.works-thumbs {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

.thumbsSwiper {
    padding: 20px 0;
}

.thumb-card {
    position: relative;
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(0, 217, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.thumb-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thumb-card img,
.thumb-card .case-logo {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    filter: brightness(0.7);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.thumb-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 2;
}

.thumb-overlay span {
    font-size: 12px;
    color: var(--white);
    text-align: center;
    display: block;
}

.thumb-card:hover {
    border-color: var(--c-cyan);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 217, 255, 0.3);
}

.thumb-card:hover::before {
    opacity: 1;
}

.thumb-card:hover img,
.thumb-card:hover .case-logo {
    filter: brightness(1);
    transform: scale(1.1);
}

.thumb-card:hover .thumb-overlay {
    transform: translateY(0);
}

/* Active 狀態 */
.thumbsSwiper .swiper-slide-thumb-active .thumb-card {
    border-color: var(--c-cyan);
    background: rgba(0, 217, 255, 0.15);
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.4);
}

.thumbsSwiper .swiper-slide-thumb-active .thumb-card img,
.thumbsSwiper .swiper-slide-thumb-active .thumb-card .case-logo {
    filter: brightness(1);
}

/* 縮圖預設樣式 */
.thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--c-cyan), var(--c-blue));
    border-radius: 10px;
}

.thumb-fallback span {
    font-size: 32px;
    font-weight: 700;
    color: var(--white);
    text-transform: uppercase;
}

/* 縮圖中間項目放大效果 */
.thumbsSwiper .swiper-slide {
    transition: all 0.3s ease;
    opacity: 0.6;
    transform: scale(0.9);
}

.thumbsSwiper .swiper-slide-active,
.thumbsSwiper .swiper-slide-thumb-active {
    opacity: 1;
    transform: scale(1);
}

/* 相鄰的縮圖稍微縮小 */
.thumbsSwiper .swiper-slide-prev,
.thumbsSwiper .swiper-slide-next {
    opacity: 0.8;
    transform: scale(0.95);
}

/* 按鈕樣式 */
.index-more {
    text-align: center;
    margin-top: 50px;
}

#works-Button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 45px;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--c-cyan), var(--c-blue));
    border: 2px solid var(--c-cyan);
    border-radius: 12px;
    color: var(--white);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 8px 30px rgba(0, 217, 255, 0.4);
}

#works-Button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--c-blue), var(--c-cyan));
    opacity: 0;
    transition: opacity 0.3s ease;
}

#works-Button span,
#works-Button i {
    position: relative;
    z-index: 1;
}

#works-Button i {
    transition: transform 0.3s ease;
}

#works-Button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 217, 255, 0.6);
    border-color: var(--white);
    color: var(--light);
}

#works-Button:hover::before {
    opacity: 1;
}

#works-Button:hover i {
    transform: translateX(5px);
}

/* ===== 分類標籤 (圖片上) ===== */
.works-category {
    position: absolute;
    top: 20px;
    left: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 2px solid;
    font-size: 13px;
    font-weight: 600;
    z-index: 2;
    transition: all 0.3s ease;
    color: #ffffff !important; /* 🔥 強制文字白色 */
}

.works-category i {
    font-size: 12px;
    color: #ffffff; /* 🔥 icon 也是白色 */
}

.works-card:hover .works-category {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); /* 🔥 改用黑色陰影 */
}

/* ===== 技術標籤區域 ===== */
.works-skills {
    flex-shrink: 0;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 217, 255, 0.2);
}

.skills-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-cyan);
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
}

.skills-label i {
    font-size: 14px;
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-tag {
    display: inline-block;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(230, 241, 255, 0.9);
    background: rgba(0, 217, 255, 0.15);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 15px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.skill-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 217, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.skill-tag:hover {
    background: rgba(0, 217, 255, 0.25);
    border-color: var(--c-cyan);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 217, 255, 0.3);
    color: var(--white);
}

.skill-tag:hover::before {
    left: 100%;
}

/* 調整卡片高度以容納技術標籤 */
.works-card {
    min-height: 750px; /* 從 700px 增加到 750px */
}

.works-image {
    height: 450px; /* 從 500px 減少到 450px */
}

/* 調整描述區域高度 */
.works-description {
    max-height: 120px; /* 從 150px 減少到 120px */
}

/* ===== 響應式調整 ===== */
@media (max-width: 1200px) {
    .works-card {
        min-height: 650px;
    }

    .works-image {
        height: 380px;
    }

    .works-description {
        max-height: 100px;
    }

    .works-category {
        top: 15px;
        left: 15px;
        padding: 6px 14px;
        font-size: 12px;
    }

    .skill-tag {
        padding: 4px 10px;
        font-size: 11px;
    }
}

@media (max-width: 992px) {
    .works-card {
        min-height: 580px;
    }

    .works-image {
        height: 320px;
    }

    .works-description {
        max-height: 90px;
    }

    .skills-label {
        font-size: 12px;
    }

    .skills-list {
        gap: 6px;
    }
}

@media (max-width: 768px) {
    .works-card {
        min-height: auto;
    }

    .works-image {
        height: 250px;
    }

    .works-description {
        max-height: 80px;
    }

    .works-category {
        top: 10px;
        left: 10px;
        padding: 5px 12px;
        font-size: 11px;
    }

    .works-category i {
        font-size: 10px;
    }

    .works-skills {
        margin-top: 12px;
        padding-top: 12px;
    }

    .skills-label {
        font-size: 11px;
        gap: 6px;
        margin-bottom: 8px;
    }

    .skills-list {
        gap: 5px;
    }

    .skill-tag {
        padding: 4px 10px;
        font-size: 11px;
    }

    .works-footer {
        gap: 10px;
        flex-wrap: wrap;
    }

    .works-link {
        padding: 8px 20px;
        font-size: 13px;
        gap: 8px;
    }
}

@media (max-width: 425px) {
    .works-image {
        height: 200px;
    }

    .works-description {
        max-height: 70px;
    }

    .works-category {
        padding: 4px 10px;
        font-size: 10px;
    }

    .skills-label {
        font-size: 10px;
    }

    .skill-tag {
        padding: 3px 8px;
        font-size: 10px;
    }
}

/* 手機優化：單一作品呈現、尺寸縮小、間距收斂 */
@media (max-width: 576px) {
    #works {
        padding: 56px 16px 48px;
    }

    #works-contents {
        margin-top: 48px;
    }

    .worksSwiper {
        padding: 8px 0;      /* 滑軌內距縮小 */
    }

    .worksSwiper .swiper-slide {
        padding: 0 4px;      /* slide 之間更緊湊 */
    }

    .works-card {
        min-height: auto;    /* 讓卡片依內容高度 */
        border-radius: 14px;
        box-shadow: 0 8px 24px rgba(0,0,0,.35);
    }

    .works-image {
        height: 180px;       /* 圖片高度縮小 */
    }

    .works-content {
        padding: 14px;
    }

    .works-header {
        gap: 10px;
        margin-bottom: 10px;
    }

    .works-logo {
        width: 36px;
        height: 36px;
        padding: 6px;
        border-radius: 8px;
    }

    .works-content h2 {
        font-size: 18px;
    }

    .works-description {
        font-size: 13px;
        line-height: 1.7;
        max-height: 88px;    /* 文字區高度限制 */
        margin-bottom: 12px;
        padding-right: 6px;
    }

    .works-category {
        top: 10px;
        left: 10px;
        padding: 5px 10px;
        font-size: 11px;
        border-radius: 14px;
    }

    .works-skills {
        margin-top: 10px;
        padding-top: 10px;
    }

    .skills-label {
        font-size: 11px;
        gap: 6px;
        margin-bottom: 8px;
    }

    .skills-list {
        gap: 6px;
    }

    .skill-tag {
        padding: 4px 10px;
        font-size: 11px;
        border-radius: 12px;
    }

    .works-footer {
        margin-top: 10px;
    }

    /* 手機隱藏左右導航鍵，改用滑動＋分頁點 */
    .swiper-nav { display: none; }

    .swiper-pagination { margin-top: 16px; }

    /* 縮圖列更小、更易點擊 */
    .works-thumbs { padding: 8px 0; }
    .thumb-card { padding: 10px; border-radius: 12px; }
    .thumb-overlay span { font-size: 10px; }
}

