/*
 * Product page.
 *
 * This styles WooCommerce's OWN single-product markup rather than replacing it.
 * That is deliberate: every WooCommerce hook still fires, so the native gallery
 * (with zoom and lightbox), the variation form, the tabs and anything a plugin
 * adds all keep working. The previous hand-built template fired no hooks at all,
 * which is why variations never appeared and why a delivery-estimate plugin would
 * have rendered nothing at all.
 *
 * Only presentation lives here. Behaviour stays with WooCommerce.
 */

.bb-pdp-inner {
  max-width: var(--bb-max-width-narrow);
  margin: 0 auto;
  padding: 0 var(--bb-side-padding) 90px;
}

.bb-pdp-breadcrumb {
  padding: 28px 0 0;
  font-size: 12.5px;
  color: var(--bb-tertiary-alt);
}
.bb-pdp-breadcrumb a { color: var(--bb-tertiary-alt); }
.bb-pdp-breadcrumb a:hover { color: var(--bb-ink); }

/* Two columns: gallery left, summary right. */
.bb-pdp div.product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 60px;
  padding-top: 24px;
}
/* WooCommerce's own stylesheet floats these two and pins them to 48% width
   (.woocommerce div.product div.images / div.summary). Inside a grid track that
   leaves each column filling less than half its space, so the float and the width
   both have to be undone here.

   Specificity matters: WooCommerce's selector scores (0,3,2), so the obvious
   `.bb-pdp div.product .summary` at (0,3,1) quietly loses. The body prefix takes
   these to (0,3,3), which wins outright without reaching for !important. */
body .bb-pdp div.product div.images,
body .bb-pdp div.product div.woocommerce-product-gallery,
body .bb-pdp div.product div.summary {
  float: none;
  width: 100%;
  margin: 0;
}
.bb-pdp div.product .woocommerce-product-gallery { grid-column: 1; }
.bb-pdp div.product .summary { grid-column: 2; }

/* Same for anything spanning the full width below the two columns. */
.bb-pdp div.product > .woocommerce-tabs,
.bb-pdp div.product > .related,
.bb-pdp div.product > .upsells {
  float: none;
  width: 100%;
}

/* Anything below the two columns spans the full width. */
.bb-pdp div.product > .woocommerce-tabs,
.bb-pdp div.product > .related,
.bb-pdp div.product > .upsells,
.bb-pdp div.product > .bb-similar-items {
  grid-column: 1 / -1;
}

/* Gallery */
.bb-pdp .woocommerce-product-gallery { position: relative; }
.bb-pdp .woocommerce-product-gallery__image img { display: block; width: 100%; height: auto; }

/* WooCommerce's zoom trigger, drawn as a magnifying glass. */
.bb-pdp .woocommerce-product-gallery__trigger {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--bb-hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  color: var(--bb-ink);
  transition: background 140ms;
}
.bb-pdp .woocommerce-product-gallery__trigger:hover { background: #fff; }
.bb-pdp .woocommerce-product-gallery__trigger::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 1.8px solid var(--bb-ink);
  border-radius: 50%;
  box-shadow: 4px 4px 0 -1.5px var(--bb-ink);
  transform: translate(-2px, -2px);
}
.bb-pdp .woocommerce-product-gallery__trigger img { display: none; }

/* Thumbnail strip, square-cornered to match the brand.
 *
 * WooCommerce styles these list items as `width: 25%; float: left`, which is
 * right for its own floated strip and wrong inside a grid: the 25% resolves
 * against the grid track rather than the strip, so each thumbnail rendered at a
 * quarter of its cell and sat marooned in the corner of it. That is the spacing
 * problem, not the gap. The items have to be told to fill their track.
 *
 * The selector mirrors WooCommerce's own shape with a `body` prefix so it
 * outranks it on specificity rather than with !important, the same approach used
 * for the columns above.
 *
 * auto-fit rather than a fixed four: products here carry anywhere from two to
 * nine images, and four columns left a fifth thumbnail stranded alone on a
 * second row. The source thumbnails are 100px square, so 80px is the smallest
 * track worth having and auto-fit stretches a short final row to fill.
 */
.bb-pdp .flex-control-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

body .bb-pdp div.product div.images .flex-control-thumbs li {
  width: 100%;
  max-width: none;
  float: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

body .bb-pdp div.product div.images .flex-control-thumbs img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: pointer;
  opacity: .55;
  transition: opacity 140ms;
}

.bb-pdp .flex-control-thumbs img.flex-active,
.bb-pdp .flex-control-thumbs img:hover { opacity: 1; }

/* Summary column */
.bb-pdp .summary > * { margin: 0 0 18px; }
.bb-pdp .summary > *:last-child { margin-bottom: 0; }

.bb-pdp .bb-pdp-eyebrow {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--bb-tertiary-alt);
}

.bb-pdp .product_title {
  font-family: var(--bb-font-serif);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.2;
  color: var(--bb-ink);
}

.bb-pdp .summary .price,
.bb-pdp .summary .price .amount {
  font-family: var(--bb-font-sans);
  font-size: 19px;
  font-weight: 600;
  color: var(--bb-ink);
}
.bb-pdp .summary .price del { opacity: .5; font-weight: 400; margin-right: 8px; }
.bb-pdp .summary .price ins { text-decoration: none; }

.bb-pdp .woocommerce-product-details__short-description,
.bb-pdp .woocommerce-product-details__short-description p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--bb-muted);
  max-width: 440px;
}

/* Variation form. The real selects stay in the DOM and are driven by the
   swatches built in single-product.js, so WooCommerce keeps control of price,
   stock and add-to-cart. */
.bb-pdp .variations { width: 100%; border: 0; margin: 0 0 18px; }
.bb-pdp .variations th,
.bb-pdp .variations td { display: block; width: 100%; padding: 0; border: 0; text-align: left; }
.bb-pdp .variations tr { display: block; margin-bottom: 16px; }
.bb-pdp .variations label {
  font-size: 12px;
  font-weight: 600;
  color: var(--bb-ink);
  margin-bottom: 10px;
  display: block;
}

/* Out of sight, still focusable, still the source of truth.

   The long selector is deliberate. WooCommerce sets a width on this select via
   `.woocommerce div.product form.cart .variations select`, which outranks a
   shorter rule here; the select then stayed 882px wide while merely looking
   hidden, and pushed the whole page into a horizontal scroll. */
body .bb-pdp div.product form.cart .variations select.bb-native-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.bb-swatch-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.bb-swatch {
  cursor: pointer;
  padding: 11px 16px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--bb-hairline);
  background: #fff;
  color: var(--bb-ink);
  transition: border-color 140ms, background 140ms, color 140ms;
}
.bb-swatch:hover { border-color: var(--bb-ink); }
.bb-swatch.is-selected { background: var(--bb-ink); border-color: var(--bb-ink); color: #fff; }
.bb-swatch.is-disabled { opacity: .35; cursor: not-allowed; text-decoration: line-through; }

/* Colour swatches are circles rather than pills. */
.bb-swatch--color {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border-width: 2px;
  font-size: 0;
  text-indent: -9999px;
}
.bb-swatch--color.is-selected { border-color: var(--bb-ink); }
.bb-swatch--color.is-disabled { text-decoration: none; }

.bb-pdp .reset_variations {
  display: inline-block;
  font-size: 12px;
  color: var(--bb-muted);
  text-decoration: underline;
}

.bb-pdp .woocommerce-variation-price { margin-bottom: 14px; }
.bb-pdp .woocommerce-variation-availability p { font-size: 12.5px; color: var(--bb-muted); margin: 0 0 10px; }

/* Quantity and add to bag */
.bb-pdp form.cart { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.bb-pdp form.variations_form { display: block; }
.bb-pdp .woocommerce-variation-add-to-cart { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.bb-pdp .quantity {
  display: flex;
  align-items: center;
  border: 1px solid var(--bb-hairline);
}
.bb-pdp .quantity input.qty {
  width: 58px;
  border: 0;
  padding: 13px 8px;
  font-size: 13px;
  text-align: center;
  background: none;
  color: var(--bb-ink);
}

.bb-pdp .single_add_to_cart_button {
  flex: 1;
  min-width: 200px;
  text-align: center;
  background: var(--bb-ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 16px 20px;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: opacity 140ms;
}
.bb-pdp .single_add_to_cart_button:hover { opacity: .88; }
.bb-pdp .single_add_to_cart_button.disabled { opacity: .4; cursor: not-allowed; }

/* Shipping and returns block */
.bb-pdp-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--bb-hairline);
}
.bb-pdp-info__row { display: flex; gap: 12px; }
.bb-pdp-info__row svg { flex: none; margin-top: 1px; }
.bb-pdp-info__title { font-size: 12.5px; font-weight: 600; text-decoration: underline; }
.bb-pdp-info__note { font-size: 12px; color: var(--bb-tertiary-alt); margin-top: 3px; }

/* Product meta kept but played down. */
.bb-pdp .product_meta { font-size: 12px; color: var(--bb-tertiary-alt); }
.bb-pdp .product_meta a { color: var(--bb-muted); }
.bb-pdp .product_meta > span { display: block; margin-bottom: 4px; }

/* Tabs. Kept because this is where plugins add their content. */
.bb-pdp .woocommerce-tabs { margin-top: 70px; }
.bb-pdp .woocommerce-tabs ul.tabs {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0 0 24px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--bb-hairline);
}
.bb-pdp .woocommerce-tabs ul.tabs li { margin: 0; }
.bb-pdp .woocommerce-tabs ul.tabs li a {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--bb-tertiary);
}
.bb-pdp .woocommerce-tabs ul.tabs li.active a { color: var(--bb-ink); }
.bb-pdp .woocommerce-tabs .panel h2 { display: none; }
.bb-pdp .woocommerce-tabs .panel { font-size: 14px; line-height: 1.7; color: var(--bb-muted); }

/* Similar items already sits inside .bb-pdp-inner, so it must not add a second
   max-width and another set of side gutters on top. */
.bb-pdp .bb-similar-items {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
  margin-top: 70px;
}
.bb-pdp .bb-similar-items img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Notices */
.bb-pdp .woocommerce-notices-wrapper .woocommerce-message,
.bb-pdp .woocommerce-notices-wrapper .woocommerce-error,
.bb-pdp .woocommerce-notices-wrapper .woocommerce-info {
  border-left: 3px solid var(--bb-ink);
  background: var(--bb-body-bg);
  padding: 14px 18px;
  font-size: 13px;
  margin-bottom: 20px;
  list-style: none;
}
