/* Shared dimensions for catalog cards and the linked product tiles in navigation. */
:root :is(product-card.product-card, .resource-card[data-resource-type="product"]) {
  --pk-card-gap: 10px;
  --pk-card-padding: 13px;
  --pk-card-image-ratio: 1.1;
  --pk-card-title-size: 15px;
  --pk-card-detail-size: 12px;
  --pk-card-muted: #596555;
  --pk-card-price-size: 1.125rem;

  @media screen and (max-width: 749px) {
    --pk-card-gap: 8px;
    --pk-card-padding: 10px;
    --pk-card-image-ratio: 1;
    --pk-card-title-size: 13px;
    --pk-card-detail-size: 11px;
    --pk-card-price-size: 1.0625rem;
  }
}

/* The native product-card component owns prices, purchase actions and availability. */
:root product-card.product-card:not(:where([product-grid-view="zoom-out"] *)) {
  display: grid;
  height: 100%;
  min-width: 0;
  border-radius: 0;

  &:is(:hover, :focus-within) {
    box-shadow: none !important;
  }

  & .product-card__content {
    --product-card-gap: var(--pk-card-gap);
    display: flex;
    flex-flow: column nowrap;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-width: 0;
    gap: var(--pk-card-gap);
    padding: var(--pk-card-padding);
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  & .card-gallery {
    --gallery-aspect-ratio: var(--pk-card-image-ratio) !important;
    aspect-ratio: var(--pk-card-image-ratio);
    flex-shrink: 0;
    width: 100%;
    overflow: hidden;
    border-radius: 7px;
    background: #fff;
  }

  & .product-media__image {
    object-fit: contain;
    object-position: center;
  }

  & .pk-card-info {
    display: grid;
    gap: 7px;
    min-width: 0;
    width: 100%;
    color: #24372b;
    text-align: center;
    overflow-wrap: anywhere;
  }

  & .pk-card-info p {
    margin: 0;
  }

  & .pk-card-info__line {
    color: var(--pk-card-muted);
    font: 700 10px/1.4 var(--font-body--family, Inter, sans-serif);
    letter-spacing: .09em;
    text-transform: uppercase;
  }

  & .pk-card-info__link {
    display: block;
    color: inherit;
    text-decoration: none;
  }

  & .pk-card-info__title,
  & .product-card-title-text .text-block p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    margin: 0;
    min-height: 2.8em;
    color: #24372b;
    font: 600 var(--pk-card-title-size)/1.4 var(--font-body--family, Inter, sans-serif);
    letter-spacing: -.015em;
    text-align: center !important;
  }

  & .pk-card-info__detail {
    color: var(--pk-card-muted);
    font: 400 var(--pk-card-detail-size)/1.5 var(--font-body--family, Inter, sans-serif);
  }

  & .pk-card-info__sizes {
    padding-block-start: 7px;
    border-block-start: 1px solid #e8ede6;
    color: var(--pk-card-muted);
    font: 400 11px/1.5 var(--font-body--family, Inter, sans-serif);
  }

  & product-price,
  & product-price [ref="priceContainer"] {
    text-align: center !important;
  }

  & .collection-card-quick-add :is(add-to-cart-component, .quick-add__button--choose) {
    flex-basis: auto !important;
    width: max-content !important;
    min-width: 60% !important;
    max-width: 100% !important;
  }

  & .product-badges {
    inset: auto;
    inset-block-start: 0;
    inset-inline-start: 0;
  }

  & .product-badges :is(.badge--sale, [data-badge-type="sale"]) {
    border-radius: 5px;
    padding: 5px 8px;
    background: #edf2e9;
    color: #114634;
  }

}

/* Product suggestions use a linked tile. Category, page and article links have other resource types. */
:root .resource-card[data-resource-type="product"] {
  min-width: 0;
  gap: var(--pk-card-gap);
  border: 0;
  box-shadow: none;

  & .resource-card__media {
    --resource-card-aspect-ratio: var(--pk-card-image-ratio) !important;
    position: relative;
    overflow: hidden;
    border-radius: 7px;
    background: #fff;
  }

  & .resource-card__image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: var(--pk-card-image-ratio);
    object-fit: contain;
    border-radius: 7px;
  }

  & .resource-card__content {
    text-align: center;
    flex: 1 1 auto;
    gap: var(--pk-card-gap);
  }

  & .resource-card__title {
    -webkit-line-clamp: 3;
    color: #24372b;
    font: 600 var(--pk-card-title-size)/1.4 var(--font-body--family, Inter, sans-serif);
    letter-spacing: -.015em;
    text-align: center;
  }

  & [ref="priceContainer"] {
    margin-block-start: auto;
    text-align: center;
  }

  & .price {
    color: var(--walmet-brand, #114634);
    font-size: var(--pk-card-price-size);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    letter-spacing: -.01em;
  }

  & :is(.compare-at-price, .price__compare, s) {
    color: #999;
    font-size: .875rem;
    font-weight: 500;
    text-decoration: line-through;
  }
}
