/* ==========================================================================
   TankAndBarrel.com - parent category + home category tile grid (tb_catgrid)
   2026-11-27  -  CSS only. Same links, same names, same alt text, same images.
   Scoped to .category-listing (used by both parent category pages and the
   home page "shop by category" grid).

   Why the boxes look uneven today
   - The row is already a flex wrap, so tiles don't fall into holes, but the
     visible card (.category-images-item) only grows with its content.
   - Names wrap to 1 or 2 lines on desktop (and get clamped to 2 lines on
     phones), so cards in the same row end at different heights. The heavy
     15px shadow makes that ragged edge obvious.
   - Images are tagged 200x150, but img-responsive uses height:auto, so any
     thumb that isn't actually 4:3 comes out a different height.
   - Bootstrap h5 margins and the <hr> under each photo add more uneven padding.
   - .equal-height is on the cards, but the equalHeight script only runs on
     product listings, not on these grids.

   This sheet: equal-height cards, a fixed-height photo well with object-fit:
   contain, reserved name space so every tile is the same size, typography
   that matches the navy/blue header and sidebar, a whole-card hover, and
   consistent gaps. Long names are not ellipsized, so labels like
   "1.5 SG" / "1.9 SG" stay visible.
   ========================================================================== */

.category-listing {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.category-listing > .row.list-group {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: row;
          flex-direction: row;
  -webkit-flex-wrap: wrap;
          flex-wrap: wrap;
  -webkit-align-items: stretch;
          align-items: stretch;
  margin-left: -10px;
  margin-right: -10px;
}

.category-listing > .row.list-group > [class*="col-"] {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
          flex-direction: column;
  float: none;
  padding-left: 10px;
  padding-right: 10px;
  margin-bottom: 0;
}

/* ---- the card itself: fill the column, same chrome as the sidebar cards ---- */
.category-listing .thumbnail.category-images-item,
.category-listing .category-images-item {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
          flex-direction: column;
  -webkit-flex: 1 1 auto;
          flex: 1 1 auto;
  width: 100%;
  height: auto;
  margin: 0 0 20px;
  padding: 0;
  background: #fff;
  border: 1px solid #e3e8ee;
  border-radius: 6px;
  -webkit-box-shadow: 0 1px 3px rgba(19, 37, 58, .06);
          box-shadow: 0 1px 3px rgba(19, 37, 58, .06);
  overflow: hidden;
  position: relative;
  -webkit-transition: border-color .15s ease, box-shadow .15s ease;
          transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}

.category-listing .category-images-item:hover,
.category-listing .category-images-item:focus-within {
  border-color: #1e6fc4;
  -webkit-box-shadow: 0 4px 12px rgba(19, 37, 58, .12);
          box-shadow: 0 4px 12px rgba(19, 37, 58, .12);
}

/* Hide the dated rule under each photo */
.category-listing .category-images-item > hr {
  display: none;
}

/* ---- fixed-height photo well; photos sit on white and are never cropped ---- */
.category-listing .category-images-item > a:first-of-type {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: center;
          justify-content: center;
  -webkit-flex: 0 0 168px;
          flex: 0 0 168px;
  height: 168px;
  width: 100%;
  padding: 8px 12px 0;
  background: #fff;
  overflow: hidden;
  line-height: 0;
  text-decoration: none;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}

.category-listing .category-images-item > a:first-of-type img,
.category-listing .category-images-item img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  object-fit: contain;
  object-position: center;
  -webkit-transition: none;
          transition: none;
  -webkit-transform: none;
      -ms-transform: none;
          transform: none;
}

/* ---- names: reserved 2-line height on desktop so every card matches ---- */
.category-listing .category-images-name {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: center;
          justify-content: center;
  -webkit-flex: 1 1 auto;
          flex: 1 1 auto;
  width: 100%;
  min-height: 64px; /* padding 8+12 + two 15px/1.3 lines */
  margin: 0;
  padding: 8px 12px 12px;
  text-align: center;
  white-space: normal;
  background: #fff;
  font-size: 15px;
  line-height: 1.3;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}

.category-listing .category-images-name h5 {
  margin: 0;
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
}

/* !important beats the home page's inline font-size / color on the name link */
.category-listing .category-images-name a,
.category-listing .category-images-name a[style] {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  color: #13253a !important;
  text-decoration: none !important;
  white-space: normal;
  overflow: visible;
  -webkit-line-clamp: unset;
}

/* Stretch the name link over the whole card so the tile is one click target */
.category-listing .category-images-name a::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
}

.category-listing .category-images-item:hover .category-images-name a,
.category-listing .category-images-item:hover .category-images-name a[style],
.category-listing .category-images-item:focus-within .category-images-name a,
.category-listing .category-images-item:focus-within .category-images-name a[style] {
  color: #1e6fc4 !important;
}

.category-listing .category-images-name a:focus {
  outline: none;
}

.category-listing .category-images-item:focus-within {
  outline: 2px solid #1e6fc4;
  outline-offset: 2px;
}

/* Descriptions are off on the home grid today; style them if they are turned on later */
.category-listing .category-images-desc {
  padding: 0 12px 12px;
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #33475b;
}

.category-listing .category-images-see-more,
.category-listing .category-images-see-more a {
  color: #1e6fc4;
  font-size: 12px;
  font-weight: 600;
  padding-left: 4px;
}

/* --------------------------------------------------------------------------
   Tablet (768-991): 3 columns. At this width the left sidebar has already
   stacked, and 4 columns made the longest names wrap too tightly.
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 991px) {
  .category-listing > .row.list-group > [class*="col-"] {
    width: 33.33333333%;
  }
  .category-listing .category-images-name {
    min-height: 82px; /* padding 8+12 + three 15px/1.3 lines */
  }
}

/* --------------------------------------------------------------------------
   Phone: keep the existing two-across layout from user.css, but use the
   same card chrome and a 3-line name so "1.5 SG" / "1.9 SG" is not cut off
   (user.css currently clamps names to 2 lines).
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .category-listing > .row.list-group {
    -webkit-flex-direction: row !important;
            flex-direction: row !important;
    margin-left: -6px;
    margin-right: -6px;
  }
  .category-listing > .row.list-group > [class*="col-"] {
    width: 50%;
    float: none;
    padding-left: 6px;
    padding-right: 6px;
  }
  .category-listing .thumbnail.category-images-item,
  .category-listing .category-images-item {
    margin: 0 0 12px;
    height: auto;
  }
  .category-listing .category-images-item > a:first-of-type {
    -webkit-flex-basis: 118px;
            flex-basis: 118px;
    height: 118px;
    padding: 6px 8px 0;
  }
  .category-listing .category-images-name {
    min-height: 70px; /* padding 6+10 + three 13px/1.3 lines */
    padding: 6px 8px 10px;
    font-size: 13px;
  }
  .category-listing .category-images-name a,
  .category-listing .category-images-name a[style] {
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
  }
}
