/* Container 容器間距 */
.wc-category-card-container {
    width: 100%;
    margin: 2em 0;
    box-sizing: border-box;
}

/* 4欄位響應式 Grid 排版 */
.wc-category-card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 預設桌機端 4 等分 */
    gap: 20px; /* 卡片與卡片間距 */
}

/* 每一張類別卡片的容器 */
.wc-category-card-item {
    background: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 6px;
    padding: 15px; /* 內縮外框，使圖片與標題形成相框包覆效果 */
    box-sizing: border-box;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    text-align: center;
}

/* 懸停動態效果 */
.wc-category-card-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.wc-category-card-link {
    text-decoration: none;
    display: block;
    color: #333333;
}

.wc-category-card-link:hover {
    text-decoration: none;
}

/* 類別主圖容器（設定固定長寬比，避免版面破格） */
.wc-category-card-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 改為 1:1 正方形比例，與設計圖樣式一致 */
    background-color: #f7f7f7;
    overflow: hidden;
}

/* 圖片本身填滿且不變形 */
.wc-category-card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* 關鍵：確保主圖完美覆蓋且不拉伸變形 */
    transition: transform 0.3s ease;
}

.wc-category-card-item:hover .wc-category-card-image {
    transform: scale(1.05); /* 懸停時主圖微幅放大 */
}

/* 類別文字樣式 */
.wc-category-card-info {
    padding: 15px 0 5px 0;
    background: transparent;
}

/* 文字對齊與行高 */
.wc-category-card-title {
    margin: 0;
    font-size: 1.05em;
    font-weight: bold;
    color: #a07d5a; /* 精緻的淺棕色 (與設計圖文字顏色一致) */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s ease;
}

.wc-category-card-item:hover .wc-category-card-title {
    color: #111111; /* 懸停時文字變深色 */
}

/* ==========================================================================
   RWD 響應式斷點設定 (完美契合 Storefront 規格)
   ========================================================================== */

/* 平板端 (768px 以下)：改為 2 欄顯示 */
@media (max-width: 768px) {
    .wc-category-card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .wc-category-card-title {
        font-size: 1em;
    }
}

/* 手機端 (480px 以下)：改為 1 欄或保持精簡的 2 欄 */
@media (max-width: 480px) {
    .wc-category-card-grid {
        grid-template-columns: repeat(2, 1fr); /* 電商通常更推薦 2 欄，以防單欄滾動過長 */
        gap: 10px;
    }

    .wc-category-card-info {
        padding: 10px 5px;
    }

    .wc-category-card-title {
        font-size: 0.9em;
    }
}
