/* ============ Works Search UI ============ */
:root {
    --ws-search-primary: #938c34;
    --ws-search-text: #66622c;
    --ws-search-link: #938c34;
    --ws-works-code: #807c18;
}

#works-search {
    margin-top: 70px;
}

#works-search .midashi h3 {
    font-family: "Noto Serif JP", serif;
    color: #66622c;
    font-size: 3rem;
    font-weight: 500;
    letter-spacing: .2em;
}

/* 施工例タイプ検索（topcatsの上の見出し） */
.ws-block-head{
    display: block;
    width: 100%;
    flex: 0 0 100%;     /* 親がflexのとき改行させる */
    margin: 18px 0 10px;
}

.ws-block-head label{
    display: flex;
    flex-direction: column;
    text-align: center;
    color: var(--ws-search-text);
    font-weight: 600;
    font-size: 1.5rem;
    line-height: 1.7;
}

@media (max-width: 767px){
    .ws-block-head{
        margin: 14px 0 8px;
    }
    .ws-block-head label{
        font-size: 15px;
    }
}


#works-search .midashi .lazyWrap img {
    display: block;
    width: 320px;
    margin: 8px auto 0;
}

@media (max-width: 767px) {
    #works-search .midashi h3 {
        font-size: 3.8rem;
    }
    #works-search {
        margin-top: 10vh;
    }

    #works-search .midashi .lazyWrap img {
        width: 100%;
    }
}

/* =========================================================
   Works Search UI (scoped by .ws-*)
   ---------------------------------------------------------
   - カード4枚（.ws-topcats / .ws-topcat）
   - 行レイアウト（.ws-row：左ラベル / 右フィールド）
   - テイストタブ（.ws-tabs）
   - 課題チェック（.ws-checkgrid）
   - 送信ボタン（.ws-actions）
   - スマホは1カラム
   ========================================================= */

.ws-form {
    width: 80%;
    max-width: 1440px;
    margin: 0 auto;
    background: #f3f3e6;
    border: 1px solid #cfcab0;
    padding: 24px 28px 28px;
    box-sizing: border-box;
}

.ws-form-toggle {
    display: none;
}

@media (max-width: 767px) {

    /* トグルボタン */
    .ws-form-toggle {
        display: block;
        width: 90%;
        margin: 0 auto 14px;
        padding: 12px 14px;
        font-size: 16px;
        font-weight: 600;
        text-align: center;
        background: var(--ws-search-primary);
        color: #fff;
        border-radius: 6px;
        border: none;
    }

    /* 初期状態：フォームを隠す */
    .ws-form {
        display: none;
        margin-top: 10px;
        width: 90%;
    }

    /* 開いた状態 */
    .ws-form.is-open {
        display: block;
        animation: wsFade .25s ease;
    }

    @keyframes wsFade {
        from { opacity: 0; transform: translateY(-6px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}

/* ========== 上部カテゴリ（カード4枚） ========== */
.ws-topcats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    margin: 6px 0 18px;
    padding: 0;
    list-style: none;
}

.ws-topcat {
    display: block;
    width: 217px;
    cursor: pointer;
    user-select: none;
    border: 1px solid #d6d2b5;
    background: #fff;
    overflow: hidden;
    transition: box-shadow .18s ease, transform .04s ease;

    position: relative; /* チェックバッジの基準 */
}

/* チェック枠（常時表示） */
.ws-topcat::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 6;

    width: 26px;
    height: 26px;
    border-radius: 6px;

    background: rgba(255, 255, 255, 0.92);
    border: 2px solid var(--ws-search-primary, #938c34);

    pointer-events: none;
}

/* ✓（未選択時は非表示） */
.ws-topcat::after {
    content: "✓";
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 7;

    width: 26px;
    height: 26px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 16px;
    font-weight: 900;
    line-height: 1;
    color: var(--ws-search-primary, #938c34);

    opacity: 0;           /* 未選択は✓なし */
    transform: scale(0.9);
    transition: opacity .18s ease, transform .18s ease;

    pointer-events: none;
}

/* 選択時だけ✓表示 */
.ws-topcat.is-active::after {
    opacity: 1;
    transform: scale(1);
}


.ws-topcat:active {
    transform: translateY(1px);
}

/* --- 上部カテゴリカード：画像の非選択時を少し曇らせる --- */
.ws-topcat-fig img {
    transition: filter .25s ease, opacity .25s ease;
    filter: brightness(0.78) saturate(0.9); /* ← 非選択時：少し霞む */
    opacity: 0.88;
}

/* 選択時はクリア */
.ws-topcat.is-active .ws-topcat-fig img {
    filter: none;
    opacity: 1;
}

/* ホバー時は少し明るくする（任意） */
@media (hover: hover) {
    .ws-topcat:hover .ws-topcat-fig img {
        filter: brightness(0.92) saturate(1);
        opacity: 1;
    }
}


.ws-topcat-fig {
    position: relative;
    height: 152px;
    background: #eee;
    margin: 0 !important;
}

.ws-topcat-fig img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ws-topcat-label {
    display: block;
    text-align: center;
    font-size: 14px;
    letter-spacing: .08em;
    color: #fff;
    padding: 8px 6px;
    background: var(--ws-search-primary);
    opacity: 70%;
}


.ws-topcat.is-active .ws-topcat-label {
    background: var(--ws-search-primary);
    opacity: 100%;
}


@media (max-width: 767px) {

    /* セクション全体：1カラムで縦並び */
    .ws-topcats {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin: 8px 0 16px;
    }

    /* 各カードを横並びレイアウトに */
    .ws-topcat {
        display: flex;
        align-items: stretch;
        width: 100%;
        max-width: 480px;     /* 好みで */
        margin: 0 auto;
        border-radius: 8px;
        overflow: hidden;
    }

    /* 左側：サムネ（高さをかなり低くする） */
    .ws-topcat-fig {
        flex: 0 0 36%;        /* 画像の横幅（約1/3〜4割） */
        height: 64px;         /* ← 高さをここでぐっと抑える */
        margin: 0 !important;
        background: #eee;
    }

    .ws-topcat-fig img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }


    /* --- 選択時（is-active） --- */
    .ws-topcat.is-active .ws-topcat-label {
        color: #fff;
        background: var(--ws-search-primary);
    }

    .ws-topcat.is-active .ws-topcat-fig img {
        filter: none;
        opacity: 1;
    }

    /* 右側：ラベル部分をボタン風に */
    .ws-topcat-label {
        font-size: 2.5rem;
        color:var(--ws-search-primary);
        background: #fff;
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 8px;
        letter-spacing: .06em;
        line-height: 1.4;
        text-align: center;
        white-space: normal;
        opacity: 1;
    }

    .ws-topcat {
        width: 100%;
    }

    .ws-topcat::before,
    .ws-topcat::after {
        display: none !important;
        content: none !important;
    }
}


@media (hover: hover) {
    .ws-topcat:hover {
        border-color: var(--ws-search-primary);
        box-shadow: 0 0 0 2px rgba(147, 140, 52, 0.25) inset; /* 少し立体感を追加 */
    }
}

/* ========== 2カラム行（左ラベル / 右フィールド） ========== */
.ws-row {
    display: grid;
    grid-template-columns: 200px 1fr; /* ← 左列を固定幅に */
    align-items: center;
    gap: 20px;
    padding: 18px 22px;
    margin-top: 30px;
    box-sizing: border-box;
}

@media (max-width: 767px) {
    .ws-row {
        margin-top: 0;
        padding: 18px 0;
        grid-template-columns: 1fr;
    }
}

.ws-label {
    display: flex;
    flex-direction: column; /* ← これを追加 */
    align-items: center;
    text-align: center;
    color: var(--ws-search-text);
    font-weight: 600;
    font-size: 1.5rem;
    line-height: 1.7;
}

.ws-field {
    display: block;
}

/* ========== フリーワード入力 ========== */
.ws-field input[type="search"] {
    width: 100%;
    font-size: 16px;
    line-height: 1;
    padding: 10px 12px;
    border: 1px solid #cfcfcf;
    border-radius: 6px;
    background: #fff;
    color: #333;
}


/* ========== テイスト（タブ風トグル） ========== */
.ws-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    list-style: none;
    margin-top: 10px;
    position: relative;
    padding-left: 28px;
}

.ws-tabs a {
    display: inline-block;
    padding: 4px 6px;
    color: var(--ws-search-link);
    font-size: 1.5rem;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
    font-weight: 200;
}

.ws-tabs a:hover {
    color: var(--ws-search-link, #a38f5b);
    text-decoration-color: var(--ws-search-link, #a38f5b);
}

.ws-tabs::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    width: 16px;
    height: 12px;
    display: block; /* ② サイズを効かせる */
    background-image: url("/wp-content/themes/htg/assets/img/works/tabs_arrow.webp");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
    z-index: 1;
}

@media (max-width: 767px) {
    .ws-label {
        font-size: 2.8rem;
    }
    .ws-field input[type="search"] {
        font-size: 2.5rem;
    }
    .ws-tabs a {
        font-size: 2.5rem;
    }
}

/* ========== 暮らしの課題（チェックグリッド） ========== */
.ws-checkgrid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 18px;
    list-style: none;
    padding: 0;
    margin: 0;
}

@media (max-width: 980px) {
    .ws-checkgrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}



.ws-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ws-search-text);
    font-size: 1.5rem;
}

.ws-check input {
    transform: translateY(1px);
}

@media (max-width: 767px) {
    .ws-check{
        font-size: 2.5rem;
    }
    .ws-checkgrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 12px; /* ついでに少し詰めてもOK */
    }
}
/* ========== 送信ボタン / クリア ========== */
.ws-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
}

.ws-submit {
    min-width: 260px;
    font-size: 1.8rem;
    padding: 12px 18px;
    border-radius: 8px;
    border: 0 !important;
    background: var(--ws-search-primary);
    color: #ffffff;
    font-weight: 700;
    letter-spacing: .2em;
}

.ws-submit:hover {
    filter: brightness(0.98);
}

.ws-reset {
    text-decoration: underline;
    font-size: 14px;
}

/* --- ツールバー配置 --- */
.ws-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin: 18px auto 8px;
    width: 80%;
    max-width: 1440px;
}

/* --- ページャ --- */
.ws-pager-list {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ws-pager-item a,
.ws-pager-item span {
    display: inline-flex;
    min-width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border: 1px solid #cfcab0;
    background: #fff;
    color: var(--ws-search-text, #66622c);
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
}

.ws-pager-item a:hover {
    border-color: var(--ws-search-primary, #938c34);
    color: var(--ws-search-primary, #938c34);
}

.ws-pager-item .current, /* paginate_links は現在ページを <span class="current"> で出す */
.ws-pager-item span.current {
    background: var(--ws-search-primary, #938c34);
    color: #fff;
    border-color: var(--ws-search-primary, #938c34);
    font-weight: 700;
}

.ws-pager-total {
    margin-left: 10px;
    color: var(--ws-search-text, #66622c);
    font-size: 14px;
}

/* --- ソート（右側） --- */
.ws-sort {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ws-sort-label {
    color: var(--ws-search-text, #66622c);
    font-size: 14px;
}

/* カスタムセレクト（枠・矢印を検索UI色に） */
.ws-select {
    position: relative;
    display: inline-block;
}

.ws-select select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 8px 36px 8px 12px;
    border: 1px solid #cfcab0;
    border-radius: 4px;
    background: #fff;
    color: var(--ws-search-text, #66622c);
    font-size: 14px;
    line-height: 1;
}

.ws-select select:focus {
    outline: 2px solid color-mix(in oklab, var(--ws-search-primary, #938c34) 40%, transparent);
    outline-offset: 2px;
}

.ws-select-caret {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    pointer-events: none;
    /* 小さな山型の矢印 */
    background: linear-gradient(45deg, transparent 50%, var(--ws-search-primary, #938c34) 50%) left/50% 100% no-repeat,
    linear-gradient(-45deg, transparent 50%, var(--ws-search-primary, #938c34) 50%) right/50% 100% no-repeat;
}

/* --- レスポンシブ --- */
@media (max-width: 767px) {
    .ws-toolbar {
        width: 90%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .ws-pager-list {
        flex-wrap: wrap;
    }
}


/* === グリッド === */
.ws-results {
    width: 80%;
    max-width: 1440px;
    margin: 0 auto 0;
}

.ws-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px 26px;
    list-style: none;
    padding: 0;
    margin: 0;
}

@media (max-width: 1024px) {
    .ws-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* === カード本体 === */
.ws-card {
    background: #f3f3e6;
    overflow: hidden;
    box-sizing: border-box;
    transition: transform .06s ease,
    box-shadow .18s ease,
    border-color .18s ease;
}

.ws-card-link {
    display: block;
    height: 100%;                           /* ← カード全体をクリック領域に */
    color: inherit;
    text-decoration: none;
    /* border は削除 */
}

/* ホバー時の見た目も .ws-card に移動 */
.ws-card:hover {
    transform: translateY(-2px);
    border-color: var(--ws-search-primary, #938c34);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .06);
}


.ws-card-fig {
    position: relative;
    aspect-ratio: 25/16;
    margin: 0 !important
}

.ws-card-fig img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 上段ラベル群 */
.ws-card-meta {
    display: flex;
}

.ws-card-code {
    display: inline-block;
    font-size: 1.5rem;
    letter-spacing: .08em;
    color: #fff;
    background: var(--ws-works-code, #938c34);
    padding: 4px 8px;
    font-weight: 700;
}

.ws-card-area {
    display: inline-block;
    font-size: 1.5rem;;
    color: var(--ws-search-text);
    background: #ffffff;
    border: 1px solid #807c18;
    padding: 3px 8px;
}


.ws-card-ym {
    display: inline-block;
    font-size: 1.5rem;;
    color: var(--ws-search-text);
    background: #ffffff;
    border: 1px solid #807c18;
    padding: 3px 8px;
}

/* タイトル：2行で省略 */
.ws-card-title {
    padding: 10px 10px 12px;
    margin: 0;
    color: #66622c;
    font-feature-settings: "palt";
    font-weight: 400;
    line-height: 1.2em;
    font-size: 1.8rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.ws-empty {
    grid-column: 1/-1;
    text-align: center;
    color: #66622c;
    padding: 30px 0;
    font-size: 2.5rem;
}

@media (max-width: 767px) {

    .ws-card-code {
        font-size:2.5rem;
    }

    .ws-card-area {
        font-size:2.5rem;
    }


    .ws-card-ym {
        font-size:2.5rem;
    }

    /* タイトル：2行で省略 */
    .ws-card-title {
        font-size: 3rem;
    }

}

