/**
 * CSS custom properties (variables) for product components
 * Uses WordPress preset font sizes when available, with fallbacks
 */
:root {
  /* Use WordPress preset font sizes when available */
  --font-size-400: var(--wp--preset--font-size--small, 0.875rem);     /* Small text */
  --font-size-500: var(--wp--preset--font-size--medium, 1rem);        /* Body text */
  --font-size-600: var(--wp--preset--font-size--large, 1.25rem);      /* Subheadings */
  --font-size-700: var(--wp--preset--font-size--x-large, 1.5rem);     /* Headings */
  --font-size-800: var(--wp--preset--font-size--xx-large, 1.75rem);   /* Large headings */

  /* Base settings */
  --font-size-base: var(--font-size-500);  /* Use medium as base */
  --line-height: 1.5;

  /* Calculated spacing based on font size and line height */
  --text-spc-500: calc(var(--line-height) * var(--font-size-500));
  --text-spc-600: calc(var(--line-height) * var(--font-size-600));
  --text-spc-700: calc(var(--line-height) * var(--font-size-700));
  --text-spc-800: calc(var(--line-height) * var(--font-size-800));
}

/**
 * Product-specific heading styles (scoped to product components)
 */
.product h2 {
  font-size: var(--font-size-600);
  text-transform: uppercase;
  margin: 0 0 var(--text-spc-500) 0;
  line-height: 1.2;
  display: none;
}

.product h3 {
  font-size: var(--font-size-500);
}

.product h4 {
  font-size: var(--font-size-400);
  text-transform: uppercase;
}

/**
 * Product image styling
 * Makes images responsive and fill the card width
 */
.product__image--small {
  width: 100%;
  height: auto;
  object-fit: cover;
  margin-bottom: var(--text-spc-500);
}

/* ==========================================================================
   Product Grid and Components
   ========================================================================== */
/**
 * Product grid layout
 * Responsive grid: 3 columns on desktop, adaptive on smaller screens
 */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.5rem;
  align-items: start;
}

/* Large screens: exactly 3 columns */
@media (min-width: 900px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Medium screens: 2 columns */
@media (max-width: 899px) and (min-width: 600px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Small screens: 1 column */
@media (max-width: 599px) {
  .products-grid {
    grid-template-columns: 1fr;
  }
}

/**
 * Main container for the Kuduhear products section
 */
#kuduhear-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/**
 * Simple header styling - only basic layout
 */
.kuduhear-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
}

.kuduhear-header h2 {
  margin: 0;
}

/**
 * Cart button styling (now outside header)
 */
.snipcart-checkout {
  background-color: #000;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  margin-bottom: 2rem;
}

/**
 * Product container
 * Flexible column layout for product details
 */
.product {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product__info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: var(--text-spc-500);
  padding: 1rem;
  border: none;
  background-color: transparent;
  font-size: var(--font-size-500);
  text-align: inherit;
  height: 100%;
}

.product__info:hover {
  cursor: pointer;
}

/**
 * Add to basket button
 */
.product__button {
  margin: 1rem auto 0;
  padding: 0.8rem 2rem;
  background-color: #000;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: var(--font-size-500);
  transition: background-color 0.2s ease;
  width: auto;
  display: block;
  min-width: 12rem;
  text-align: center;
  border-radius: 4px;
}

.product__button:hover,
.product__button:focus {
  background-color: #333;
  outline: 2px solid var(--color-focus, #4d90fe);
  outline-offset: 2px;
}

/**
 * Product price container
 */
.product__price {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: auto;
  padding-top: 2rem;
  min-height: 8rem; /* Ensure consistent height for price area */
  justify-content: flex-end;
}

/**
 * Tax information text
 */
.product__price__taxes {
  font-size: var(--font-size-400);
}

/**
 * Price value
 */
.product__price__value {
  font-size: var(--font-size-600);
}

.product__price--popover {
  grid-column: 1 / -1;
}
