@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;700&family=Noto+Serif+TC:wght@700;900&family=JetBrains+Mono:wght@300&display=swap');

/* 全域重設 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0A0A0A;
    font-family: 'Noto Sans TC', sans-serif;
    user-select: none;
}

/* 1. 開場點擊播放遮罩 */
#startScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0A0A0A;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-in-out;
}

.start-content {
    text-align: center;
    color: #F5EFE2;
}

.start-title {
    font-family: 'Noto Serif TC', serif;
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 0.5rem;
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(20px);
    animation: startFadeUp 1.2s forwards 0.3s;
}

.start-subtitle {
    font-size: 1.2rem;
    letter-spacing: 0.3rem;
    color: #888;
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(20px);
    animation: startFadeUp 1.2s forwards 0.6s;
}

#playBtn {
    background: transparent;
    border: 1px solid #E8B14A;
    color: #E8B14A;
    padding: 12px 40px;
    font-size: 1.1rem;
    font-family: 'Noto Sans TC', sans-serif;
    letter-spacing: 0.2rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    opacity: 0;
    animation: fadeIn 1.5s forwards 1s;
}

#playBtn:hover {
    background-color: #E8B14A;
    color: #0A0A0A;
    box-shadow: 0 0 15px rgba(232, 177, 74, 0.4);
}

/* 2. 影片主播放容器 */
#videoContainer {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 3. 左上角章節標記 */
#chapterNum {
    position: absolute;
    top: 40px;
    left: 40px;
    z-index: 10;
    color: #888;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    letter-spacing: 0.1rem;
    pointer-events: none;
}

.chapter-badge {
    background-color: #E8B14A;
    color: #0A0A0A;
    padding: 2px 8px;
    font-weight: 700;
    margin-right: 5px;
    font-size: 0.8rem;
    border-radius: 2px;
}

/* 4. 照片背景容器 (Ken Burns) */
#imageContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

/* 當前場景啟用時，觸發 Ken Burns 慢推動畫 */
.scene.active {
    opacity: 1;
    animation: kenBurns 5s linear forwards;
}

/* 5. 電影感黑場過渡遮罩 */
#transitionMask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0A0A0A;
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out;
}

#transitionMask.active {
    opacity: 1;
}

/* 6. 畫面中央大字卡 */
#textCard {
    position: absolute;
    z-index: 3;
    color: #F5EFE2;
    text-align: center;
    max-width: 80%;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#cardText {
    font-family: 'Noto Serif TC', serif;
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.3rem;
    text-shadow: 0 4px 24px rgba(0,0,0,0.65);
    white-space: pre-line;
}

/* 7. 底部口白字幕 */
#subtitleContainer {
    position: absolute;
    bottom: 7%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    max-width: 95%;
    pointer-events: none;
}

#subtitleText {
    color: #FFFFFF;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 12px 24px;
    border-radius: 6px;
    font-size: clamp(0.9rem, 1.8vw, 1.4rem);
    white-space: nowrap;
    font-weight: 400;
    letter-spacing: 0.1rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#subtitleText.show {
    opacity: 1;
}

/* 8. 底部金色進度條 */
#progressBar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background-color: #E8B14A;
    width: 0%;
    z-index: 5;
    transition: width 0.1s linear;
}

/* 動畫定義 */
@keyframes startFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes kenBurns {
    from {
        transform: scale(1.0);
    }
    to {
        transform: scale(1.08);
    }
}

/* hidden 通用隱藏 */
.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* 大字卡的淡入淡出動畫控制（由 JS 透過 addClass/removeClass 觸發） */
.card-fade-in {
    animation: cardFadeIn 1.5s ease-out forwards;
}

.card-fade-out {
    animation: cardFadeOut 1.0s ease-in forwards;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}
