/* Products grid — centered, responsive */
.products-head{
  display:flex; align-items:center; justify-content:space-between;
  max-width:1200px; margin:40px auto 8px; padding:0 16px;
}
.products-head h1{ margin:0; font-size:28px; }
.products-head .toolbar span{ margin-right:8px; font-size:14px; color:#64748b }
.products-head select{ padding:8px 10px; border:1px solid #e5e7eb; border-radius:10px; background:#fff }

/* ✅ 讓每個 grid item 的高度一致，卡片才能撐滿 */
.grid{
  max-width:1200px; margin:12px auto 48px; padding:0 16px;
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(220px, 1fr));
gap:16px;
  align-items:stretch;
}

/* ✅ 卡片高度一致 */
.card{
  display:flex;
  flex-direction:column;
  border:1px solid #e5e7eb;
  border-radius:14px;
  overflow:hidden;
  background:#fff;
  color:#0f172a;
  height:100%;
}
.card:hover{ outline:2px solid #3b82f6; outline-offset:-2px }

/* ✅ 背景色交換：圖片區白底、文字區灰底 */
.thumb{
  background:#fff;               /* 原本 #f2f4f7 */
  height:170px;                  /* 想更高就調這裡 */
  display:flex;
  align-items:center;
  justify-content:center;
  padding:10px;
  box-sizing:border-box;
}
.thumb img{
  width:100%;
  height:100%;
  object-fit:contain;            /* 不裁切，完整顯示 */
  display:block;
}

/* ✅ 文字區固定高度：標題兩行一致，下面「查看詳情」自然就會對齊 */
.body{
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:6px;
  background:#f2f4f7;            /* 新增：原本白底 */
}
/* partials_product_grid.php 使用 .title（不是 h3），所以同時支援兩種寫法 */
.body .title,
.body h3{
  margin:0;
  font-size:16px;
  line-height:1.25;
  min-height:calc(1.25em * 2);   /* 固定兩行高度（即使只有一行也會撐住） */
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;          /* 超過兩行省略 */
  overflow:hidden;
}
.muted{ color:#6b7280; font-size:13px }

.empty{ grid-column:1 / -1; text-align:center; color:#6b7280; padding:40px 10px }

/* 其他你原本的 */
.linear-scale-hero{
  max-width:480px;
  margin:16px auto 24px;
}
.linear-scale-hero img{
  width:100%;
  height:auto;
  display:block;
  object-fit:contain;
}


/* Mobile: prefer 2 x N layout for cards */
@media (max-width: 900px){
  .grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap:12px; }
  .card .thumb{ height:150px; }
}
@media (max-width: 380px){
  .grid{ grid-template-columns: 1fr; }
}
