/* ======================================================================
   ALPHA.26 — CART COLLISION + MOBILE CARD HOUSEKEEPING
   Cart only. Loaded after the shared alpha.20 Cart/Checkout stylesheet.
   Presentation only: no quantity, price, PEWC, coupon, shipping or order logic.
   ====================================================================== */

/* Keep the cart table from becoming a narrow sidebar before it is genuinely wide enough. */
@media (min-width:821px) and (max-width:1279px){
  body.cgss-v2-cart.woocommerce-cart .cart-content-wrapper{
    display:block !important;
    width:100% !important;
    max-width:1180px !important;
    margin-left:auto !important;
    margin-right:auto !important;
  }
  body.cgss-v2-cart.woocommerce-cart .cart-content-wrapper > *,
  body.cgss-v2-cart.woocommerce-cart .woocommerce-cart-form,
  body.cgss-v2-cart.woocommerce-cart .cart_totals{
    float:none !important;
    clear:both !important;
    width:100% !important;
    max-width:none !important;
    min-width:0 !important;
    margin-left:0 !important;
    margin-right:0 !important;
    box-sizing:border-box !important;
  }
  body.cgss-v2-cart.woocommerce-cart .cart_totals{
    margin-top:24px !important;
  }
  body.cgss-v2-cart.woocommerce-cart .shop_table.cart .product-name,
  body.cgss-v2-cart.woocommerce-cart .shop_table.cart .product-name *{
    min-width:0 !important;
    max-width:100% !important;
    box-sizing:border-box !important;
  }
}

/* Mobile/tablet cart becomes one deliberate product card, not a six-column table. */
@media (max-width:820px){
  body.cgss-v2-cart.woocommerce-cart .woocommerce-cart-form,
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart{
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow:visible !important;
    box-sizing:border-box !important;
  }

  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > thead{
    display:none !important;
  }

  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody{
    display:block !important;
    width:100% !important;
    min-width:0 !important;
  }

  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item{
    display:grid !important;
    grid-template-columns:28px 62px minmax(92px,1fr) minmax(70px,auto) !important;
    grid-template-areas:
      "remove thumb name name"
      "price price quantity subtotal" !important;
    column-gap:10px !important;
    row-gap:10px !important;
    align-items:start !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    margin:0 !important;
    padding:12px 10px 11px !important;
    border:0 !important;
    border-bottom:10px solid var(--cg20-band,#E9DDD1) !important;
    background:rgba(255,253,249,.98) !important;
    box-sizing:border-box !important;
  }

  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td{
    display:block !important;
    float:none !important;
    clear:none !important;
    width:auto !important;
    max-width:100% !important;
    min-width:0 !important;
    height:auto !important;
    margin:0 !important;
    padding:0 !important;
    border:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    box-sizing:border-box !important;
    text-align:left !important;
    vertical-align:top !important;
  }

  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td.product-remove{
    grid-area:remove !important;
    align-self:start !important;
    justify-self:start !important;
    padding-top:3px !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-remove > a.remove{
    position:static !important;
    inset:auto !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    width:28px !important;
    min-width:28px !important;
    height:28px !important;
    min-height:28px !important;
    margin:0 !important;
    padding:0 !important;
    border:1px solid rgba(104,0,10,.18) !important;
    border-radius:50% !important;
    background:#FFF8F6 !important;
    color:var(--cg20-red,#68000A) !important;
    line-height:26px !important;
  }

  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td.product-thumbnail{
    grid-area:thumb !important;
    align-self:start !important;
    justify-self:start !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-thumbnail > a{
    display:block !important;
    width:62px !important;
    max-width:62px !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-thumbnail :is(img,.cgss-promoted-artwork){
    display:block !important;
    width:auto !important;
    max-width:62px !important;
    max-height:74px !important;
    margin:0 !important;
  }

  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td.product-name{
    grid-area:name !important;
    align-self:start !important;
    padding:0 2px !important;
    overflow:visible !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name,
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name *{
    min-width:0 !important;
    max-width:100% !important;
    box-sizing:border-box !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name > a:first-child,
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart td.product-name > a:first-of-type{
    display:block !important;
    margin:0 0 6px !important;
    font-size:14px !important;
    line-height:1.3 !important;
    overflow-wrap:anywhere !important;
    word-break:normal !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name > small{
    display:block !important;
    margin:0 0 7px !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name > small a[href*="pewc_key"]{
    display:inline-flex !important;
    width:auto !important;
    max-width:100% !important;
    min-height:28px !important;
    padding:5px 8px !important;
    white-space:normal !important;
  }

  /* PEWC choices stay with the product instead of collapsing into a thin side rail. */
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name ul.variation{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:0 !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    margin:7px 0 0 !important;
    padding:7px 8px !important;
    overflow:visible !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name ul.variation > li,
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name ul.variation > li[class*="Alreadyhaveanimageonfile"],
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name ul.variation > li:has(.pewc-upload-thumb-wrapper),
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name ul.variation > li[class*="PrintPrep"]{
    display:grid !important;
    grid-column:auto !important;
    grid-template-columns:minmax(92px,40%) minmax(0,1fr) !important;
    gap:6px !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    margin:0 !important;
    padding:4px 0 !important;
    overflow:visible !important;
    box-sizing:border-box !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name ul.variation :is(.item-variation-name,.item-variation-value,.item-variation-value p){
    display:block !important;
    width:auto !important;
    max-width:100% !important;
    min-width:0 !important;
    margin:0 !important;
    float:none !important;
    clear:none !important;
    overflow-wrap:anywhere !important;
    word-break:normal !important;
    white-space:normal !important;
  }

  /* Compact financial footer: Price | Quantity | Subtotal. */
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td.product-price,
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td.product-quantity,
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td.product-subtotal{
    align-self:end !important;
    padding-top:9px !important;
    border-top:1px solid var(--cg20-line-soft,#E8DFD6) !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td.product-price{
    grid-area:price !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td.product-quantity{
    grid-area:quantity !important;
    text-align:center !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td.product-subtotal{
    grid-area:subtotal !important;
    text-align:right !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td:is(.product-price,.product-quantity,.product-subtotal)::before{
    content:attr(data-title) !important;
    display:block !important;
    width:100% !important;
    margin:0 0 5px !important;
    color:var(--cg20-slate,#52666C) !important;
    font-family:var(--e-global-typography-primary-font-family,"Poppins",Arial,sans-serif) !important;
    font-size:9px !important;
    font-weight:700 !important;
    letter-spacing:.055em !important;
    line-height:1.1 !important;
    text-transform:uppercase !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td.product-quantity::before{
    text-align:center !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item > td.product-subtotal::before{
    text-align:right !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart td.product-price .amount{
    font-size:12px !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart td.product-subtotal .amount{
    font-size:15px !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart td.product-quantity .quantity{
    margin:0 auto !important;
  }

  /* WoodMart's action row remains a normal full-width control area after card rows. */
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.wd-cart-action-row,
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr:not(.cart_item){
    display:block !important;
    width:100% !important;
    max-width:100% !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.wd-cart-action-row > td,
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr:not(.cart_item) > td{
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    box-sizing:border-box !important;
  }
}

@media (max-width:430px){
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart > tbody > tr.cart_item{
    grid-template-columns:28px 58px minmax(88px,1fr) minmax(64px,auto) !important;
    column-gap:8px !important;
    padding-left:8px !important;
    padding-right:8px !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-thumbnail > a{
    width:58px !important;
    max-width:58px !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-thumbnail :is(img,.cgss-promoted-artwork){
    max-width:58px !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name ul.variation > li,
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name ul.variation > li[class*="Alreadyhaveanimageonfile"],
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name ul.variation > li:has(.pewc-upload-thumb-wrapper),
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart .product-name ul.variation > li[class*="PrintPrep"]{
    grid-template-columns:minmax(86px,41%) minmax(0,1fr) !important;
    gap:5px !important;
  }
}


/* ======================================================================
   ALPHA.33 — CONSOLE-APPROVED DESKTOP CART GEOMETRY
   Live-verified on Craft Giclée Cart. Keeps WoodMart table sizing fluid,
   gives material thumbnails a dedicated lane, and prevents header/financial
   collisions without changing PEWC detail-card ownership.
   ====================================================================== */
@media (min-width:821px){
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart{
    table-layout:auto !important;
  }

  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart th.product-remove,
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart td.product-remove{
    width:26px !important;
    min-width:26px !important;
    padding-left:2px !important;
    padding-right:2px !important;
    text-align:center !important;
  }

  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart td.product-thumbnail{
    width:70px !important;
    min-width:70px !important;
    max-width:70px !important;
    padding:10px 8px !important;
    vertical-align:middle !important;
    box-sizing:border-box !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart td.product-thumbnail > a{
    display:flex !important;
    width:54px !important;
    height:70px !important;
    margin:0 auto !important;
    align-items:center !important;
    justify-content:center !important;
    overflow:hidden !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart td.product-thumbnail > a > img{
    display:block !important;
    width:auto !important;
    height:auto !important;
    max-width:54px !important;
    max-height:66px !important;
    object-fit:contain !important;
    margin:0 auto !important;
  }

  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart tr.cart_item:not(.cgpp-reorder-line) td.product-name{
    width:auto !important;
    min-width:0 !important;
    padding-left:10px !important;
    padding-right:12px !important;
    box-sizing:border-box !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart tr.cart_item:not(.cgpp-reorder-line) td.product-name > *{
    max-width:100% !important;
    box-sizing:border-box !important;
  }

  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart thead th{
    box-sizing:border-box !important;
    white-space:nowrap !important;
    line-height:1.2 !important;
    vertical-align:middle !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart thead th.product-name{
    text-align:left !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart thead th.product-price{
    min-width:62px !important;
    padding-left:5px !important;
    padding-right:5px !important;
    text-align:center !important;
    font-size:8px !important;
    letter-spacing:.04em !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart thead th.product-quantity{
    min-width:78px !important;
    padding-left:5px !important;
    padding-right:5px !important;
    text-align:center !important;
    font-size:8px !important;
    letter-spacing:.04em !important;
  }
  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart thead th.product-subtotal{
    min-width:68px !important;
    padding-left:5px !important;
    padding-right:8px !important;
    text-align:right !important;
    font-size:8px !important;
    letter-spacing:.04em !important;
  }

  body.cgss-v2-cart.woocommerce-cart table.shop_table.cart tr.cgpp-reorder-line td.product-name{
    width:auto !important;
    min-width:0 !important;
  }
}
