/* blog-posts-section.css — 部落格文章區塊（BlogPostsSection）樣式
   兩種版面同一份標記，只靠 class 切換：--grid（卡片格狀）／--list（縮圖＋文字橫列）
   設計語言跟站方：平面單色、圓角、橙 #ed8323 作強調、FontAwesome 圖示；全部規則前綴 .blog-posts-section / .bps- */

.blog-posts-section {
    --bps-r-sm: 6px;
    --bps-r: 12px;
    --bps-line: #e6e6e6;
    --bps-line-soft: #f2f2f2;
    --bps-muted: #757575;
    --bps-ink: #212121;
    --bps-accent: #ed8323;
    --bps-accent-soft: #fff3e8;
    --bps-cols-sm: 1;
    --bps-cols-md: 2;
    --bps-cols-xl: 3;
    font-family: -apple-system, "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
    color: var(--bps-ink);
    font-size: 14px;
    line-height: 1.6;
    margin: 24px 0;
}

.blog-posts-section * {
    box-sizing: border-box;
}

/* ---------- 標題列 ---------- */
.bps-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-bottom: 14px;
}

.bps-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--bps-ink);
    line-height: 1.3;
}

.bps-sub {
    margin-top: 2px;
    color: var(--bps-muted);
    font-size: 13px;
}

.bps-more {
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--bps-accent);
    font-size: 13.5px;
    text-decoration: none;
    white-space: nowrap;
}

.bps-more:hover {
    color: #d9751a;
    text-decoration: none;
}

.bps-more .fa {
    font-size: 12px;
}

/* ---------- 卡片容器 ---------- */
.bps-track {
    display: grid;
    grid-template-columns: repeat(var(--bps-cols-sm, 1), minmax(0, 1fr));
    gap: 18px;
}

.bps-empty {
    margin: 0;
    padding: 26px 0;
    text-align: center;
    color: var(--bps-muted);
}

.bps-card {
    display: block;
    position: relative;              /* 連結 ::after 鋪滿整張卡，用佢做定位基準 */
    background: #fff;
    border: 1px solid var(--bps-line);
    border-radius: var(--bps-r);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

@media (hover: hover) {
    .bps-card:hover {
        text-decoration: none;
        color: inherit;
        box-shadow: 0 4px 20px #00000014;
        transform: translateY(-2px);
    }

    .bps-card:hover .bps-card__link {
    color: inherit;
    text-decoration: none;
}

/* 整張卡可點：連結用 ::after 鋪滿卡片（標題本身仍係真連結，SEO／無障礙都係標準做法） */
.bps-card__link::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* 分類 chip（WordPress 分類），z-index 高過上面嘅卡片覆蓋層，所以自己一樣可點 */
.bps-card__cats {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.bps-cat {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    background: var(--bps-accent-soft);
    color: var(--bps-accent);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.65;
    white-space: nowrap;
    text-decoration: none;
}

.bps-cat:hover {
    background: var(--bps-accent);
    color: #fff;
    text-decoration: none;
}

/* 分類顏色變體：設定檔 categories 嘅 'style'（'style' => 'news' ⇒ .bps-cat--news）；要新色就照抄一條 */
.bps-cat--news {
    background: #e8f1ff;
    color: #1565c0;
}

.bps-cat--news:hover {
    background: #1565c0;
    color: #fff;
}

.bps-cat--life {
    background: #e9f7ee;
    color: #1a7f37;
}

.bps-cat--life:hover {
    background: #1a7f37;
    color: #fff;
}

.bps-card__title {
        color: var(--bps-accent);
    }
}

.bps-card__img {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.bps-card__img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bps-card__body {
    padding: 12px 14px 14px;
}

.bps-card__title {
    margin: 0;
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--bps-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bps-card__excerpt {
    margin: 6px 0 0;
    color: var(--bps-muted);
    font-size: 13px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bps-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 10px;
    color: var(--bps-muted);
    font-size: 12px;
}

.bps-meta .fa {
    color: #b0b0b0;
    margin-right: 2px;
}

.bps-card__more {
    position: relative;              /* 真連結：疊高過卡片覆蓋層，自己可點（唔靠 JS／唔怕 CSS 未更新） */
    z-index: 1;
    display: inline-block;
    margin-top: 10px;
    color: var(--bps-accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.bps-card__more:hover {
    color: #d9751a;
    text-decoration: none;
}

.bps-card__more .fa {
    font-size: 12px;
    transition: transform 0.18s ease;
}

@media (hover: hover) {
    .bps-card:hover .bps-card__more .fa {
        transform: translateX(3px);
    }
}

/* ---------- List View 追加（載入更多）---------- */
.bps-append {
    margin-top: 14px;
    text-align: center;
}

.bps-append__btn {
    min-width: 148px;
    height: 40px;
    padding: 0 22px;
    border: 1px solid var(--bps-accent);
    border-radius: 999px;
    background: #fff;
    color: var(--bps-accent);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.bps-append__btn:hover:not([disabled]) {
    background: var(--bps-accent);
    color: #fff;
}

.bps-append__btn[disabled] {
    opacity: 0.55;
    cursor: default;
}

.bps-append__msg {
    display: block;
    margin-top: 6px;
    color: var(--bps-muted);
    font-size: 12.5px;
}

/* ---------- Grid view（卡片格狀）---------- */
.blog-posts-section--grid .bps-card {
    display: flex;
    flex-direction: column;
}

.blog-posts-section--grid .bps-card__img {
    aspect-ratio: 16 / 9;
}

.blog-posts-section--grid .bps-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.blog-posts-section--grid .bps-card__more {
    margin-top: auto;
    padding-top: 10px;
}

/* ---------- List view（縮圖＋文字橫列）---------- */
.blog-posts-section--list .bps-track {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

.blog-posts-section--list .bps-card {
    display: grid;
    grid-template-columns: var(--bps-thumb, 200px) minmax(0, 1fr);
    align-items: stretch;
}

.blog-posts-section--list .bps-card:hover {
    transform: none;
}

.blog-posts-section--list .bps-card__img {
    height: 100%;
    min-height: 150px;
}

.blog-posts-section--list .bps-card__img img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.blog-posts-section--list .bps-card__body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.blog-posts-section--list .bps-card__title {
    -webkit-line-clamp: 2;
    font-size: 16.5px;
}

.blog-posts-section--list .bps-card__excerpt {
    -webkit-line-clamp: 2;
}

/* ---------- RWD ---------- */
/* 斷點同 route-product 元件一致：>=768 用 cols-md、>=1200 用 cols-xl；另外 list 縮圖 >=992 加闊 */
@media (min-width: 768px) {
    .bps-track {
        grid-template-columns: repeat(var(--bps-cols-md, 2), minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .blog-posts-section--list .bps-card {
        --bps-thumb: 260px;
    }
}

@media (min-width: 1200px) {
    .bps-track {
        grid-template-columns: repeat(var(--bps-cols-xl, 3), minmax(0, 1fr));
    }
}

/* 平板：格距收窄少少，list 標題縮一級 */
@media (max-width: 991px) {
    .bps-track {
        gap: 16px;
    }

    .blog-posts-section--list .bps-card__body {
        padding: 12px 14px;
    }

    .blog-posts-section--list .bps-card__title {
        font-size: 16px;
    }
}

/* 手機：單欄、間距更緊、list 改成「圖上字下」 */
@media (max-width: 767px) {
    .bps-head {
        align-items: flex-start;
    }

    .bps-title {
        font-size: 19px;
    }

    .bps-sub {
        font-size: 12.5px;
    }

    .bps-track {
        gap: 12px;
    }

    .bps-card__body {
        padding: 11px 12px 12px;
    }

    .bps-card__title {
        font-size: 15px;
    }

    .bps-card__excerpt {
        font-size: 12.5px;
    }

    .bps-card__meta {
        margin-top: 8px;
        font-size: 11.5px;
    }

    .bps-card__more {
        margin-top: 8px;
        font-size: 12.5px;
    }

    /* 手機 list view：唔跟 grid 疊成一模一樣 —— 保留小縮圖橫列（112px），
       兩種版面在手機仍然一眼分得出，亦慳位 */
    .blog-posts-section--list .bps-card {
        grid-template-columns: 112px minmax(0, 1fr);
    }

    .blog-posts-section--list .bps-card__img {
        position: relative;
        height: 100%;
        min-height: 108px;
        aspect-ratio: auto;
    }

    .blog-posts-section--list .bps-card__img img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    .blog-posts-section--list .bps-card__body {
        justify-content: center;
        padding: 10px 12px;
    }

    .blog-posts-section--list .bps-card__title {
        font-size: 15px;
        line-height: 1.4;
    }

    .blog-posts-section--list .bps-card__excerpt {
        margin-top: 4px;
        font-size: 12.5px;
        -webkit-line-clamp: 2;
    }

    .blog-posts-section--list .bps-card__meta {
        margin-top: 6px;
    }

    .blog-posts-section--list .bps-card__more {
        display: none;
    }

    .bps-card__cats {
        gap: 4px;
        margin-bottom: 4px;
    }

    .bps-cat {
        font-size: 11px;
        padding: 0 6px;
    }
}

/* 好窄（<=360）：標題再細少少，免爆行 */
@media (max-width: 360px) {
    .bps-title {
        font-size: 18px;
    }

    .blog-posts-section--list .bps-card {
        grid-template-columns: 96px minmax(0, 1fr);
    }

    .bps-card__title {
        font-size: 14.5px;
    }
}

/* 尊重系統「減少動態」設定 */
@media (prefers-reduced-motion: reduce) {
    .bps-card,
    .bps-card__more .fa {
        transition: none;
    }

    .bps-card:hover {
        transform: none;
    }
}
