/* TradesFolks 18.4.43 — Compact Desktop + Mobile Swipe Industries
   Desktop becomes denser; mobile becomes horizontal left-to-right card rail.
   All category artwork remains proportional and never stretches. */

/* Shared image integrity */
.tf-home-v3-category-media img{
  width:100%!important;
  height:100%!important;
  max-width:100%!important;
  max-height:100%!important;
  object-fit:contain!important;
  object-position:center center!important;
  transform:none!important;
}

/* ---------- DESKTOP / LARGE TABLET ---------- */
@media(min-width:768px){
  .tf-home-v3-industries{
    padding-top:16px!important;
    padding-bottom:18px!important;
  }

  .tf-home-v3-industries .shell{
    width:min(calc(100% - 28px),1780px)!important;
    max-width:1780px!important;
  }

  .tf-home-v3-section-head{
    margin-bottom:8px!important;
    gap:10px!important;
  }
  .tf-home-v3-section-head>div>span{
    font-size:7px!important;
    letter-spacing:.12em!important;
  }
  .tf-home-v3-section-head h2{
    font-size:24px!important;
    line-height:1.02!important;
    letter-spacing:-.025em!important;
  }
  .tf-home-v3-section-head p{
    font-size:10px!important;
    margin-top:3px!important;
  }
  .tf-home-v3-section-head>a{
    min-height:30px!important;
    padding:0 9px!important;
    font-size:8.5px!important;
    border-radius:8px!important;
  }

  .tf-home-v3-category-grid{
    gap:7px!important;
  }
  .tf-home-v3-category-card{
    border-radius:9px!important;
  }
  .tf-home-v3-category-media{
    height:116px!important;
    min-height:116px!important;
  }
  .tf-home-v3-category-body{
    padding:6px 7px 7px!important;
    min-height:42px!important;
  }
  .tf-home-v3-category-body>span{
    font-size:6.5px!important;
    margin-bottom:1px!important;
  }
  .tf-home-v3-category-body>strong{
    font-size:8.8px!important;
    line-height:1.15!important;
  }

  .tf-home-v3-subcategories{
    margin-top:10px!important;
  }
  .tf-home-v3-subcategories>strong{
    font-size:9px!important;
  }
  .tf-home-v3-subcategories a{
    font-size:8px!important;
    padding:4px 7px!important;
  }
}

/* Ultra-wide: more columns = smaller overall section height. */
@media(min-width:1600px){
  .tf-home-v3-category-grid{
    grid-template-columns:repeat(7,minmax(0,1fr))!important;
  }
  .tf-home-v3-category-media{
    height:108px!important;
    min-height:108px!important;
  }
}

/* Standard desktop */
@media(min-width:1280px) and (max-width:1599px){
  .tf-home-v3-category-grid{
    grid-template-columns:repeat(6,minmax(0,1fr))!important;
  }
  .tf-home-v3-category-media{
    height:112px!important;
    min-height:112px!important;
  }
}

/* Laptop / tablet landscape */
@media(min-width:768px) and (max-width:1279px){
  .tf-home-v3-category-grid{
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
  }
  .tf-home-v3-category-media{
    height:104px!important;
    min-height:104px!important;
  }
}

/* ---------- MOBILE HORIZONTAL SWIPE ---------- */
@media(max-width:767px){
  .tf-home-v3-industries{
    padding:14px 0 82px!important;
    overflow:hidden!important;
  }
  .tf-home-v3-industries .shell{
    width:100%!important;
    max-width:none!important;
    padding-inline:10px!important;
    overflow:visible!important;
    box-sizing:border-box!important;
  }

  .tf-home-v3-section-head{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:7px!important;
    margin-bottom:9px!important;
  }
  .tf-home-v3-section-head h2{
    font-size:20px!important;
    line-height:1.03!important;
  }
  .tf-home-v3-section-head p{
    font-size:9px!important;
    line-height:1.3!important;
  }
  .tf-home-v3-section-head>a{
    width:100%!important;
    min-height:32px!important;
    font-size:9px!important;
  }

  /* Rail replaces 3-column grid. */
  .tf-home-v3-category-grid{
    display:flex!important;
    flex-wrap:nowrap!important;
    grid-template-columns:none!important;
    gap:7px!important;
    width:auto!important;
    max-width:none!important;
    margin:0 -10px!important;
    padding:0 10px 4px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    scroll-snap-type:x mandatory!important;
    scroll-padding-left:10px!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior-inline:contain!important;
    scrollbar-width:none!important;
  }
  .tf-home-v3-category-grid::-webkit-scrollbar{
    display:none!important;
  }

  .tf-home-v3-category-card{
    flex:0 0 132px!important;
    width:132px!important;
    min-width:132px!important;
    max-width:132px!important;
    scroll-snap-align:start!important;
    border-radius:9px!important;
  }
  .tf-home-v3-category-media{
    width:100%!important;
    height:84px!important;
    min-height:84px!important;
  }
  .tf-home-v3-category-media img{
    padding:5px!important;
    box-sizing:border-box!important;
  }
  .tf-home-v3-category-body{
    min-height:49px!important;
    padding:6px 7px 7px!important;
  }
  .tf-home-v3-category-body>span{
    font-size:6.5px!important;
    margin-bottom:2px!important;
  }
  .tf-home-v3-category-body>strong{
    font-size:8.5px!important;
    line-height:1.17!important;
    display:-webkit-box!important;
    -webkit-box-orient:vertical!important;
    -webkit-line-clamp:2!important;
    overflow:hidden!important;
    white-space:normal!important;
  }

  .tf-home-v3-subcategories{
    margin-top:11px!important;
  }
  .tf-home-v3-subcategories>div{
    display:flex!important;
    flex-wrap:nowrap!important;
    overflow-x:auto!important;
    gap:5px!important;
    scrollbar-width:none!important;
    -webkit-overflow-scrolling:touch!important;
  }
  .tf-home-v3-subcategories>div::-webkit-scrollbar{
    display:none!important;
  }
  .tf-home-v3-subcategories a{
    flex:0 0 auto!important;
    white-space:nowrap!important;
    font-size:8px!important;
    padding:5px 8px!important;
  }
}

/* Small phones: slightly narrower cards so 2.5 cards remain visible. */
@media(max-width:390px){
  .tf-home-v3-industries .shell{
    padding-inline:8px!important;
  }
  .tf-home-v3-category-grid{
    margin-inline:-8px!important;
    padding-inline:8px!important;
    scroll-padding-left:8px!important;
  }
  .tf-home-v3-category-card{
    flex-basis:122px!important;
    width:122px!important;
    min-width:122px!important;
    max-width:122px!important;
  }
  .tf-home-v3-category-media{
    height:78px!important;
    min-height:78px!important;
  }
  .tf-home-v3-section-head h2{
    font-size:19px!important;
  }
}
