/* MBF Fundraiser - product.css
   Single product page layout and styles
   ======================================== */

/* -------------------------------------------------------
   Single product page wrapper
   ------------------------------------------------------- */
.single-product .mbf-woo-main {
  padding-bottom: var(--space-3xl);
}

.mbf-woo-main .woocommerce,
.mbf-woo-main .woocommerce-page {
  width: 100%;
}

/* -------------------------------------------------------
   Product grid — gallery LEFT (col 1), summary RIGHT (col 2)
   Everything else spans both columns full-width.

   IMPORTANT: div.product contains more than just gallery + summary.
   WooCommerce also appends tabs, related products, upsells, and notices
   as direct children. We must explicitly assign grid positions so those
   elements span the full width instead of auto-placing into half-columns.

   Neither column is sticky — both scroll naturally with the page.
   (Sticky gallery caused the description section to be visually
   overlapped as the sticky element persisted through div.product's
   entire scroll height.)
   ------------------------------------------------------- */
div.product {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 3rem;
  row-gap: 0;
  align-items: start;
  padding-top: var(--space-md);
}

/* Explicit column placement for the two main elements */
.mbf-gallery {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  max-width: 480px;
  width: 100%;
}

.summary.entry-summary {
  grid-column: 2;
  grid-row: 1;
  /* Override any WooCommerce default width/float */
  width: 100% !important;
  float: none !important;
}

/* Everything else in div.product spans full width */
div.product > .woocommerce-notices-wrapper,
div.product > .woocommerce-tabs,
div.product > .woocommerce-product-rating,
div.product > .related.products,
div.product > .upsells.products,
div.product > .up-sells.products,
div.product > .wc-tabs-wrapper,
div.product > .mbf-product-description {
  grid-column: 1 / -1;
}

/* -------------------------------------------------------
   Product image gallery (left column) — custom MBF gallery
   ------------------------------------------------------- */

/* Sale badge over the gallery */
.mbf-gallery > .mbf-badge.mbf-badge--sale {
  position: absolute;
  top: 0.625rem;
  left: 0.625rem;
  z-index: 2;
}

/* Main image area */
.mbf-gallery__main {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius);
  background-color: var(--color-border);
}

/* Zoom link fills the entire main area */
.mbf-gallery__zoom {
  display: block;
  width: 100%;
  height: 100%;
}

.mbf-gallery__main-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: opacity var(--transition);
}

/* Thumbnail strip — 4-column grid */
.mbf-gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.375rem;
  margin-top: 0.5rem;
}

.mbf-gallery__thumb {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  background-color: var(--color-border);
  transition: border-color var(--transition), opacity var(--transition);
  opacity: 0.6;
}

.mbf-gallery__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.mbf-gallery__thumb:hover,
.mbf-gallery__thumb.is-active {
  border-color: var(--color-accent);
  opacity: 1;
}

/* -------------------------------------------------------
   Product summary (right column) — scrolls naturally
   ------------------------------------------------------- */
.summary.entry-summary {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0.25rem;
}

/* Category breadcrumb */
.posted_in {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0;
}

.posted_in a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Product title */
.product_title.entry-title {
  font-family: var(--font-serif);
  font-size: clamp(1.375rem, 2vw, 2rem);
  font-weight: 500;
  line-height: 1.15;
  color: var(--color-text);
  margin: 0;
}

/* Star rating */
.woocommerce-product-rating {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.star-rating {
  color: var(--color-accent);
  font-size: 0.875rem;
}

/* Price */
.summary .price {
  font-family: var(--font-sans);
  font-size: 1.375rem;
  color: var(--color-text);
  font-weight: 500;
  line-height: 1;
}

.summary .price ins {
  text-decoration: none;
  color: var(--color-accent);
}

.summary .price del {
  color: var(--color-text-muted);
  opacity: 0.6;
  font-size: 1.125rem;
  font-weight: 400;
}

/* Short description */
.woocommerce-product-details__short-description {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.7;
  padding: 0.875rem 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.woocommerce-product-details__short-description p {
  margin: 0;
}

/* -------------------------------------------------------
   Variations / variable product
   ------------------------------------------------------- */
.variations {
  width: 100%;
  border: none;
  margin: 0;
  border-collapse: collapse;
}

.variations tr {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.variations tr:last-child {
  margin-bottom: 0;
}

.variations .label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.variations .label label {
  margin: 0;
}

.variations .value select {
  width: 100%;
  padding: 0.7rem 2.25rem 0.7rem 0.875rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--color-text);
  background-color: var(--color-surface);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
  transition: border-color var(--transition);
}

.variations .value select:focus,
.variations .value select:hover {
  border-color: var(--color-accent);
  outline: none;
}

/* Reset variation link */
.reset_variations {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color var(--transition);
  display: inline-block;
  margin-top: 0.25rem;
}

.reset_variations:hover {
  color: var(--color-text);
}

/* Variation price and availability */
.woocommerce-variation-price,
.woocommerce-variation-availability {
  padding: 0.5rem 0;
}

.woocommerce-variation-price .price {
  font-size: 1.25rem;
}

.woocommerce-variation-availability p {
  font-size: 0.875rem;
  margin: 0;
  color: var(--color-text-muted);
}

.woocommerce-variation-availability p.in-stock {
  color: var(--color-accent);
  font-weight: 500;
}

/* -------------------------------------------------------
   Quantity + Add to Cart
   -------------------------------------------------------
   Simple products: .cart > .quantity + button
   Variable products: .woocommerce-variation-add-to-cart > .quantity + button
   Both cases use flex-row to place qty and button side-by-side.
   ------------------------------------------------------- */

/* Simple product cart form */
form.cart {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* Variations table and variation wrap go full-width above the qty/button row */
form.cart .variations,
form.cart .single_variation_wrap {
  flex: 0 0 100%;
}

/* For simple products: qty is inline, button fills remaining space */
form.cart > .quantity {
  flex: 0 0 auto;
}

form.cart > .single_add_to_cart_button {
  flex: 1 1 auto;
  min-width: 160px;
}

/* Variable product: qty+button container */
.woocommerce-variation-add-to-cart {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.woocommerce-variation-add-to-cart .quantity {
  flex: 0 0 auto;
}

.woocommerce-variation-add-to-cart .single_add_to_cart_button {
  flex: 1 1 auto;
  min-width: 160px;
}

/* Quantity stepper (with +/- buttons from template override) */
.quantity {
  display: inline-flex;
  align-items: stretch;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
  background-color: var(--color-surface);
}

.quantity:focus-within {
  border-color: var(--color-accent);
}

.quantity__minus,
.quantity__plus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition), background-color var(--transition);
  line-height: 1;
  padding: 0;
  font-family: var(--font-sans);
  flex-shrink: 0;
}

.quantity__minus:hover,
.quantity__plus:hover {
  color: var(--color-accent);
  background-color: var(--color-bg);
}

.quantity .qty {
  width: 2.75rem;
  text-align: center;
  border: none;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--color-text);
  padding: 0.625rem 0;
  background: transparent;
  -moz-appearance: textfield;
  outline: none;
}

.quantity .qty::-webkit-outer-spin-button,
.quantity .qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

/* Add to cart button
   Use !important to override WooCommerce's own stylesheet which loads
   .button.alt with a purple default color. */
.woocommerce .single_add_to_cart_button,
.woocommerce button.single_add_to_cart_button,
button.single_add_to_cart_button {
  padding: 0.875rem 1.5rem;
  background-color: var(--color-accent) !important;
  color: #fff !important;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color var(--transition);
  white-space: nowrap;
  width: 100%;
}

.woocommerce .single_add_to_cart_button:hover,
.woocommerce button.single_add_to_cart_button:hover,
button.single_add_to_cart_button:hover {
  background-color: var(--color-accent-hover) !important;
  color: #fff !important;
}

.single_add_to_cart_button.loading {
  opacity: 0.7;
  pointer-events: none;
}

.single_add_to_cart_button.added {
  display: none;
}

/* Stock status */
.stock.in-stock {
  color: var(--color-accent);
  font-size: 0.875rem;
  font-weight: 500;
}

.stock.out-of-stock {
  color: var(--color-sale);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Product meta (SKU, categories) — hidden by design */
.product_meta {
  display: none;
}

/* -------------------------------------------------------
   Full description (below the gallery/summary, full width)
   Rendered by woocommerce/single-product/tabs/tabs.php
   ------------------------------------------------------- */
.woocommerce-tabs,
.wc-tabs-wrapper {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-xl);
}

/* Full-width description — no max-width constraint */
.mbf-product-description h2,
.woocommerce-tabs h2,
.woocommerce-Tabs-panel--description h2 {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 500;
  margin-bottom: var(--space-lg);
}

.mbf-product-description p,
.mbf-product-description ul,
.mbf-product-description ol {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.75;
  margin-bottom: var(--space-md);
}

/* -------------------------------------------------------
   Related products (full width, below description)
   ------------------------------------------------------- */
.related.products {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
}

.related.products > h2 {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 500;
  margin-bottom: var(--space-xl);
}

.related.products ul.products {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
  min-width: 0; /* allow grid to shrink inside full-bleed column */
}

/* WooCommerce clearfix adds ::before and ::after (display: table); those become grid items and create a blank first cell — remove them */
.related.products ul.products::before,
.related.products ul.products::after {
  content: none !important;
  display: none !important;
}

/* Reset WooCommerce float/width/clear on related product items; min-width: 0 so items can shrink and all 4 fit in one row.
   WC adds .first + clear:both for float grids — that pushes the first item to row 2 in our grid, so reset clear. */
.related.products ul.products li.product {
  float: none !important;
  clear: none !important;
  width: auto !important;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.related.products ul.products li.product a {
  display: block;
  text-decoration: none;
  min-width: 0; /* allow link (and image/title inside) to shrink with grid cell */
}

.related.products ul.products li.product a img {
  border-radius: var(--radius);
  width: 100%;
  min-width: 0; /* allow image to shrink with grid cell */
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.4s ease;
}

.related.products ul.products li.product a:hover img {
  transform: scale(1.03);
}

.related.products ul.products li.product .woocommerce-loop-product__title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text);
  padding: 0.625rem 0 0.25rem;
  transition: color var(--transition);
}

.related.products ul.products li.product a:hover .woocommerce-loop-product__title {
  color: var(--color-accent);
}

.related.products ul.products li.product .price {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.related.products ul.products li.product .price ins {
  text-decoration: none;
  color: var(--color-accent);
}

.related.products ul.products li.product .price del {
  opacity: 0.6;
}

/* Hide add-to-cart on related products — click the card to go to product page */
.related.products ul.products li.product .button {
  display: none;
}
