.banner-section {
    padding-top: 40px;
    padding-bottom: 40px;
}

.banner-container {
    background-image: url('/static/images/banner-2.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: calc(100vh - 500px);
    width: 100%;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    /* margin: 20px auto; */
}

.banner-container::after {
    display: none;
}


.banner-content {
    display: flex;
    width: 100%;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    max-width: 800px;
    z-index: 2;
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(2px);
    padding: 30px;
    border-radius: 10px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 5%;
    height: auto;
}

.banner-content h2 {
    font-size: 40px;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 5px;
}

.banner-content p {
    font-size: 17px;
    font-weight: 500;
    color: #333;
    text-align: left;
    margin-top: 15px;
}

/* 麵包屑 */
.breadcrumb-section {
    padding: 20px 0;
}

.breadcrumb-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.breadcrumb-container ul {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.breadcrumb-container ul li {
    list-style: none;
    position: relative;
    padding-right: 15px;
}

.breadcrumb-container ul li::after {
    content: '/';
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    font-size: 15px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.breadcrumb-container ul li:last-child::after {
    display: none;
}

.breadcrumb-container ul li a {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.breadcrumb-container ul li a:hover {
    color: var(--primary-color);
}


/* 核心產品 */
.product-section {
    padding: 40px 0;
}

.product-heading h2 {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    text-align: left;
    position: relative;
    display: inline-flex;
    width: auto;
    margin-bottom: 12px;
}

.product-wrapper {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 35px;
}

.product-card {
    display: block;
    background-color: #fff;
    border: 1px solid #e7edf3;
    text-decoration: none;
    border-radius: 10px;
    overflow: hidden;
    transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0px 10px rgba(18, 51, 88, .12);
    /* border-color: #d5e2ef; */
}

.product-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-body {
    padding: 18px 18px 20px;
}

.product-body h3 {
    font-size: 26px;
    line-height: 1.28;
    color: #111;
    font-weight: 500;
    margin-bottom: 8px;
}

.product-body p {
    font-size: 15px;
    line-height: 1.7;
    color: #4f5e6e;
    margin-bottom: 14px;
    min-height: 52px;
}

.product-link {
    display: inline-block;
    position: relative;
    font-weight: 500;
    font-size: 14px;
    line-height: 14px;
    color: var(--primary-color);
    padding: 10px 20px;
    border-radius: 5px;
    border: 1px solid var(--primary-color);
    overflow: hidden;
    z-index: 0;
    isolation: isolate;
}

.product-link span {
    position: relative;
    z-index: 1;
    color: inherit;
}

.product-link::after {
    content: '';
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 0px;
    z-index: -1;
    transition: all 0.3s ease;
    transform: scaleX(0);
    transform-origin: left center;
}

.product-card:hover .product-link::after {
    transform: scaleX(1);
}

.product-card:hover .product-link {
    color: #fff;
}


/* 產品分類 */
.category-section {
    padding: 40px 0;
}

.category-header {
    text-align: center;
    margin-bottom: 40px;
}

.category-header h2 {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0px;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e7edf3;
    border-right: 1px solid #e7edf3;
}

.category-item:hover {
    box-shadow: 0 6px 12px rgba(18, 51, 88, .12);
}

@media (min-width: 767px) {

    /* 每列最右：滿列為第 4、8… 格；最後一排不足 4 格時為該排最後一個 */
    .category-item:nth-child(4n),
    .category-item:last-child {
        border-right: none;
    }

    /* 最後一排不要底線（僅一排時整排即為最後一排） */
    .category-item:nth-child(4n + 1):nth-last-child(-n + 4),
    .category-item:nth-child(4n + 1):nth-last-child(-n + 4)~.category-item {
        border-bottom: none;
    }
}

.category-item {
    width: 100%;
    padding: 30px;
    overflow: hidden;
}

.category-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all .3s ease;
}

.category-item:hover img {
    transform: scale(1.03);
}

.category-body {
    margin-top: 20px;
}

.category-body h3 {
    font-size: 20px;
    text-align: center;
    color: #333;
    font-weight: 500;
}

/* ========== 移動端 / 平板：覆蓋 desktop 規則（本檔在 index-M 之後載入，需在此還原 banner 高度與版面） ========== */

@media (max-width: 991px) {
    .banner-section .banner-container {
        height: 75vh;
        min-height: 380px;
    }

    .product-wrapper {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }
}

@media (max-width: 767px) {
    .banner-section {
        padding-top: 0px;
        padding-bottom: 10px;
    }

    .banner-section .banner-container {
        height: min(64vh, 220px);
        min-height: 220px;
        max-height: 440px;
    }


    .banner-section .banner-content {
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
        width: calc(100% - 28px);
        max-width: 36rem;
        padding: 18px 16px;
        box-sizing: border-box;
        background-color: rgba(255, 255, 255, 0.85);
    }

    .banner-section .banner-content h2 {
        font-size: clamp(22px, 5.5vw, 28px);
        line-height: 1.25;
    }

    .banner-section .banner-content p {
        font-size: 14px;
        line-height: 1.65;
        margin-top: 10px;
    }

    .banner-section .breadcrumb-container ul {
        flex-wrap: wrap;
        justify-content: flex-start;
        row-gap: 4px;
    }

    .product-section {
        padding: 24px 0 32px;
    }

    .product-section .product-heading {
        justify-content: flex-start;
        margin-bottom: 16px;
        align-items: flex-start;
    }

    .product-section .product-heading h2 {
        text-align: left;
        font-size: clamp(24px, 6vw, 30px);
    }

    .product-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .product-body {
        padding: 16px 16px 18px;
    }

    .product-body h3 {
        font-size: 19px;
        line-height: 1.35;
    }

    .product-body p {
        font-size: 14px;
        line-height: 1.65;
        min-height: 0;
        margin-bottom: 12px;
    }

    .product-link {
        padding: 10px 18px;
        font-size: 13px;
    }

    .category-section {
        padding: 28px 0;
    }

    .category-header {
        margin-bottom: 20px;
    }

    .category-header h2 {
        font-size: 26px;
    }

    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0px;
    }

    /* 覆蓋桌面四欄的分割線邏輯，改為獨立圓角卡片 */
    .category-item {
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        padding: 14px 12px;
        border-bottom: 1px solid #e7edf3;
        border-right: 1px solid #e7edf3;
    }

    /* 每列最右：滿列為第 4、8… 格；最後一排不足 4 格時為該排最後一個 */
    .category-item:nth-child(2n) {
        border-right: none;
    }

    /* 最後一排不要底線（僅一排時整排即為最後一排） */
    .category-item:nth-child(odd):nth-last-child(-n+2),
    .category-item:nth-child(odd):nth-last-child(-n+2)~.category-item {
        border-bottom: none;
    }

    .category-image {
        flex-shrink: 0;
    }

    .category-section .category-item img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .category-body {
        margin-top: 0;
        flex: 1;
        min-width: 0;
    }

    .category-body h3 {
        font-size: 14px;
        line-height: 1.45;
        text-align: left;
        word-break: break-word;
    }
}

@media (max-width: 420px) {
    .category-grid {
        grid-template-columns: 1fr;
    }

    .banner-section .banner-container {
        min-height: 260px;
        height: min(58vh, 380px);
    }
}