/* Task 1297: four stable, equal product-category cards. */
@media (min-width: 721px) {
  .product-index-page .product-category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-rows: 1fr;
    align-items: stretch !important;
    gap: clamp(18px, 3vw, 28px) !important;
  }

  .product-index-page .product-category-card,
  .product-index-page .product-category-card.card,
  .product-index-page .product-category-card:hover,
  .product-index-page .product-category-card:focus,
  .product-index-page .product-category-card:focus-visible,
  .product-index-page .product-category-card:focus-within {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(2.5rem, auto) 190px !important;
    align-items: start !important;
    align-self: stretch !important;
    justify-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
    min-height: 258px !important;
    gap: 12px !important;
    padding: 14px !important;
    border: 1px solid var(--yen-ref-line) !important;
    border-radius: 24px !important;
    box-sizing: border-box !important;
    background: var(--yen-ref-surface) !important;
    box-shadow: 0 14px 34px rgba(53, 66, 52, .055) !important;
    transform: none !important;
  }

  .product-index-page .product-category-card:hover,
  .product-index-page .product-category-card:focus-visible {
    background: var(--yen-ref-surface-strong) !important;
    box-shadow: 0 18px 38px rgba(53, 66, 52, .09) !important;
  }

  .product-index-page .product-category-card h2,
  .product-index-page .product-category-card:hover h2,
  .product-index-page .product-category-card:focus-visible h2 {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: stretch !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 2.5rem !important;
    line-height: 1.2 !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    text-wrap: balance !important;
  }

  .product-index-page .product-category-image-frame,
  .product-index-page .product-category-card:hover .product-category-image-frame,
  .product-index-page .product-category-card:focus-visible .product-category-image-frame {
    align-self: end !important;
    width: 190px !important;
    height: 190px !important;
    min-width: 190px !important;
    min-height: 190px !important;
    aspect-ratio: 1 / 1 !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 720px) {
  .product-index-page .product-category-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 10px !important;
    overflow-x: clip !important;
  }

  .product-index-page .product-category-card,
  .product-index-page .product-category-card.card,
  .product-index-page .product-category-card:hover,
  .product-index-page .product-category-card:focus,
  .product-index-page .product-category-card:focus-visible,
  .product-index-page .product-category-card:focus-within {
    grid-template-columns: 92px minmax(0, 1fr) !important;
    grid-template-rows: 92px !important;
    align-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 116px !important;
    min-height: 116px !important;
    gap: 13px !important;
    padding: 11px 12px !important;
    border: 1px solid var(--yen-ref-line) !important;
    border-radius: 20px !important;
    box-sizing: border-box !important;
    transform: none !important;
  }

  .product-index-page .product-category-card h2,
  .product-index-page .product-category-card:hover h2,
  .product-index-page .product-category-card:focus-visible h2 {
    order: 1 !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 2.4rem !important;
    font-size: 1rem !important;
    line-height: 1.2 !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    text-wrap: pretty !important;
  }

  .product-index-page .product-category-image-frame,
  .product-index-page .product-category-card:hover .product-category-image-frame,
  .product-index-page .product-category-card:focus-visible .product-category-image-frame {
    order: 0 !important;
    width: 92px !important;
    height: 92px !important;
    min-width: 92px !important;
    min-height: 92px !important;
    box-sizing: border-box !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-index-page .product-category-card {
    transition: none !important;
  }
}
