/* TradesFolks 18.4.135
   Category Directory hotfix after CSS consolidation.
   Desktop: left parent card + 8 child cards in a true 4 x 2 grid.
   Mobile: compact horizontal child-card rail with no reserved dead height.
*/

@media(min-width:821px){
  .tf-homepage .home-category-showcases{
    width:calc(100% - 56px)!important;
    margin-left:auto!important;
    margin-right:auto!important;
  }

  .tf-homepage .home-category-showcases > .shell{
    width:100%!important;
    max-width:none!important;
    margin:0!important;
    padding:0!important;
  }

  .tf-homepage .home-category-showcase{
    margin:0 0 14px!important;
    padding:12px!important;
    border-radius:16px!important;
    box-sizing:border-box!important;
  }

  .tf-homepage .home-category-showcase-grid{
    display:grid!important;
    grid-template-columns:minmax(300px,1.16fr) minmax(0,3.04fr)!important;
    align-items:stretch!important;
    min-height:400px!important;
    height:auto!important;
    gap:0!important;
  }

  .tf-homepage .home-category-source-card{
    grid-column:1!important;
    grid-row:1!important;
    min-height:400px!important;
    height:100%!important;
    margin:0!important;
    border-radius:14px 0 0 14px!important;
    overflow:hidden!important;
  }

  .tf-homepage .home-category-subgrid{
    grid-column:2!important;
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    grid-template-rows:repeat(2,minmax(0,1fr))!important;
    min-height:400px!important;
    height:100%!important;
    gap:0!important;
    align-content:stretch!important;
  }

  .tf-homepage .home-category-subcard{
    min-width:0!important;
    min-height:200px!important;
    height:100%!important;
    margin:0!important;
    padding:14px!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }

  .tf-homepage .home-category-subcard strong{
    display:block!important;
    min-height:20px!important;
    margin:0!important;
    font-size:13px!important;
    line-height:1.2!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  .tf-homepage .home-category-subcard-image{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    height:145px!important;
    min-height:145px!important;
    margin-top:6px!important;
    overflow:hidden!important;
  }

  .tf-homepage .home-category-subcard-image img{
    width:100%!important;
    height:100%!important;
    object-fit:contain!important;
    object-position:center!important;
    display:block!important;
  }

  .tf-homepage .home-category-subcard:nth-child(n+9){
    display:none!important;
  }
}

@media(min-width:821px) and (max-width:1180px){
  .tf-homepage .home-category-showcase-grid{
    grid-template-columns:minmax(250px,1fr) minmax(0,3fr)!important;
    min-height:360px!important;
  }
  .tf-homepage .home-category-source-card,
  .tf-homepage .home-category-subgrid{
    min-height:360px!important;
  }
  .tf-homepage .home-category-subcard{
    min-height:180px!important;
    padding:11px!important;
  }
  .tf-homepage .home-category-subcard-image{
    height:126px!important;
    min-height:126px!important;
  }
}

@media(max-width:820px){
  .tf-homepage .home-category-showcases{
    width:calc(100% - 16px)!important;
    margin:10px auto!important;
    min-height:0!important;
    height:auto!important;
  }

  .tf-homepage .home-category-showcases > .shell{
    width:100%!important;
    max-width:none!important;
    margin:0!important;
    padding:0!important;
  }

  .tf-homepage .home-category-showcase{
    margin:0 0 10px!important;
    padding:10px!important;
    min-height:0!important;
    height:auto!important;
    border-radius:14px!important;
  }

  .tf-homepage .home-category-showcase-head{
    margin-bottom:8px!important;
  }

  .tf-homepage .home-category-showcase-grid{
    display:block!important;
    min-height:0!important;
    height:auto!important;
  }

  .tf-homepage .home-category-source-card{
    min-height:138px!important;
    height:138px!important;
    margin:0 0 8px!important;
    border-radius:12px!important;
    overflow:hidden!important;
  }

  .tf-homepage .home-category-subgrid{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    width:100%!important;
    min-height:0!important;
    height:auto!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    scroll-snap-type:x mandatory!important;
    scrollbar-width:none!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .tf-homepage .home-category-subgrid::-webkit-scrollbar{
    display:none!important;
  }

  .tf-homepage .home-category-subcard{
    flex:0 0 42vw!important;
    width:42vw!important;
    min-width:42vw!important;
    max-width:42vw!important;
    min-height:120px!important;
    height:120px!important;
    padding:8px!important;
    border-radius:11px!important;
    scroll-snap-align:start!important;
  }

  .tf-homepage .home-category-subcard strong{
    font-size:7px!important;
    line-height:1.15!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  .tf-homepage .home-category-subcard-image{
    height:82px!important;
    min-height:82px!important;
    margin-top:4px!important;
  }

  .tf-homepage .home-category-subcard-image img{
    width:100%!important;
    height:100%!important;
    object-fit:contain!important;
  }
}
