/**
 * 商品カード (共通パーツ)
 *
 * Product/_product_card.twig 用。商品一覧ページと記事本文への埋め込みで共有する。
 * categoryProductListPage.css から切り出したもので、規則の順序は元のまま
 * (後段の .ev-product-item / .ev-product-image が前段を上書きする関係を保つ)。
 *
 * ページ固有の指定で上書きできるよう、各ページの CSS より先に読み込むこと。
 */

.ev-product-item {
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-decoration: none;
  color: inherit;
}

.ev-product-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.ev-product-image {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ev-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  margin-left: -12px;
  transition: transform 0.3s ease;
}

.ev-product-item:hover .ev-product-image img {
  transform: scale(1.05);
}

.ev-product-info {
  padding: 15px;
}

.ev-product-codes {
  margin-bottom: 8px;
}

.ev-product-codes-value {
  font-size: 12px;
  color: #666;
  background-color: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
}

.ev-product-name {
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 10px 0;
  line-height: 1.4;
  color: #222222;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ev-product-prices {
  margin-bottom: 10px;
}

.ev-product-price-value {
  font-size: 15px;
  font-weight: 400;
  color: #222222;
}

.ev-product-price-tax {
  font-size: 11px;
  color: #222222;
  margin-left: 4px;
  font-weight: 500;
}

.ev-product-item {
  padding: 25px 20px;
  background: #fff;
  border-radius: 4px;
  border: 1px solid transparent;
  overflow: hidden;
  height: 400px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease-in-out;
}

.ev-product-item:hover {
  border: 1px solid #BBBBBB;
  border-radius: 4px;
  transform: translateY(-5px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.ev-product-tag {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  top: 10px;
  left: 10px;
  z-index: 2;
}

.ev-product-tag-value {
  display: inline-block;
  padding: 4px 8px;
  margin: 2px;
  font-size: 12px;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
}

.ev-product-tag-value-ellipsis {
  display: inline-flex;
  align-items: right;
  justify-content: right;
  padding: 10px 8px 0 10px;
  margin: 2px;
  vertical-align: bottom;
}

.ev-product-tag-value-ellipsis svg {
  width: 23px;
  height: 5px;
  display: block;
}

.ev-product-image {
  margin: 10px;
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.ev-product-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  text-align: left;
  color: #222222;
  font-weight: 400;
}

.ev-product-codes {
  color: #777777;
  margin-bottom: 10px;
}

.ev-product-prices {
  margin-bottom: 10px;
}

.ev-product-description {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  max-height: calc(1.5em * 3);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

/** 記事本文に埋め込んだカードの一列 */
.ev-article-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  column-gap: 2px;
  row-gap: 12px;
  width: 100%;
  margin: 32px 0;
}

@media (max-width: 500px) {
  .ev-product-item {
    padding: 0px;
    height: 360px !important;
  }

  .ev-product-info {
    padding: 10px;
  }

  .ev-product-name {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }

  .ev-product-description {
    font-size: 11px;
    flex-shrink: 0;
  }

  .ev-article-products {
    grid-template-columns: repeat(auto-fill, minmax(159px, 1fr));
  }
}

/**
 * テーマ CSS が無い場所 (default_frame を継承しない単体ページ等) でも
 * カードが崩れないようにするための指定。
 *
 * - リンク下線: カード全体が <a> で囲まれており、祖先の <a> に付いた
 *   text-decoration は子孫側から打ち消せない (CSS 仕様)。a 自体に指定する。
 *   テーマも a { text-decoration: underline } を指定しているため、
 *   商品一覧ページでも同様に必要。
 * - box-sizing: テーマが全体に border-box を当てている前提で
 *   height と padding を組んでいるため、単体でも自分で指定する。
 */
.ev-article-products a,
.ev-product-grid a {
  text-decoration: none;
  color: inherit;
}

.ev-product-item,
.ev-product-item * {
  box-sizing: border-box;
}
