/* ==============================================
   取扱品目（commodity）アーカイブ・シングル・モーダル
   ============================================== */

/* --- 第2階層カード --- */
.com_cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.6rem;
}
@media (min-width: 560px) and (max-width: 820.9px) {
  .com_cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
  }
}
@media (max-width: 559.9px) {
  .com_cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

.com_card {
  cursor: pointer;
  border-radius: 0.8rem;
  background-color: #f5f5f5;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  overflow: hidden;
}
.com_card:hover {
  border-color: #de0101;
  background-color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.com_card_inner {
  padding: 2rem 2.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 12rem;
  position: relative;
}
@media (max-width: 559.9px) {
  .com_card_inner {
    padding: 16px 12px;
    min-height: 80px;
  }
}

.com_card_title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1b1b1b;
  line-height: 1.4;
  margin-bottom: 0.8rem;
}
@media (max-width: 559.9px) {
  .com_card_title {
    font-size: 1.4rem;
    margin-bottom: 4px;
  }
}

.com_card_count {
  font-size: 1.3rem;
  color: #888;
  font-weight: 400;
}
@media (max-width: 559.9px) {
  .com_card_count {
    font-size: 1.1rem;
  }
}

.com_card_arrow {
  position: absolute;
  bottom: 1rem;
  right: 1.2rem;
  color: #ccc;
  font-size: 1.2rem;
  transition: color 0.3s ease;
}
.com_card:hover .com_card_arrow {
  color: #de0101;
}

/* --- モーダル --- */
.commodity-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}
.commodity-modal-overlay.is-active {
  display: flex;
}

.commodity-modal {
  background: #fff;
  border-radius: 1.2rem;
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalFadeIn 0.25s ease;
}
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.commodity-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 2.4rem;
  border-bottom: 1px solid #eee;
  background-color: #1b1b1b;
  flex-shrink: 0;
}
@media (max-width: 559.9px) {
  .commodity-modal-header {
    padding: 16px;
  }
}

.commodity-modal-title {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}
@media (max-width: 559.9px) {
  .commodity-modal-title {
    font-size: 1.6rem;
  }
}

.commodity-modal-close {
  background: none;
  border: none;
  font-size: 3rem;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.commodity-modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.commodity-modal-body {
  padding: 2rem 2.4rem;
  overflow-y: auto;
  flex-grow: 1;
}
@media (max-width: 559.9px) {
  .commodity-modal-body {
    padding: 16px;
  }
}

.commodity-modal-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.commodity-modal-list li {
  border-bottom: 1px solid #f0f0f0;
}
.commodity-modal-list li:last-child {
  border-bottom: none;
}
.commodity-modal-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 1.2rem;
  color: #1b1b1b;
  text-decoration: none;
  font-size: 1.6rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 0.4rem;
}
@media (max-width: 559.9px) {
  .commodity-modal-list li a {
    padding: 12px 8px;
    font-size: 1.4rem;
  }
}
.commodity-modal-list li a:hover {
  background-color: #f5f5f5;
  color: #de0101;
}
.commodity-modal-list li a::after {
  content: "\f054";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 1.2rem;
  color: #ccc;
  flex-shrink: 0;
  margin-left: 12px;
}
.commodity-modal-list li a:hover::after {
  color: #de0101;
}

.commodity-modal-empty {
  text-align: center;
  padding: 3rem 0;
  color: #999;
  font-size: 1.4rem;
}

/* --- シングルページ --- */
.commodity-single {
  padding: 0 0 4rem;
}

.commodity-single-header {
  margin-bottom: 3rem;
}

.commodity-single-cats {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.commodity-cat-badge {
  display: inline-block;
  padding: 0.4rem 1.6rem;
  border-radius: 0.4rem;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.6;
}
.commodity-cat-badge.level1 {
  background-color: #1b1b1b;
  color: #fff;
}
.commodity-cat-badge.level2 {
  background-color: #6b613d;
  color: #fff;
}

.commodity-single-title {
  font-size: 3.2rem;
  font-weight: 700;
  color: #1b1b1b;
  line-height: 1.4;
  padding-bottom: 1.6rem;
  border-bottom: 3px solid #de0101;
}
@media (max-width: 559.9px) {
  .commodity-single-title {
    font-size: 2.4rem;
    padding-bottom: 12px;
  }
}

.commodity-single-thumb {
  margin-bottom: 3rem;
  border-radius: 0.8rem;
  overflow: hidden;
}
.commodity-single-thumb img {
  width: 100%;
  height: auto;
  display: block;
}

.commodity-single-content {
  font-size: 1.6rem;
  line-height: 1.8;
  margin-bottom: 4rem;
}
.commodity-single-content p {
  margin-bottom: 1.6rem;
}
.commodity-single-content img {
  max-width: 100% !important;
  height: auto;
}

/* --- レスポンシブテーブル（4列対応） --- */
.commodity-single-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  border: 1px solid #ddd;
}
.commodity-single-content table thead th {
  background-color: #1b1b1b;
  color: #fff;
  font-weight: 700;
  padding: 1.2rem 1.6rem;
  text-align: center;
  border: 1px solid #333;
  font-size: 1.4rem;
  white-space: nowrap;
}
.commodity-single-content table tbody td {
  padding: 1.2rem 1.6rem;
  border: 1px solid #ddd;
  text-align: left;
  vertical-align: top;
  font-size: 1.4rem;
}
.commodity-single-content table tbody tr:nth-child(even) {
  background-color: #fafafa;
}
.commodity-single-content table tbody tr:hover {
  background-color: #f0f5fa;
}

@media (max-width: 559.9px) {
  .commodity-single-content table.is-responsive {
    border: none;
  }
  .commodity-single-content table.is-responsive thead {
    display: none;
  }
  .commodity-single-content table.is-responsive tbody tr {
    display: block;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0.6rem;
    margin-bottom: 1.2rem;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  }
  .commodity-single-content table.is-responsive tbody tr:nth-child(even) {
    background-color: #fff;
  }
  .commodity-single-content table.is-responsive tbody td {
    display: flex;
    align-items: flex-start;
    padding: 1rem 1.4rem;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    font-size: 1.3rem;
  }
  .commodity-single-content table.is-responsive tbody td:last-child {
    border-bottom: none;
  }
  .commodity-single-content table.is-responsive tbody td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 7em;
    font-weight: 700;
    color: #1b1b1b;
    background-color: #f5f5f5;
    padding: 0.2rem 0.8rem;
    border-radius: 0.3rem;
    margin-right: 1rem;
    font-size: 1.2rem;
    flex-shrink: 0;
  }
}

/* PC表示時のテーブルスクロール（列が多い場合のフォールバック） */
.commodity-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 2rem;
}
@media (min-width: 560px) {
  .commodity-table-wrap {
    border: 1px solid #ddd;
    border-radius: 0.4rem;
  }
  .commodity-table-wrap table {
    border: none;
    margin-bottom: 0;
  }
}

/* --- 関連品目 --- */
.commodity-related {
  margin-bottom: 4rem;
  padding: 3rem;
  background-color: #f5f5f5;
  border-radius: 0.8rem;
}
@media (max-width: 559.9px) {
  .commodity-related {
    padding: 20px;
  }
}

.commodity-related-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #ddd;
}
@media (max-width: 559.9px) {
  .commodity-related-title {
    font-size: 1.6rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
  }
}

.commodity-related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}
@media (min-width: 560px) and (max-width: 820.9px) {
  .commodity-related-list {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 559.9px) {
  .commodity-related-list {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
.commodity-related-list li a {
  display: block;
  padding: 1rem 1.4rem;
  background: #fff;
  border-radius: 0.4rem;
  color: #1b1b1b;
  text-decoration: none;
  font-size: 1.4rem;
  transition: all 0.2s ease;
}
.commodity-related-list li a:hover {
  background-color: #1b1b1b;
  color: #fff;
}

/* --- 戻るボタン --- */
.commodity-back {
  text-align: center;
  margin-top: 4rem;
}
.commodity-back .button {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding: 1.4rem 4rem;
  background-color: #f5f5f5;
  color: #1b1b1b;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 700;
  border-radius: 0.4rem;
  transition: all 0.3s ease;
}
.commodity-back .button:hover {
  background-color: #1b1b1b;
  color: #fff;
}

/* --- com_description (L1 説明テキスト) --- */
.com_description {
  margin-top: 1.6rem;
  font-size: 1.5rem;
  line-height: 1.8;
  color: #666;
}
@media (max-width: 559.9px) {
  .com_description {
    margin-top: 8px;
    font-size: 1.3rem;
  }
}
