/* ============================= */
/* 全域樣式 Body                 */
/* ============================= */
html, body {
  overflow-x: hidden; /* 防止左右滾動 */
  width: 100%;
  touch-action: auto; /* 全局允許縮放 */
}

body {
    margin: 0;
    font-family: "Noto Sans TC";
    background-color: #FAF9F4;
    color: #16377E;
    -webkit-box-shadow: 0px 0px rgba(250,249,244,1);
    box-shadow: 0 0px rgba(250,249,244,1);
}

/* ============================= */

/* Header 區塊                   */
/* ============================= */
header {
    width: 100%;
    max-width: 1000px;     /* 最大寬度，跟 main div 相同 */
    margin: 20px 0 0 4.5%;   /* 左側 5% 對齊文字開頭 */
    font-size: 0;           /* 隱藏文字 */
}

header img {
    width: 30%;
    max-width: 430px;       /* 可視需求微調，防止過大 */
    height: auto;
    box-shadow: 0 0;
}

/* ============================= */
/* 導覽列 Nav                    */
/* ============================= */
nav {
    text-align: center;
    background-color: rgba(72,112,197,1);
}

nav ul {
    display: flex;
    justify-content: center;
    padding: 10px 0;
    margin: 0;
    list-style: none;
    letter-spacing: 5px;
    text-decoration: underline;
}

nav ul li {
    margin: 0 20px;
}

nav ul li a {
    color: #FAF9F4;
}

nav ul li a:hover {
    color: #FFD700;
}

/* ============================= */
/* 主要內容 Main 區塊            */
/* ============================= */
main div {
    display: flex;
    flex-direction: row-reverse; /* 圖片右側，文字左側 */
    align-items: flex-start;
    justify-content: space-between;
    margin: 20px 5%;
}

main div img {
    width: 45%;
    height: auto;
    border-radius: 2%;
    box-shadow: 0 0 10px 1px #4870C5;
}

#sec-1 {
    width: 50%;
    margin-left: 0;
    margin-right: 3%;
}

#sec-1 h2 {
    margin: 0 0 20px 0;
    line-height: 35px;
    text-indent: 0;
}

#sec-1 p {
    margin: 0 0 20px 0;
    line-height: 35px;
    text-indent: 2em;
    text-align: justify;
}

/* 水平線 */
hr {
    margin: 50px 10% 0 5%;
}

/* ============================= */
/* 圖片 Figure 區塊             */
/* ============================= */
.fig {
    display: block;
    width: 100%;
    max-width: 600px;
    height: auto;
    margin: 50px auto 0 auto;
}

.fig-p {
    text-align: center;
    margin-top: 20px;
}

/* 滑鼠滑過圖片微微放大效果 */
figure img {
    transition: transform 0.5s ease, opacity 0.3s ease;
    border-radius: 3%;
    max-width: 100%;
}

/* ============================= */
/* 回到頂端按鈕固定位置             */
/* ============================= */
#toTop {
    position: fixed;
    right: 5px;               /* 距右邊距離 */
    top: 50vh;                /* 視窗高度的一半 */
    z-index: 999;
    cursor: pointer;
}

/* ============================= */
/* 手機版 RWD                    */
/* ============================= */
html { font-size: 18px; } /* 預設是16px，這樣手機字會整體放大一點 */
@media screen and (max-width: 768px) {
    main div {
        flex-direction: column;
        align-items: center;
    }
    main div img {
        width: 90%;
        margin: 10px auto;
        order: 1;
    }
    #sec-1 {
        width: 90%;
        margin: 20px auto;
        order: 2;
    }
    header img {
        width: 90%;
        height: auto;
    }
    .fig {
        width: 90%;
        max-width: 90%;
        height: auto;
    }
	
	    /* ✅ 讓 nav 可以橫向滾動（不換行） */
    nav ul {
        display: flex;
        flex-wrap: nowrap;           /* 不允許換行 */
        overflow-x: auto;            /* 開啟橫向滾動 */
        white-space: nowrap;         /* 防止文字換行 */
        scrollbar-width: none;       /* 隱藏捲軸（Firefox） */
    }
	
	/* 導覽列字體大小 */
    nav ul li a {
        font-size: 1rem; /* 約16px，可再依實際感覺調整成1.1rem */
        letter-spacing: 1px;
    }

    /* main 裡面 h2 和 p 的字體 */
    #sec-1 h2 {
        font-size: 1.1rem; /* 原本大概是18px，這樣會在手機上清晰可讀 */
        line-height: 1.6em;
    }
    #sec-1 p {
        font-size: 1rem;
        line-height: 1.8em;
    }

    /* 圖片說明文字 */
    .fig-p {
        font-size: 1rem;
        line-height: 1.6em;
        margin-top: 10px;
    }
	
/* 防止手機上整頁左右滑動 */
html, body {
  overflow-x: hidden !important;
  width: 100%;
  position: relative;
}
}
