/* Bench Brothers | focused visual and mobile fixes (2026-11).
   Loaded AFTER existing styles, never removes content or media. */

/* Catalog filter bar and products share the same site grid. */
html body[data-page="catalog"] .catalog-section {
  width: min(calc(100% - 40px), 1540px) !important;
  max-width: 1540px !important;
  margin-inline: auto !important;
  box-sizing: border-box !important;
}
html body[data-page="catalog"] .catalog-section .catalog-tabs,
html body[data-page="catalog"] .catalog-section .product-grid,
html body[data-page="catalog"] .catalog-section .catalog-empty {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
html body[data-page="catalog"] .catalog-section .catalog-tabs {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  min-width: 0 !important;
}

/* Catalog titles and detail-page headings intentionally use separate CMS style keys. */
html body[data-page] .product-card__body h3 {
  font-size: var(--bb-size-desktop, clamp(16px, 1.13vw, 20px)) !important;
  line-height: var(--bb-line-height, 1.25) !important;
}
html body[data-page="product"] .product-info > h1 {
  font-size: var(--bb-size-desktop, clamp(27px, 2.4vw, 43px)) !important;
  line-height: var(--bb-line-height, 1.12) !important;
}

/* About: copy sits vertically centered next to the hero image, no fake top gap. */
@media (min-width: 821px) {
  html body[data-page="about"] .about-hero { align-items: center !important; }
  html body[data-page="about"] .about-hero__text {
    align-self: center !important;
    margin-block: 0 !important;
    padding-block: clamp(8px, 2vw, 28px) !important;
    transform: none !important;
  }
  html body[data-page="about"] .about-hero__image { align-self: center !important; }
}

/* Details: prevent impossible narrow label widths / broken Russian words. */
html body[data-page="product"] .specs > div {
  display: grid !important;
  grid-template-columns: minmax(120px, 42%) minmax(0, 1fr) !important;
  align-items: start !important;
  gap: clamp(12px, 2vw, 24px) !important;
}
html body[data-page="product"] .specs > div > span,
html body[data-page="product"] .specs > div > span[data-editable-text] {
  min-width: 0 !important;
  max-width: 100% !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  hyphens: none !important;
  white-space: normal !important;
}
html body[data-page="product"] .specs > div > b {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  text-align: right !important;
  white-space: normal !important;
}

/* The active product video keeps its native or explicitly configured ratio. */
html body[data-page="product"] .product-gallery__main[data-media-type="video"] {
  aspect-ratio: var(--bb-v27-video-ratio, var(--bb-img-ratio, 16 / 9)) !important;
  height: auto !important;
  overflow: hidden !important;
}
html body[data-page="product"] .product-gallery__main[data-media-type="video"] video,
html body[data-page="product"] .product-gallery__active-video {
  width: 100% !important;
  height: 100% !important;
  object-fit: var(--bb-v27-video-fit, contain) !important;
  object-position: center center !important;
}

/* Social links: keep current footer layout while ensuring full-size click targets. */
html body .footer-socials a {
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
  min-width: 42px;
  min-height: 42px;
}

@media (max-width: 820px) {
  html body[data-page="catalog"] .catalog-section {
    width: calc(100% - 24px) !important;
  }
  html body[data-page] .product-card__body h3 {
    font-size: var(--bb-size-mobile, 15px) !important;
    line-height: var(--bb-line-height, 1.25) !important;
  }
  html body[data-page="product"] .product-info > h1 {
    font-size: var(--bb-size-mobile, clamp(23px, 6vw, 32px)) !important;
  }
  html body[data-page="product"] .specs > div {
    grid-template-columns: minmax(116px, 43%) minmax(0, 1fr) !important;
    gap: 12px !important;
  }
  html body[data-page="product"] .specs > div > span,
  html body[data-page="product"] .specs > div > b {
    font-size: clamp(12px, 3.55vw, 14px) !important;
    line-height: 1.35 !important;
  }
  /* Dark availability badges: translucent fill, text stays fully legible. */
  html body .product-card__media .badge,
  html body .product-card__media .product-badge {
    background: rgba(0, 0, 0, .5) !important;
    opacity: 1 !important;
    color: #fff !important;
  }
  html body[data-page="about"] .about-production__track {
    display: flex !important;
    gap: 12px !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  html body[data-page="about"] .about-production__slide {
    flex: 0 0 min(76vw, 340px) !important;
    width: min(76vw, 340px) !important;
    min-width: min(76vw, 340px) !important;
    height: auto !important;
    aspect-ratio: 4 / 3 !important;
    scroll-snap-align: start;
    overflow: hidden !important;
  }
  html body[data-page="about"] .about-production__slide > img,
  html body[data-page="about"] .about-production__slide > video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
}

/* Administrator visual preview: a scrollable, complete page rather than 900px iframe crop. */
body:has(#siteEditorStage) #siteEditorStage {
  display: block !important;
  position: relative !important;
  width: 100% !important;
  height: min(82vh, 940px) !important;
  min-height: 500px !important;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch;
}
body:has(#siteEditorStage) .bb-v27-editor-canvas {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 500px;
  margin: 0 auto !important;
}
body:has(#siteEditorStage) #siteFrame {
  display: block !important;
  position: relative !important;
  inset: auto !important;
  left: auto !important;
  margin: 0 auto !important;
  max-width: 100% !important;
  height: 100% !important;
  min-height: 500px !important;
  border: 0 !important;
  transform: none !important;
  transform-origin: top center !important;
}
.bb-v27-product-picker { display: flex; flex-wrap: wrap; align-items:center; gap: 8px; margin-block: 8px 12px; }
.bb-v27-product-picker label { font-size: 14px; font-weight: 600; }
.bb-v27-product-picker select { max-width: min(70vw, 390px); min-height: 38px; border: 1px solid #d7d7d7; border-radius: 10px; padding: 6px 10px; background: #fff; color: #1c1d1f; }
.bb-v27-product-picker button,
.bb-v27-visual-open { min-height: 38px; padding: 7px 13px; border: 1px solid #d9d9d9; border-radius: 9px; background: #fff; color: #1c1d1f; font: inherit; cursor:pointer; }
.bb-v27-video-ratio-row { margin-block: 9px 0; display: flex; gap: 8px; align-items:center; flex-wrap:wrap; font-size: 13px; }
.bb-v27-video-ratio-row select { min-height: 36px; flex: 1 1 140px; border:1px solid #ddd; border-radius:8px; padding: 4px 8px; background:#fff; }
.bb-v27-video-ratio-row .bb-v27-video-state { color:#767676; font-size: 11px; }
