/* Theme-agnostic defaults for shop list/filter/card UI. */

:where(.product-meta) {
  font-family: inherit;
}

:where(.pd-caption) {
  border-color: currentColor;
}

:where(.price) {
  font-weight: 600;
}

:where(.old-price) {
  margin-right: 0.35em;
  text-decoration: line-through;
  opacity: 0.7;
}

:where(.sale-badge) {
  display: inline-block;
  margin-left: 0.35em;
  font-size: 0.75rem;
  line-height: 1.1;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--shop-sale-badge-border, #1f6d1f);
  background: var(--shop-sale-badge-bg, #2e8b57);
  color: var(--shop-sale-badge-fg, #ffffff);
  vertical-align: middle;
  text-transform: uppercase;
}

/* Inherited: input { width: 100%; } */
:is(.price-row, .shop-products-toolbar) {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

:where(.price-row input) {
  width: auto;
  max-width: 6rem;
}

:where(.price-row label) {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

:where(#shop-products-ui) {
  min-width: 0;
}

/* The product pager is a template placeholder until JavaScript has pages to show. */
#shop-products-pagination:empty {
  display: none;
}

:where(.shop-products-toolbar .sorter) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  flex: 0 0 auto;
  align-self: flex-start;
}

:where(.shop-products-toolbar .sorter select) {
  width: auto;
}

.shop-products-toolbar #shop-filters-details {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

:where(.shop-products-toolbar summary) {
  --summary-pad-x: 10px;
  line-height: normal;
}

:where(.product-grid) {
  display: grid;
  grid-template-columns: repeat(var(--shop-grid-cols-xl, 5), minmax(0, 1fr));
  gap: var(--shop-grid-gap, 1rem);
  margin: var(--shop-grid-margin, 1.5rem 0);
}

:where(.product-card) {
  padding: var(--shop-card-padding, 0.875rem 0.5rem);
  border: var(--shop-card-border, 1px solid);
  background: var(--shop-card-bg, transparent);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  text-align: center;
  align-items: center;
}

:where(.product-card > img) {
  display: block;
  width: 100%;
  height: auto;
}

.product-card :is(h2, h3) {
  margin: 0.5rem 0;
  font-size: 1.1rem;
}

:where(.product-card .short) {
  font-size: 0.95rem;
  opacity: 0.85;
  margin: 0.3em 0;
}

@media (max-width: 1200px) {
  :where(.product-grid) {
    grid-template-columns: repeat(var(--shop-grid-cols-lg, 4), minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  :where(.product-grid) {
    grid-template-columns: repeat(var(--shop-grid-cols-md, 3), minmax(0, 1fr));
    gap: var(--shop-grid-gap-sm, 0.875rem);
  }
}

@media (max-width: 700px) {
  :where(.product-grid) {
    grid-template-columns: repeat(var(--shop-grid-cols-sm, 2), minmax(0, 1fr));
  }
}

:where(#shop-products-ui) button {
  margin-bottom: 0.5rem;
}

:where(.filter-group) {
  margin-bottom: 0.5rem;
}

:where(.wishlist-list, .shop-cart-items) {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

:where(.wish-item, .shop-cart-items > li) {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  border: 1px solid;
  padding: 0.5rem;
}

:where(.shop-item-image) {
  display: block;
  flex: 0 0 72px;
}

:where(.shop-item-image > img) {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
}

:where(.wish-body, .shop-cart-body) {
  min-width: 0;
}

:where(.wish-body a, .shop-cart-body a) {
  overflow-wrap: anywhere;
}

.shop-cart-link, .shop-wishlist-link { display: inline-flex; align-items: center; color: inherit; }
:where(.shop-cart-items > li) { flex-wrap: wrap; }
:where(.shop-cart-body) { flex: 1 1 10rem; }
.shop-cart-items input, [data-cart-quantity] { width: 6rem; }
.shop-product-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-block: .75rem; }

:where([data-wishlist-add]) { display: inline-flex; align-items: center; justify-content: center; }
:where([data-wishlist-add] svg) { display: block; }

:where(.shop-taxonomy-grid) {
  display: grid;
  grid-template-columns: repeat(var(--shop-grid-cols-xl, 5), minmax(0, 1fr));
  gap: var(--shop-grid-gap, 1rem);
  margin-block: 1.5rem;
}
:where(.shop-taxonomy-card) {
  min-width: 0;
  padding: var(--shop-card-padding, 1rem);
  border: var(--shop-card-border, 1px solid);
  background: var(--shop-card-bg, transparent);
  overflow-wrap: anywhere;
}
:where(.shop-taxonomy-card .featured-image-link) { display: block; }
:where(.shop-taxonomy-card .featured-image) { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
:where(.shop-taxonomy-grid--brands .featured-image) { object-fit: contain; }
:where(.shop-taxonomy-card h2) { font-size: 1.2rem; margin-block: 0.75rem; }
:where(.shop-taxonomy-count) { font-size: 0.9rem; opacity: 0.8; }
:where(.shop-directory-toolbar) { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem; }
:where(.shop-directory-toolbar label) { display: flex; flex-direction: column; gap: 0.35rem; }
:where(.shop-directory-toolbar input, .shop-directory-toolbar select) { width: auto; max-width: 100%; font: inherit; }
:where([data-directory-pager]) { display: flex; gap: 1rem; }
[data-directory-pager][hidden] { display: none; }
.shop-directory-toolbar [hidden] { display: none; }

@media (max-width: 1200px) { :where(.shop-taxonomy-grid) { grid-template-columns: repeat(var(--shop-grid-cols-lg, 4), minmax(0, 1fr)); } }
@media (max-width: 900px) { :where(.shop-taxonomy-grid) { grid-template-columns: repeat(var(--shop-grid-cols-md, 3), minmax(0, 1fr)); } }
@media (max-width: 700px) { :where(.shop-taxonomy-grid) { grid-template-columns: repeat(var(--shop-grid-cols-sm, 2), minmax(0, 1fr)); } }

/* Loading placeholders share the layout classes of the finished content. */
:where(.shop-empty-state) { padding: 1.5rem; border: 1px solid; border-radius: .75rem; margin-block: 1.5rem; }
:where(.shop-empty-state p) { margin: 0 0 1rem; }
:where(.shop-skeleton-block, .shop-skeleton-line) { background: var(--shop-skeleton-color, rgb(128 128 128 / .15)); border-radius: .3rem; }
:where(.shop-skeleton-line) { height: 1rem; width: 65%; margin-block: .6rem; }
:where(.shop-skeleton-line--title) { height: 1.6rem; width: 80%; }
:where(.shop-skeleton-line--option) { width: 45%; }
:where(.shop-skeleton-line--price) { width: 6rem; height: 1.2rem; }
:where(.shop-skeleton-line--action) { width: 7rem; height: 2.7rem; margin-block: .8rem 0; }
:where(.shop-skeleton-image) { width: 100%; aspect-ratio: var(--shop-card-image-ratio, 1); }
:where(.shop-taxonomy-grid .shop-skeleton-image) { aspect-ratio: 4 / 3; }
:where(.shop-skeleton-row .shop-item-image) { width: 72px; height: 72px; }
:where(.shop-skeleton-row > :is(.wish-body, .shop-cart-body)) { width: 100%; }
:where(.shop-skeleton-row button, .shop-skeleton-row input) { pointer-events: none; }
[data-shop-index-loading][hidden], [data-shop-loading-status][hidden] { display: none; }
html.shop-index-pending :is([data-ssr-fallback], [data-directory-fallback]) { display: none; }
html.shop-index-pending [data-shop-index-loading] { display: grid; }
html.shop-index-pending [data-shop-loading-status] { display: block; }
:where(.shop-directory-count) { min-width: 12ch; white-space: nowrap; }

[data-shop-loading-status] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.shop-directory-toolbar .shop-directory-clear[hidden] { display: inline-flex; visibility: hidden; }

:where(.shop-skeleton-text, .shop-skeleton-button) { background: var(--shop-skeleton-color, rgb(128 128 128 / .15)); color: transparent; border-radius: .3rem; }
:where(.shop-skeleton-title) { width: 80%; }
:where(.shop-skeleton-option) { display: inline-block; width: 6rem; }
:where(.shop-skeleton-price) { min-width: 4rem; }
:where(.shop-skeleton-caption) { visibility: hidden; }

:where(.shop-item-summary > a) { display: block; }
:where(.shop-item-price, .shop-item-actions) { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
:where(.shop-item-actions > .shop-product-actions) { margin: 0; }
.shop-item-actions:empty { display: none; }
.shop-skeleton-row .shop-product-actions .shop-skeleton-button { background: var(--shop-skeleton-color, rgb(128 128 128 / .15)); border-color: transparent; }
:where(.shop-cart-body .shop-skeleton-caption) { display: block; width: 24px; height: 24px; }
