/* style.css - 統一管理所有客製化樣式 */
html {
    scroll-behavior: smooth;
}

/* 解決錨點定位被 Fixed Header 遮擋的問題 */
section[id] {
    scroll-margin-top: 100px; /* 根據您的 Menu Bar 高度調整，通常 80px-100px */
}

body {
    padding-top: 80px; /* 根據 Menu Bar 高度調整 */
}

/* 2. Menu Bar (Navbar) 統一樣式 */
.navbar-custom {
    background-color: #000 !important; /* 統一黑色背景 */
    padding: 10px 0;
}

.navbar-brand-text {
    font-size: 1.1rem;
    font-weight: bold;
    color: white !important;
}

.nav-link {
    color: rgba(255,255,255,0.8) !important; /* 預設灰白色 */
    font-size: 1rem;
    padding: 10px 15px !important;
}

.nav-link:hover, .nav-link.active {
    color: #fff !important; /* 滑鼠移過變全白 */
}

/* 3. 手機版 Menu Dropdown 修正 */
/* 當螢幕小於 991px (手機/平板) 時 */
@media (max-width: 991px) {
    .navbar-collapse {
        background-color: #000; /* 手機選單展開後的背景色 */
        padding: 15px;
        border-radius: 0 0 10px 10px;
        max-height: 80vh; /* 防止選單太長超出螢幕 */
        overflow-y: auto; /* 允許滾動 */
    }

    .navbar-toggler {
        border-color: rgba(255,255,255,0.5) !important;
    }

    .navbar-toggler-icon {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
    }

    /* 手機版 Dropdown 選單樣式 */
    .dropdown-menu {
        background-color: #222 !important; /* 深灰色背景 */
        border: none;
        padding-left: 20px; /* 縮排，讓層級更明顯 */
    }

    .dropdown-item {
        color: #ddd !important;
        padding: 10px 0;
    }
}

/* 4. Banner (Hero Section) 統一樣式 */
.hero-section-short {
    background: none !important; /* 移除任何背景圖干擾 */
    min-height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    /* 如果背景圖是在 body 或其他地方設的，這裡確保它是透明的 */
}

.cd-headline {
    font-size: 3rem; /* 電腦版大小 */
    color: #ffc107 !important; /* 黃色 */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.hero-btn {
    border-radius: 50px;
    padding: 12px 30px;
    font-weight: bold;
    font-size: 1.1rem;
    margin: 10px;
}

/* 手機版 Banner 特調 */
@media (max-width: 768px) {
    .hero-section-short {
        min-height: auto;
        padding-top: 40px; /* 減少上方留白 */
        padding-bottom: 60px;
    }

    .cd-headline {
        font-size: 1.8rem !important; /* 手機字體變小 */
        line-height: 1.4;
        margin-bottom: 20px;
    }

    .cd-words-wrapper b {
        font-size: 1.1rem !important;
        color: #00bfff !important; /* 亮藍色副標題 */
        display: block;
        margin-top: 5px;
    }

    .d-flex.gap-3 {
        flex-direction: column; /* 按鈕垂直排列 */
        gap: 15px !important;
    }

    .hero-btn {
        width: 100%; /* 按鈕全寬 */
        margin: 5px 0;
    }
}

/* 確保圖片容器是相對定位，讓裡面的圖片可以重疊 */
.services-image-wrap {
    position: relative;
    display: block;
    overflow: hidden; /* 防止圖片超出範圍 */
}

/* 設定所有服務圖片的基本樣式 */
.services-image-wrap img {
    transition: all 0.3s ease-in-out; /* 加入平滑過渡效果 */
    display: block;
    width: 100%;
    height: auto;
}

/* 第一張圖 (平時顯示)：當 hover 時變透明 */
.services-image-wrap:hover .services-image {
    opacity: 0; 
}

/* 第二張圖 (Hover 圖)：預設絕對定位疊在上面，平時透明 */
.services-image-wrap .services-image-hover {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0; /* 平時隱藏 */
    z-index: 2; /* 確保它疊在上面 */
}

/* 當 Mouse 移入容器時，顯示第二張圖 */
.services-image-wrap:hover .services-image-hover {
    opacity: 1; /* 顯示出來 */
}




/* --- Footer 樣式 (統一管理) --- */
.site-footer {
    background-color: #111; /* 深黑色背景 */
    color: #fff;
    padding: 60px 0 30px;
    font-size: 0.95rem;
}

.footer-logo {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.2);
}

.footer-brand-text {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    letter-spacing: 1px;
}

/* 連結樣式 */
.footer-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #ffc107; /* 黃色高亮 */
}

/* 列表連結 */
.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.footer-links a:hover {
    color: #fff;
    transform: translateX(5px); /* 滑鼠移過輕微右移 */
}

/* 標題下方的裝飾線 (選擇性) */
.site-footer h5 {
    position: relative;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-weight: 600;
}

.site-footer h5::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 2px;
    background-color: #007cba; /* 品牌藍色 */
}

/* 手機版微調 */
@media (max-width: 768px) {
    .site-footer {
        padding: 40px 0 20px;
        text-align: left; /* 手機版靠左對齊通常比較好閱讀 */
    }
    
    .footer-bottom {
        text-align: center !important; /* 版權宣告置中 */
    }
}


/* =============================================
   Mobile Portrait Fix (手機打直觀看修正)
   ============================================= */

/* 針對一般手機打直 (寬度小於 768px) */
@media screen and (max-width: 768px) {
    
    /* 1. 全局字體修正：確保內文夠大，不用放大鏡 */
    body {
        font-size: 16px !important; /* 強制最小 16px */
        line-height: 1.6;
    }

    p, li, span, div {
        font-size: 1rem; /* 使用 rem 單位，讓文字保持彈性 */
    }

    /* 2. 標題大小調整：避免手機上標題太大佔滿螢幕 */
    h1, .h1 { font-size: 1.75rem !important; }
    h2, .h2 { font-size: 1.5rem !important; }
    h3, .h3 { font-size: 1.3rem !important; }

    /* 3. Navbar 導航欄修正 */
    /* 確保 Logo 與漢堡選單按鈕排列正確 */
    .navbar {
        padding: 10px 15px; /* 增加邊距 */
    }

    .navbar-brand {
        font-size: 1.2rem; /* Logo 字體適中 */
        max-width: 75%;    /* 留位給漢堡按鈕 */
        white-space: normal; /* 允許長標題換行 */
    }

    /* 4. 手機選單連結 (最上層) 樣式優化 */
    /* 讓手指更容易點擊，並轉為直排 */
    .navbar-nav .nav-item {
        margin: 5px 0; /* 上下分開 */
        width: 100%;
        text-align: center; /* 文字置中 */
        border-bottom: 1px solid rgba(255,255,255,0.1); /* 淡淡的分隔線 */
    }

    .navbar-nav .nav-link {
        font-size: 18px !important; /* 導航文字放大 */
        padding: 12px 0 !important; /* 增加點擊範圍 */
        display: block; /* 確保整條都能點 */
    }

    /* 5. 容器邊距修正 */
    /* 避免文字貼邊，左右留出呼吸空間 */
    .container, .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    /* 修正你提到的「看不到文字」問題，可能是顏色太淡或太細 */
    body {
        -webkit-text-size-adjust: 100%; /* 防止 iOS 自動調整字體 */
    }
}
