/* Cast Accordion Styles - 電影節風格手風琴卡司展示 */

.cast-accordion {
    display: flex;
    width: 100%;
    height: 500px;
    gap: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

/* Accordion Card - 每個卡片 */
.accordion-card {
    position: relative;
    flex: 1;
    min-width: 120px;
    height: 100%;
    overflow: hidden;
    cursor: pointer;
    transition: flex 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    background: #000;
}

/* 背景圖片 - 窄條狀態時顯示 */
.card-bg-image {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.6s ease;
}

/* 窄條狀態 - 默認顯示 */
.card-narrow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.4) 0%, rgba(10, 10, 10, 0.4) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: transform 0.6s ease, background 0.6s ease;
    overflow: hidden;
}

.card-narrow img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.narrow-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem 0;
    position: relative;
    z-index: 5;
}

/* 分類標籤 */
.cast-label {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #d19233;
    color: #fff;
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    padding: 8px 16px;
    text-align: center;
    line-height: 1.4;
    white-space: nowrap;
    z-index: 10;
}

/* 垂直姓名 */
.cast-name-vertical {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: 'Noto Serif TC', serif;
    font-size: 2rem;
    color: #fff;
    letter-spacing: 0.5em;
    font-weight: 400;
}

/* 展開狀態 - 初始隱藏 */
.card-expanded {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    opacity: 0;
    z-index: 3;
    transition: opacity 0.6s ease 0.2s;
}

.expanded-image {
    flex: 0 0 60%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.expanded-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 60%;
    /* 將圖片位置向上移動 20% */
}

.expanded-info {
    flex: 1;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    padding: 1rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    position: relative;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* 展開狀態的分類標籤 */
.cast-category {
    position: absolute;
    top: 30px;
    right: 30px;
    background: #dfb33dce;
    color: #fff;
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 10px 18px;
    text-align: center;
    line-height: 1.5;
}

.cast-category span {
    font-family: 'Cinzel', serif;
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    font-weight: 400;
}

.cast-name-large {
    font-family: 'Noto Serif TC', serif;
    font-size: 3.5rem;
    color: #fff;
    margin: 0;
    font-weight: 400;
    line-height: 1.2;
}

.cast-role-large {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 1.2rem;
    color: #D4AF37;
    margin: 0;
    letter-spacing: 0.1em;
}

.cast-description {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #B0B0B0;
    margin: 1rem 0 0 0;
    max-width: 400px;
}

/* Hover 和 Active 狀態 */
.accordion-card.active {
    flex: 4;
    z-index: 10;
    filter: brightness(1.2);
}

.accordion-card.active .card-bg-image {
    opacity: 0;
    z-index: 0;
}

.accordion-card.active .card-narrow {
    opacity: 0;
    transform: scale(0.95);
}

.accordion-card:hover .card-narrow {
    transform: scale(0.96);
    filter: brightness(1.35);
}

.card-expanded,
.accordion-card.active .expanded-info,
.accordion-card.active .card-expanded {
    opacity: 1;
}

/* 未展開的卡片變暗 */
.accordion-card:not(:hover):not(.active) {
    filter: brightness(0.7);
}

.accordion-card:not(:hover):not(.active) .card-bg-image {
    filter: brightness(0.5);
}


/* 添加分隔線效果 */
.accordion-card::after {
    content: '';
    position: absolute;
    right: 0;
    top: 5%;
    height: 90%;
    width: 1px;
    background: linear-gradient(to bottom,
            transparent 0%,
            rgba(212, 175, 55, 0.3) 20%,
            rgba(212, 175, 55, 0.3) 80%,
            transparent 100%);
    z-index: 5;
    opacity: 0.5;
}

.accordion-card:last-child::after {
    display: none;
}

/* 響應式設計 */
@media (max-width: 1024px) {
    .cast-accordion {
        height: 500px;
    }

    .cast-name-large {
        font-size: 2.8rem;
    }

    .expanded-info {
        padding: 3rem 2rem;
    }

    .cast-description {
        font-size: 0.9rem;
        margin-top: 0;
    }
}

.cast-mobile-nav {
    display: none;
}

@media (max-width: 768px) {
    .cast-accordion {
        position: relative;
        display: block;
        /* Change from flex to block */
        height: 650px;
        min-height: auto;
    }

    .accordion-card {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100% !important;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.5s ease;
    }

    .accordion-card.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        z-index: 10;
        filter: brightness(1);
    }

    .card-narrow {
        display: none !important;
        /* Hide narrow vertical label */
    }

    .card-expanded {
        flex-direction: column;
        opacity: 1 !important;
    }

    .expanded-image {
        flex: 0 0 50%;
        width: 100%;
        height: 50%;
    }

    .expanded-image img {
        object-position: center 30%;
    }

    .expanded-info {
        flex: 0 0 50%;
        width: 100%;
        height: 50%;
        padding: 1.5rem !important;
        padding-bottom: 70px !important;
        /* Make room for navigation */
        overflow-y: auto;
    }

    .cast-category {
        top: 15px;
        right: 15px;
        font-size: 0.6rem;
        padding: 6px 12px;
    }

    .cast-name-large {
        font-size: 2.2rem;
    }

    .cast-role-large {
        font-size: 1rem;
    }

    .cast-description {
        font-size: 0.85rem;
    }

    .accordion-card::after {
        display: none;
    }

    /* Mobile Navigation */
    .cast-mobile-nav {
        position: absolute;
        top: 85%;
        left: 0;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 1.5rem;
        z-index: 20;
        /* Above cards */
        padding: 0 1rem;
    }

    .cast-nav-btn {
        background: rgba(0, 0, 0, 0.5);
        color: #D4AF37;
        border: 1px solid rgba(212, 175, 55, 0.5);
        width: 40px;
        height: 40px;
        border-radius: 50%;
        font-size: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        backdrop-filter: blur(5px);
        transition: all 0.3s ease;
    }

    .cast-indicators {
        display: flex;
        gap: 8px;
    }

    .cast-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .cast-dot.active {
        background: #D4AF37;
        transform: scale(1.2);
    }
}

@media (max-width: 480px) {
    .cast-accordion {
        height: 550px;
    }

    .expanded-image {
        flex: 0 0 45%;
        height: 45%;
    }

    .expanded-info {
        flex: 0 0 55%;
        height: 55%;
        padding-bottom: 70px !important;
    }
}