/* 基礎頁面重設，確保排版精準 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 圖片外層容器 */
.image-gallery {
    display: flex;
    justify-content: center; /* 讓內容物在容器內置中 */
    align-items: center;
    
    /* 關鍵修改：讓容器寬度剛好等於「圖片 + 間距」的總寬度 */
    width: fit-content; 
    
    /* 📣 這裡可以精確設定你想要的圖片間距（例如：20px、30px、50px） */
    gap: 10px; 
    
    /* 上下留白 20px（可自行調整），左右自動置中 */
    padding: 5px 0; 
    margin: 0 auto; 
}

/* 連結超連結外框 */
.gallery-item {
    display: inline-block;
    text-decoration: none;
    /* 透過 transition 讓往上跳的動作變平滑 */
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease;
    border-radius: 8px; /* 選擇性：給圖片一個微圓角，可刪除 */
    overflow: hidden;
    
    /* 嚴格固定寬高，不允許縮放 */
    flex: 0 0 290px; 
    width: 290px;
    height: 290px;
}

/* 圖片本體設定 */
.gallery-item img {
    width: 290px;
    height: 290px;
    object-fit: cover; /* 確保圖片不變形 */
    display: block;
}

/* 滑鼠移過去（Hover）產生的往上跳特效 */
.gallery-item:hover {
    /* translateY 負值代表往上移動，這裡設定往上跳 15px */
    transform: translateY(-15px); 
}