/* ==================================== */
/* ===  一、基礎樣式：由小至大 (Mobile First)  === */
/* ==================================== */

/* 1. 響應式容器 */
.section-story-image {
    display: flex;
    flex-direction: column;
    /* 手機版：圖片在上，文字在下 */
    width: 100vw;
    min-height: 65vh;
    /* 使用 min-height 以適應內容長度 */
    overflow: hidden;
    color: black;
    box-sizing: border-box;
    padding: 0rem;
}

/* 2. 圖片區域 */
.image-area {
    position: relative;
    width: 100vw;
    height: 50vh;
}

/* 3. 圖片樣式與動畫控制 (核心部分) */
.image-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* 保持圖片比例並填滿容器，類似背景圖的 cover */
    opacity: 0;
    transition: opacity 1s ease-in-out;
    animation: image-fade 8s infinite;
    /* 總動畫週期為 8 秒 */
}

/* 控制第二張圖片的動畫延遲，實現輪播 */
.image-slide:nth-of-type(2) {
    animation-delay: 4s;
    /* 延遲 4 秒開始，與第一張圖片錯開 */
}

/* 4. 文字區域 */
.text-area {
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1rem;
    box-sizing: border-box;
}

/* 5. 手機版文字樣式 */
.text-area h2 {
    font-size: 6vw;
    font-weight: bold;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.text-area h3 {
    font-size: 3vw;
    font-weight: 600;
    margin-bottom: 0.5rem;
}


/* ==================================== */
/* ===  二、桌面版樣式：僅覆寫必要屬性  === */
/* ==================================== */

@media (min-width: 768px) {

    /* 1. 響應式容器 */
    .section-story-image {
        flex-direction: row;
        /* 桌面版：圖文左右並排 */
        min-height: 100vh;
    }

    /* 2. 圖片區域 */
    .image-area {
        width: 50%;
        height: auto;
        padding-top: 50%;
        /* 確保容器比例為1:1 */
    }

    /* 3. 文字區域 */
    .text-area {
        width: 50%;
        height: auto;
        padding: 5vw;
        text-align: left;
        align-items: flex-start;
    }

    /* 4. 桌面版文字樣式 */
    .text-area h2 {
        font-size: 2.8vw;
        margin-bottom: 1rem;
    }

    .text-area h3 {
        font-size: 1.7vw;
        margin-bottom: 0.5rem;
    }
}

/* ==================================== */
/* ===  三、動畫定義  === */
/* ==================================== */
@keyframes image-fade {
    0% {
        opacity: 1;
    }

    /* 0% 到 49% 顯示 */
    49% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }

    /* 50% 到 100% 隱藏 */
    100% {
        opacity: 0;
    }
}
