/* CP313: remove oversized category rows and prevent mobile footer clipping. */
/* Keep filtered registry cards out of layout; component display rules must not
   override the native hidden state used by the 15-item pagination. */
body.pg-visual-system.pg-posguard-template .models-grid#modelsGrid > [data-pg-registry-card][hidden],
body.pg-visual-system.pg-posguard-template [data-pg-registry][hidden] {
  display: none !important;
}

@media (min-width: 769px) {
  body.pg-visual-system.pg-posguard-template .pg-filter-disclosure:not([open]) > .pg-filter-disclosure-fields {
    display: contents !important;
  }
}

@media (max-width: 768px) {
  body.pg-visual-system.pg-posguard-template .pg-filter-disclosure:not([open]) > .pg-filter-disclosure-fields {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  body.pg-visual-system.pg-page-home .page.home-shell .pgd-products#products .pgd-product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: none !important;
    grid-auto-rows: auto !important;
    align-content: start !important;
    align-items: stretch !important;
    height: auto !important;
    min-height: 0 !important;
  }

  body.pg-visual-system.pg-page-home .page.home-shell .pgd-products#products .pgd-product-grid > a.pgd-image-card.pgd-text-category {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    height: auto !important;
    min-height: 190px !important;
    max-height: none !important;
    padding: 18px !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    overflow: visible !important;
  }

  body.pg-visual-system.pg-page-home .page.home-shell .pgd-products#products .pgd-text-category :is(.pgd-category-title, .pgd-category-description, .pgd-category-link) {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    background: transparent !important;
  }

  body.pg-visual-system.pg-page-home .page.home-shell .pgd-products#products .pgd-text-category .pgd-category-link {
    margin-top: auto !important;
  }
}

/* Use approved category product photos in place of generic placeholder icons. */
body.pg-visual-system.pg-page-home .page.home-shell .pgd-products#products .pgd-category-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 118px;
  min-height: 118px;
  overflow: hidden;
  border: 1px solid rgba(63, 133, 183, .36);
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(4, 13, 23, .94), rgba(2, 8, 17, .98));
  box-sizing: border-box;
}

body.pg-visual-system.pg-page-home .page.home-shell .pgd-products#products .pgd-category-photo > img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  padding: 4px;
  object-fit: contain;
  object-position: center;
  box-sizing: border-box;
}

@media (max-width: 767px) {
  body.pg-visual-system.pg-page-home .page.home-shell .pgd-products#products .pgd-category-photo {
    height: 96px;
    min-height: 96px;
  }
}

@media (max-width: 768px) {
  body.pg-visual-system.pg-page-home .pg-home-mobile .pgm-accessory-grid > .pgm-category-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    align-self: flex-start !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    height: auto !important;
    min-height: 190px !important;
    max-height: none !important;
    padding: 14px !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    overflow: visible !important;
  }

  body.pg-visual-system.pg-page-home .pg-home-mobile .pgm-category-card > .pgm-category-icon {
    width: 40px !important;
    height: 40px !important;
    flex-basis: 40px !important;
  }

  body.pg-visual-system.pg-page-home .pg-home-mobile .pgm-category-card > .pgm-category-title {
    font-size: 13px !important;
    line-height: 1.25 !important;
  }

  body.pg-visual-system.pg-page-home .pg-home-mobile .pgm-category-card > .pgm-category-description {
    display: -webkit-box !important;
    overflow: hidden !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  body.pg-visual-system.pg-page-home .pg-home-mobile .pgm-category-card > .pgm-category-link {
    margin-top: auto !important;
    font-size: 11px !important;
  }

  body.pg-visual-system footer#pg-footer .pg-footer-contact-links {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 6px !important;
    overflow: visible !important;
  }

  body.pg-visual-system footer#pg-footer .pg-footer-secondary-phone {
    display: flex !important;
  }

  body.pg-visual-system footer#pg-footer .pg-footer-contact-links > a {
    grid-column: auto !important;
    grid-row: auto !important;
    width: auto !important;
    min-width: 0 !important;
    justify-content: flex-start !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    font-size: 10px !important;
  }
}
