/*
 * TJ-227 layout balance overlay.
 * Copy-only: completes the public product rail and removes orphaned grid items.
 */

/* Eight canonical public pages form a balanced two-row authority rail. */
body.tj-os-page .tj-os-primary-nav {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  width: min(1180px, 100%) !important;
  max-width: 1180px !important;
  justify-self: center !important;
  margin-inline: auto !important;
  gap: 7px !important;
}

body.tj-os-page .tj-os-primary-nav a {
  min-height: 62px !important;
  padding: 10px 13px !important;
}

body.tj-os-page .tj-nav-subtitle {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  text-wrap: balance;
}

body.tj-os-page .tj-os-tool-menu-label {
  display: block;
  padding: 8px 12px 4px;
  color: #158394;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* The real catalog is divided by buying intent instead of appearing as one
   undifferentiated wall. Every existing offer stays present exactly once. */
body.tj-os-page #products #productGrid.product-grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: clamp(46px, 4.5vw, 72px) !important;
  width: 100% !important;
  max-width: none !important;
  margin-inline: auto !important;
}

body.tj-os-page #products .product-family {
  min-width: 0;
}

body.tj-os-page #products .product-family-head {
  display: grid;
  grid-template-columns: minmax(230px, 0.75fr) minmax(320px, 1.15fr) auto;
  align-items: end;
  gap: clamp(18px, 2vw, 32px);
  margin: 0 0 22px;
  padding: 0 4px;
}

body.tj-os-page #products .product-family-head > div {
  display: grid;
  gap: 6px;
}

body.tj-os-page #products .product-family-head span {
  color: #158394;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

body.tj-os-page #products .product-family-head h3 {
  margin: 0;
  color: #13253a;
  font-size: clamp(25px, 2.15vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

body.tj-os-page #products .product-family-head p {
  max-width: 62ch;
  margin: 0;
  color: #60758d;
  font-size: 14px;
  line-height: 1.7;
}

body.tj-os-page #products .product-family-head > strong {
  display: inline-flex;
  min-width: 76px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding-inline: 12px;
  border: 1px solid rgba(31, 151, 174, 0.18);
  border-radius: 999px;
  color: #18768b;
  background: rgba(235, 248, 250, 0.86);
  font-size: 11px;
  white-space: nowrap;
}

body.tj-os-page #products .product-family-grid {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: clamp(22px, 1.8vw, 30px) !important;
  width: 100% !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  flex-wrap: nowrap !important;
}

body.tj-os-page #products .product-family-grid .product-card,
body.tj-os-page #products .product-family-grid .product-card[data-product-card="payment-geo-flow"],
body.tj-os-page #products .product-family-grid .product-card[data-product-card="checkout-recovery-sprint"] {
  grid-column: span 2 !important;
  order: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

@media (min-width: 981px) {
  body.tj-os-page #products .product-family--ends-two .product-family-grid > .product-card:nth-last-child(2) {
    grid-column: 2 / span 2 !important;
  }

  body.tj-os-page #products .product-family--ends-two .product-family-grid > .product-card:last-child {
    grid-column: 4 / span 2 !important;
  }
}

@media (max-width: 1180px) {
  body.tj-os-page .tj-os-primary-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 681px) and (max-width: 980px) {
  body.tj-os-page #products .product-family-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.tj-os-page #products .product-family-grid .product-card,
  body.tj-os-page #products .product-family-grid .product-card[data-product-card="payment-geo-flow"],
  body.tj-os-page #products .product-family-grid .product-card[data-product-card="checkout-recovery-sprint"] {
    grid-column: auto !important;
  }

  body.tj-os-page #products .product-family--ends-two .product-family-grid > .product-card:last-child {
    grid-column: 1 / -1 !important;
    justify-self: center;
    width: calc(50% - 11px) !important;
  }
}

@media (max-width: 760px) {
  body.tj-os-page .tj-os-primary-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    max-width: none !important;
  }

  body.tj-os-page .tj-os-primary-nav a {
    min-height: 56px !important;
    padding: 8px 9px !important;
  }
}

@media (max-width: 680px) {
  body.tj-os-page #products .product-family-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  body.tj-os-page #products .product-family-head > strong {
    justify-self: start;
  }

  body.tj-os-page #products .product-family-grid {
    grid-template-columns: 1fr !important;
  }

  body.tj-os-page #products .product-family-grid .product-card,
  body.tj-os-page #products .product-family-grid .product-card[data-product-card="payment-geo-flow"],
  body.tj-os-page #products .product-family-grid .product-card[data-product-card="checkout-recovery-sprint"] {
    grid-column: auto !important;
    width: 100% !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.tj-os-page .tj-os-primary-nav a {
    transition: none !important;
  }
}
