/**
 * Product Card Fixes
 * 
 * This file contains stronger CSS rules to ensure proper display of product cards
 * across all templates. The selectors are highly specific to override any conflicting styles.
 */

/* Product Grid */
.product-archive-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
  gap: 24px !important;
  margin-bottom: 48px !important;
}

@media (max-width: 960px) {
  .product-archive-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    gap: 20px !important;
  }
}

@media (max-width: 767px) {
  .product-archive-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    gap: 16px !important;
  }
}

/* Thumbnail Styles */
.product-card__thumb,
.product-card .product-card__thumb,
#primary .product-card__thumb,
body .product-card__thumb,
div.product-card__thumb,
.archive-page .product-card__thumb,
.taxonomy-product-category-page .product-card__thumb {
  position: relative !important;
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  overflow: hidden !important;
  background-color: #f5f7fa !important;
  display: block !important;
}

.product-card__thumb img,
.product-card .product-card__thumb img,
#primary .product-card__thumb img,
body .product-card__thumb img,
div.product-card__thumb img,
.archive-page .product-card__thumb img,
.taxonomy-product-category-page .product-card__thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important; /* contain→coverに変更: 画像を縦横比を維持しながらもコンテナを埋めるようにする */
  object-position: center !important;
  transition: transform 0.5s ease !important;
  display: block !important;
  max-height: 100% !important;
  background-color: #ffffff !important;
}

/* Card Container */
.product-card,
article.product-card,
#primary .product-card,
.archive-page .product-card,
.taxonomy-product-category-page .product-card {
  background: #ffffff !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}

.product-card:hover,
article.product-card:hover,
#primary .product-card:hover,
.archive-page .product-card:hover,
.taxonomy-product-category-page .product-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08) !important;
}

/* Card Link */
.product-card__link,
.product-card .product-card__link,
#primary .product-card__link,
.archive-page .product-card__link,
.taxonomy-product-category-page .product-card__link {
  display: flex !important;
  flex-direction: column !important;
  color: inherit !important;
  text-decoration: none !important;
  height: 100% !important;
}

/* Card Body */
.product-card__body,
.product-card .product-card__body,
#primary .product-card__body,
.archive-page .product-card__body,
.taxonomy-product-category-page .product-card__body {
  padding: 16px !important;
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Card Title */
.product-card__title,
.product-card .product-card__title,
#primary .product-card__title,
.archive-page .product-card__title,
.taxonomy-product-category-page .product-card__title {
  font-family: "Noto Sans JP", sans-serif !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  margin: 0 0 8px !important;
  color: #333333 !important;
  line-height: 1.4 !important;
}

/* Card Excerpt */
.product-card__excerpt,
.product-card .product-card__excerpt,
#primary .product-card__excerpt,
.archive-page .product-card__excerpt,
.taxonomy-product-category-page .product-card__excerpt {
  font-family: "Noto Sans JP", sans-serif !important;
  font-size: 14px !important;
  color: #666666 !important;
  margin-bottom: 16px !important;
  line-height: 1.6 !important;
  flex: 1 !important;
}

/* Card More Button */
.product-card__more,
.product-card .product-card__more,
#primary .product-card__more,
.archive-page .product-card__more,
.taxonomy-product-category-page .product-card__more {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin-top: auto !important;
}

.product-card__more-text,
.product-card .product-card__more-text,
#primary .product-card__more-text,
.archive-page .product-card__more-text,
.taxonomy-product-category-page .product-card__more-text {
  font-family: "Noto Sans JP", sans-serif !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #005BAC !important;
  transition: color 0.3s ease !important;
}

.product-card__more-icon,
.product-card .product-card__more-icon,
#primary .product-card__more-icon,
.archive-page .product-card__more-icon,
.taxonomy-product-category-page .product-card__more-icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #005BAC !important;
  transition: transform 0.3s ease !important;
}

/* Hover Effects */
.product-card:hover .product-card__thumb img {
  transform: scale(1.05) !important;
}

.product-card:hover .product-card__more-text {
  color: #004589 !important;
}

.product-card:hover .product-card__more-icon {
  transform: translateX(4px) !important;
}