/* ============================================== */
/* Font/Icon Imports */
/* ============================================== */
@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,700,800");
@import url("fontawesome-all.min.css");

/* ============================================== */
/* CSS Reset */
/* ============================================== */

html, body, div, span, applet, object,
iframe, h1, h2, h3, h4, h5, h6, p, blockquote,
pre, a, abbr, acronym, address, big, cite,
code, del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var, b,
u, i, center, dl, dt, dd, ol, ul, li, fieldset,
form, label, legend, table, caption, tbody,
tfoot, thead, tr, th, td, article, aside,
canvas, details, embed, figure, figcaption,
footer, header, hgroup, menu, nav, output, ruby,
section, summary, time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
    display: block;
}

body {
    line-height: 1;
}

ol, ul {
    list-style: none;
}

blockquote, q {
    quotes: none;
}

    blockquote:before, blockquote:after, q:before, q:after {
        content: '';
        content: none;
    }

table {
    border-collapse: collapse;
    border-spacing: 0;
}

body {
    -webkit-text-size-adjust: none;
}

mark {
    background-color: transparent;
    color: inherit;
}

input::-moz-focus-inner {
    border: 0;
    padding: 0;
}

input, select, textarea {
    -moz-appearance: none;
    -webkit-appearance: none;
    -ms-appearance: none;
    appearance: none;
}

/* Basic */

    html {
        box-sizing: border-box;
    }

    *, *:before, *:after {
        box-sizing: inherit;
    }

    /* --- RWD 修正 --- */
    html, body {
        overflow-x: hidden;
    }

    @-ms-viewport {
        width: device-width;
    }

    body {
        background: #ffffff; 
    }

        body.is-preload * {
            -moz-transition: none !important;
            -webkit-transition: none !important;
            -ms-transition: none !important;
            transition: none !important;
            -moz-animation: none !important;
            -webkit-animation: none !important;
            -ms-animation: none !important;
            animation: none !important;
        }

    /* --- RWD 修正 --- */
    body, input, select, textarea {
        font-family: 'Open Sans', sans-serif;
        color: #7b818c;
        font-weight: 400;
        font-size: 15px; /* 原為 11pt */
        line-height: 1.85em;
    }

    a {
        color: inherit;
        text-decoration: underline;
    }

        a:hover {
            text-decoration: none;
        }

    h1, h2, h3, h4, h5, h6 {
        text-transform: uppercase;
        font-weight: 800;
        letter-spacing: 0.04em;
        color: #404248;
        margin: 0 0 1em 0;
    }

    h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
        color: inherit;
        text-decoration: none;
        outline: 0;
    }

    h2 {
        font-size: 2em;
        margin: 0 0 1.5em 0;
        line-height: 1em;
    }

        h2.icon {
            line-height: 48px;
        }

            h2.icon:before {
                position: relative;
                top: 0.05em;
                margin-right: 0.5em;
                opacity: 0.25;
            }

    h3 {
        font-size: 1.35em;
        margin-top: 2em;
    }

    b, strong {
        color: #404248;
        font-weight: 700;
    }

    i, em {
        font-style: italic;
    }

    br.clear {
        clear: both;
    }

    sub {
        position: relative;
        top: 0.5em;
        font-size: 0.8em;
    }

    sup {
        position: relative;
        top: -0.5em;
        font-size: 0.8em;
    }

    hr {
        border: 0;
        border-top: solid 1px #ddd;
    }

    blockquote {
        border-left: solid 0.5em #ddd;
        padding: 1em 0 1em 2em;
        font-style: italic;
    }

    p, ul, ol, dl, table {
        margin-bottom: 2em;
    }

    .date {
        display: block;
        text-transform: uppercase;
        font-weight: 700;
        letter-spacing: 0.065em;
        font-size: 0.9em;
        color: #696969;
        margin: 0 0 0.25em 0;
    }

/* --- RWD 修正 (Container) --- */
.container {
    margin: 0 auto;
    max-width: 1200px; 
    width: 100%; 
    padding-left: 20px; 
    padding-right: 20px; 
}

    
/* ============================================== */
/* 網格系統 (Grid System) 修正 */
/* ============================================== */

.row {
    display: flex;
    flex-wrap: wrap; 
    margin-left: -15px;
    margin-right: -15px;
}

/* --- RWD 修正 --- */
.col-3 { 
    width: 25%;
    padding-left: 15px;
    padding-right: 15px;
}

/* 響應式圖片 */
img {
    max-width: 100%;
    height: auto;
}

/* Header (您的原始樣式) */

    #header {
        position: relative;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.1);
        padding: 0.75em;
        margin-bottom: 0;
    }

    #header .inner {
        background-image: -moz-linear-gradient(top, rgb(255, 255, 255), rgba(253, 252, 252, 0.918)), url("images/bg02.png");
        background-image: -webkit-linear-gradient(top, rgba(255, 255, 255), rgba(253, 252, 252, 0.918)), url("images/bg02.png");
        background-image: -ms-linear-gradient(top, rgba(255, 255, 255), rgba(253, 252, 252, 0.918)), url("images/bg02.png");
        background-image: linear-gradient(top, rgba(255, 255, 255), rgba(253, 252, 252, 0.918)), url("images/bg02.png");
        position: relative;
        height: 4.5em; /* Nav 列高度 */
        background-color: #ffffff; 
        background-color: rgba(242, 246, 255, 0.9);
        border-radius: 8px;
        box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0.45), inset 0px 2px 1px 0px rgba(255, 255, 255, 0.15);
        text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.5);
        
        display: flex;
        justify-content: space-between;
        align-items: center; 
        padding: 0 1.75em; 
    }

    /* Logo 容器 (a 標籤) */
    #header .inner > a {
        height: 4.5em; 
        display: flex;
        align-items: center; 
        margin-left: -0.75em; 
        padding-left: 1.75em;
        z-index: 10001; /* --- RWD 新增 --- */
    }

    /* Logo 圖片 */
    #header a img {
        max-height: 5.5em; 
        height: 100%; 
        width: auto;
        max-width: 100%;
        margin: 0;
        position: static; 
        top: auto; 
        transform: none; 
    } 

/* Nav (導航列) 修正 */

    #nav {
        position: relative;
        right: auto;
        top: auto;
        line-height: normal;
    }

    #nav > ul {
        display: flex;
        align-items: center;
        margin: 0; 
        padding: 0;
    }

    /* 導航按鈕間距 */
    #nav > ul > li {
        padding: 0 1.1rem 0 1.1rem; 
    }
    
    #nav > ul > li:last-child {
        padding-right: 0;
    }
    
    #nav > ul > li > a, #nav > ul > li > span {
        font-family: 'Microsoft JhengHei', Arial, sans-serif; 
        font-weight: bold; 
        font-size: 16px;
        letter-spacing: 0.075em;
        padding: 0.5em 0.8em 0.5em 0.8em;
        border-radius: 6px;
        outline: 0;
        text-shadow: none;
    }

/* ============================================== */
/* --- RWD 新增 --- 漢堡選單 (Mobile Navigation) */
/* ============================================== */

#nav-toggle {
    display: none; /* 預設 (PC/平板) 隱藏 */
    font-size: 24px;
    color: #404248; 
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 10001; 
    position: absolute; 
    right: 1.75em;
    top: 50%;
    transform: translateY(-50%);
}

/* 顯示為「X」 */
body.nav-active #nav-toggle:before {
    content: '\f00d'; 
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}

/* 顯示為「三」 */
body:not(.nav-active) #nav-toggle:before {
    content: '\f0c9'; 
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}


/* ============================================== */
/* Top Bar (深紅色 Bar) 樣式 - 頂部聯繫資訊 */
/* ============================================== */
#top-bar-wrapper {
    background-color: #8B0000; /* 深紅色 */
    color: #ffffff;
    font-size: 0.85em; 
    padding: 0.4em 0; 
    line-height: 1.2; 
}

#top-bar {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    flex-wrap: wrap; /* --- RWD 新增 --- */
}

.left-contact {
    display: flex;
    gap: 1.5em; 
    align-items: center;
    flex-wrap: wrap; /* --- RWD 新增 --- */
}

.right-lang {
    display: flex;
    gap: 1.5em; 
    align-items: center;
}

.left-contact a, .right-lang a, .right-lang span {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
    cursor: pointer;
    white-space: nowrap;
    font-weight: bold; 
}

/* ============================================== */
/* 中間額外的聯繫資訊條 (公司簡介上方) */
/* ============================================== */
#contact-info-strip {
    background-color: #D2232A; 
    color: #ffffff;
    display: flex;
    justify-content: space-around; 
    align-items: center;
    padding: 1.2em 0; 
    margin-bottom: 2.5em; 
    font-size: 1.0em; 
    flex-wrap: wrap; /* --- RWD 新增 --- */
}

.contact-item {
    margin: 0 1em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    padding: 5px 0; /* --- RWD 新增 --- */
}

.contact-item i {
    color: #ffffff; 
    margin-right: 0.5em; 
    font-size: 1.2em;
}

.contact-item a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
}

/* ============================================== */
/* 公司簡介區塊 (您的 index_middle.php) */
/* ============================================== */
#company-intro-wrapper {
    background-color: #ffffff; 
    padding: 5em 0;
}

.company-image img {
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    height: auto;
    width: 100%;
    display: block;
}

header.major h2 {
    color: #D2232A; 
}
header.major {
    border-bottom: solid 1px #dbdbdb;
    margin: 0 0 1.5em 0;
}
header.major:after {
    display: none; 
}


/* ============================================== */
/* 產品列表區塊 (Userwats Products) */
/* ============================================== */
#products-section {
    background-color: #ffffff; 
    padding-top: 5em;
}

.section-title {
    color: #D2232A; 
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 1.5em;
}

.product-grid {
    text-align: center;
}

/* ============================================== */
/* 產品網格樣式 (RWD 修正) */
/* ============================================== */

.product-item {
    text-align: center;
    margin-bottom: 30px; 
}

/* --- RWD 修正 (1:1 響應式正方形) --- */
.product-image-container {
    width: 100%; 
    padding-top: 100%; 
    position: relative; 
    margin: 0 auto;
    margin-bottom: 15px; 
    border: 1px solid #ddd;
    background-color: #fff;
    overflow: hidden; 
}

/* --- RWD 修正 (圖片絕對定位) --- */
.product-item .product-image {
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; 
    padding: 10px; 
    box-sizing: border-box; 
}

/* 產品名稱樣式 */
.product-item .product-name {
    margin: 0;
    padding-top: 5px;
    font-weight: bold;
    color: #333; 
    white-space: nowrap; 
    overflow: hidden;
    text-overflow: ellipsis; 
}

/* ============================================== */
/* 底部全橫幅圖片 */
/* ============================================== */
#full-width-clickable-banner img {
    display: block;
    width: 100%;
    height: auto;
}

/* ============================================== */
/* 底部版權區塊 */
/* ============================================== */
#copyright-wrapper {
    background-color: #8B0000; 
    padding: 1.5em 0;
    text-align: center;
}

.copyright-text {
    color: #ffffff;
    font-size: 0.8em;
    margin: 0;
    text-shadow: none;
}

/* ============================================== */
/* 公司介紹頂部文字區塊樣式 (您的原始樣式) */
/* ============================================== */

#company-info {
    text-align: center;
    max-width: 900px; 
    margin: 0 auto 5em auto; 
    padding: 2em 0;
}
.main-header h2 {
    font-size: 2em;
    font-weight: 700;
    color: #404248;
    margin-bottom: 0.25em;
    text-transform: none; 
}
.main-header .underline {
    width: 60px;
    height: 3px;
    background-color: #D2232A; 
    margin: 0 auto 3em auto;
}
.intro-paragraph, .certification-paragraph {
    text-align: left; 
    margin: 0 0 1.5em 0;
}

/* ============================================== */
/* 底部圓形畫廊佈局樣式 (RWD 修正) */
/* ============================================== */

#photo-gallery {
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center; 
    margin-bottom: 5em;
    margin-left: -10px; 
    margin-right: -10px; 
}

/* 桌面 (PC) 5 欄 */
.gallery-item {
    width: 20%; 
    padding: 0 10px;
    box-sizing: border-box;
    text-align: center;
    margin-bottom: 20px; 
}

/* --- RWD 修正 (響應式圓形) --- */
.photo-circle-container {
    width: 100%;
    padding-top: 100%; 
    position: relative; 
    border-radius: 50%; 
    overflow: hidden; 
    margin: 0 auto 10px auto;
    border: 3px solid #ffffff; 
    box-shadow: 0 0 0 1px #ddd; 
    cursor: pointer;
    transition: transform 0.3s ease;
}
.photo-circle-container:hover {
    transform: scale(1.05); 
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* --- RWD 修正 (圖片絕對定位) --- */
.photo-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; 
}

.photo-label {
    font-size: 0.95em;
    font-weight: bold;
    color: #404248;
    margin: 0 0 1em 0;
}


/* ============================================== */
/* 您的「終極 FIX」區域 (保留) */
/* ============================================== */

.equipment-gallery .gallery-item-small {
    padding: 1em; 
    box-sizing: border-box !important;
    margin-bottom: 2em; 
}
.equipment-gallery .image-container {
    width: 100% !important; 
    padding-top: 100% !important; 
    position: relative !important;
    border: 1px solid #ddd !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important;
    margin-bottom: 10px !important;
    overflow: hidden !important;
    background-color: #fff !important; 
}
.equipment-gallery .equipment-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; 
    display: block !important;
}
.equipment-gallery .image-label {
    text-align: center !important;
    margin: 0 !important;
}
.row {
    display: flex !important;
    flex-wrap: wrap !important;
}

/* FIX：LightBox/Modal */
.modal {
    display: none; 
    position: fixed !important;
    z-index: 9999 !important; 
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: auto !important; 
    background-color: rgba(0,0,0,0.95) !important; 
    padding-top: 0 !important; 
}
.close {
    position: fixed !important; 
    top: 20px !important;
    right: 30px !important;
    color: #fff !important;
    font-size: 50px !important;
    font-weight: bold !important;
    z-index: 10000 !important; 
    cursor: pointer;
}
.modal-content {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: auto !important;
    max-width: 90% !important; 
    max-height: 90vh !important; 
    text-align: center;
}
.mySlides {
    display: none; 
    max-width: 100%;
    max-height: 100%;
}
.modal-content img {
    max-width: 100% !important;
    max-height: 80vh !important; 
    width: auto !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
}
.prev, .next {
    cursor: pointer;
    position: absolute !important;
    top: 50% !important;
    width: auto !important;
    padding: 16px !important;
    margin-top: -50px !important;
    color: white !important;
    font-size: 20px !important;
    z-index: 10000 !important;
    background-color: rgba(0,0,0,0.5) !important;
    user-select: none;
}
.next {
    right: 0 !important;
    left: auto !important;
}
.prev {
    left: 0 !important;
    right: auto !important;
}


/* ============================================== */
/* RWD 調整 (平板與手機) */
/* ============================================== */

@media screen and (max-width: 1280px) {
    /* (您的 RWD Large 樣式 - 目前為空) */
}

/* --- RWD 修正 --- 
 * 平板電腦樣式 (寬度小於 980px) 
 */
@media screen and (max-width: 980px) {
    
    /* (平板上將繼續顯示 PC 版的橫向選單) */
    
    /* 1. 修正聯繫資訊條在平板上的佈局 */
    #contact-info-strip {
        flex-direction: column; /* 垂直堆疊 */
        align-items: center; /* 置中 */
        padding: 1em 0;
    }
    .contact-item {
        margin: 0.3em 0;
        white-space: normal; /* 允許換行 */
    }

    /* 2. 公司簡介佈局 (上圖下文) -> (在 PC 已是 col-12，平板不需變動) */
    .row > .col-6 {
        width: 100% !important;
        margin-bottom: 2em;
    }
    
    /* 3. 產品網格 (4欄) -> (2欄) */
    .col-6-medium {
        width: 50% !important;
        float: left; 
    }
    
    /* 4. 圓形畫廊 (5欄) -> (3欄) */
    .gallery-item {
        width: 33.333%;
    }
}


/* --- RWD 修正 --- 
 * 手機樣式 (寬度小於 736px) 
 */
@media screen and (max-width: 736px) {
    
    /* --- RWD 修正：漢堡選單邏輯 (只在手機顯示) --- */
    #nav-toggle {
        display: block; /* 顯示漢堡按鈕 */
    }
    
    #nav {
        display: none; /* 隱藏 PC 版導航列 */
        position: fixed; 
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh; 
        background: rgba(255, 255, 255, 0.98); 
        z-index: 10000;
        padding-top: 100px; 
        overflow-y: auto;
    }
    
    /* 當漢堡選單被點擊 (body 具有 .nav-active) */
    body.nav-active #nav {
        display: block; /* 顯示選單 */
    }

    #nav > ul {
        display: block; /* 改為垂直排列 */
        text-align: center;
    }
    
    #nav > ul > li {
        padding: 0;
        margin: 15px 0; /* 增加垂直間距 */
    }
    
    #nav > ul > li > a, #nav > ul > li > span {
        font-size: 20px; /* 放大字體 */
        padding: 15px;
        display: block; /* 讓連結變為塊狀 */
        color: #404248; /* 確保文字顏色清晰 */
    }
    /* --- 漢堡選單邏輯結束 --- */


    /* 1. 調整字體大小 */
    body, input, select, textarea {
        font-size: 14px;
    }
    h2, .section-title {
        font-size: 1.8em;
    }
    
    /* 2. 調整 Header 高度 */
    #header .inner {
        height: 4em;
    }
    #header .inner > a {
        height: 4em;
    }

    /* 3. 調整 Top Bar */
    #top-bar {
        justify-content: center; /* 全部置中 */
        text-align: center;
    }
    .left-contact, .right-lang {
        justify-content: center;
        width: 100%;
        gap: 1em;
        margin-bottom: 5px;
    }

    /* 4. 產品網格 (2欄) -> (1欄) */
    .col-12-small {
        width: 100% !important;
        float: left; 
    }
    
    /* 強制覆蓋產品網格為 1 欄 */
    #products-section .col-3,
    #products-section .col-6-medium {
        width: 100% !important; 
    }

    /* 5. 圓形畫廊 (3欄) -> (2欄) */
    .gallery-item {
        width: 50%; /* 2 欄 */
    }

    /* 6. 聯繫資訊條在手機上的佈局 */
    #contact-info-strip {
        padding: 0.8em 0;
        justify-content: center; /* 置中 */
    }
    .contact-item {
        margin: 0.1em 0;
        justify-content: center;
        width: 100%;
        text-align: center;
    }
}