/* 1. 全局平滑捲動 */
html {
    scroll-behavior: smooth;
}

/* 2. 為了避免固定 Header 遮住錨點內容，設定 scroll-margin-top */
section {
    scroll-margin-top: 80px; /* 對應 Header 的高度 */
    padding-bottom: 60px;    /* 每個區塊底部的間隔 */
}

/* style.css */
:root {
    --primary-color: #008C99; /* Pantone 3135 */
    --secondary-color: #5B6770; /* Pantone 431 */
    --light-gray: #f4f4f4;
    --white: #ffffff;
    --text-color: #333;
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--white);
    padding-top: 80px; /* Space for fixed header */
}

/* Header & Nav */
header {
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
}

.logo img {
    height: 60px;
    width: auto;
}

nav ul {
    list-style: none;
    display: flex;
}

nav ul li {
    margin-left: 30px;
}

nav ul li a {
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 1.1rem;
    transition: var(--transition);
}

nav ul li a:hover, nav ul li a.active {
    color: var(--primary-color);
}

/* Mobile Menu */
.menu-toggle {
    display: none;
    font-size: 2rem;
    color: var(--primary-color);
    cursor: pointer;
}

/* Hero Section */
.hero {
    height: 80vh;
    background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)), url('images/01-公司簡介‧關於鎧暘-照片1.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--white);
    padding: 0 20px;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero p {
    font-size: 1.5rem;
    margin-bottom: 30px;
    max-width: 800px;
}

.btn {
    background: var(--primary-color);
    color: var(--white);
    padding: 12px 30px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: var(--transition);
    border: 2px solid var(--primary-color);
}

.btn:hover {
    background: transparent;
    color: var(--white);
}

/* Page Banner */
.page-banner {
    width: 100%;
    height: 300px;
    background-color: var(--light-gray);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.page-banner img {
    /* 修正: 強制圖片最大寬度為容器的 100%，並讓高度自動調整以維持圖片比例。 */
    max-width: 100%; 
    height: auto;
    object-fit: contain;
}

/* Content Sections */
.container {
    max-width: 1200px;
    margin: 50px auto;
    padding: 0 20px;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
    color: var(--secondary-color);
    font-size: 2rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    margin: 10px auto 0;
}

/* About Grid */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    margin-bottom: 60px;
}

.about-text h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.about-img img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Advantage 4S */
.advantage-section {
    background-size: cover;
    background-position: center left;
    padding: 60px 20px;
    background-color: #f9f9f9;
}

.four-s-img {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.four-s-img img {
    width: 100%;
    height: auto;
}

/* style.css - New Timeline Styles */

/* 大事記容器 */
.timeline-section {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* 中央連接線 */
.timeline-section::before {
    content: '';
    position: absolute;
    left: 50px; /* 手機版線條位置預設 */
    top: 0;
    bottom: 0;
    width: 4px;
    background: #e0e0e0;
    z-index: 0;
}

/* 個別項目 */
.timeline-row {
    display: flex;
    flex-direction: column; /* 手機版預設垂直 */
    margin-bottom: 40px;
    position: relative;
}

/* 時間點 (圓點) */
.timeline-dot {
    position: absolute;
    left: 42px; /* 調整圓點位置以對齊線條 */
    top: 20px;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border: 4px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--primary-color);
    z-index: 1;
}

/* 時間標籤 (2022 Q2) */
.timeline-date {
    font-weight: 800;
    color: var(--primary-color);
    font-size: 1.5rem;
    padding-left: 80px; /* 讓出位置給圓點 */
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

/* 內容卡片 */
.timeline-card {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border-left: 5px solid var(--primary-color);
    margin-left: 50px; /* 手機版向右縮進 */
    transition: transform 0.3s ease;
}

.timeline-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.timeline-card h4 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 8px;
    line-height: 1.5;
}

.timeline-card p {
    color: #666;
    font-size: 0.95rem;
    font-style: italic;
    line-height: 1.4;
    margin-bottom: 15px; /* 每個事件之間的間隔 */
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.timeline-card p:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

/* 桌機版樣式 (寬度大於 768px) */
@media (min-width: 768px) {
    .timeline-section::before {
        left: 50%;
        transform: translateX(-50%);
    }

    .timeline-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .timeline-dot {
        left: 50%;
        transform: translateX(-50%);
        top: 25px;
    }

    /* 偶數項：日期在左，內容在右 */
    .timeline-row:nth-child(even) .timeline-date {
        width: 45%;
        text-align: right;
        justify-content: flex-end;
        padding-right: 40px;
        padding-left: 0;
    }
    
    .timeline-row:nth-child(even) .timeline-card {
        width: 45%;
        margin-left: 0;
    }

    /* 奇數項：內容在左，日期在右 */
    .timeline-row:nth-child(odd) {
        flex-direction: row-reverse;
    }

    .timeline-row:nth-child(odd) .timeline-date {
        width: 45%;
        text-align: left;
        padding-left: 40px;
    }

    .timeline-row:nth-child(odd) .timeline-card {
        width: 45%;
        margin-left: 0;
        border-left: none;
        border-right: 5px solid var(--primary-color); /* 奇數項飾條在右邊 */
    }
}

/* Quality ISO */
.quality-iso {
    text-align: center;
    margin-top: 40px;
}

.quality-iso img {
    max-width: 100%;
    height: auto;
}

/* Products Tabs */
.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    border: 1px solid var(--secondary-color);
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    margin: 5px;
    transition: var(--transition);
}

.tab-btn.active, .tab-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.product-content {
    display: none;
    animation: fadeIn 0.5s;
}

.product-content.active {
    display: block;
}

.product-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.product-card img {
    width: 100%;
    height: 300px; /* Fixed height for consistency */
    object-fit: cover; /* Crop to fit */
    object-position: center;
}

@media (min-width: 768px) {
    .product-card {
        flex-direction: row;
    }
    .product-card img {
        width: 40%;
        height: auto;
    }
}

.product-info {
    padding: 20px;
    flex: 1;
}

.product-info h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.product-spec {
    list-style: disc;
    margin-left: 20px;
    color: var(--secondary-color);
}

/* Recruiting */
.welfare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.welfare-card {
    background: var(--light-gray);
    padding: 20px;
    border-radius: 8px;
    border-top: 4px solid var(--primary-color);
}

.job-btn {
    display: inline-block;
    background: #ff9900; /* 104 color */
    color: #fff;
    padding: 15px 40px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 30px;
    text-align: center;
}

/* Contact */
.contact-box {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 40px;
}

.contact-info-item {
    margin: 15px 0;
}

.map-container {
    width: 100%;
    height: 400px;
    background: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #888;
}

/* Footer */
footer {
    background: var(--secondary-color);
    color: var(--white);
    text-align: center;
    padding: 20px;
    margin-top: 50px;
}

/* RWD Mobile */
@media (max-width: 768px) {
    nav ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background: var(--white);
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    }
    .hero {
        /* 縮減手機版的 Hero 區域高度，改善背景圖片的縱向裁切問題 */
        height: 60vh; 
    }

    nav ul.show {
        display: flex;
    }

    nav ul li {
        margin: 0;
        text-align: center;
        padding: 15px 0;
        border-bottom: 1px solid #eee;
    }

    .menu-toggle {
        display: block;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 2rem;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* style.css - Quality Policy Section Styles */
.quality-policy-section {
    padding: 60px 0;
    background-color: #f8f8f8; /* 淺灰色背景增加區塊感 */
}

.quality-policy-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 40px;
}

.quality-policy-text,
.quality-policy-image {
    flex: 1 1 45%; /* 在大螢幕上各佔約一半 */
    min-width: 300px; /* 最小寬度，用於響應式設計 */
}

.quality-policy-text p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #333;
    margin-bottom: 20px;
}

.quality-policy-text h4 {
    color: var(--primary-color); /* 使用品牌主色 */
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.3rem;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    padding-bottom: 5px;
}

.quality-policy-text ul {
    list-style: disc;
    padding-left: 20px;
    margin-bottom: 20px;
}

.quality-policy-text li {
    line-height: 1.6;
    margin-bottom: 5px;
}

.quality-policy-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* 確保手機版垂直堆疊 */
@media (max-width: 768px) {
    .quality-policy-grid {
        flex-direction: column;
    }
    .quality-policy-text,
    .quality-policy-image {
        flex: 1 1 100%;
    }
}

/* style.css - Language Switcher Styles */

/* 預設隱藏英文內容 */
.lang-en {
    display: none !important;
}

/* 當 body 擁有 .en-mode 類別時 */
body.en-mode .lang-zh {
    display: none !important;
}

body.en-mode .lang-en {
    display: block !important;
}

/* 特殊情況：行內元素的顯示方式 (避免 block 破壞排版) */
body.en-mode span.lang-en {
    display: inline !important;
}

/* 語言切換按鈕樣式 */
.lang-btn {
    margin-left: 20px;
    padding: 5px 15px;
    border: 1px solid var(--primary-color);
    background-color: transparent;
    color: var(--primary-color);
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.lang-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/* 手機版選單內的按鈕位置調整 */
@media (max-width: 768px) {
    .lang-btn {
        margin: 10px auto;
        display: block;
    }
}
/* style.css - Timeline Local Scroll */

.timeline-scroll-container {
    /* 設定固定高度，超過產生捲軸 */
    max-height: 600px; 
    overflow-y: auto;
    
    /* 美化外觀 */
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 30px 20px 10px 20px;
    margin-top: 20px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);

    /* 自定義捲軸樣式 (Chrome/Safari) */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f0f0f0;
}

.timeline-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.timeline-scroll-container::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.timeline-scroll-container::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 4px;
}