/*

カスタム投稿タイプ　商品一覧(product)　テンプレート
CSS
*/

.category-product-wrapper {
    display: flex;
    justify-content: space-between;
    padding: 60px 0;
}

.product-list {
    max-width: 70%;
    width: 100%;
}

.category-sidebar {
    max-width: 25%;
    width: 100%;
}

ul.custom-post-list li {
    width: 29.7%;
}

ul.custom-post-list {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
}

h2.product-taxonomy-title {
    text-align: center;
    margin-bottom: 34px;
    background: #ccc;
    color: #fff;
    line-height: 1;
    padding: 5px 0 8px;
    font-size: 20px;
}

.product-thumbnail img {
    object-fit: cover;
    object-position: center;
    width: 100%;
    height: 220px;
}

.category-section {
    margin-bottom: 78px;
}

.more-button a {
    border: 1px solid;
    max-width: 350px;
    text-align: center;
    font-size: 16px;
    line-height: 1;
    padding: 23px 0;
    margin: 34px auto 0;
    display: block;
}

h2.side-cate-title {
    text-align: center;
    border-bottom: 1px solid;
    font-size: 20px;
    background: #ccc;
    color: #fff;
    line-height: 1;
    padding: 6px 0 9px;
}

ul.product-categories li a {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid;
    position: relative;
    transition: .6s;
}

ul.child-categories {
    border-bottom: 1px solid;
}

ul.child-categories li a {
    font-size: 15px;
    padding: 9px 0 10px 16px;
    border-bottom: 1px solid #ccc;
}

ul.product-categories li a:hover:after {
    right: 15px;
}

ul.product-categories li a:hover {
    background: #ededed;
}

ul.product-categories li a:after {
    content: '';
    width: 5px;
    height: 5px;
    border: 0;
    border-top: solid 1px #111;
    border-right: solid 1px #111;
    transform: rotate(45deg);
    position: absolute;
    top: 0;
    right: 20px;
    bottom: 0;
    margin: auto;
    transition: .6s;
}

.back-to-archive {
    max-width: fit-content;
    margin: 80px auto 0;
}

.back-to-archive a {
    text-align: center;
    text-decoration: underline;
    font-size: 14px;
}

.post-category-name {
    background: #ccc;
    color: #fff;
    max-width: 150px;
    text-align: center;
    font-size: 14px;
    line-height: 1;
    padding: 7px 0;
    margin-bottom: 6px;
}

h1.entry-title {
    padding: 13px 0;
    border-bottom: 1px solid;
    margin-bottom: 18px;
}

.post-price {
    max-width: fit-content;
    margin: 0 0 30px auto;
    font-size: 20px;
}

.post-description {
    margin-bottom: 25px;
}

h3.tyui-title {
    font-size: 16px;
    margin-bottom: 7px;
    font-weight: bold;
}

.post-notes {
    background: #ededed;
    padding: 14px 16px;
}

.product-list .post-thumbnail.post-thumbnail-single img {
    height: auto;
}

ul.custom-post-list.sh-custom-post-list .product-thumbnail img {
    height: 300px;
}

.gallery_inner {
    max-width: 1000px;
    margin: 0 auto;
    padding-bottom: 200px;
    padding-top: 50px;
}

/* --- タブボタンのスタイル --- */
.product-filter-nav {
    display: flex;
    max-width: initial !important;
    justify-content: center !important;
    gap: 3%;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-btn {
    display: block !important;
    font-size: 16px !important;
    font-family: "DM Sans", "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    font-weight: 200;
    letter-spacing: var(--base-font-spacing);
    width: 140px !important;
    padding: 8px 0;
    color: var(--main-color) !important;
    background-color: rgb(255, 255, 255, .2) !important;
    border: 1px solid rgb(62, 45, 26, .2) !important;
    border-radius: 2em;
    text-align: center;
    line-height: 1;
    cursor: pointer;
    transition: .3s;
}

.filter-btn.active,
.filter-btn:hover,
#more-btn:hover {
    background: transparent !important;
    transition: .3s;
}

/* --- AJAXで読み込まれる画像のスタイル（既存を流用） --- */
.gallery_inner {
    padding-top: 50px;
    padding-bottom: 200px;
}

/* WordPressグループブロックの内側 */
.gallery_inner>.wp-block-group__inner-container {
    width: calc(100vw - 120px) !important;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

/* ギャラリー一覧 */
#gallery-container {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 100px;
    width: 100%;
    max-width: none !important;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* ここ大事：前のflex用widthを打ち消す */
#gallery-container>li {
    width: auto !important;
    max-width: none !important;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* サムネイルリンク */
#gallery-container .open-modal {
    display: block;
    width: 100%;
    overflow: hidden;
}

/* サムネイル枠 */
#gallery-container .product-thumbnail {
    width: 100%;
    aspect-ratio: 269 / 328;
    overflow: hidden;
}

/* サムネイル画像だけに適用 */
#gallery-container .product-thumbnail img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
    object-position: center;
    display: block;
}

.more-button {
    text-align: center;
    margin-top: 100px;
}

#more-btn {
    position: relative;
    font-size: 16px !important;
    font-family: "DM Sans", "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    font-weight: 200;
    width: 130px;
    padding: 10px 0;
    font-size: 15px;
    color: var(--main-color);
    background-color: rgb(255, 255, 255, .2);
    border: 1px solid rgb(62, 45, 26, .3);
    letter-spacing: 0.1em;
    border-radius: 2em;
    text-align: center !important;
    justify-content: center;
    line-height: 1;
    cursor: pointer;
    transition: .3s;
}

#more-btn::after {
    position: absolute;
    top: 50%;
    right: 20px;
    content: "";
    width: 0.3em;
    height: 0.3em;
    border-top: 1px solid rgb(62, 45, 26, .3);
    border-right: 1px solid rgb(62, 45, 26, .3);
    transform: rotate(45deg) translateY(-50%);
}

/* モーダル本体（gallery-modalという名前に変更） */
.gallery-modal {
    position: fixed !important;
    z-index: 999999 !important;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.gallery-modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* 画像を囲むコンテナ */
.gallery-modal-inner {
    position: relative;
    background: #f4d8cd;
    width: 90%;
    max-width: 800px;
    /* ★ここで画像表示の最大サイズを制御 */
    max-height: 90vh;
    padding: 40px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ★画像自体のサイズ制限（これで大きすぎるのを防ぐ） */
.gallery-modal-inner img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    /* アスペクト比を維持 */
}

/* ×閉じるボタン（右上固定） */
.close-modal-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-family: "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
    font-size: 30px;
    color: var(--border-color) !important;
    cursor: pointer;
    line-height: 1;
}

.gallery-reveal-target.diagonal-reveal {
    --reveal-delay: 0s;

    opacity: 0;

    border: 1px solid var(--border-color);
    box-sizing: border-box;
    overflow: hidden;

    -webkit-mask-image: linear-gradient(to bottom right,
            #000 0%,
            #000 35%,
            rgba(0, 0, 0, 0.65) 48%,
            rgba(0, 0, 0, 0.25) 58%,
            transparent 72%,
            transparent 100%);
    mask-image: linear-gradient(to bottom right,
            #000 0%,
            #000 35%,
            rgba(0, 0, 0, 0.65) 48%,
            rgba(0, 0, 0, 0.25) 58%,
            transparent 72%,
            transparent 100%);

    -webkit-mask-size: 260% 260%;
    mask-size: 260% 260%;

    -webkit-mask-position: 100% 100%;
    mask-position: 100% 100%;

    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;

    transition:
        opacity 2.5s ease,
        transform 3.8s cubic-bezier(0.22, 1, 0.36, 1),
        -webkit-mask-position 3.8s cubic-bezier(0.22, 1, 0.36, 1),
        mask-position 3.8s cubic-bezier(0.22, 1, 0.36, 1);

    transition-delay:
        var(--reveal-delay),
        var(--reveal-delay),
        var(--reveal-delay),
        var(--reveal-delay);
}

.gallery-reveal-target.diagonal-reveal.is-revealed {
    opacity: 1;
    transform: translateY(0);

    -webkit-mask-position: 0% 0%;
    mask-position: 0% 0%;
}

/* ==============================

    スマホ・タブレット縦

============================== */

@media screen and (max-width:1100px) {
    .gallery_inner>.wp-block-group__inner-container {
        width: calc(100vw - 120px) !important;
        max-width: 600px;
    }

    #gallery-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-btn,
    #more-btn {
        font-size: 14px !important;
        width: 120px !important;
    }
}

/* ==============================

    スマホ　

============================== */

@media screen and (max-width: 710px) {
    ul.custom-post-list.sh-custom-post-list .product-thumbnail img {
        height: 145px;
    }

    .category-product-wrapper {
        display: block;
        padding: 30px 0 60px;
    }

    .product-list {
        max-width: 100%;
    }

    ul.custom-post-list li {
        width: 47%;
    }

    ul.custom-post-list {
        gap: 20px;
        max-width: 400px;
        margin: auto;
    }

    .product-thumbnail img {
        height: 145px;
    }

    h2.product-taxonomy-title {
        margin-bottom: 31px;
        padding: 5px 0 6px;
        font-size: 18px;
    }

    .more-button a {
        max-width: 230px;
        font-size: 14px;
        margin: 33px auto 0;
        padding: 15px 0;
    }

    .category-section {
        margin-bottom: 50px;
    }

    .category-sidebar {
        max-width: 100%;
    }

    h2.side-cate-title {
        font-size: 16px;
        padding: 5px 0 6px;
    }

    ul.product-categories li a {
        padding: 10px 0;
        font-size: 14px;
    }

    ul.child-categories li a {
        font-size: 13px;
        padding: 7px 0 8px 11px;
    }

    .post-category-name {
        max-width: 130px;
        font-size: 12px;
        padding: 5px 0;
        margin-bottom: 0;
    }

    h1.entry-title {
        padding: 7px 0 12px;
        margin-bottom: 12px;
        font-size: 18px;
    }

    .post-price {
        max-width: fit-content;
        margin: 0 0 17px auto;
        font-size: 17px;
    }

    .post-description {
        margin-bottom: 25px;
        font-size: 14px;
    }

    h3.tyui-title {
        font-size: 14px;
        margin-bottom: 5px;
    }

    .back-to-archive {
        margin: 40px auto 38px;
    }

    .back-to-archive a {
        font-size: 12px;
    }

    .wrap.product-wrap {
        padding-bottom: 40px;
    }

    #gallery-container {
        gap: 60px;
    }

    .product-filter-nav {
        max-width: 300px !important;
        gap: 20px;
    }

    /* 画像を囲むコンテナ */
    .gallery-modal-inner {
        max-height: 70vh;
    }

    /* ★画像自体のサイズ制限（これで大きすぎるのを防ぐ） */
    .gallery-modal-inner img {
        max-height: 60vh;
    }
}

@media screen and (max-width: 500px) {
    .gallery_inner>.wp-block-group__inner-container {
        width: calc(100vw - 60px) !important;
    }

    #gallery-container {
        gap: 40px;
    }
}

/* ==============================

    タブレット縦横

============================== */

@media (max-width: 1650px) and (min-width: 710px) {


    ul.custom-post-list {
        gap: 36px;
    }


    ul.custom-post-list.sh-custom-post-list .product-thumbnail img {
        height: 300px;
    }
}

/* ==============================

    タブレット縦のみ

============================== */

@media (max-width: 1100px) and (min-width: 710px) {
    .product-thumbnail img {
        height: 180px;
    }

    ul.custom-post-list li {
        width: 46%;
    }

    .product-thumbnail img {
        height: 210px;
    }

    .category-sidebar {
        max-width: 26%;
    }

    .more-button a {
        max-width: 300px;
    }
}