/* ==========================================================================
   BEARBONES OFF ROAD — PRINT STYLES
   Tuned for: order confirmation / "thank you" page, single-product PDP,
   and the cart page (parts list to take to the workshop).
   Strategy: strip all chrome, give the page a paper feel, keep only the
   information the customer or fitter actually needs.
   ========================================================================== */

@media print {

  /* ── reset / paper ──────────────────────────────────────────────────── */
  @page {
    size: A4;
    margin: 18mm 16mm 22mm;
  }

  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html, body {
    background: #fff !important;
    color: #000;
    font-size: 11pt;
    line-height: 1.45;
  }

  body {
    font-family: var(--body), Helvetica, Arial, sans-serif;
  }

  /* ── chrome we never want to print ──────────────────────────────────── */
  .bb-announcement,
  .bb-nav,
  .bb-nav-toggle,
  .bb-header__tools,
  .bb-search,
  .bb-skip-link,
  .bb-shipping-progress,
  .bb-footer__newsletter,
  .bb-footer__cols,
  .bb-social,
  .woocommerce-cart-form .actions,
  .wc-block-cart__submit-container,
  .wp-block-buttons,
  .bb-iconbtn,
  [data-bb-open-picker],
  .bb-picker {
    display: none !important;
  }

  /* Keep just the logo at the top of the page. */
  .bb-header,
  .bb-header__main,
  .bb-container {
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    display: block !important;
  }
  .bb-header__logo img {
    width: 140px !important;
    height: auto !important;
    margin: 0 0 18pt !important;
    filter: grayscale(1) contrast(1.05);
  }

  /* Footer becomes a single line: company / VAT info. */
  .bb-footer            { background: transparent !important; padding-top: 12pt !important; border-top: 1px solid #ccc; margin-top: 18pt; }
  .bb-footer__bottom    { padding: 0 !important; font-size: 9pt; color: #555 !important; display: block !important; }
  .bb-footer__bottom > div + div { display: none !important; }

  /* ── type ───────────────────────────────────────────────────────────── */
  h1, h2, h3, h4, h5,
  .bb-display { font-family: var(--display), Helvetica, Arial, sans-serif; }
  h1 { font-size: 22pt; }
  h2 { font-size: 16pt; }
  h3 { font-size: 13pt; }
  h4 { font-size: 11pt; }

  /* Convert links to "label (url)" when href is meaningful. */
  a[href^="http"]::after,
  a[href^="/"]::after  {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555 !important;
    word-break: break-all;
  }
  a[href^="#"]::after,
  a[href^="javascript"]::after { content: ""; }

  /* ── PDP ─────────────────────────────────────────────────────────────── */
  .bb-pdp__main > .bb-container {
    display: grid !important;
    grid-template-columns: 40mm 1fr !important;
    gap: 6mm !important;
  }
  .bb-pdp__gallery .flex-control-thumbs,
  .bb-pdp__gallery .woocommerce-product-gallery__trigger { display: none !important; }
  .bb-pdp__gallery img { max-width: 40mm !important; height: auto !important; }

  .bb-pdp__summary .quantity,
  .bb-pdp__summary form.cart,
  .bb-pdp__summary .bb-btn { display: none !important; }

  /* Fitment chart — keep, it's the most useful printable element. */
  table { width: 100% !important; border-collapse: collapse; }
  table th, table td {
    border: 1px solid #ccc !important;
    padding: 6pt 8pt !important;
    text-align: left;
    vertical-align: top;
  }
  table thead { background: #f0f0f0 !important; }
  table thead th { color: #000 !important; font-weight: 600; }

  /* Page break hints. */
  h1, h2, h3 { break-after: avoid-page; }
  table, .bb-product-card, .woocommerce-cart-form__cart-item { break-inside: avoid; }

  /* ── Order received / "thank you" page ──────────────────────────────── */
  .woocommerce-order,
  .woocommerce-order-overview,
  .woocommerce-order-details {
    page-break-inside: avoid;
  }
  .woocommerce-order h1,
  .woocommerce-order h2 { margin-top: 0; }
  .woocommerce-order ul.order_details {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6pt;
    border: 1px solid #ccc;
    padding: 8pt;
  }
  .woocommerce-order ul.order_details li strong { display: block; font-weight: 600; }

  /* ── Cart printable parts-list ──────────────────────────────────────── */
  .bb-cart .woocommerce-cart-form__contents {
    width: 100% !important;
    border-collapse: collapse;
  }
  .bb-cart .product-thumbnail,
  .bb-cart .product-remove { display: none !important; }
  .bb-cart .product-quantity .quantity { display: inline; }
  .bb-cart .product-quantity input { border: none !important; padding: 0 !important; width: auto !important; }

  /* Add a print-only line: "printed from bearbones.co.uk on <date>" */
  .bb-print-footer {
    display: block !important;
    margin-top: 12pt;
    font-size: 8pt;
    color: #666 !important;
    text-align: right;
  }
}

/* On screen the print-footer is invisible. */
.bb-print-footer { display: none; }
