.services-section {
    padding: 30px 20px 30px 20px;
    background: #f8fafc;
    contain: layout paint;
}

.services-container {
    max-width: 1300px;
    margin: 0 auto;
}

.services-header {
    text-align: center;
    margin-bottom: 30px;
}

.services-subtitle {
    display: inline-block;
    font-size: 14px;
    letter-spacing: 2px;
    color: #2563eb;
    margin-bottom: 12px;
    font-weight: 600;
}

.services-title {
    font-size: 36px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 16px;
}

.services-desc {
    font-size: 16px;
    color: #6b7280;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

#services {
    background: #f9f9f9;
    padding: 50px 20px;
}

#services h2 {
    text-align: center;
    margin-bottom: 40px;
    color: #007acc;
}

.services {
    display: flex;
    justify-content: space-between;
}

.service-item {
    flex: 1;
    margin: 0 10px;
}

.service-item h3 {
    margin-bottom: 10px;
    color: #007acc;
}

.service-item ul {
    list-style: disc inside;
}

.service-item li {
    margin-bottom: 8px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.service-card {
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid transparent;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    content-visibility: auto;
    contain-intrinsic-size: 300px;
}

.service-card:hover {
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.12);
    border-color: #2563eb;
    transform: translateY(-5px);
}

.service-card:hover .service-image img {
    transform: scale(1.05);
}

.service-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #e5e7eb;
    aspect-ratio: 16/9;
    height: auto;
}

.service-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.service-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 25px;
    border-radius: 50%;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.service-icon span {
    font-size: 36px;
    color: #ffffff;
}

.service-body {
    padding: 30px 26px 36px;
    text-align: center;
}

.service-title {
    font-size: 22px;
    font-weight: 600;
    color: #2563eb;
    margin-bottom: 18px;
}

.service-list {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    width: fit-content;
    text-align: left;
}

.service-list li {
    position: relative;
    padding-left: 14px;
}

.service-list li::before {
    content: "•";
    position: absolute;
    left: 0;
}

.hero-services-wrapper {
    background: linear-gradient(180deg,
            #f8fafc 0%,
            #f8fafc 60%,
            #ffffff 100%);
}

.expertise-section {
    padding: 30px 20px;
    background-color: #f9f9f9;
}

.expertise-container {
    max-width: 1200px;
    margin: 0 auto;
}

.expertise-header {
    text-align: center;
    margin-bottom: 50px;
}

.expertise-subtitle {
    display: inline-block;
    font-size: 14px;
    letter-spacing: 2px;
    color: #2563eb;
    margin-bottom: 12px;
    font-weight: 600;
}

.expertise-title {
    font-size: 36px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 16px;
}

.expertise-desc {
    font-size: 16px;
    color: #6b7280;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.expertise-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.expertise-card {
    background-color: #fff;
    padding: 30px 25px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    content-visibility: auto;
    contain-intrinsic-size: 300px;
}

.expertise-card.fade-in-element {
    opacity: 0;
    transform: translateY(20px);
}

.expertise-card.fade-in-visible {
    animation: fadeInUp 0.8s ease forwards;
}

.expertise-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid transparent;
}

.expertise-title-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.expertise-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 28px;
}

.expertise-card h3.expertise-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.expertise-card ul.expertise-list {
    list-style: disc inside;
    padding-left: 0;
    margin: 0 auto;
    width: fit-content;
    color: #555;
}

.expertise-card ul.expertise-list li {
    list-style: none;
    padding-left: 0;
    margin: 0;
    color: #555;
    font-weight: 400;
}

.expertise-card ul.expertise-list li::before {
    content: "•";
    margin-right: 8px;
}

/* =========================
   Expertise 主題色系
   ========================= */
:root {
    /* 灰（Backend / 穩定） */
    --expertise-gray: #6b7280;

    /* 紅（Frontend / 互動） */
    --expertise-red: #ef4444;

    /* 淺藍（Cloud / 架構） */
    --expertise-sky: #0ea5e9;

    /* 藍（Database / 核心技術） */
    --expertise-blue: #2563eb;

    /* 紫（UX / UI 設計 / 創意） */
    --expertise-purple: #7c3aed;

    /* 綠（QA / 品質） */
    --expertise-green: #22c55e;
}

/* =========================
   Expertise 卡片樣式套色
   ========================= */

/* ---------- Backend (灰) ---------- */
.expertise-card.gray:hover {
    border-color: var(--expertise-gray);
}

.expertise-card.gray .expertise-icon-wrapper {
    border: 2px solid var(--expertise-gray);
    color: var(--expertise-gray);
}

.expertise-card.gray h3.expertise-title {
    color: var(--expertise-gray);
}

.expertise-card.gray ul.expertise-list li::before {
    color: var(--expertise-gray);
}

/* ---------- Frontend (紅) ---------- */
.expertise-card.red:hover {
    border-color: var(--expertise-red);
}

.expertise-card.red .expertise-icon-wrapper {
    border: 2px solid var(--expertise-red);
    color: var(--expertise-red);
}

.expertise-card.red h3.expertise-title {
    color: var(--expertise-red);
}

.expertise-card.red ul.expertise-list li::before {
    color: var(--expertise-red);
}

/* ---------- Cloud (淺藍) ---------- */
.expertise-card.sky:hover {
    border-color: var(--expertise-sky);
}

.expertise-card.sky .expertise-icon-wrapper {
    border: 2px solid var(--expertise-sky);
    color: var(--expertise-sky);
}

.expertise-card.sky h3.expertise-title {
    color: var(--expertise-sky);
}

.expertise-card.sky ul.expertise-list li::before {
    color: var(--expertise-sky);
}

/* ---------- Database (藍) ---------- */
.expertise-card.blue:hover {
    border-color: var(--expertise-blue);
}

.expertise-card.blue .expertise-icon-wrapper {
    border: 2px solid var(--expertise-blue);
    color: var(--expertise-blue);
}

.expertise-card.blue h3.expertise-title {
    color: var(--expertise-blue);
}

.expertise-card.blue ul.expertise-list {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    width: fit-content;
    text-align: left;
}

.expertise-card.blue ul.expertise-list li {
    position: relative;
    padding-left: 14px;
}

.expertise-card.blue ul.expertise-list li::before {
    content: "•";
    position: absolute;
    left: 0;
}

/* ---------- UX / UI Design (紫) ---------- */
.expertise-card.purple:hover {
    border-color: var(--expertise-purple);
}

.expertise-card.purple .expertise-icon-wrapper {
    border: 2px solid var(--expertise-purple);
    color: var(--expertise-purple);
}

.expertise-card.purple h3.expertise-title {
    color: var(--expertise-purple);
}

.expertise-card.purple ul.expertise-list li::before {
    color: var(--expertise-purple);
}

/* ---------- QA / Test Automation (綠) ---------- */
.expertise-card.green:hover {
    border-color: var(--expertise-green);
}

.expertise-card.green .expertise-icon-wrapper {
    border: 2px solid var(--expertise-green);
    color: var(--expertise-green);
}

.expertise-card.green h3.expertise-title {
    color: var(--expertise-green);
}

.expertise-card.green ul.expertise-list li::before {
    color: var(--expertise-green);
}

/* 圖片初始狀態：模糊 + 放大一點 */
.img-blur {
    filter: blur(20px);
    transform: scale(1.05);
    transition:
        filter 0.6s ease,
        transform 0.6s ease;
    will-change: filter, transform;
}

/* 圖片載入完成後 */
.img-blur.is-loaded {
    filter: blur(0);
    transform: scale(1);
}

/* =====================================
   首屏 render 控制（效能關鍵）
===================================== */

/* 非首屏卡片先隱藏 */
.service-card.is-hidden,
.expertise-card.is-hidden {
    display: none;
}

/* 動畫 keyframes */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 576px) {

    /* ===== 區塊整體 ===== */
    .services-section,
    .expertise-section {
        padding: 40px 14px;
    }

    /* ===== 區塊標題 ===== */
    .services-title,
    .expertise-title {
        font-size: 22px;
    }

    .services-desc,
    .expertise-desc {
        font-size: 14.5px;
        line-height: 1.8;
    }

    /* ===== Grid 改為單欄（最重要） ===== */
    .services-grid,
    .expertise-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* =================================
       Services Card 手機優化
    ================================= */

    .service-card {
        border-radius: 16px;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
    }

    /* 手機不需要 hover 位移 */
    .service-card:hover {
        transform: none;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
    }

    /* 圖片高度統一，避免 aspect-ratio 混亂 */
    .service-image {
        aspect-ratio: auto;
        height: 140px;
    }

    .service-body {
        padding: 18px 14px 22px;
        text-align: left;
    }

    .service-title {
        font-size: 17px;
        margin-bottom: 10px;
        text-align: center;

    }

    .service-list li {
        font-size: 14px;
        line-height: 1.6;
        padding: 4px 0 4px 14px;
    }

    /* =================================
       Expertise Card 手機優化
    ================================= */

    .expertise-card {
        padding: 22px 16px;
        border-radius: 14px;
        text-align: left;
    }

    .expertise-title-wrapper {
        margin-bottom: 14px;
    }

    .expertise-icon-wrapper {
        width: 56px;
        height: 56px;
        font-size: 24px;
        margin-bottom: 8px;
    }

    .expertise-card h3.expertise-title {
        font-size: 17px;
    }

    .expertise-card ul.expertise-list li {
        font-size: 14px;
        line-height: 1.6;
        padding: 3px 0;
    }

    /* hover 效果手機關閉 */
    .expertise-card:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    }
}