/* ==========================================================================
   GLOBAL BACKGROUND COLOR UPDATE
   ========================================================================== */

body, 
#page, 
.site,
#content,
.site-content {
    background-color: #f8f8fa !important; /* A clean, modern subtle grey */
}

/**
 * Product card styles — Type A (default) and Type B (homepage featured).
 */

/* ==========================================================================
   TYPE A — vertical card (shop/category pages)
   ========================================================================== */

.product-card--a {
  width: 100%;
  margin: 0;
  background: transparent;
  border-radius: 16px;
  border: 1px solid var(--color-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Force image container to be perfectly square */
.product-card--a .product-card__image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1 !important;
  background: var(--color-bg);
  display: block;
  overflow: hidden;
}

.product-card--a .product-card__image-link {
  display: block;
  width: 100%;
  height: 100%;
}

.product-card--a .product-card__image-link img {
  width: 100%;
  height: 100%;
  object-fit: cover !important;
  display: block;
}

.product-card--a .product-card__body {
  padding: 16px 16px 0 16px; 
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.product-card__title-link {
  text-decoration: none;
}

.product-card__title {
  font-family: var(--font-base);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 4px;
  text-align: center;
}

.product-card__categories {
  font-family: var(--font-base);
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  align-items: center;
}

.product-card__categories a {
  color: var(--color-text-muted);
  text-decoration: none;
  align-items: center;
}

.product-card__description {
  font-family: var(--font-base);
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0 0 16px;
  flex: 1 1 auto;
}

/* Split Action Row layout configuration */
.product-card__action-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0;
  margin: auto -16px 0 -16px;
  border-top: 1px solid var(--color-border);
}

.product-card--a .product-card__category-badges {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  margin: 0 0 10px !important;
  width: 100% !important;
}

/* Left Side: Price block with vertical border */
.product-card__price-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 12px;
  border-right: 1px solid var(--color-border);
}

.product-card__price-label {
  display: none;
}

.product-card__price {
  font-family: var(--font-base);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.product-card__price del {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-right: 4px;
}

/* Right Side: Clean plain text CTA action */
.product-card__place-order-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  color: var(--color-primary);
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  border-radius: 0 !important;
  text-decoration: none;
  white-space: nowrap;
  flex: 1;
  transition: color 0.2s ease;
}

.product-card__place-order-btn:hover {
  color: var(--color-success);
  background: transparent !important;
}

/* ==========================================================================
   TYPE B — horizontal card (homepage featured)
   ========================================================================== */

.product-card--b {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  background: #ffffff; /* Gives featured items standalone breathing depth visibility */
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  width: 100%;
  box-sizing: border-box;
}

.product-card--b .product-card__body--b {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  align-items: flex-start;
  text-align: left;
}

.product-card--b .product-card__title {
  text-align: left !important;
  align-self: flex-start;
}

.product-card--b .product-card__image-wrap--square {
  display: block !important;
  flex: 0 0 100px;
  width: 100px !important;
  height: 100px !important;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--color-bg);
}

.product-card--b .product-card__image-wrap--square img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

/* ==========================================================================
   CATEGORY BADGES ENGINE
   ========================================================================== */

.product-card__category-badges {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  margin: 0 0 4px !important;
  width: 100%;
}

.product-card__category-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 4px 10px !important;
  border: 1px solid var(--color-border-strong) !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: var(--color-text) !important;
  font-family: var(--font-base) !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  text-align: center !important;
  height: auto !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
}

.product-card__rating {
  display: flex;
  gap: 2px;
}

.product-card__star {
  color: var(--color-border-strong);
}

.product-card__star.is-filled {
  color: var(--color-success);
}

.product-card__price--b {
  font-family: var(--font-base);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 4px;
}

/* ==========================================================================
   DYNAMIC GRID CONTROLLERS (RESPONSIVE VIEWPORT ALIGNMENTS)
   ========================================================================== */

/* Shop loops standard archive layouts overrides */
ul.products {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
  gap: 16px !important;
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.products li.product {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none;
  display: flex;
  align-items: stretch;
  width: 100% !important;
  float: none !important;
}

ul.products li.product .product-card--a {
  width: 100%;
  max-width: none;
  height: 100%;
}

ul.products::before,
ul.products::after {
  display: none !important;
  content: none !important;
}

/* Related section (uses vertical Layout Type A) */
.related-products-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
  gap: 16px !important;
  width: 100%;
}

/* Featured section (Uses horizontal Layout Type B on homepage) */
.featured-products-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
  gap: 16px !important;
  width: 100%;
}

/* ==========================================================================
   UNIVERSAL MOBILE RESPONSIVE ENGINE (UP TO 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* --- TYPE A: 2-COLUMN FORCE AND PREVENT OUT-OF-BOUNDS CUT-OFFS --- */
  ul.products,
  .related-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important; /* Forces columns to resize inward rather than overflowing */
    gap: 10px !important; /* Extra breathing space for small viewports */
  }

  .product-card--a .product-card__body {
    padding: 10px 10px 0 10px; /* Reduce text box inner padding to save lateral real estate */
  }

  .product-card--a .product-card__title {
    font-size: 14px; /* Scaled down slightly to fit names without clipping */
    line-height: 1.3;
  }

  .product-card--a .product-card__description {
    font-size: 12px;
    margin-bottom: 12px;
  }

  /* Shrink text sizing inside split footer cells to protect action bar formatting from fracturing */
  .product-card--a .product-card__action-row {
    margin: auto -10px 0 -10px;
  }

  .product-card--a .product-card__price {
    font-size: 13px;
  }

  .product-card--a .product-card__place-order-btn {
    font-size: 12px;
    padding: 10px 4px;
  }

  .product-card--a .product-card__category-badge {
    padding: 3px 6px !important;
    font-size: 10px !important;
  }

  /* --- TYPE B: TRANSFORM FEATURED SECTION INTO STYLISH 2-COLUMN ROWS --- */
  .featured-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important; /* Change from 1 col stacking to crisp 2 columns */
    gap: 10px !important;
  }

  .product-card--b {
    flex-direction: column !important; /* Converts horizontal cards to tight, clean vertical modules on mobile */
    align-items: flex-start !important;
    padding: 12px;
    border-radius: 14px;
    gap: 10px;
  }

  .product-card--b .product-card__image-wrap--square {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important; /* Perfectly shapes image to card width constraints */
    flex: 0 0 auto;
    border-radius: 8px;
  }

  .product-card--b .product-card__body--b {
    padding: 0;
    width: 100%;
    gap: 2px;
  }

  .product-card--b .product-card__title {
    font-size: 14px !important;
    margin: 0;
  }

  .product-card--b .product-card__price--b {
    font-size: 14px;
    margin-top: 2px;
  }
  
  .product-card--b .product-card__category-badge {
    padding: 3px 6px !important;
    font-size: 10px !important;
  }
}

/* Global utility rule cleanups */
.storefront-breadcrumb {
    margin-bottom: 0px !important;
}

.product-card__title-link,
.product-card__title-link:hover,
.product-card__title-link:focus,
.product-card__title-link:visited,
.product-card__place-order-btn,
.product-card__place-order-btn:hover,
.product-card__place-order-btn:focus,
.product-card__place-order-btn:visited,
.product-card--b .product-card__image-wrap--square,
.product-card--b .product-card__image-wrap--square:hover {
  text-decoration: none !important;
}


.product-card__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;

    /* Lock the box to exactly 2 lines of text so cards in the same row stay equal height */
    line-height: 1.3;
    min-height: calc(1.3em * 2);
    max-height: calc(1.3em * 2);
}