/* =========================================================
   BabyLife 2.9.12 — real responsive category grid for restored legacy landings
   Scope is activated only by JS on the two legacy landing URLs.
   Presentation only; page text, URLs, headings, image alt text and SEO metadata
   are not rewritten in WordPress or the database.
   ========================================================= */

body.blsc-legacy-card-grid-active {
  overflow-x: clip;
}

body.blsc-legacy-card-grid-active .blsc-legacy-page-restored {
  width: min(calc(100% - 32px), var(--bl-shell, 1240px)) !important;
  max-width: 1240px !important;
  min-width: 0 !important;
  margin-inline: auto !important;
  padding-inline: 0 !important;
  box-sizing: border-box !important;
}

body.blsc-legacy-card-grid-active .blsc-legacy-page-head {
  width: 100%;
  max-width: 100%;
}

body.blsc-legacy-card-grid-active .blsc-legacy-category-grid {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 0 30px !important;
  padding: 0 !important;
  clear: both;
  box-sizing: border-box !important;
}

body.blsc-legacy-card-grid-active .blsc-legacy-category-card {
  display: flex !important;
  flex-direction: column;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid var(--bl-line, #ebe5ed);
  border-radius: 16px;
  background: #fff;
  color: inherit;
  text-decoration: none !important;
  box-shadow: 0 7px 22px rgba(42, 25, 39, .06);
  box-sizing: border-box !important;
}

body.blsc-legacy-card-grid-active .blsc-legacy-category-card > img,
body.blsc-legacy-card-grid-active .blsc-legacy-category-card > picture,
body.blsc-legacy-card-grid-active .blsc-legacy-category-card picture > img {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}

body.blsc-legacy-card-grid-active .blsc-legacy-category-card > h2,
body.blsc-legacy-card-grid-active .blsc-legacy-category-card > h3,
body.blsc-legacy-card-grid-active .blsc-legacy-category-card > h4 {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 54px;
  margin: 0 !important;
  padding: 10px 8px !important;
  font-size: 15px !important;
  line-height: 1.65 !important;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
  box-sizing: border-box !important;
}

body.blsc-legacy-card-grid-active .blsc-legacy-page-restored > :is(p, h2, h3, h4, ul, ol, blockquote, table, figure) {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

body.blsc-legacy-card-grid-active .blsc-legacy-page-restored > p {
  overflow-wrap: anywhere;
}

body.blsc-legacy-card-grid-active .blsc-legacy-page-restored > :is(ul, ol) {
  padding-inline-start: 1.4em;
  padding-inline-end: 0;
}

/* Old empty paragraphs/anchors left by malformed legacy markup are removed by
   JS. This is only a visual safety fallback. */
body.blsc-legacy-card-grid-active .blsc-legacy-card-orphan:empty {
  display: none !important;
}

@media (hover: hover) and (pointer: fine) {
  body.blsc-legacy-card-grid-active .blsc-legacy-category-card {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  }
  body.blsc-legacy-card-grid-active .blsc-legacy-category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(42, 25, 39, .10);
    border-color: #dfd2dc;
  }
}

@media (max-width: 1024px) {
  body.blsc-legacy-card-grid-active .blsc-legacy-page-restored {
    width: calc(100% - 24px) !important;
  }
  body.blsc-legacy-card-grid-active .blsc-legacy-category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
  }
}

@media (max-width: 767px) {
  body.blsc-legacy-card-grid-active .blsc-legacy-page-restored {
    width: calc(100% - 20px) !important;
    padding-block: 20px 42px;
  }

  body.blsc-legacy-card-grid-active .blsc-legacy-page-head {
    margin-bottom: 16px;
  }

  body.blsc-legacy-card-grid-active .blsc-legacy-page-head h1 {
    font-size: clamp(22px, 6.6vw, 29px) !important;
    line-height: 1.55 !important;
  }

  body.blsc-legacy-card-grid-active .blsc-legacy-category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 24px !important;
  }

  body.blsc-legacy-card-grid-active .blsc-legacy-category-card {
    border-radius: 13px;
  }

  body.blsc-legacy-card-grid-active .blsc-legacy-category-card > h2,
  body.blsc-legacy-card-grid-active .blsc-legacy-category-card > h3,
  body.blsc-legacy-card-grid-active .blsc-legacy-category-card > h4 {
    min-height: 48px;
    padding: 8px 5px !important;
    font-size: 13px !important;
    line-height: 1.55 !important;
  }

  body.blsc-legacy-card-grid-active .blsc-legacy-page-restored > h2 {
    font-size: clamp(19px, 5.5vw, 24px);
    line-height: 1.6;
  }

  body.blsc-legacy-card-grid-active .blsc-legacy-page-restored > h3 {
    font-size: clamp(17px, 5vw, 21px);
    line-height: 1.65;
  }

  body.blsc-legacy-card-grid-active .blsc-legacy-page-restored > p,
  body.blsc-legacy-card-grid-active .blsc-legacy-page-restored > li {
    font-size: 14px;
    line-height: 1.9;
  }
}

@media (max-width: 360px) {
  body.blsc-legacy-card-grid-active .blsc-legacy-page-restored {
    width: calc(100% - 16px) !important;
  }
  body.blsc-legacy-card-grid-active .blsc-legacy-category-grid {
    gap: 8px;
  }
  body.blsc-legacy-card-grid-active .blsc-legacy-category-card > h2,
  body.blsc-legacy-card-grid-active .blsc-legacy-category-card > h3,
  body.blsc-legacy-card-grid-active .blsc-legacy-category-card > h4 {
    font-size: 12.5px !important;
  }
}
