/* -------- 全域設定 -------- */
body {
    padding-top: 80px; /* 預留 150px 的空間，避免導覽列 (navbar) 壓到內容 */
    font-family: Arial, sans-serif; /* 設定全站字體 */
}

/* -------- 頂部導覽列 -------- */
.navbar {
    height: 100px; /* 導覽列高度固定 150px */
    display: flex; /* 使用 flex 排版 */
    align-items: center; /* 垂直置中 */
    justify-content: space-between; /* 左右分散排列 */
}

    .navbar span {
        font-size: clamp(1.5rem, 3vw, 3rem);
        /* 文字大小會隨螢幕寬度縮放：最小 1.5rem，最大 3rem */
    }

/* 手機版隱藏 Logo */
@media (max-width: 768px) {
    .me-2 {
        display: none;
    }
}

/* -------- 左邊紅色選單 (Sidebar) -------- */
/* 讓 Sidebar + Content 並排 */
/*.main-layout {
    display: flex;
    height: calc(100vh - 150px);*/ /* 扣掉上方導覽列高度 */
/*}*/
.sidebar {
    position: absolute;
    top: 90px;
    left: 0;
    bottom: 260px;
    height: calc(100% - 150px); /* 高度填滿剩下的螢幕 */
    display: flex;
    flex-direction: column; /* 垂直排列 */
    gap: 0px; /* 元素之間間距 */
    padding: 20px; /* 內距 */
    width: 260px; /* 固定寬度 */
}

    .sidebar span {
        display: block; /* 或者使用 inline-block */
        word-wrap: break-word; /* 确保文本能换行 */
        white-space: normal; /* 确保正常换行 */
        flex-wrap: wrap; /* 自动换行 */
    }

    .sidebar button {
        width: 100%; /* 撐滿 sidebar 寬度 */
        height: 100px; /* 固定按鈕高度 */
        font-size: 1.4rem;
        font-weight: bold; /* 粗體 */
        text-align: center; /* 文字置中 */
        background-color: #dc3545;
        color: white;
        border: none; /* 移除邊框 */
        border-radius: 10px; /* 圓角 */
        white-space: normal; /* 允許文字換行 */
        transition: background-color 0.3s ease; /* 滑過時平滑變色 */
        flex-wrap: wrap; /* 自动换行 */
    }


        .sidebar a:hover, .sidebar button:hover {
            background-color: #b02a37;
        }


/* 手機版調整按鈕大小 */
@media (max-width: 768px) {
    .sidebar {
        width: 200px; /* sidebar 寬度縮小 */
    }

        .sidebar button {
            font-size: 1rem; /* 按鈕字體縮小 */
            height: 80px; /* 按鈕高度縮小 */
            width: 150px;
            ; /* 按鈕寬度自動 */
        }
}



/* -------- 佈告欄內容 -------- */

/*使用 Flexbox 響應式兩欄/單欄佈局 */
#content-area {
    margin-left: 270px; 
    margin-right: 20px;
    margin-top: 2.5rem;
    display: flex;
    flex-wrap: wrap; 
    gap: 10px; 
    width: auto;
}


    #content-area .news-item {
        background: #fff;
        padding: 10px;
        margin-top: 10px;
        border-radius: 10px;
        box-shadow: 0px 2px 6px rgba(0,0,0,0.1);
        flex: 1 1 calc(50% - 10px); 

        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

        #content-area.news-item:hover {
            transform: scale(1.02);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        #content-area .news-item img {
            width: 100px;
            height: 100px;
            object-fit: cover;
            border-radius: 6px;
            flex-shrink: 0;
        }

    #content-area .article-content {
        flex: 1;
        display: flex;
        flex-direction: column;
    }



.news-item h5 {
    font-size: clamp(1.25rem, 3vw, 1.5rem); /* 大小隨螢幕寬度縮放：最小 1.5rem，最大 2rem */
    font-weight: bold; /* 粗體 */
    margin-bottom: 10px;
}

.news-item p {
    color: #555; /* 深灰文字 */
    margin: 0; /* 移除段落預設外距 */
}


/* 平板 (992px 以下) → 單欄 */
@media (max-width: 992px) {
    #content-area .news-item {
        flex: 1 1 100%;
    }
}

/* 手機 (768px 以下) → 單欄，並調整內距 */
@media (max-width: 768px) {
    #content-area {
        margin-top: 5px;
        margin-left: 10px; /* 原本 sidebar 空間 */
        margin-right: 10px; /* 保留右側間距 */
        margin-bottom: 100px;
        padding: 5px;
    }

        #content-area .news-item {
            flex: 1 1 100%; /* 手機同樣單欄 */
        }

    .news-item h5 {
        font-size: clamp(1.2rem, 4vw, 1.6rem); /* 手機字體稍微縮小 */
        margin-bottom: 20px;
    }

    .news-item p {
        font-size: 0.95rem;
    }
}



/* -------- 右邊 Bulletin Board -------- */
.bulletin {
    position: fixed;
    top: 100px; /* 對齊導覽列底下 */
    right: -270px; /* 預設收合在右側螢幕外 */
    width: 250px; /* 寬度 */
    height: calc(100% - 100px); /* 高度扣掉導覽列 */
    background-color: #f8f9fa; /* 淺灰背景 */
    border: 1px solid #333; /* 黑色邊框 */
    padding: 20px; /* 內距 */
    transition: right 0.3s ease-in-out; /* 開合時平滑動畫 */
    overflow-y: auto; /* 有垂直內容超出時才出現滾動條 */
}


    .bulletin.active {
        right: 0; /* 展開後顯示 */
    }

    .bulletin h5 {
        color: #dc3545; /* 紅色標題 */
        font-weight: bold;
        margin-bottom: 15px;
    }

    .bulletin a, .bulletin button {
        font-size: 1.25rem; /* 字體大小 */
        text-align: center; /* 文字置中 */
        margin: 5px 0; /* 上下間距 */
        display: block; /* 占滿一行 */
        padding: 10px 0; /* 內距 */
        color: black;
        text-decoration: none; /* 移除底線 */
        border-bottom: 1px solid #aaa; /* 灰色下框線 */
    }

        .bulletin button:hover {
            color: #dc3545; /* 滑鼠移上去變紅 */
        }


/* -------- 中間顯示圖片的內容區 -------- */
#content {
    margin-left: 270px; /* 預留左邊 sidebar 空間 */
    height: calc(100vh - 140px); /* 高度扣掉導覽列 */
    display: flex;
    justify-content: center; /* 水平置中 */
    align-items: center; /* 垂直置中 */
}

    #content img.content-img {
        max-width: 100%; /* 最大寬度 */
        max-height: 100%; /* 最大高度 */
        object-fit: contain; /* 保持比例縮放，不會裁切 */
    }

/* iframe 內容置中顯示 */
.content-iframe {
    width: 80%; /* 寬度 */
    max-width: 800px; /* 最大寬度 */
    height: auto; /* 高度自動 */
    display: block;
    margin: 0 auto; /* 左右置中 */
}

/* -------- 中間內容 (iframe) -------- */
.content {
    margin-left: 270px; /* 預留左側 sidebar */
    margin-right: 260px; /* 預留右側 bulletin */
    height: calc(100vh - 110px); /* 扣掉導覽列高度 */
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
}

    .content iframe {
        padding: 80px 0; /* 給 iframe 上下留白 */
        width: 100%;
        height: 100%;
        border: none;
        object-fit: contain; /* 內容保持比例 */
    }

iframe {
    margin-top: -60px; /* 讓 iframe 往上貼齊，遮住最上面黑色那條但內容露出來 */
}


/* -------- 選廠區背景圖片 + 半透明框 -------- */
.background {
    background: url("../img/tsmc_factory.jpg") no-repeat center center; /* 背景圖 */
    background-size: cover; /* 填滿螢幕 */
    height: 88vh; /* 高度為螢幕 88% */
    width: 100%;
    display: flex;
    align-items: center; /* 垂直置中 */
    justify-content: center; /* 水平置中 */
}

/* 中央半透明框 */
.overlay-box {
    background: rgba(255, 255, 255, 0.8); /* 半透明白色背景 */
    /* clamp() 讓內距彈性縮放 */
    /* 最小 30px、最大 150px，彈性值為視窗寬度的 8% */
    padding: clamp(30px, 8vw, 150px);
    border-radius: 50px; /* 圓角 */
    box-shadow: 0px 4px 15px rgba(0,0,0,0.3); /* 陰影效果 */
}

    /* 中央標題字體 */
    .overlay-box h2 {
        font-size: clamp(2rem, 2.5vw, 3rem); /* 大字體 */
    }

    /* 中央按鈕 */
    .overlay-box a, .overlay-box button {
        /* 字體大小：最小 1rem、最大 2.5rem，彈性值為視窗寬度的 2.5% */
        font-size: clamp(1rem, 2.5vw, 2.5rem);
        /* 內距：最小 10px 20px、最大 25px 45px，彈性值為視窗寬度的 2% 4% */
        padding: clamp(10px, 2vw, 25px) clamp(20px, 4vw, 45px);
        border-radius: 20px; /* 圓角 */
        background-color: rgba(255, 255, 255, 0.293);
    }



/* 確保按鈕的大小能夠適應容器 */
.button-container a, .button-container button {
    width: 150px; /* 固定寬度 */
    height: 100px; /* 固定高度 */
    font-size: 2rem; /* 固定字體大小 */
    display: flex; /* 讓文字置中 */
    align-items: center; /* 垂直置中 */
    justify-content: center; /* 水平置中 */
}

/* 針對行動裝置微調 */
@media (max-width: 768px) {
    .button-container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

        .button-container a, .button-container button {
            width: 0 0 45%; /* 小螢幕稍微縮小 */
            font-size: 1.8rem;
            ;
            padding: 20px 0;
        }

    .overlay-box {
        padding: clamp(10px, 6vw, 50px); /* 手機版內距稍微縮小 */
    }
}

@media (max-width: 576px) {
    .button-container a, .button-container button {
        width: 0 0 45%; /* 幾乎滿版 */
        height: 80px;
        font-size: 1.8rem;
    }
}

.overlay-box a:hover, .overlay-box button:hover {
    background-color: rgba(231, 46, 46, 0.75) /* 滑鼠移上去變深 */
    color: #fff;
}


/*以下為SideBar用*/

:root {
    --header-h: 0px; /* 有固定頂欄就填它的高度，例如 56px；沒有就留 0 */
    --sidebar-w: 260px; /* 左側紅色選單寬度，依你的實際寬調整 */
}

/* 讓左側 partial 固定在左邊 */
.report-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--header-h));
    overflow: auto;
}

/* 主內容讓位 + 限制寬度，防止超出而出現水平捲軸 */
.report-main {
    margin-left: var(--sidebar-w);
    width: calc(100vw - var(--sidebar-w)); /* ← 重點 */
    overflow-x: hidden; /* 安全起見 */
    box-sizing: border-box;
}

/*OtherLink Edit*/
/* 預設手機等裝置滿版 */
.input-xl-desktop {
    width: 100%;
}

/* 只在很大的螢幕時放大 */
@media (min-width: 1200px) {
    .input-xl-desktop {
        width: 300%;
        max-width: none;
    }
}

/* 只給這個 offcanvas 用的半高樣式 */
.offcanvas-half {
    --bs-offcanvas-height: 50vh; /* 內建變數：控制 offcanvas-bottom 的高度 */
    border-top-left-radius: .75rem; /* 美化 */
    border-top-right-radius: .75rem;
    box-shadow: 0 -8px 24px rgba(0,0,0,.15);
}

/* iOS 安全區域（可選） */
@supports(padding:max(0px)) {
    .offcanvas-half .offcanvas-body {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}
