/* ------------------------------------------------
カテゴリー絞り込み：HTMLのdetails/summaryで開閉する
--------------------------------------------------- */
.cm-category-filter__controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

/* 2つの見出しを横並びにし、どちらのパネルも共通の全幅にする。 */
.cm-category-filter__group {
    grid-area: 1 / 1;
    min-width: 0;
    pointer-events: none;
}

.cm-category-filter__summary {
    box-sizing: border-box;
    width: calc(50% - 8px);
    padding: 10px 30px;
    overflow: hidden;
    list-style: none;
    pointer-events: auto;
}

/* 元のbuttonと同じ字体・字間にし、共通summaryの位置・装飾を解除する。 */
.cm-category .cm-category-filter__summary,
.cm-category .cm-category__more {
    position: static;
    bottom: auto;
    z-index: auto;
    font-family: Arial;
    letter-spacing: normal;
}

.cm-category .cm-category-filter__summary::before,
.cm-category .cm-category-filter__summary::after,
.cm-category .cm-category__more::before,
.cm-category .cm-category__more::after {
    content: none;
    display: none;
}

.cm-category-filter__summary::-webkit-details-marker,
.cm-category__more::-webkit-details-marker {
    display: none;
}

.cm-category-filter__summary::marker,
.cm-category__more::marker {
    content: '';
}

.cm-category-filter__group:nth-child(2) > .cm-category-filter__summary {
    margin-left: auto;
}

.cm-category-filter__group[open] > .cm-category-filter__summary {
    background: #e8f0ff;
}

.cm-category-filter__group[open] > .cm-category-filter__summary .dd__chev {
    transform: rotate(180deg);
}

.cm-category-filter__panel {
    pointer-events: auto;
}

/* nameによる排他開閉に未対応でも、同時に開いたパネルを重ねない。 */
.cm-category-filter__group[open] + .cm-category-filter__group[open] {
    grid-area: 2 / 1;
    margin-top: 16px;
}

/* ------------------------------------------------
カテゴリ専用の一覧・9件ずつの追加表示
旧 .catList / .more の表示切替JSとは分離する。
--------------------------------------------------- */
.cm-category__results {
    scroll-margin-top: 100px;
}

.cm-category__heading {
    font-weight: 700;
    font-size: 1.4rem;
}

.cm-category .cm-category__title-link {
    display: block;
    font: inherit;
    letter-spacing: inherit;
    color: inherit;
    text-decoration: none;
}

/* 未開封のまとまりより後ろは、ボタンも含めて隠す。 */
.cm-category__batch:not([open]) ~ .cm-category__batch {
    display: none;
}

/* 開いたまとまりのボタンだけを消し、次のボタンへ進む。 */
.cm-category__batch[open] > .cm-category__more {
    display: none;
}

/* 元の.more buttonと同じ見た目。追加のアイコンやフォントは使わない。 */
.cm-category__more {
    box-sizing: border-box;
    display: block;
    width: 400px;
    min-width: 0;
    max-width: 100%;
    margin: 0 auto 40px;
    padding: 10px 30px;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 35px;
    background: #fff url(https://carryme.jp/wp-content/themes/carryme.jp_theme/images/arrow_orange.png) no-repeat right 20px center / 6px 10px;
    color: #111;
    font-weight: 600;
    font-size: 1.1em;
    line-height: normal;
    text-align: center;
    text-decoration: none;
    list-style: none;
    cursor: pointer;
    transition: 0.2s;
}

.cm-category__more:hover {
    border-color: #ff5000;
    background: #ff5000 url(https://carryme.jp/wp-content/themes/carryme.jp_theme/images/arrow_white.png) no-repeat right 20px center / 6px 10px;
    color: #fff;
}

.cm-category__more:focus-visible,
.cm-category__title-link:focus-visible {
    outline: 2px solid #333;
    outline-offset: 3px;
}

@media (max-width: 768px) {
    .cm-category-filter__summary {
        width: 100%;
    }

    .cm-category-filter__group:nth-child(2) > .cm-category-filter__summary {
        margin-top: 70px;
        margin-left: 0;
    }

    /* スマートフォンでは見出し2つの下にパネルを配置する。 */
    .cm-category-filter__group:first-child > .cm-category-filter__panel {
        margin-top: 85px;
    }

    .cm-category-filter__group[open] + .cm-category-filter__group[open] > .cm-category-filter__summary {
        margin-top: 0;
    }

    .cm-category__more {
        width: 100%;
        min-width: 0;
        font-size: 1em;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cm-category__more,
    .cm-category-filter__summary .dd__chev {
        transition: none;
    }
}
