/* 全域設定 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Noto Sans TC', sans-serif; background-color: #fff; }
/* 讓內容稍微晚 0.2 秒才出現，層次感會很強 */
.service-header {
    animation: fadeInPage 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
    opacity: 0;
}

.service-image {
    animation: fadeInPage 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.4s forwards;
    opacity: 0;
}
/* 導覽列樣式 */
nav {
    position: fixed;
    top: 0; width: 100%;
    padding: 20px 50px;
    display: flex;
    justify-content: space-between;
    z-index: 1000;
    transition: .35s;
}
nav a { color: white; text-decoration: none; margin-left: 20px; }
nav.scrolled {
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    padding: 15px 50px;
}

/* 主頁最上層 */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1; /* 確保圖片在文字後方 */
    transform: scale(1.05);
}

.overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0,0,0,.45), rgba(0,0,0,.20));
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 10;
    width: min(900px, 90%);
    color: white;
    opacity: 0; /* 配合 JS 動態淡入 */
}

/* 按鈕樣式維持您的設定，但確保 class 名稱對應 */
.primary {
    padding: 18px 40px; border: none; border-radius: 50px;
    background: white; color: black; font-size: 17px; cursor: pointer; transition: .35s;
}
.primary:hover { transform: translateY(-5px); box-shadow: 0 20px 40px rgba(255,255,255,.25); }

.secondary {
    padding: 18px 40px; border: 1px solid white; border-radius: 50px;
    background: transparent; color: white; font-size: 17px; cursor: pointer; transition: .35s;
}
.secondary:hover { background: white; color: black; }

/* 精選案例區塊容器 */
.portfolio {
    padding: 80px 10%;
    text-align: center;
}

.portfolio h2 {
    margin-bottom: 40px;
    font-size: 28px;
    letter-spacing: 2px;
}

/* 圖片網格設定 */
.portfolio .gallery {
    display: flex;          /* 使用 Flexbox 排列 */
    justify-content: center; /* 居中對齊 */
    gap: 20px;              /* 圖片之間的間距 */
}

/* 每一張照片的容器 */
.portfolio .photo {
    flex: 1;                /* 平分寬度 */
    overflow: hidden;       /* 確保圖片放大時不會超出範圍 */
    border-radius: 8px;     /* 圓角（選用） */
    aspect-ratio: 4 / 3;    /* 強制設定照片比例為 4:3，這樣三張圖才會等高 */
}

/* 照片本身 */
.portfolio .photo img {
    width: 100%;            /* 寬度撐滿父容器 */
    height: 100%;           /* 高度撐滿父容器 */
    object-fit: cover;      /* 自動裁切多餘部分，確保不變形 */
    transition: transform 0.5s ease; /* 滑鼠移入時的放大動畫 */
    cursor: pointer;
}

/* 滑鼠移入放大效果 */
.portfolio .photo img:hover {
    transform: scale(1.1);
}

/* 手機版適應：當螢幕寬度小於 768px 時，改為垂直排列 */
@media (max-width: 768px) {
    .portfolio .gallery {
        flex-direction: column; /* 改為單欄垂直排列 */
    }
    
    .portfolio .photo {
        aspect-ratio: auto;    /* 手機版取消比例限制 */
        height: 250px;         /* 固定高度 */
    }
}
/* 簡單幫下方區塊加點間距 */
section { padding: 80px 10%; text-align: center; }
.cards { display: flex; justify-content: center; gap: 20px; margin-top: 40px; }
.card { border: 1px solid #eee; padding: 30px; border-radius: 10px; flex: 1; }

/* 聯絡表單容器 */
.contact form {
    display: flex;
    flex-direction: column; /* 垂直排列 */
    align-items: center;    /* 居中對齊 */
    gap: 15px;             /* 欄位之間的間距 */
    max-width: 500px;      /* 限制表單最大寬度 */
    margin: 40px auto;     /* 居中並與上方標題保持距離 */
}

/* 統一設定 input 和 textarea 的外觀 */
.contact form input, 
.contact form textarea {
    width: 100%;           /* 寬度撐滿父容器，達成同寬 */
    height: 50px;          /* 統一高度，達成同高 */
    padding: 12px 20px;    /* 內邊距 */
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;    /* 圓角 */
    background-color: #f9f9f9;
    
    /* 關鍵屬性：確保 padding 不會撐大寬度 */
    box-sizing: border-box; 
    
    outline: none;
    transition: border-color 0.3s;
}

/* 針對 textarea 的額外處理 */
.contact form textarea {
    resize: none;          /* 禁用右下角的拉伸箭頭，維持固定高度 */
    line-height: 26px;     /* 調整文字行高，避免文字太靠頂部 */
    overflow: hidden;      /* 隱藏滾動條（因為高度很短） */
}

/* 焦點狀態（點擊時變色） */
.contact form input:focus, 
.contact form textarea:focus {
    border-color: #000;
    background-color: #fff;
}

/* 修正按鈕寬度與欄位一致 */
.contact form button {
    width: 100%;           /* 按鈕也跟欄位一樣寬 */
    padding: 15px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: 0.3s;
}

.contact form button:hover {
    background: #333;
}
/* 服務項目區域容器 */
.service {
    padding: 80px 10%;
    background-color: #ffffff;
    text-align: center;
}

.service h2 {
    font-size: 32px;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.section-desc {
    color: #888;
    margin-bottom: 40px;
    font-size: 14px;
}

/* 卡片按鈕容器排列 */
.cards {
    display: grid;
    /* 在大螢幕顯示 4 欄，中螢幕 2 欄，手機 1 欄 */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* 按鈕本體樣式 */
.card-btn {
    background: #f8f8f8;
    border: 1px solid #eee;
    padding: 40px 30px;
    border-radius: 15px;
    cursor: pointer;
    text-align: left; /* 文字靠左比較像現代設計 */
    
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
}

/* 標題與副標題 */
.card-btn h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: #333;
    transition: 0.3s;
}

.card-btn p {
    font-size: 14px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 右下角箭頭 */
.arrow {
    margin-top: 30px;
    font-size: 24px;
    color: #ccc;
    transition: 0.3s;
}

/* --- 懸停效果 (Hover Effect) --- */

.card-btn:hover {
    background-color: #000; /* 變成黑色背景 */
    border-color: #000;
    transform: translateY(-10px); /* 向上浮起 */
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

/* 懸停時文字變白色 */
.card-btn:hover h3 {
    color: #fff;
}

.card-btn:hover p {
    color: #bbb;
}

.card-btn:hover .arrow {
    color: #fff;
    transform: translateX(10px); /* 箭頭往右滑動 */
}
/* 去除超連結的預設樣式 */
.card-btn {
    text-decoration: none !important; /* 強制去掉底線 (藍線) */
    color: inherit;                  /* 讓文字顏色繼承原本設定，不要變藍色 */
    display: flex;                   /* 確保佈局不會跑掉 */
    outline: none;                   /* 去掉點擊時的虛線框 */
}

/* 針對卡片內的標題與文字也要確保沒有底線 */
.card-btn h3, 
.card-btn p {
    text-decoration: none;
}
/* 點擊時的縮放感 */
.card-btn:active {
    transform: translateY(-5px) scale(0.98);
}
/* 聯絡區域樣式 */
.contact {
    padding: 100px 10%;
    text-align: center;
    background-color: #fcfcfc;
}

.contact-desc {
    color: #888;
    margin-bottom: 50px;
}

.contact-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap; /* 手機版會自動換行 */
}

/* 聯絡卡片本體 */
.contact-card {
    background: white;
    border: 1px solid #eee;
    padding: 40px;
    border-radius: 15px;
    text-decoration: none;
    color: #333;
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contact-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
    border-color: #000;
}

.contact-icon {
    font-size: 40px;
    margin-bottom: 20px;
}

.contact-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.contact-card p {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
}

.contact-action {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 2px solid #000;
    padding-bottom: 5px;
    transition: 0.3s;
}

.contact-card:hover .contact-action {
    background: #000;
    color: #fff;
    padding: 5px 15px;
    border-radius: 5px;
}

/* 公司下方小字 */
.company-info {
    margin-top: 60px;
    color: #999;
    font-size: 14px;
    line-height: 2;
}

@media (max-width: 768px) {
    .contact-container {
        flex-direction: column;
        align-items: center;
    }
}