/* --- 變數定義 (方便統一修改) --- */
:root {
    /* 移除 --profile-grid-columns，因為它將由特定規則處理 */
    --profile-image-size: 110px;
    --profile-grid-gap: 10px;
    --main-layout-gap: 40px;
    --promo-image-radius: 30px;
    --ig-icon-bg: #e1306c;
}

/* --- 整個節目區塊 --- */
.show-block {
    max-width: 1200px;
    margin: 40px auto;
    padding-bottom: 40px;
    font-family: system-ui, -apple-system, sans-serif;
    border-bottom: 1px solid #e5e7eb;
}
.show-list > .show-block:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* --- 內部主要容器 --- */
.show-inner {
    display: flex;
    align-items: flex-start; 
    gap: var(--main-layout-gap);
}

/* --- 左側容器 (包裹圖片和標題) --- */
.left-panel-wrapper {
    flex: 1;
    position: relative;
    max-width: 315px; 
}

/* 16:9 圖片容器 */
.left-panel-wrapper::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 16:9 */
}

/* 左側大圖 */
.left-panel-wrapper .show-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; 
    object-position: center;
    border-radius: var(--promo-image-radius);
}

/* 節目標題 */
.left-panel-wrapper .show-title {
    position: absolute;
    bottom: 0px;
    right: 0px;
    background-color: var(--ig-icon-bg);
    padding: 8px 30px;
    border-radius: 30px 0; 
    font-size: 1rem;
    font-weight: 400;
    color: #fff;
    margin: 0;
    white-space: nowrap;
    z-index: 10;
    transition: background-color 0.3s;
	letter-spacing:0.2rem;
}
.left-panel-wrapper .show-title a {
    text-decoration: none;
    color: inherit;
}
.left-panel-wrapper .show-title:hover {
    background-color: #c8235c;
}

/* --- 右側演員區 --- */
.show-inner .show-content {
    flex: 1.5;
    padding-top: 0;
}

/* --- 右側演員網格 --- */
.cast-group {
    display: grid;
    gap: var(--profile-grid-gap);
    justify-items: center;
}

/* 
   --- 【關鍵修改點】 ---
   根據 .cast-group 內部包含的卡片類型來設定欄數
*/
/* 如果 .cast-group 裡面有 .cast-card1，就設定為 7 欄 */
.cast-group:has(.cast-card1) {
    grid-template-columns: repeat(7, 1fr);
}

/* 如果 .cast-group 裡面有 .cast-card2，就設定為 4 欄 */
.cast-group:has(.cast-card2) {
    grid-template-columns: repeat(4, 1fr);
}

/* 如果 .cast-group 裡面有 .cast-card3，就設定為 5 欄 */
.cast-group:has(.cast-card3) {
    grid-template-columns: repeat(6, 1fr);
}


/* --- 單一演員卡片 --- */
.cast-card1, .cast-card2, .cast-card3 {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%; 
    text-align: center;
}

/* 演員圓形頭像 */
.cast-card1 .cast-thumbnail, 
.cast-card2 .cast-thumbnail,
.cast-card3 .cast-thumbnail {
    width: var(--profile-image-size);
    aspect-ratio: 1 / 1;    
    border-radius: 50%;
    object-fit: cover;  
    margin-bottom: 0px;
    border: 4px solid #f0f2f5;
    transition: transform 0.3s ease;
}
.cast-card1 .cast-thumbnail:hover,
.cast-card2 .cast-thumbnail:hover,
.cast-card3 .cast-thumbnail:hover{
    transform: scale(1.05);
}

/* (以下的名字、IG 圖示等樣式保持不變) */
.cast-name-line { display: flex; align-items: center; justify-content: center; gap: 8px; }
.cast-name { font-size: 1rem; color: #444; text-decoration: none; font-weight: 300; }
.cast-name:hover { color: var(--ig-icon-bg); }
.ig-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; background-color: var(--ig-icon-bg); border-radius: 50%; color: white; transition: transform 0.2s; }
.ig-icon:hover { transform: scale(1.1); }
.ig-icon svg { width: 13px; height: 13px; }

/* --- 響應式設計 (RWD) --- */

/* 平板尺寸 */
@media (max-width: 1024px) {
    /* 在平板上，無論是 card1 還是 card2，都統一為 3 欄 */
    .cast-group:has(.cast-card1),
    .cast-group:has(.cast-card2),
	.cast-group:has(.cast-card2) {
        grid-template-columns: repeat(3, 1fr);
    }
    .show-block {
        --profile-image-size: 100px;
    }
}

/* 手機尺寸 */
@media (max-width: 768px) {
    .show-inner {
        flex-direction: column; 
        gap: 30px;
    }
    .left-panel-wrapper {
        width: 100%;
        max-width: 100%;
    }
    
    .show-inner .show-content {
        display: flex;
        justify-content: center;
        width: 100%;
    }
    
    /* 手機上仍然統一為 3 欄 */
    .cast-group:has(.cast-card1) {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px; /* 這裡可以直接設定 gap，不需要再用變數 */
    }
	.cast-group:has(.cast-card2) {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px; /* 這裡可以直接設定 gap，不需要再用變數 */
    }
	.cast-group:has(.cast-card3) {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px; /* 這裡可以直接設定 gap，不需要再用變數 */
    }
    .show-block {
        --profile-image-size: 110px;
    }
}