/**
 * RSCat 分類頁樣式
 *
 * 依照規格定義的 UI/UX 設計：
 * - 版頭圖區塊：600px（桌機）/ 400px（平板）/ 280px（手機）
 * - 卡片樣式：寬度 305px，圓角 17.941px，陰影
 * - 卡片圖片：強制 4:3 比例，object-fit: cover
 * - 響應式排版：桌機 4x3 / 平板 2x6 / 手機 1x12
 *
 * @package RSCat
 * @since 1.0.0
 * @updated 1.0.5 - 每頁 12 張，圖片強制 4:3
 */

/* ==========================================================================
   1. 變數定義
   ========================================================================== */
:root {
    /* 顏色 */
    --rscat-color-white: #FFF;
    --rscat-color-black: #222;
    --rscat-color-primary: #33C3D8;
    --rscat-color-hover-bg: #F7F7F7;
    --rscat-color-shadow: rgba(0, 0, 0, 0.25);
    --rscat-color-placeholder: #E0E0E0;

    /* 尺寸 */
    --rscat-header-height-desktop: 600px;
    --rscat-header-height-tablet: 400px;
    --rscat-header-height-mobile: 280px;

    --rscat-card-width: 305px;
    --rscat-card-height: 393px;
    --rscat-card-border-radius: 17.941px;
    --rscat-card-shadow: 0 3.588px 17.941px var(--rscat-color-shadow);

    --rscat-image-width: 230px;
    --rscat-image-height: 200px;

    /* 間距 */
    --rscat-container-max-width: 1280px;
    --rscat-content-gap: 100px;
    --rscat-grid-gap: 30px;
    --rscat-card-image-gap: 50px;
}

/* ==========================================================================
   2. 版頭圖區塊
   ========================================================================== */
.rscat-header {
    position: relative;
    width: 100%;
    height: var(--rscat-header-height-desktop);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--rscat-color-placeholder);
    border-radius: 60px 60px 0 0;
    padding: 70px 80px;
    display: flex;
    align-items: flex-end;
}

.rscat-header__title {
    color: var(--rscat-color-white);
    font-family: 'Roboto', sans-serif;
    font-size: 46px;
    font-weight: 700;
    line-height: normal;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); /* 提升可讀性 */
}

/* 平板版頭圖 */
@media (max-width: 1024px) {
    .rscat-header {
        height: var(--rscat-header-height-tablet);
        padding: 50px 60px;
        border-radius: 40px 40px 0 0;
    }

    .rscat-header__title {
        font-size: 36px;
    }
}

/* 手機版頭圖 */
@media (max-width: 768px) {
    .rscat-header {
        height: var(--rscat-header-height-mobile);
        padding: 40px 30px;
        border-radius: 30px 30px 0 0;
    }

    .rscat-header__title {
        font-size: 28px;
    }
}

/* ==========================================================================
   3. 主內容區塊
   ========================================================================== */
.rscat-content {
    margin-top: var(--rscat-content-gap);
    padding: 0 20px;
}

.rscat-container {
    max-width: var(--rscat-container-max-width);
    margin: 0 auto;
}

/* 無結果訊息 */
.rscat-no-results {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #666;
}

/* ==========================================================================
   4. 卡片網格排版
   ========================================================================== */
.rscat-card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 桌機：4 欄 */
    gap: var(--rscat-grid-gap);
    margin-bottom: 60px;
}

/* 平板：2 欄 */
@media (max-width: 1024px) {
    .rscat-card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* 手機：1 欄 */
@media (max-width: 768px) {
    .rscat-card-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ==========================================================================
   5. 卡片樣式
   ========================================================================== */
.rscat-card {
    width: 100%;
    max-width: var(--rscat-card-width);
    background: var(--rscat-color-white);
    border-radius: var(--rscat-card-border-radius);
    box-shadow: var(--rscat-card-shadow);
    transition: background-color 0.3s ease, transform 0.3s ease;
    overflow: hidden;
    margin: 0 auto; /* 置中對齊 */
}

/* 卡片連結 */
.rscat-card__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    padding: 40px 20px 30px;
    text-decoration: none;
    color: inherit;
}

/* Hover 狀態 */
.rscat-card:hover {
    background-color: var(--rscat-color-hover-bg);
    transform: translateY(-5px); /* 微妙上浮效果 */
}

/* ==========================================================================
   6. 卡片圖片區塊（強制 4:3 比例）
   ========================================================================== */
.rscat-card__image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 比例 = 3/4 = 75% */
    margin-bottom: 20px;
    flex-shrink: 0; /* 防止壓縮 */
    overflow: hidden;
}

.rscat-card__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* 裁切填滿，保持比例 */
}

/* 佔位圖樣式 */
.rscat-card__image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--rscat-color-placeholder);
}

/* ==========================================================================
   7. 卡片標題
   ========================================================================== */
.rscat-card__title {
    color: var(--rscat-color-black);
    font-family: 'Roboto', sans-serif;
    font-size: 20.632px;
    font-weight: 500;
    text-transform: capitalize;
    text-align: center;
    margin: 0;
    line-height: 1.4;
    transition: color 0.3s ease;
    /* 防止標題過長溢出 */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Hover 狀態 */
.rscat-card:hover .rscat-card__title {
    color: var(--rscat-color-primary);
}

/* ==========================================================================
   8. 分頁導航
   ========================================================================== */
.rscat-pagination {
    margin: 60px 0;
}

.rscat-pagination__links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* 分頁連結樣式 */
.rscat-pagination__links a,
.rscat-pagination__links .current {
    display: inline-block;
    padding: 10px 15px;
    background: var(--rscat-color-white);
    border: 1px solid #DDD;
    border-radius: 5px;
    color: var(--rscat-color-black);
    text-decoration: none;
    transition: all 0.3s ease;
}

/* Hover 狀態 */
.rscat-pagination__links a:hover {
    background: var(--rscat-color-primary);
    color: var(--rscat-color-white);
    border-color: var(--rscat-color-primary);
}

/* 當前頁碼樣式 */
.rscat-pagination__links .current {
    background: var(--rscat-color-primary);
    color: var(--rscat-color-white);
    border-color: var(--rscat-color-primary);
    font-weight: 700;
}

/* 省略號樣式 */
.rscat-pagination__links .dots {
    padding: 10px 5px;
    color: #999;
}

/* 手機版分頁 */
@media (max-width: 768px) {
    .rscat-pagination__links a,
    .rscat-pagination__links .current {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* ==========================================================================
   9. 輔助工具
   ========================================================================== */

/* 清除浮動（如需要） */
.rscat-clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* 隱藏元素（保留螢幕閱讀器可存取） */
.rscat-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   10. 列印樣式（可選）
   ========================================================================== */
@media print {
    .rscat-header {
        height: auto;
        padding: 20px;
        border-radius: 0;
    }

    .rscat-card {
        box-shadow: none;
        border: 1px solid #DDD;
        break-inside: avoid;
    }

    .rscat-pagination {
        display: none;
    }
}
