/* 卡258-1 分類列表頁（products/list.php）：分類圖限高、介紹文移到商品格後面、商品格 grid 等高、分頁鈕 44px
   只在 products/list.php 載入；選擇器全部限定 body.c258-cat（同檔 <body> 加的 class）且有商品格的頁
   （同樣板的優惠活動／本週優惠／伴手禮等無商品格頁不套，畫面維持原樣）
   斷點跟 styles.css 一致：≤669 手機、670–1199 平板（站本身也是手機排版）、≥1200 電腦
   回退：還原 products/list.php 備份、刪本檔 */

/* 分類圖：寬滿版、高度上限，置中裁切 */
body.c258-cat:has(.right-content > .product-list) .page-banner > img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  object-position: center;
}

/* 介紹文移到商品格後面（只調顯示順序，內容不動） */
body.c258-cat:has(.right-content > .product-list) .column2 .right-content {
  display: flex;
  flex-direction: column;
}
body.c258-cat:has(.right-content > .product-list) .column2 .right-content > .product-big { order: 1; }
body.c258-cat:has(.right-content > .product-list) .column2 .right-content > .product-list { order: 2; }
body.c258-cat:has(.right-content > .product-list) .column2 .right-content > .info { order: 3; margin: 30px 0 0; }
body.c258-cat:has(.right-content > .product-list) .column2 .right-content > .knowledge { order: 4; }

/* 介紹文裡的圖：修變形 */
body.c258-cat:has(.right-content > .product-list) .column2 .right-content .info img {
  max-width: 100%;
  height: auto !important;
}

/* 商品格：grid、同列等高 */
body.c258-cat:has(.right-content > .product-list) .right-content .product-list .row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  border: 0;
}
body.c258-cat:has(.right-content > .product-list) .right-content .product-list .row::before,
body.c258-cat:has(.right-content > .product-list) .right-content .product-list .row::after {
  content: none;
  display: none;
}
body.c258-cat:has(.right-content > .product-list) .right-content .product-list .row > .col,
body.c258-cat:has(.right-content > .product-list) .right-content .product-list .row > .col:nth-child(2n) {
  float: none;
  width: auto;
  margin: 0;
  border: 1px #ddd solid;
  background: #fff;
  display: flex;
}
body.c258-cat:has(.right-content > .product-list) .right-content .product-list .row > .col > a {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 10px 10px 12px;
}
body.c258-cat:has(.right-content > .product-list) .right-content .product-list .row > .col > a > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
}
body.c258-cat:has(.right-content > .product-list) .right-content .product-list .row > .col > a > h2 {
  padding: 0;
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.4;
  height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
body.c258-cat:has(.right-content > .product-list) .right-content .product-list .row > .col > a > .price {
  margin-top: auto;
  padding: 6px 0 0;
}

/* 分頁：點擊區至少 44×44 */
body.c258-cat:has(.right-content > .product-list) .pager {
  padding: 30px 0;
}
body.c258-cat:has(.right-content > .product-list) .pager a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0 2px;
  vertical-align: middle;
}
body.c258-cat:has(.right-content > .product-list) .pager a:not(:first-child):not(:nth-child(2)):not(:last-child):not(:nth-last-child(2)) {
  width: 44px;
  height: 44px;
  line-height: 44px;
}

/* 平板（站本身仍是手機排版） */
@media only screen and (min-width: 670px) and (max-width: 1199px) {
  body.c258-cat:has(.right-content > .product-list) .page-banner > img { max-height: 300px; }
  body.c258-cat:has(.right-content > .product-list) .right-content .product-list .row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 電腦 */
@media only screen and (min-width: 1200px) {
  body.c258-cat:has(.right-content > .product-list) .page-banner > img { max-height: 360px; }
  body.c258-cat:has(.right-content > .product-list) .column2 .right-content > .info { margin: 40px 0 0; }
  body.c258-cat:has(.right-content > .product-list) .right-content .product-list .row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
  body.c258-cat:has(.right-content > .product-list) .right-content .product-list .row > .col > a > h2 { font-size: 16px; }
}
