/*
 * おすすめ車両のカード（content/parts/stock-cards.html。中身は components/StockCards.tsx が作る）。今はどのページにも置いていない（保留）。
 * 下の方に、代わりに置いている「条件別ボタン」（content/parts/stock-search-buttons.html）の見た目もある。
 * app/layout.tsx で theme.css・od-typography.css の後に読み込む。
 * 今は在庫（カーセンサー）の区切り（灰色の背景・白い文字の wp-block-cover）の中に置いている。
 * スマホ 2列、768px から 3列、992px から 4列。
 */

.od-stock {
  margin: 0 auto;
  max-width: 1140px;
  text-align: left;
}

.od-stock [hidden] {
  display: none !important;
}

.od-stock__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

@media (min-width: 768px) {
  .od-stock__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 992px) {
  .od-stock__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
  }
}

/* ---- カード ---- */

.od-stock-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  color: #222;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.od-stock a.od-stock-card__link {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  color: #222;
  text-decoration: none;
}

.od-stock a.od-stock-card__link:hover .od-stock-card__name,
.od-stock a.od-stock-card__link:focus-visible .od-stock-card__name {
  text-decoration: underline;
}

.od-stock-card__photo {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e5e8eb;
}

.od-stock .od-stock-card__photo img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  object-fit: cover;
}

.od-stock-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
  font-size: 13px;
  line-height: 1.5;
}

.od-stock-card__name {
  margin-bottom: 2px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.od-stock-card__spec,
.od-stock-card__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 6px;
}

.od-stock-card__spec-label,
.od-stock-card__price-label {
  flex: none;
  color: #666;
  font-size: 12px;
}

.od-stock-card__spec-value,
.od-stock-card__price-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.od-stock-card__price-value {
  color: #d32f2f;
  font-size: 15px;
  font-weight: 700;
}

.od-stock-card__comment {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid #eee;
  color: #444;
  overflow-wrap: anywhere;
}

.od-stock a.od-stock-card__assess {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0 10px 10px;
  padding: 6px 8px;
  border-radius: 22px;
  background: var(--wp--preset--color--vivid-cyan-blue, #0693e3);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}

.od-stock a.od-stock-card__assess:hover {
  opacity: 0.85;
}

/* ---- 在庫一覧へのリンク（0台・読み込めないとき／一番下） ---- */

.od-stock__fallback,
.od-stock__all {
  margin: 20px 0 0;
  text-align: center;
}

.od-stock a.od-stock__fallback-link,
.od-stock a.od-stock__all-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  max-width: 100%;
  min-height: 48px;
  padding: 10px 24px;
  border: 2px solid #fff;
  border-radius: 24px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
}

.od-stock a.od-stock__fallback-link::after,
.od-stock a.od-stock__all-link::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: 10px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.od-stock a.od-stock__fallback-link:hover,
.od-stock a.od-stock__all-link:hover {
  background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 400px) {
  .od-stock__grid {
    gap: 10px;
  }

  .od-stock-card__body {
    padding: 8px;
  }

  .od-stock a.od-stock-card__assess {
    margin: 0 8px 8px;
    font-size: 13px;
  }
}

/*
 * ---- 条件別ボタン（content/parts/stock-search-buttons.html） ----
 * カーセンサーの在庫一覧を条件で絞って開くボタン。在庫（カーセンサー）の区切り（暗い背景・白い文字）の中に置く。
 * スマホ 2列（奇数のときは最後のボタンを横いっぱい）、768px から 3列。ボタンは高さ48px以上・文字16px。
 */

.od-stock-search {
  margin: 0 auto 24px; /* 下に続く行（トップのクチコミの行など）と詰まらないように */
  max-width: 760px;
  text-align: center;
}

.od-stock-search .od-stock-search__lead {
  margin: 0 0 14px;
  color: #fff;
  font-size: 15px;
  line-height: 1.6;
}

.od-stock-search .od-stock-search__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.od-stock-search .od-stock-search__list > li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.od-stock-search .od-stock-search__list > li::before {
  content: none;
}

/* スマホ（2列）でボタンが奇数のときは、最後のボタンを2列ぶんにして空きマスをなくす */
@media (max-width: 767px) {
  .od-stock-search .od-stock-search__list > li:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (min-width: 768px) {
  .od-stock-search .od-stock-search__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
}

.od-stock-search a.od-stock-search__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff;
  color: #222;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}

.od-stock-search .od-stock-search__label {
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.od-stock-search .od-stock-search__sub {
  margin-top: 2px;
  color: #666;
  font-size: 12px;
}

.od-stock-search a.od-stock-search__link:hover,
.od-stock-search a.od-stock-search__link:focus-visible {
  background: #eef6fc;
}

.od-stock-search .od-stock-search__all {
  margin: 16px 0 0;
}

/* 「すべての在庫を見る」は枠線だけのボタン（区切りの暗い背景の上） */
.od-stock-search a.od-stock-search__link--all {
  display: inline-flex;
  flex-direction: row;
  width: auto;
  max-width: 100%;
  min-height: 48px;
  padding: 10px 28px;
  border: 2px solid #fff;
  border-radius: 24px;
  background: transparent;
  color: #fff;
  box-shadow: none;
}

.od-stock-search a.od-stock-search__link--all::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: 10px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.od-stock-search a.od-stock-search__link--all:hover,
.od-stock-search a.od-stock-search__link--all:focus-visible {
  background: rgba(255, 255, 255, 0.15);
}
