/**
 * Shopify Storefront Web Components Styles
 *
 * Styles for Shopify-backed products displayed via
 * Shopify Storefront Web Components SDK.
 *
 * Components:
 * - ShopifyProductCard (single product display)
 * - ShopifyCollection (product grid + modal)
 */

/* ==========================================================================
   Single Product Card (ShopifyProductCard Component)
   ========================================================================== */

.product-layout {
  display: flex;
}

.product-layout .product-card {
  max-width: 80rem;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 1em;
  border-radius: 12px;
}

.product-layout .product-card__container {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  box-sizing: border-box;
}

.product-layout .product-card__media {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.product-layout .product-card__main-image img {
  border-radius: 0.5rem;
}

.product-layout .product-card__details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.5rem;
}

.product-layout .product-card__info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.product-layout .product-card__title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
}

.product-layout .product-card__price {
  display: flex;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
}

.product-layout .product__link {
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.875rem;
  font-weight: 700;
}

.product-layout .product-card__product-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  background-color: #000000;
  border-radius: 0.75rem;
  transition: background-color 0.3s ease, color 0.3s ease;
  border: 2px solid black;
}

.product-layout .product-card__product-link:hover {
  background: #ffffff;
  color: #000000;
  border: 2px solid black;
}

/* ==========================================================================
   Collection Component (ShopifyCollection Component)
   ========================================================================== */

/* Collection Container */
.collection {
  padding: 1rem;
  border-radius: 0.75rem;
  background-color: #ffffff;
}

.collection__title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 1rem 0;
  color: #111827;
}

/* Product Grid */
.product-grid {
  margin: 0 auto;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  justify-items: center;
  align-items: center;
}

/* Product Cards in Grid */
.product-grid .product-card {
  position: relative;
  cursor: pointer;
  border: 0;
  background-color: inherit;
}

.product-grid .product-card:is([disabled]) {
  cursor: not-allowed;
}

.product-grid .product-card:is([disabled])::before {
  position: absolute;
  z-index: 1;
  content: '';
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.5);
}

.product-grid .product-card:is([disabled])::after {
  content: 'Sold out';
  position: absolute;
  top: 40%;
  left: 0;
  width: 100%;
  height: 100%;
  color: #000000;
  font-size: 1.125rem;
  font-weight: 700;
  text-align: center;
  z-index: 2;
}

.product-grid .product-card__image-container {
  width: 100%;
  overflow: hidden;
  border-radius: 0.625rem;
  aspect-ratio: auto;
  height: 20rem;
}

.product-grid .product-card__image-container img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: transform 0.3s ease-in-out;
}

.product-grid .product-card:hover .product-card__image-container img {
  transform: scale(1.1);
}

.product-grid .product-card__image-container:hover {
  opacity: 0.75;
}

.product-grid .product-card__details {
  margin: 0.5rem 0;
  display: flex;
  justify-content: space-between;
}

.product-grid .product-card__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-grid .product-card__title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #000000;
  text-align: left;
  margin: 14px 0 0 0;
}

.product-grid .product-card__title:hover {
  text-decoration: underline;
}

.product-grid .product-card__category {
  margin: 0;
  font-size: 0.875rem;
  color: #6b7280;
  text-align: left;
}

.product-grid .product-card__price {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
  margin: 0;
  text-align: left;
}

/* ==========================================================================
   Product Modal (Shared by ShopifyCollection)
   ========================================================================== */

.product-modal {
  padding: 0;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 0;
}

.product-modal::backdrop {
  background-color: rgba(156, 163, 175, 0.5);
}

.product-modal__container {
  position: relative;
  overflow-x: hidden;
  padding: 2rem;
}

.product-modal__close-container {
  display: grid;
  justify-items: end;
  justify-content: end;
  margin-left: 2rem;
  padding-bottom: 1rem;
}

.product-modal__close {
  border-radius: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  cursor: pointer;
}

.product-modal__content {
  width: 100%;
  background-color: #ffffff;
  border-radius: 0.75rem;
  max-width: 54rem;
  min-width: 320px;
}

.product-modal__layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 768px) {
  .product-modal__layout {
    flex-direction: row;
  }
}

.product-modal__media {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.product-modal__media img {
  border-radius: 0.25rem;
  width: 100%;
}

.product-modal__details {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
}

.product-modal__header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.product-modal__vendor {
  opacity: 0.5;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.product-modal__title {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0;
}

.product-modal__price-container {
  display: flex;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 1.25rem;
}

.product-modal__compare-price {
  text-decoration: line-through;
  opacity: 0.5;
}

.product-modal__buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.product-modal__buttons button {
  font-size: 0.875rem;
  font-weight: 800;
  transition: background-color 0.3s ease, color 0.3s ease;
  cursor: pointer;
  border: 2px solid black;
  text-transform: uppercase;
}

.product-modal__add-button {
  background-color: #000000;
  color: #ffffff;
  border-radius: 0.75rem;
  padding: 1rem;
  font-size: 18px;
  font-weight: 500;
  width: 100%;
}

.product-modal__add-button:hover {
  background: #ffffff;
  color: #000000;
  border: 2px solid black;
}

.product-modal__add-button:disabled {
  opacity: 0.3;
}

.product-modal__buy-button {
  background-color: #ffffff;
  color: #000000;
  border-radius: 0.75rem;
  padding: 1rem;
  font-size: 18px;
  font-weight: 500;
  width: 100%;
}

.product-modal__buy-button:disabled {
  opacity: 0.3;
}

.product-modal__buy-button:hover {
  opacity: 0.3;
}

.product-modal__description-text {
  font-weight: 400;
  color: #717171;
  letter-spacing: 0.05em;
  font-size: 0.875rem;
}

.product-modal__description-text p {
  margin: 0;
}
