* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

/* 頁面載入動畫 */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1a2e, #16213e, #0f3460);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeOut 2s ease-in-out forwards;
}

.transition-text {
    color: #64ffda;
    font-size: 2rem;
    font-weight: 300;
    animation: pulse 1.5s ease-in-out;
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* 浮動粒子背景 */
.floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.7; }
    50% { transform: translateY(-20px) rotate(180deg); opacity: 1; }
}

/* 主要容器 */
.container {
    position: relative;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    animation: slideUp 1s ease-out 2s both;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 標題區域 */
.header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 3rem;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    font-weight: 700;
}

.header p {
    font-size: 1.2rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* 專案導航按鈕 */
.project-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.project-btn {
    padding: 12px 24px;
    background: linear-gradient(45deg, #ff6b6b, #ffa726);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
    position: relative;
    overflow: hidden;
}

.project-btn.primary {
    background: linear-gradient(45deg, #2c3e50, #34495e);
    box-shadow: 0 5px 15px rgba(44, 62, 80, 0.3);
}

.project-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(44, 62, 80, 0.4);
}

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

.project-btn:hover::before {
    left: 100%;
}

/* 整體佈局 */
.showcase-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin: 2rem 0;
}

/* 分類卡片 (外部容器) */
.category-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.category-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem; /* 增加標題與內容的間距 */
    color: #333;
    text-align: center;
    position: relative;
}

.category-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 2px;
}

/* 讓成績單的網格只顯示單個項目並置中 */
.single-item-grid {
    grid-template-columns: minmax(200px, 400px);
    justify-content: center;
}

/* 成績單的圖片容器 */
.single-item-grid .image-container {
    aspect-ratio: 16 / 11;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.single-item-grid .image-container:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.3);
}

.responsive-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: all 0.3s ease;
}

.single-item-grid .image-container:hover .responsive-image {
    transform: scale(1.1);
}

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 1.2rem 1rem 0.8rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.single-item-grid .image-container:hover .image-overlay {
    opacity: 1;
}


/* --- 通用項目卡片設計 (獲獎紀錄 & 專業證照) --- */

/* 通用網格佈局 */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2rem; /* 卡片間距 */
}

/* 通用卡片樣式 */
.item-card {
    background: #ffffff;
    border-radius: 15px;
    overflow: hidden; /* 確保內容不會超出圓角 */
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease-out;
    display: flex;
    flex-direction: column;
    cursor: pointer; /* 讓整個卡片都有點擊手勢 */
}

.item-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
}

/* 卡片中的圖片容器 */
.item-card .image-container {
    aspect-ratio: 16 / 11;
    border-radius: 0; /* 移除圓角，由父容器控制 */
    box-shadow: none; /* 移除陰影 */
    overflow: hidden; /* 確保圖片縮放時不會超出 */
}

.item-card:hover .responsive-image {
    transform: scale(1.05); /* 讓圖片在卡片hover時輕微放大 */
}

/* 卡片下方的資訊區塊 */
.item-info {
    padding: 1rem;
    text-align: center;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #343a40;
    margin: 0;
    line-height: 1.4;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .project-nav {
        flex-direction: column;
        align-items: center;
    }

    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* 滾動動畫 */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}


/* --- 回到頂部按鈕 --- */
#backToTopBtn {
    position: fixed; /* 固定在視窗位置 */
    right: 25px; /* 距離右邊 25px */
    bottom: 25px; /* 距離底部 25px */
    width: 50px;
    height: 50px;
    background-color: rgba(44, 62, 80, 0.7); /* 半透明背景 */
    color: white;
    border-radius: 50%; /* 圓形 */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100; /* 確保在其他元素之上 */
    
    /* 預設隱藏，並準備好動畫效果 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease-in-out;
}

/* 按鈕可見時的樣式 */
#backToTopBtn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 滑鼠懸停時的效果 */
#backToTopBtn:hover {
    background-color: rgba(44, 62, 80, 1); /* 變不透明 */
    transform: scale(1.1); /* 輕微放大 */
}