@charset "utf-8";

:root {
    --gallery-width: 62%;
    --main-image-width: 800px;
    /* 定義 main-image 的最大寬度 */
    --thumbnail-scale: 0.1;
    /* 縮放比例 */
    --thumbnail-min-size: 3.5rem;
    /* 最小尺寸 */
}

/* CSS Document */
.product_detail main .all {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
}

    .product_detail main .all > .content {
        width: 100%;
        margin: 0 auto;
        position: relative;
    }

.product_detail_block {
    width: 100%;
    position: relative;
}

.product_detail .gallery_block {
    width: var(--gallery-width);
    max-width: 800px;
    margin-bottom: var(--block-margins-m);
}

.product_detail main .all .right_block {
    position: sticky;
    top: 15%;
    z-index: 99;
    width: 100%;
}


.product_detail main .all .info_block {
    top: 0;
    right: 0;
    min-height: 600px;
    width: 33%;
    max-width: 440px;
    border: 1px solid var(--blue);
    padding: var(--block-margins-s) var(--block-margins-m);
    display: flex;
    gap: var(--block-margins-ss);
    flex-direction: column;
    transition: top 0.3s ease-in-out;
    /* 增加平滑效果 */
    position: absolute;
    /* top: initial; */
    right: 0;
    background-color: #ffffff;
    z-index: 5;
}

    .product_detail main .all .info_block > .btn_block {
        position: absolute;
        right: -1px;
        bottom: calc(clamp(4.3rem,6vw, 4.8rem)* -1);
        justify-content: flex-end;
    }

        .product_detail main .all .info_block > .btn_block .btn {
            width: clamp(130px,40%,150px);
            font-size: calc( var(--normal-btn-size) * 0.9);
            line-height: 1;
            /* color: var(--blue); */
            font-weight: 500;
        }

    .product_detail main .all .info_block.end {
        transform: translateY(-100%);
    }


    .product_detail main .all .info_block > div {
        width: 100%;
    }

.product_detail .info_block .first_block .name,
.product_detail .info_block .second_block .price,
.product_detail .info_block .third_block .total_box {
    font-weight: var(--bold-font);
    font-size: var(--normal-btn-size);
    position: relative;
    padding-bottom: 1rem;
}

    .product_detail .info_block .first_block .name::after,
    .product_detail main .bottom_block article h1::after {
        content: "";
        width: 100%;
        bottom: 0;
        left: 0;
        height: 1px;
        background-color: var(--gray04);
        position: absolute;
    }

.product_detail main .bottom_block article h1::after {
    transform: translateY(0.7rem);
}

.product_detail .info_block .second_block {
    flex-grow: 1;
    /* 讓它自動填滿剩餘空間 */
}

    /* .product_detail .info_block .second_block>div {
    margin-bottom: 0.5rem;
} */

    .product_detail .info_block .second_block .price {
        padding-bottom: 0;
    }

.product_detail .info_block .third_block {
    width: 100%;
}

    .product_detail .info_block .third_block .total_box {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

.product_detail .info_block > .third_block > .btn_block {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

    .product_detail .info_block > .third_block > .btn_block .btn_box {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
    }

.third_block .btn_block .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: calc((var(--block-margins-ss)) * 1.8) calc((var(--block-margins-ss)) * 1.2);
    gap: calc((var(--block-margins-ss)) * 0.5);
    margin-bottom: calc((var(--block-margins-ss)) *0.8);
    ;
    line-height: 1;
}

    .third_block .btn_block .btn:last-child {
        margin-bottom: 0;
    }

.product_detail .info_block .third_block .btn_block > .cart_option_wrapper {
    width: 100%;
    max-width: 350px;
    padding: clamp(1rem, 2.5vw, 2.5rem) clamp(0.5rem, 1vw, 1rem) clamp(1rem, 1.5vw, 1.5rem);
    position: absolute;
    bottom: 110%;
    /* 讓 cart_option_box 的底部貼齊 .btn_block 的頂部 */
    left: 0;
    background-color: #fff;
    border-radius: var(--border-radius-m);
    filter: drop-shadow(var(--box-shadow-light-form));
    border: var(--border-style);
    text-align: center;
    display: none;
}

    /* .product_detail .info_block .third_block .btn_block>.cart_option_wrapper.confirm{
    display: none; 
} */
    .product_detail .info_block .third_block .btn_block > .cart_option_wrapper .cart_option_box::after {
        content: "";
        position: absolute;
        bottom: -1.8rem;
        /* 調整這個值來控制三角形的距離 */
        left: 50%;
        transform: translateX(-50%);
        border-width: 15px;
        /* 調整大小 */
        border-style: solid;
        border-color: #ffffff transparent transparent transparent;
        /* 三角形顏色 (白色) */
        z-index: 3;
    }

.product_detail .info_block .third_block .btn_block .cart_option_wrapper .cart_option_box .btn_block {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: clamp(0.5rem, 1vw, 0.8rem);
    flex-wrap: wrap;
}

.product_detail .info_block .third_block .btn_block .cart_option_wrapper.confirm .cart_option_box .btn_block {
    flex-wrap: nowrap;
}

.product_detail .info_block .third_block .btn_block .cart_option_wrapper .cart_option_box p span {
    display: inline-block;
}

.product_detail .info_block .third_block .btn_block .cart_option_wrapper .cart_option_box p {
    margin-bottom: var(--block-margins-m);
}

.product_detail .info_block .third_block .btn_block .btn_x {
    width: 1.3rem;
    height: 1.3rem;
    position: absolute;
    right: 0.25rem;
    top: 0.25rem;
    cursor: pointer;
    transform-origin: 50% 50%;
    transition: transform 0.3s ease-in-out;
    /* 確保 transform 有 transition 效果 */
}

    .product_detail .info_block .third_block .btn_block .btn_x svg {
        mask-image: url(../../images/svg/close.svg);
        mask-size: 100% 100%;
        background-color: var(--gray02);
    }

.product_detail .info_block .third_block > .btn_block > .btn > a {
    padding: 0.8rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.product_detail .info_block .third_block .btn_block .cart_option_wrapper .cart_option_box .btn_block a {
    padding: 0.5rem 0;
}

.product_detail .info_block .third_block .btn_block .cart_option_wrapper .cart_option_box .btn_block > .btn {
    width: 100%;
    max-width: 150px;
    margin-bottom: 0;
}

.third_block .btn_box .btn {
    background-repeat: no-repeat, no-repeat;
    background-position: calc(47% - 3rem) center, center;
    background-size: 25px 25px, cover;
    padding-left: clamp(3rem, 15vh, 15%);
    line-height: 1;
    display: inline-block;
    color: white;
    text-align: center;
    border: none;
    cursor: pointer;
}

/* 加入 icon + 漸層，使用多層背景寫法 */
.third_block .btn_block .btn.add_to_cart {
    background-image: url(../images/svg/cart_solid.svg), var(--gold-gradient);
    background-repeat: no-repeat, no-repeat;
}

.third_block .btn_block .btn.quick_buy {
    background-image: url(../images/svg/quick_buy.svg), var(--red-gradient);
    background-repeat: no-repeat, no-repeat;
}

.third_block .btn_block .btn.quick_gift {
    background-image: url(../images/svg/gift.svg), var(--blue-gradient);
    background-repeat: no-repeat, no-repeat;
}


/* .third_block .btn_box .btn::before {
    content: "";
    display: inline-block;
    aspect-ratio: 1 / 1;
    max-width: 27px;
    width: 100%;
    background-color: currentColor; /* 可讓 icon 顏色跟文字一致 

    mask-size: 100% 100%;
    mask-repeat: no-repeat;
    mask-position: center;

    -webkit-mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
} */
/* .third_block .btn_block .btn.add_to_cart::before {
    mask-image: url(../images/svg/cart_solid.svg);
    -webkit-mask-image: url(../images/svg/cart_solid.svg);
}

.third_block .btn_block .btn.quick_buy::before {
    mask-image: url(../images/svg/quick_buy.svg);
    -webkit-mask-image: url(../images/svg/quick_buy.svg);
}

.third_block .btn_block .btn.quick_gift::before {
    mask-image: url(../images/svg/gift.svg);
    -webkit-mask-image: url(../images/svg/gift.svg);
} */


/* .third_block .btn_block .btn.add_to_cart {
    background: var(--gold-gradient);
} */

/* .third_block .btn_block .btn.quick_buy, */
.product_detail .info_block .third_block .btn_block .cart_option_wrapper .cart_option_box .btn_block .btn.myself {
    background: var(--red-gradient);
}

/* .third_block .btn_block .btn.quick_gift, */
.product_detail .info_block .third_block .btn_block .cart_option_wrapper .cart_option_box .btn_block .btn.friend {
    background: var(--blue-gradient);
}



.product_detail .bottom_block {
    width: var(--gallery-width);
    /*寬度和商品大圖同步變化*/

    max-width: 800px;
    margin-right: auto;
}

.product_detail main .all > .content .header .bread_crumbs {
    justify-content: flex-start;
}


/*商品相簿*/
main .all .product-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
}

main .all .main-image {
    width: 100%;
    max-width: var(--main-image-width);
    aspect-ratio: 4 / 3;
    position: relative;
    overflow: hidden;
}

    main .all .main-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        position: absolute;
        top: 0;
        left: 0;
    }

main .all .thumbnails {
    margin-top: 10px;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-right: auto;
}

    main .all .thumbnails img {
        width: calc(max(var(--thumbnail-min-size), min(var(--main-image-width) * var(--thumbnail-scale), 100vw * var(--thumbnail-scale))));
        aspect-ratio: 4 / 3;
        cursor: pointer;
        border: 2px solid transparent;
        transition: border-color 0.3s ease-in-out;
    }


/* 播放按鈕 */
.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: clamp(2rem, 4vw, 4rem);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    width: clamp(4rem, 6vw, 7rem);
    aspect-ratio: 1 / 1;
}



.video-frame {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

@media (hover) {
    .video-play-button:hover {
        background: rgba(0, 0, 0, 0.8);
    }

    .thumbnails img:hover {
        border-color: var(--blue);
    }

    .product_detail .info_block .third_block .btn_block .btn_x:hover {
        transform: rotate(90deg);
    }
}


/*商品介紹圖片單欄雙欄設定*/
/* 預設單欄 */
.product_detail main .bottom_block article {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    background: var(--gray05);
    padding: calc(var(--block-margins-m) * 0.9);
}

    .product_detail main .bottom_block article div {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: var(--img-gap);
        --img-gap: 1rem;
    }

    .product_detail main .bottom_block article figure {
        width: 100%;
        margin: var(--block-margins-ss) 0;
    }

        .product_detail main .bottom_block article figure img {
            width: 100%;
            height: auto;
            display: block;
        }


        /* 預設 row2 雙欄排版 */
        .product_detail main .bottom_block article figure.row2 {
            width: calc(50% - var(--img-gap) * 0.5);
        }

            /* 如果 .row2 只有 1 個，讓它變 100% */
            .product_detail main .bottom_block article figure.row2:only-of-type {
                width: 100%;
            }

            /* 如果有奇數個 .row2，讓最後一個 .row2 變成 100% */
            .product_detail main .bottom_block article figure.row2:last-of-type:nth-child(even) {
                width: 100%;
            }

    .product_detail main .bottom_block article h1,
    .product_detail main .bottom_block article h2 {
        width: 100%;
    }

    .product_detail main .bottom_block article h1 {
        display: flex;
        align-items: center;
        font-size: var(--normal-btn-size);
        font-weight: var(--bold-font);
        position: relative;
        margin: var(--block-margins-ss) 0;
    }

    .product_detail main .bottom_block article hr {
        width: 100%;
        background-color: var(--gray04);
        height: 1px;
    }

    .product_detail main .bottom_block article h1::before {
        content: "";
        display: inline-block;
        width: 30px;
        /* 調整圖片寬度 */
        background-color: var(--gray01);
        aspect-ratio: 1/1;
        mask-image: url("../../images/svg/header/02-5_guide.svg");
        mask-repeat: no-repeat;
        mask-position: center;
        mask-size: contain;
        margin-right: 4px;
        /* 控制圖片與文字的間距 */
        vertical-align: middle;
        /* 確保與文字對齊 */
    }

    .product_detail main .bottom_block article h2 {
        margin: 0.5rem 0;
        font-weight: var(--bold-font);
    }

    .product_detail main .bottom_block article ul {
        width: 100%;
        margin: 3% 0;
    }

        .product_detail main .bottom_block article p,
        .product_detail main .bottom_block article ul li {
            line-height: var(--line-height-p);
            text-align: justify;
            margin-bottom: 0.8rem;
        }

        .product_detail main .bottom_block article ul li {
            width: 100%;
            display: flex;
            align-items: baseline;
            gap: 0.3rem;
        }

            .product_detail main .bottom_block article ul li span {
                flex: 0.95;
            }

            .product_detail main .bottom_block article ul li::before {
                content: "";
                display: block;
                width: 2%;
                max-width: 10px;
                min-width: 8px;
                background-color: var(--gray01);
                aspect-ratio: 1/1;
                mask-image: url("../../images/svg/star.svg");
                mask-repeat: no-repeat;
                mask-position: center;
                mask-size: contain;
            }

    .product_detail main .bottom_block article figure {
        width: 100%;
        z-index: 0;
        position: relative;
        background: #fff;
        box-shadow: var(--box-shadow-light-form);
    }

        .product_detail main .bottom_block article figure figcaption {
            margin: clamp(0.3rem, 0.5vw, 0.35rem) auto clamp(0.55rem, 1.1vw, 0.65rem);
            text-align: center;
        }

    /* 商品介紹表格 */
    /* 基本表格設定 */
    .product_detail main .bottom_block article table {
        width: 100%;
        border-collapse: collapse;
        border: 1px solid var(--gray04);
    }

    .product_detail main .bottom_block article th,
    .product_detail main .bottom_block article td {
        /* border: 1px solid #ddd; */
        padding: 8px;
        text-align: center;
        background: #fff;
    }

    .product_detail main .bottom_block article th {
        background-color: var(--gray04);
        font-weight: 500;
    }

@media (max-width: 1350px) {
    .product_detail main .all > .content {
        width: 90%;
    }

    .product_detail main .all .info_block {
        min-height: 500px;
    }
}

@media (max-width: 1200px) {
    .third_block .btn_box .btn {
        background-position: calc(50% - 3rem) center, center;
        padding-left: clamp(3rem, 15vh, 15%);
    }

    .product_detail main .bottom_block article table,
    .product_detail main .bottom_block article thead,
    .product_detail main .bottom_block article tbody,
    .product_detail main .bottom_block article tr,
    .product_detail main .bottom_block article th,
    .product_detail main .bottom_block article td {
        display: block;
        width: 100%;
    }

    .product_detail main .bottom_block article thead {
        display: none;
        /* 隱藏表頭 */
    }

    /* tbody 設為 grid */
    .product_detail main .bottom_block article tbody {
        width: 100%;
    }

        .product_detail main .bottom_block article tbody tr {
            background: #fff;
            align-items: baseline;
        }

        /* 設定奇數行的背景顏色 */
        .product_detail main .bottom_block article tbody td:nth-of-type(odd) {
            background: var(--gray04);
        }

        .product_detail main .bottom_block article tbody td {
            display: flex;
            align-items: baseline;
            text-align: left;
            padding: 0;
            border: none;
            position: relative;
            border-bottom: 1px solid #fff;
        }

            .product_detail main .bottom_block article tbody td::before {
                content: attr(data-label);
                /* 用 data-label 顯示標題 */
                font-weight: 500;
                text-align: left;
                padding: 0.5rem;
                min-width: 80px;
                margin-right: 0.5rem;
                white-space: nowrap;
                /* 避免換行 */
                flex-shrink: 0;
            }

            .product_detail main .bottom_block article tbody td span {
                flex-grow: 1;
                /* 讓內容區域填滿剩餘空間 */
                min-width: 0;
                /* 讓內容區域能夠縮小，避免溢出 */
                padding-left: 0.5rem;
                /* 內容區域與標題的間距 */
            }

    /* tbody td::before {
        content: attr(data-label);
        font-weight: 500;
        text-align: left;
        padding: 0.5rem;
        margin-right: 0.5rem;
    
        display: inline-block;
        min-width: 20%;
        width: max-content;
        flex-shrink: 0;
    }
    
    tbody td span {
        flex-grow: 1;
        min-width: 0;
    } */

}

@media (max-width: 900px) {
    :root {
        --gallery-width: 100%;
    }

    .product_detail main .all > .content {
        width: 90%;
        margin: 0 auto;
    }

    .product_detail main .all {
        flex-direction: column;
    }

    .product_detail_block {
        display: flex;
        flex-direction: column;
    }

    .product_detail .gallery_block {
        order: 1;
    }

    .product_detail main .all .right_block {
        order: 2;
        position: relative;
    }

    .product_detail .bottom_block {
        order: 3;
        margin-top: clamp(3rem,6vw, 3.6rem);
    }

    .product_detail .info_block {
        max-width: 100%;
    }

        .product_detail .info_block .third_block .btn_block .btn_box {
            display: flex;
            flex-direction: row;
            gap: 0.7rem;
        }

        .product_detail .info_block .third_block .btn_block .btn {
            margin-bottom: 0;
        }

    .product_detail main .all .info_block {
        float: none;
        /* padding:clamp( 2rem,3vw,3rem); */
        width: 100%;
        min-height: fit-content;
        max-width: 800px;
        margin: 1rem auto;
        position: static;
        right: auto;
    }

        .product_detail main .all .info_block > .btn_block {
            bottom: calc(clamp(3.2rem, 6.5vw, 4rem) * -1);
        }

            .product_detail main .all .info_block > .btn_block .btn {
                padding-top: calc( var(--block-margins-ss)*0.5);
                padding-bottom: calc( var(--block-margins-ss)*0.5);
            }

    .product_detail .info_block .third_block .btn_block > .cart_option_wrapper {
        bottom: 130%;
        left: -10%;
    }

    .third_block .btn_box .btn {
        background-position: calc(50% - 3rem) center, center;
        padding-left: clamp(2.5rem, 1vw, 1%);
    }
}

@media (max-width: 768px) {
    .product_detail .info_block.fixed {
        position: static;
        /* 小螢幕時恢復正常流 */
    }
}

/* RWD：小於 600px 時全部變單欄 */
@media (max-width: 600px) {
    /* .product_detail  main .bottom_block article {
        display: block;
    } */

    .product_detail main .bottom_block article figure {
        width: 100% !important;
    }
}

@media (max-width: 570px) {
    .product_detail .info_block > .third_block > .btn_block .btn_box {
        flex-direction: column;
    }

    .product_detail .info_block .third_block .btn_block > .cart_option_wrapper {
        position: absolute;
        max-width: 400px;
        bottom: 115%;
        left: 50%;
        transform: translateX(-50%);
    }

    .product_detail main .all .info_block > .btn_block {
        justify-content: center;
    }

    .third_block .btn_block .btn {
        line-height: 1.5;
    }
}

@media (max-width: 530px) {
    .product_detail .info_block .third_block .btn_block {
        /* flex-direction: column; */
        gap: 0;
    }
}

@media (max-width: 400px) {

    .product_detail main .all > .content {
        width: 92%;
        margin: 0 auto;
    }


    /* 小螢幕時，表格改為直式顯示 */
    /* table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
        width: 100%; 
    }

    thead {
        display: none; 
    }

    tbody tr {
        border: 1px solid #ddd;
        background: #fff;
    }

    tbody td {
        text-align: center; margin: 0 auto;
        border: none;  padding: 0.3rem 0;
    }
    tbody td:first-of-type{ padding: 0;}
    tbody td:nth-of-type(odd) {
        background: none;
    }
    tbody td::before {
        width: 100%;
        text-align: center;
        content: attr(data-label);
        display: block;
        background: var(--gray04);
        padding: 0.5rem 0;
        margin-bottom: 0.4rem;
    } */
}

@media (max-width: 300px) {
    .third_block .btn_box .btn {
        background-position: calc(50% - 2.5rem) center, center;
        padding-left: clamp(2.5rem, 1vw, 1%);
    }
}
