/* =========================================================
   HGC PRO TILES
   ========================================================= */

.hgc-pro-tiles {
  --cols-d: 4;
  --cols-t: 2;
  --cols-m: 1;
  --gap: 28px;

  /* injected by shortcode */
  --pt-count: 0;
}

/* Grid */
.hgc-pro-tiles__grid {
  display: grid;
  grid-template-columns: repeat(var(--cols-d), minmax(0, 1fr));
  gap: var(--gap);
  justify-items: center;
  /* keeps single card nice */
}

@media (max-width: 1024px) {
  .hgc-pro-tiles__grid {
    grid-template-columns: repeat(var(--cols-t), minmax(0, 1fr));
  }
}



/* =========================================================
   Centering when count < columns (THE FIX)
   - Instead of leaving empty tracks, we shrink grid to its content width
   - Then we center the whole grid with margin auto
   ========================================================= */

/* Desktop */
.hgc-pro-tiles__grid--center-d {
  grid-template-columns: repeat(var(--pt-count), minmax(260px, 360px)) !important;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Tablet */
@media (max-width: 1024px) {
  .hgc-pro-tiles__grid--center-t {
    grid-template-columns: repeat(var(--pt-count), minmax(260px, 420px)) !important;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Mobile (normally 1 col; keep safe if you ever change cols-m) */
/* Mobile (Sliding cards) */
@media (max-width: 680px) {

  .hgc-pro-tiles__grid,
  .hgc-pro-tiles__grid--center-m {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 20px;
    grid-template-columns: none !important;
    width: 100%;
    margin: 0;
    gap: 16px;
    /* Slightly smaller gap for mobile */
    justify-content: flex-start;
  }

  .hgc-pro-tiles__card {
    flex: 0 0 85%;
    max-width: 85%;
    scroll-snap-align: center;
  }

  /* Optional scrollbar styling */
  .hgc-pro-tiles__grid::-webkit-scrollbar {
    height: 4px;
  }

  .hgc-pro-tiles__grid::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
  }
}

/* Card */
.hgc-pro-tiles__card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .06);
  transition: transform .15s ease, box-shadow .15s ease;
}

.hgc-pro-tiles__card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .10);
}

/* Clickable area - override theme link styling */
.hgc-pro-tiles a.hgc-pro-tiles__link {
  display: block;
  color: inherit !important;
  text-decoration: none !important;
}

.hgc-pro-tiles a.hgc-pro-tiles__link * {
  color: inherit !important;
  text-decoration: none !important;
}

/* Image */
.hgc-pro-tiles__media {
  height: 240px;
  background: rgba(0, 0, 0, .04);
  overflow: hidden;
}

.hgc-pro-tiles__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Content */
.hgc-pro-tiles__body {
  padding: 16px;
}

.hgc-pro-tiles__title {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
}

.hgc-pro-tiles__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: rgba(0, 0, 0, .72);
}

.hgc-pro-tiles__desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(0, 0, 0, .72);
}

/* CTA */
.hgc-pro-tiles__ctaRow {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.hgc-pro-tiles__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, .12);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
}

.hgc-pro-tiles__btn--primary {
  background: var(--global-palette8, #7fb100);
  color: #fff !important;
  border-color: transparent;
}