/* Images must never exceed their container. Without this an 800px product photo
   sets the min-content width of its grid track, and because `1fr` is really
   minmax(auto, 1fr) the track cannot shrink below it: four 800px columns, a
   container blown far past its max-width, and a horizontal scrollbar. */
img {
  max-width: 100%;
  height: auto;
}

/* Product card photo fills its 3:4 frame. */
.bb-product-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Footer links. wp_nav_menu() output cannot carry inline styles, so the colour has
   to come from here rather than from the template. */
.bb-footer-links a,
.bb-footer-links li a {
  color: var(--bb-footer-link);
  transition: color 140ms;
}
.bb-footer-links a:hover,
.bb-footer-links li a:hover {
  color: var(--bb-footer-link-hover);
}
.bb-footer-links ul,
.bb-footer-links li {
  list-style: none;
  margin: 0;
  padding: 0;
}
.bb-footer-links ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Default page wrapper. The centring lives here rather than on <main>, because an
   auto margin on a flex child cancels align-self:stretch and makes the element
   shrink to fit its content. That collapsed the cart page to a narrow strip. */
.bb-page {
  max-width: var(--bb-max-width-narrow);
  margin: 0 auto;
  padding: 60px var(--bb-side-padding) 90px;
}
.bb-page__title {
  font-family: var(--bb-font-serif);
  font-weight: 600;
  font-size: 30px;
  margin: 0 0 28px;
}

/* The Cart and Checkout blocks are alignwide; let them fill the wrapper. */
.bb-page .alignwide,
.bb-page .alignfull { max-width: none; }

/* Square corners inside WooCommerce blocks, to match the rest of the brand. */
.bb-page .wc-block-components-button,
.bb-page .wc-block-cart__submit-button,
.bb-page .wc-block-components-text-input input,
.bb-page .wc-block-components-country-input select { border-radius: 0; }

/* Ticker */
.bb-ticker-track {
  display: inline-flex;
  white-space: nowrap;
  animation: bb-scroll 22s linear infinite;
}
@keyframes bb-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Hover states */
.bb-navitem { cursor: pointer; transition: opacity 160ms; }
.bb-navitem:hover { opacity: .65; }
.bb-menulink { transition: color 140ms; display: block; }
.bb-menulink:hover { color: var(--bb-link-hover); }
.bb-reset-btn { font: inherit; }

.bb-card:hover,
.bb-cardhover:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(20, 20, 26, .10);
}
.bb-cardhover { transition: transform 180ms ease-out, box-shadow 180ms ease-out; }

/* Badge (wishlist/cart counts) */
.bb-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--bb-ink);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sign-in tooltip */
.bb-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bb-ink);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 160ms;
  pointer-events: none;
}
.bb-account-trigger:hover .bb-tooltip { opacity: 1; }

/* Open/visible states toggled via JS (hidden attribute removed) */
.bb-megamenu, .bb-dropdown-panel, #bb-currency-menu, #bb-signin-modal, #bb-quickview-modal {
  animation: bb-fade-in 140ms ease-out;
}
@keyframes bb-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* IMPORTANT: display is set here, keyed off the absence of [hidden], rather than inline
   on the element itself. An inline `style="display:..."` always beats the browser's
   built-in `[hidden] { display: none }` rule, so combining them makes hidden a no-op. */
#bb-quickview-modal:not([hidden]) { display: flex; }
#bb-signin-modal:not([hidden]) { display: flex; }
.bb-dropdown-panel--grid:not([hidden]) { display: grid; }

/* The cart overlay's pointer-events MUST live here, not inline on the element.
   An inline `pointer-events:none` beats this .is-open rule, because inline styles
   win over plain declarations. That left the drawer visibly open but completely
   unclickable: close button, checkout link, qty steppers and remove all dead.
   Same failure mode as combining [hidden] with an inline display. */
#bb-cart-overlay { pointer-events: none; }
#bb-cart-overlay.is-open {
  pointer-events: auto;
  background: rgba(20, 20, 26, .32) !important;
}
#bb-cart-overlay.is-open #bb-cart-drawer {
  transform: translateX(0) !important;
}

/* Product grid quick-view bar (hover reveal) */
.bb-quickview-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  text-align: center; background: rgba(255,255,255,0);
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: 10px 0; cursor: pointer; opacity: 0;
  transition: opacity 160ms, background 160ms;
}
.bb-product-tile:hover .bb-quickview-bar {
  opacity: 1;
  background: rgba(255,255,255,.85);
}

.bb-add-to-bag {
  transition: background 160ms, color 160ms;
}
.bb-add-to-bag:hover {
  background: var(--bb-black-solid);
  color: #fff;
}

/* -------------------------------------------------------------------
 * Shop pagination
 *
 * Rendered by template-parts/shop/pagination.php under both product grids.
 * paginate_links() emits <a class="page-numbers"> and a <span> for the current
 * page, so both are styled as one set of square tiles.
 * ----------------------------------------------------------------- */
.bb-pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--bb-hairline);
}

.bb-pagination__count {
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--bb-tertiary-alt);
}

.bb-pagination__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.bb-pagination__links .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--bb-hairline);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--bb-ink);
  text-decoration: none;
  transition: border-color 160ms ease-out, background 160ms ease-out, color 160ms ease-out;
}

.bb-pagination__links a.page-numbers:hover {
  border-color: var(--bb-ink);
}

/* paginate_links marks the current page with .current on a span, not a link. */
.bb-pagination__links .page-numbers.current {
  background: var(--bb-ink);
  border-color: var(--bb-ink);
  color: #fff;
}

/* The ellipsis is not a control, so it should not look like one. */
.bb-pagination__links .page-numbers.dots {
  border-color: transparent;
  color: var(--bb-tertiary-alt);
  min-width: 24px;
  padding: 0;
}

.bb-pagination__links .prev,
.bb-pagination__links .next {
  text-transform: uppercase;
  font-size: 11.5px;
}


/* Why a product could not be added, shown under its own Add to Bag button.
   Quiet rather than alarming: an out of stock item is disappointing news,
   not an error the shopper has made. */
.bb-add-to-bag-message {
  margin-top: 6px;
  font-size: 11.5px;
  line-height: 1.35;
  letter-spacing: .02em;
  text-align: center;
  color: #8a5a5a;
}

.bb-add-to-bag-message[hidden] { display: none; }
