/* ===========================================
   DF Blog Search - 検索・絞り込みフォーム用CSS
   /wp-content/plugins/df-blog-search/assets/blog-search.css
   =========================================== */

.blog-filter-wrap {
    margin: 20px 0 30px;
}

.blog-filter-toggle {
    display: none; /* shown only on mobile, see media query below */
    width: 100%;
    align-items: center;
    justify-content: space-between;
    background: #fff8f0;
    border: 1px solid #ffd9a8;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    box-sizing: border-box;
}

.blog-filter-toggle-caret {
    transition: transform 0.2s ease;
    color: #ff8c00;
    font-size: 14px;
}

.blog-filter-toggle[aria-expanded="true"] .blog-filter-toggle-caret {
    transform: rotate(180deg);
}

.blog-filter-form {
    background: #fff8f0;
    border: 1px solid #ffd9a8;
    border-radius: 8px;
    padding: 16px 20px;
    box-sizing: border-box;
}

.blog-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.blog-filter-row label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.blog-filter-row:last-child {
    margin-bottom: 0;
}

.blog-filter-input {
    flex: 1 1 240px;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
}

.blog-filter-select {
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
}

.blog-filter-submit {
    display: inline-flex;
    align-items: center;
    height: 36px;
    box-sizing: border-box;
    background: #ff8c00;
    color: #fff;
    border: none;
    padding: 0 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}

.blog-filter-submit:hover {
    background: #e67e00;
}

.blog-filter-reset {
    display: inline-flex;
    align-items: center;
    height: 36px;
    box-sizing: border-box;
    color: #666;
    font-size: 13px;
    text-decoration: underline;
    line-height: 1;
}

.blog-result-count {
    color: #666;
    font-size: 14px;
    margin: 10px 0 20px;
}

.blog-list {
    display: grid;
    gap: 20px;
    max-width: 100%;
    overflow-x: hidden;
}

.blog-item {
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    max-width: 100%;
    overflow-x: hidden;
}

.blog-item-link {
    display: flex;
    gap: 20px;
    text-decoration: none;
    color: inherit;
    max-width: 100%;
}

.blog-item-thumb {
    flex: 0 0 200px;
    min-width: 0;
}

.blog-item-thumb img {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

.blog-item-title {
    font-size: 18px;
    margin: 0 0 6px;
}

.blog-item-date {
    color: #999;
    font-size: 13px;
}

.blog-item-excerpt {
    margin-top: 8px;
    font-size: 14px;
    color: #555;
    line-height: 1.7;
}

#df-blog-results {
    transition: opacity 0.15s ease;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

#df-blog-results.df-blog-loading {
    opacity: 0.4;
    pointer-events: none;
}

.blog-item-body {
    min-width: 0;
    flex: 1 1 auto;
    max-width: 100%;
}

.blog-item-title,
.blog-result-count {
    overflow-wrap: break-word;
    word-break: break-word;
}

.blog-item-excerpt {
    overflow-wrap: break-word;
    word-break: break-word;
    word-wrap: break-word;
    /* fallback: if a single token still has no breakable point, force a hard break
       rather than letting it push the layout wider than the viewport */
    word-break: break-all;
}

.blog-pagination {
    text-align: center;
    margin: 40px 0;
}

.blog-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-width: 36px;
    box-sizing: border-box;
    padding: 0 12px;
    margin: 0 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
}

.blog-pagination .page-numbers.current {
    background: #ff8c00;
    color: #fff;
    border-color: #ff8c00;
}

.blog-pagination .page-numbers.dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    box-sizing: border-box;
    padding: 0 4px;
    margin: 0 2px;
    color: #999;
    border: none;
    line-height: 1;
    vertical-align: middle;
}

.blog-no-result {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    background: #f8f8f8;
    border-radius: 8px;
}

@media (max-width: 600px) {
    .blog-item-link { flex-direction: column; }
    .blog-item-thumb { flex: none; width: 100%; }
    .blog-filter-row { flex-direction: column; align-items: stretch; }
    .blog-filter-row label { display: block; }
    .blog-filter-input { flex: none; width: 100%; box-sizing: border-box; }
    .blog-filter-select { width: 100%; box-sizing: border-box; }

    /* collapsible search form: toggle bar shown, body hidden by default */
    .blog-filter-toggle {
        display: flex;
    }

    .blog-filter-body {
        display: none;
        margin-top: 8px;
    }

    .blog-filter-body.is-open {
        display: block;
    }

    /* last line of defense: if anything inside still tries to overflow,
       clip it rather than letting it widen the whole page on mobile */
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }
}

/* ===========================================
   PC: 3-column card grid (3 columns x 3 rows = 9 per page)
   =========================================== */
@media (min-width: 601px) {
    .blog-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 28px 24px;
    }

    .blog-item {
        border-bottom: none;
        padding-bottom: 0;
    }

    .blog-item-link {
        flex-direction: column;
        gap: 0;
        height: 100%;
    }

    .blog-item-thumb {
        flex: none;
        width: 100%;
    }

    .blog-item-thumb img {
        aspect-ratio: 4 / 3;
        object-fit: cover;
    }

    .blog-item-body {
        padding-top: 12px;
    }

    .blog-item-excerpt {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

/* ===========================================
   Category pill selector (replaces the old dropdowns)
   =========================================== */
.blog-filter-pill-group {
    margin-bottom: 14px;
}

.blog-filter-pill-label {
    font-size: 13px;
    color: #666;
    margin: 0 0 8px;
}

.blog-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.blog-filter-pill {
    display: inline-flex;
    align-items: center;
    height: 36px;
    box-sizing: border-box;
    padding: 0 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    line-height: 1;
}

.blog-filter-pill:hover {
    border-color: #ff8c00;
}

.blog-filter-pill.is-active {
    background: #ff8c00;
    border-color: #ff8c00;
    color: #fff;
}

.blog-filter-pill-child {
    height: 32px;
    padding: 0 14px;
    font-size: 12px;
    border-radius: 16px;
}

.blog-filter-pill-child.is-active {
    background: #fff3e0;
    border-color: #ff8c00;
    color: #b36000;
}

@media (max-width: 600px) {
    .blog-filter-pills {
        gap: 6px;
    }

    .blog-filter-pill {
        height: 32px;
        padding: 0 12px;
        font-size: 12px;
    }

    .blog-filter-pill-child {
        height: 30px;
        padding: 0 10px;
        font-size: 11px;
    }
}
