/* BaltTrade product page: gallery, buy box, supplier and info columns, reviews, bundle, rails, sticky buy bar.
   Off-scale px values (10, 11, 13, 14, 18) are the ones the UI kit Product screen uses. */

bt-gallery,
bt-variant-picker,
bt-product-form,
bt-bundle,
bt-sticky-buy {
  display: block;
}

/* ── Section rhythm ── */
.bt-product-section {
  padding-top: var(--space-4);
  padding-bottom: calc(var(--section-y) / 2);
}

.bt-product-section:has(+ .bt-pdp-aside-section) {
  padding-bottom: 0;
}

.bt-pdp-aside-section {
  padding-top: calc(var(--space-4) + var(--space-0-5));
}

.bt-pdp-aside-section--last {
  padding-bottom: calc(var(--section-y) / 2);
}

.bt-product--empty {
  padding-block: var(--space-8);
}

/* ── Layout ── */
.bt-product__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
  margin-top: var(--space-4);
}

.bt-product__media {
  min-width: 0;
}

.bt-product__info {
  --bt-info-gap: calc(var(--space-4) + var(--space-0-5));
  display: flex;
  flex-direction: column;
  gap: var(--bt-info-gap);
  min-width: 0;
}

.bt-product__block--supplier + .bt-product__block--title,
.bt-product__block--title + .bt-product__block--rating {
  margin-top: calc(var(--space-2) - var(--bt-info-gap));
}

/* Phones: compact back-link row above the gallery */
@media (max-width: 767px) {
  :root:has(.bt-product .bt-breadcrumbs) {
    --bt-crumbs-offset: calc(var(--space-10) + var(--space-1));
  }

  .bt-product-section {
    padding-top: 0;
  }

  .bt-product .bt-breadcrumbs__link {
    min-height: var(--space-10);
  }

  .bt-product .bt-breadcrumbs + .bt-product__layout {
    margin-top: var(--space-1);
  }
}

/* From 768px the trail stays one line (the H1 below repeats the full title), so the first-screen budget holds */
@media (min-width: 768px) {
  .bt-product .bt-breadcrumbs__list {
    flex-wrap: nowrap;
  }

  .bt-product .bt-breadcrumbs__item {
    flex: none;
  }

  .bt-product .bt-breadcrumbs__item:last-child {
    flex: 0 1 auto;
  }

  .bt-product .bt-breadcrumbs__current {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

/* Two columns on windows up to 860px tall (short laptops, landscape tablets): tighter buy box so Add to cart sits as high as it can (spacing only, type sizes unchanged) */
@media (min-width: 768px) and (max-height: 860px) {
  .bt-product__info {
    --bt-info-gap: var(--space-3);
  }

  .bt-product-delivery {
    gap: var(--space-1-5);
    padding: var(--space-2) var(--space-3);
  }
}

/* Windows up to 500px tall (landscape phones): no breadcrumbs row (the header stays), tighter buy box, the stock badge
   beside the price and the delivery estimate on one line, wrapping rather than clipping; type sizes unchanged */
@media (max-height: 500px) {
  :root:has(.bt-product .bt-product__layout) {
    --bt-crumbs-offset: var(--space-2);
  }

  .bt-product-section {
    padding-top: var(--space-2);
  }

  .bt-product .bt-breadcrumbs {
    display: none;
  }

  .bt-product .bt-product__layout,
  .bt-product .bt-breadcrumbs + .bt-product__layout {
    margin-top: 0;
  }

  .bt-product__info {
    --bt-info-gap: var(--space-2);
    flex-flow: row wrap;
    column-gap: var(--space-4);
  }

  .bt-product__info > * {
    flex: 1 1 100%;
    min-width: 0;
  }

  .bt-product__block--price:has(+ .bt-product__block--stock) {
    flex: 0 1 auto;
  }

  .bt-product__block--price + .bt-product__block--stock {
    flex: 1 1 auto;
    align-self: flex-start;
    margin-top: max(0px, (var(--fs-price-lg) * 1.15 - var(--badge-h)) / 2);
  }
}

[data-bt-product][aria-busy="true"] [data-bt-part] {
  opacity: 0.6;
  transition: opacity var(--dur-fast) var(--ease-standard);
}

/* From 768px the media column is as wide as the gallery (never more than its share: 1/2, from 1024px 7/12) and the info
   column takes the rest, so the gallery starts on the content axis and the gap between them is the layout gap */
@media (min-width: 768px) {
  .bt-product__layout {
    grid-template-columns: minmax(0, min(calc((100% - var(--space-6)) / 2), var(--bt-gallery-w, 100%))) minmax(0, 1fr);
  }
}

/* From 1024px the buy box takes what the gallery leaves, between its 5/12 share and 40rem, so buttons never stretch;
   any rest stays in the media column: the gallery keeps the content axis on the left, the buy box the right edge */
@media (min-width: 1024px) {
  :root:has(.bt-gallery) {
    --bt-info-w: min(max(calc((100% - var(--space-12)) * 5 / 12), calc(100% - var(--space-12) - var(--bt-gallery-w, 100%))), 40rem);
  }

  .bt-product__layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--bt-info-w, calc((100% - var(--space-12)) * 5 / 12)));
    column-gap: var(--space-12);
  }

  /* A column taller than the window scrolls until its end is in view, then sticks; --bt-media-h comes from bt-gallery */
  .bt-product--sticky-media .bt-product__media {
    position: sticky;
    top: min(calc(var(--bt-header-offset, var(--header-h)) + var(--space-4)), calc(100svh - var(--bt-media-h, 0px) - var(--space-4)));
  }
}

/* ── Gallery ──
   Frame ratio --bt-media-ratio (w/h) is set on :root by main-product: the first slide's ratio clamped to 0.8–1.333, other slides use contain.
   Height cap keeps frame + thumbnails inside the first screen (phones: 40svh, from 768px: --bt-fold-h minus the thumbnail row,
   never below 17.5rem; up to 500px tall see below). Phones: full-width frame, height min(width / ratio, cap). From 768px: width = min(column, cap x ratio).
   Tokens live on :root so the aside sections share the column split. main-product sizes mirror this. */
:root:has(.bt-gallery) {
  --bt-gallery-gap: calc(var(--space-2) + var(--space-0-5));
  --bt-gallery-chrome: 0px;
  --bt-gallery-max-h: max(12rem, 40vh);
  --bt-gallery-w: calc(var(--bt-gallery-max-h) * var(--bt-media-ratio, 0.8));
}

@supports (height: 1svh) {
  :root:has(.bt-gallery) {
    --bt-gallery-max-h: max(12rem, 40svh);
  }
}

@media (min-width: 768px) {
  :root:has(.bt-gallery) {
    --bt-thumb-size: clamp(3.5rem, 10vh - 1rem, 6rem);
    --bt-gallery-max-h: max(17.5rem, var(--bt-fold-h, calc(100vh - 14rem)) - var(--bt-gallery-chrome) - var(--space-4));
  }

  :root:has(.bt-gallery__thumbs) {
    --bt-gallery-chrome: calc(var(--bt-thumb-size) + var(--bt-gallery-gap));
  }
}

/* Windows up to 500px tall, any width: the frame alone (phone pager instead of thumbnails) fills the first screen above
   the sticky buy bar (--bt-buybar-reserve, see the sticky bar below); the floor yields down to 8rem */
@media (max-height: 500px) {
  :root:has(.bt-gallery),
  :root:has(.bt-gallery__thumbs) {
    --bt-gallery-chrome: 0px;
    --bt-gallery-max-h: max(8rem, var(--bt-fold-h, calc(100vh - 8rem)) - var(--bt-buybar-reserve, 0px) - var(--space-2));
  }
}

.bt-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--bt-gallery-gap);
}

@media (min-width: 768px) {
  .bt-gallery {
    width: min(100%, var(--bt-gallery-w));
  }
}

.bt-gallery__stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--media-bg);
}

.bt-gallery__viewport {
  position: relative;
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.bt-gallery__viewport::-webkit-scrollbar {
  display: none;
}

.bt-gallery__viewport:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: calc(var(--focus-ring-width) * -1);
}

.bt-gallery__slide {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
}

.bt-gallery__frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: var(--bt-media-ratio, 4 / 5);
  overflow: hidden;
  background: var(--media-bg);
}

/* Phones: the frame keeps the full width and only its height is capped, so narrow photos sit centred clear of the corner controls */
@media (max-width: 767px) {
  .bt-gallery__frame {
    width: 100%;
    max-height: var(--bt-gallery-max-h);
  }
}

.bt-gallery__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bt-product--fit-cover .bt-gallery__img {
  object-fit: cover;
}

.bt-gallery__frame > video,
.bt-gallery__frame > iframe,
.bt-gallery__frame > model-viewer,
.bt-gallery__frame > * > video,
.bt-gallery__frame > * > iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.bt-gallery__poster {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-primary);
  cursor: pointer;
}

.bt-gallery__play,
.bt-gallery__thumb-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  border-radius: var(--radius-full);
  background: var(--btc-white-92);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.bt-gallery__play {
  width: var(--space-16);
  height: var(--space-16);
}

.bt-gallery__thumb-icon {
  width: var(--space-7);
  height: var(--space-7);
}

/* Stacked in one column at the corner: narrow photos (centred, 0.35 ratio in a 0.8 frame) keep their top clear */
.bt-gallery__tools {
  position: absolute;
  top: calc(var(--space-2) + var(--space-0-5));
  right: calc(var(--space-2) + var(--space-0-5));
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.bt-gallery__dots {
  position: absolute;
  right: 0;
  bottom: var(--space-3);
  left: 0;
  display: flex;
  justify-content: center;
  gap: var(--space-1-5);
  pointer-events: none;
}

.bt-gallery__dot {
  width: var(--space-1-5);
  height: var(--space-1-5);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--bt-navy-900) 25%, transparent);
  transition: width var(--dur-base) var(--ease-standard);
}

.bt-gallery__dot[data-active] {
  width: 18px;
  background: var(--bt-navy-900);
}

/* Phones: "‹ 2 / 5 ›" pager instead of thumbnails and dots, in the bottom corner so it stays off the product's base */
.bt-gallery__pager {
  position: absolute;
  right: var(--space-2);
  bottom: var(--space-2);
  display: none;
  align-items: center;
  gap: var(--space-0-5);
  padding: var(--space-0-5);
  border-radius: var(--radius-full);
  background: var(--btc-white-92);
  box-shadow: var(--shadow-sm);
}

.bt-gallery__step {
  border-radius: var(--radius-full);
}

.bt-gallery__count {
  min-width: 3.25em;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text-primary);
}

.bt-gallery__thumbs {
  display: grid;
  grid-auto-columns: min(var(--bt-thumb-size, 100%), calc((100% - 4 * var(--space-2)) / 5));
  grid-auto-flow: column;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
}

@media (max-width: 767px) {
  .bt-gallery__thumbs,
  .bt-gallery__dots {
    display: none;
  }

  .bt-gallery__pager {
    display: flex;
  }
}

@media (max-height: 500px) {
  .bt-gallery__thumbs,
  .bt-gallery__dots {
    display: none;
  }

  .bt-gallery__pager {
    display: flex;
  }
}

.bt-gallery__thumbs::-webkit-scrollbar {
  display: none;
}

.bt-gallery__thumb {
  position: relative;
  aspect-ratio: var(--aspect-category);
  padding: 0;
  overflow: hidden;
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--media-bg);
  cursor: pointer;
}

.bt-gallery__thumb[aria-current="true"] {
  border: var(--border-width-thick) solid var(--bt-navy-900);
}

.bt-gallery__thumb .bt-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Zoom ── */
.bt-zoom__stage {
  max-height: 70dvh;
  overflow: auto;
  border-radius: var(--radius-md);
  background: var(--media-bg);
  cursor: zoom-in;
}

.bt-zoom__img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
}

.bt-zoom__stage--zoomed {
  cursor: zoom-out;
}

.bt-zoom__stage--zoomed .bt-zoom__img {
  width: 200%;
}

/* ── Supplier line ── */
.bt-product__supplier {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1-5);
  min-height: var(--touch-target);
  margin-block: calc((var(--space-8) - var(--touch-target)) / 2);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  text-decoration: none;
}

a.bt-product__supplier:hover {
  color: var(--text-primary);
}

a.bt-product__supplier:hover .bt-product__supplier-name {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.bt-product__supplier-mark {
  flex: none;
  color: var(--icon-secondary);
}

.bt-product__supplier-mark--verified {
  color: var(--icon-brand);
}

.bt-product__supplier-place,
.bt-product__supplier--unknown {
  font-weight: var(--fw-regular);
  color: var(--text-secondary);
}

.bt-product__supplier-help {
  color: var(--text-link);
}

/* ── Title, rating, price ── */
.bt-product__title {
  margin: 0;
  font-weight: var(--fw-extrabold);
  overflow-wrap: anywhere;
}

/* Titles over 70 characters (set in Liquid) take the h3 step at every width, so the buy box keeps its first screen */
.bt-product__title.bt-product__title--long {
  font-size: var(--fs-h3);
}

.bt-product__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.bt-product__rating-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  margin-block: calc((var(--space-6) - var(--touch-target)) / 2);
  color: inherit;
  text-decoration: none;
}

.bt-product__sku {
  font-size: var(--fs-micro);
  color: var(--text-secondary);
}

.bt-product__price {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
}

.bt-product__vat {
  font-size: var(--fs-caption);
  line-height: 1.4;
  color: var(--text-secondary);
}

/* ── Variant picker ── */
.bt-variants {
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-4) + var(--space-0-5));
}

.bt-variants__group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.bt-variants__legend {
  margin-bottom: var(--space-2);
  padding: 0;
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
}

.bt-variants__current {
  font-weight: var(--fw-regular);
  color: var(--text-secondary);
}

.bt-variants__options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.bt-option__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.bt-option {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-0-5);
  min-width: var(--space-16);
  min-height: var(--control-h-md);
  padding: var(--space-1-5) calc(var(--space-3) + var(--space-0-5));
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard);
}

.bt-option:hover {
  border-color: var(--border-strong);
}

.bt-option__input:checked + .bt-option {
  padding: 5px 13px;
  border: var(--border-width-thick) solid var(--bt-navy-900);
  font-weight: var(--fw-bold);
}

.bt-option__input:focus-visible + .bt-option {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

.bt-option[data-soldout] {
  background: var(--bt-sand-100);
  color: var(--text-secondary);
}

.bt-option[data-soldout] .bt-option__label {
  text-decoration: line-through;
}

.bt-option__note {
  font-size: 0.6875rem;
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
}

.bt-option--swatch {
  flex-flow: row wrap;
  gap: var(--space-0-5) var(--space-2);
}

.bt-option--swatch .bt-option__note {
  flex-basis: 100%;
}

.bt-option__swatch {
  flex: none;
  width: var(--space-5);
  height: var(--space-5);
  border-radius: var(--radius-full);
  background: var(--bt-swatch-image, none) center / cover no-repeat var(--bt-swatch, var(--bt-sand-200));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bt-navy-900) 16%, transparent);
}

/* ── Stock ── */
.bt-product__stock {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* ── Delivery estimate ── */
.bt-product-delivery {
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-2) + var(--space-0-5));
  padding: calc(var(--space-3) + var(--space-0-5));
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
}

.bt-product-delivery__row {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--space-2) + var(--space-0-5));
  font-size: var(--fs-body-sm);
  line-height: 1.45;
  color: var(--text-primary);
}

.bt-product-delivery__icon {
  flex: none;
  margin-top: 1px;
  color: var(--icon-secondary);
}

.bt-product-delivery__main {
  flex: 1;
  min-width: 0;
}

.bt-product-delivery__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-0-5) var(--space-3);
}

.bt-product-delivery__fee {
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}

.bt-product-delivery__eta,
.bt-product-delivery__muted {
  color: var(--text-secondary);
}

/* The supplier's methods from the shop's own delivery data (bt-delivery.js): "from €3.90 · Arrives 18–21 Nov · free over €50"; it replaces the fee and the time of the supplier's profile while it is there */
.bt-product-delivery__live {
  display: block;
}

.bt-product-delivery__change {
  margin: 0 0 0 var(--space-2);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--text-link);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.bt-product-delivery__change:hover {
  color: var(--text-link-hover);
}

.bt-product-delivery--live [data-bt-delivery-legacy] {
  display: none;
}

/* Up to 500px tall: the rows flow on one line and wrap only when they do not fit */
@media (max-height: 500px) {
  .bt-product-delivery {
    flex-flow: row wrap;
    gap: var(--space-1) var(--space-4);
    padding: var(--space-1-5) var(--space-3);
  }

  .bt-product-delivery__main {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    gap: 0 var(--space-3);
  }

  .bt-product-delivery__head {
    justify-content: flex-start;
  }
}

/* ── Buy buttons ── */
.bt-buy__form,
.bt-buy__group {
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-2) + var(--space-0-5));
}

.bt-buy__row {
  container: bt-buy / inline-size;
  display: flex;
  align-items: stretch;
  gap: calc(var(--space-2) + var(--space-0-5));
}

.bt-buy__qty {
  flex: none;
  height: var(--control-h-lg);
}

.bt-buy__add {
  flex: 1;
  min-width: 0;
}

/* Narrow rows (phones, 768–1023 tablets): less side padding and no bag icon, so the localized label keeps one line
   ("Добавить в корзину" needs 163px: one line from a 360px phone up; 320px phones fall back to two lines inside the 52px button) */
@container bt-buy (width < 26rem) {
  .bt-buy__add {
    padding-inline: var(--space-4);
  }

  .bt-buy__add .bt-icon {
    display: none;
  }
}

@container bt-buy (width < 22rem) {
  .bt-buy__add {
    padding-inline: var(--space-2);
  }
}

.bt-buy__dynamic {
  --shopify-accelerated-checkout-button-block-size: var(--control-h-lg);
  --shopify-accelerated-checkout-button-border-radius: var(--button-radius);
  min-height: var(--control-h-lg);
}

.bt-buy__dynamic .shopify-payment-button__button--unbranded {
  min-height: var(--control-h-lg);
  padding: var(--space-1-5) var(--space-6);
  border: var(--border-width-strong) solid var(--button-secondary-border);
  border-radius: var(--button-radius);
  background: var(--button-secondary-bg);
  color: var(--button-secondary-fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label);
  text-transform: none;
}

.bt-buy__dynamic .shopify-payment-button__button--unbranded:hover:not([disabled]) {
  background: var(--button-secondary-bg-hover);
}

.bt-buy__dynamic .shopify-payment-button__more-options {
  min-height: var(--touch-target);
  color: var(--text-link);
  font-size: var(--fs-caption);
}

.bt-buy__error {
  font-size: var(--fs-body-sm);
  line-height: 1.45;
  color: var(--text-danger);
}

/* ── Trust row ── */
.bt-product__trust {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) calc(var(--space-4) + var(--space-0-5));
}

/* ── Supplier card and info sections added outside main-product (aligned with the buy box) ── */
.bt-pdp-aside__body {
  min-width: 0;
}

.bt-pdp-aside__app:empty {
  display: none;
}

@media (min-width: 768px) {
  .bt-pdp-aside--aside .bt-pdp-aside__grid {
    display: grid;
    grid-template-columns: minmax(0, min(calc((100% - var(--space-6)) / 2), var(--bt-gallery-w, 100%))) minmax(0, 1fr);
    column-gap: var(--space-6);
  }

  .bt-pdp-aside--aside .bt-pdp-aside__body {
    grid-column: 2;
  }
}

@media (min-width: 1024px) {
  .bt-pdp-aside--aside .bt-pdp-aside__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--bt-info-w, calc((100% - var(--space-12)) * 5 / 12)));
    column-gap: var(--space-12);
  }
}

/* ── Product information accordions (main-product info_* blocks and product-info section) ── */
.bt-info__item + .bt-info__item > .bt-accordion {
  border-top: 0;
}

.bt-info .bt-accordion__content p + p {
  margin-top: var(--space-2);
}

/* The info column widens when the gallery is height-capped: keep reading lines short */
.bt-info .bt-accordion__content {
  max-inline-size: 75ch;
}

/* Imported supplier descriptions can carry <pre>: wrap it so the page never scrolls sideways */
.bt-info pre {
  font-family: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bt-info__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-body-sm);
}

.bt-info__table tr {
  border-bottom: var(--border-width) solid var(--border-subtle);
}

.bt-info__table th {
  width: 45%;
  padding: var(--space-2) var(--space-3) var(--space-2) 0;
  font-weight: var(--fw-semibold);
  text-align: start;
  vertical-align: top;
}

.bt-info__table td {
  padding: var(--space-2) 0;
  color: var(--text-secondary);
}

.bt-info__file {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch-target);
  font-weight: var(--fw-semibold);
}

/* ── Reviews ── */
.bt-reviews {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-8);
}

.bt-reviews__summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.bt-reviews__title {
  margin: 0;
}

.bt-reviews__score {
  display: flex;
  align-items: baseline;
  gap: calc(var(--space-2) + var(--space-0-5));
}

.bt-reviews__average {
  font-size: var(--fs-h1);
  line-height: 1;
}

.bt-reviews__empty {
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
}

.bt-reviews__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

@media (min-width: 1024px) {
  .bt-reviews {
    grid-template-columns: calc(var(--sidebar-w) + var(--space-10)) minmax(0, 1fr);
  }
}

/* ── Related rail ── */
@media (min-width: 768px) and (max-width: 1099px) {
  .bt-related__grid > :nth-child(3n + 1):last-child,
  .bt-related__grid > :nth-child(3n + 1):nth-last-child(2),
  .bt-related__grid > :nth-child(3n + 1):nth-last-child(2) + * {
    display: none;
  }
}

/* ── Recently viewed: rows 3-up desktop, 2-up tablet, 1-up mobile ── */
.bt-recent__grid {
  --bt-cols: 3;
  --bt-cols-md: 2;
  --bt-cols-sm: 1;
  --bt-gap: var(--space-3);
}

/* ── Bundle ── */
.bt-bundle__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: stretch;
}

.bt-bundle__summary {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
}

.bt-bundle__meta {
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
}

.bt-bundle__error {
  font-size: var(--fs-body-sm);
  color: var(--text-danger);
}

.bt-bundle__app {
  margin-top: var(--space-6);
}

@media (min-width: 768px) {
  .bt-bundle__grid {
    grid-template-columns: repeat(var(--bt-bundle-cols, 3), minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .bt-bundle__grid {
    grid-template-columns: repeat(var(--bt-bundle-cols, 3), minmax(0, 1fr)) var(--sidebar-w);
  }

  .bt-bundle__summary {
    grid-column: auto;
  }
}

/* ── Sticky buy bar: phones once the buy box scrolls away; windows up to 500px tall from the first screen while the main
   buy button is out of view (bt-product.js), within 56px there, the gallery keeps clear of it ── */
.bt-sticky-buy__bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: calc(var(--space-2) + var(--space-0-5)) var(--space-4) calc(calc(var(--space-2) + var(--space-0-5)) + env(safe-area-inset-bottom));
  background: var(--surface-card);
  box-shadow: var(--shadow-sticky-bottom);
  visibility: hidden;
  transform: translateY(100%);
  transition:
    transform var(--dur-slow) var(--ease-exit),
    visibility 0s linear var(--dur-slow);
}

.bt-sticky-buy[data-visible] .bt-sticky-buy__bar {
  visibility: visible;
  transform: none;
  transition:
    transform var(--dur-slow) var(--ease-enter),
    visibility 0s;
}

.bt-sticky-buy[data-instant] .bt-sticky-buy__bar {
  transition: none;
}

.bt-sticky-buy__price {
  flex: 0 1 auto;
  min-width: 0;
}

.bt-sticky-buy__action {
  flex: 1;
  min-width: 0;
}

.bt-body:has(.bt-sticky-buy[data-visible]) {
  padding-bottom: var(--bt-toast-offset, 0px);
}

.bt-sticky-buy[data-choose] :is([data-bt-sticky-add], [data-bt-sticky-notify]),
.bt-sticky-buy:not([data-choose]) [data-bt-sticky-choose] {
  display: none;
}

/* The reserve follows main-product's own data-bt-buybar (early in the HTML), not this late section, so the first paint
   already has it; focused controls stop above the bar (WCAG 2.4.11) */
@media (max-height: 500px) {
  :root {
    --bt-buybar-h: calc(var(--control-h-md) + var(--space-1-5) * 2 + env(safe-area-inset-bottom, 0px));
  }

  :root:has(.bt-product[data-bt-buybar]) {
    --bt-buybar-reserve: var(--bt-buybar-h);
  }

  html:has(.bt-sticky-buy__bar) {
    scroll-padding-bottom: calc(var(--bt-buybar-h) + var(--space-2));
  }

  .bt-sticky-buy__bar {
    padding: var(--space-1-5) max(var(--container-pad), 50% - var(--container-page) / 2 + var(--container-pad)) calc(var(--space-1-5) + env(safe-area-inset-bottom, 0px));
  }

  .bt-sticky-buy__action {
    flex: 0 1 20rem;
    margin-inline-start: auto;
  }
}

@media (min-width: 768px) and (min-height: 501px) {
  .bt-sticky-buy {
    display: none;
  }
}
