/* Homepage "Businesses" popup (partials/businesses-popup.blade.php). Text in the site's Inter,
   headings in Manrope; each card in its module's colour. */
.businesses-popup {
  --bp-ink: #15213a;
  --bp-text: #3f4b5f;
  /* Bootstrap locks body scroll while a modal is open; this overlay must scroll instead. */
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* About 393px per card (1180px for three, 790px for two) */
.businesses-popup .businesses-popup__dialog,
.businesses-popup .modal-dialog-centered.modal-dialog-scrollable {
  max-width: min(calc(var(--bp-cols, 3) * 393px), calc(100vw - 24px));
  width: min(calc(var(--bp-cols, 3) * 393px), calc(100vw - 24px));
  margin: .75rem auto;
  height: auto;
  max-height: calc(100dvh - 1.5rem);
}

/* Beat Bootstrap 5: .modal-dialog-centered.modal-dialog-scrollable .modal-content { max-height: none }
   which lets the cards grow past the viewport and then clips them with overflow:hidden. */
.businesses-popup .modal-dialog-scrollable .businesses-popup__content,
.businesses-popup.modal .businesses-popup__content {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 1.5rem);
  border: 0;
  border-radius: 22px;
  background: #f6f8fb;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
  overflow: hidden;
}

.businesses-popup__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex: 0 0 auto;
  padding: 16px 22px 8px;
}

.businesses-popup__title {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--bp-ink);
}

.businesses-popup__lead {
  margin: .2rem 0 0;
  font-size: .86rem;
  color: #64748b;
}

.businesses-popup__close {
  flex-shrink: 0;
  margin-top: 4px;
}

.businesses-popup__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px 18px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* The chat button stays behind the popup */
body.modal-open .discussion-fab,
body.modal-open .discussion-banner-chat {
  visibility: hidden;
}

/* ---------- Cards ---------- */
.bp-grid {
  display: grid;
  grid-template-columns: repeat(var(--bp-cols, 3), minmax(0, 1fr));
  gap: 16px;
}

.bp-card {
  --tone: #f97316;
  --tone-dark: #c2410c;
  --tone-bg: linear-gradient(160deg, #fff6ee 0%, #ffe8d5 100%);
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
  overflow: hidden;
}

.bp-card--consultants {
  --tone: #7c3aed;
  --tone-dark: #6d28d9;
  --tone-bg: linear-gradient(160deg, #f7f2ff 0%, #ece3ff 100%);
}

.bp-card--services {
  --tone: #16a34a;
  --tone-dark: #15803d;
  --tone-bg: linear-gradient(160deg, #f0fcf4 0%, #dcf4e4 100%);
}

/* Offers & Ads popup: the homepage Offers card's rose, and amber for ads */
.bp-card--offers {
  --tone: #e11d48;
  --tone-dark: #be123c;
  --tone-bg: linear-gradient(160deg, #fff4f6 0%, #ffe3e8 100%);
}

.bp-card--ads {
  --tone: #d97706;
  --tone-dark: #b45309;
  --tone-bg: linear-gradient(160deg, #fffaeb 0%, #fdefc4 100%);
}

.bp-card__top {
  --bp-art-h: 150px;
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  /* tall enough for the illustration below the icon */
  min-height: calc(var(--bp-art-h) + 72px);
  padding: 18px 18px 0;
  background: var(--tone-bg);
}

/* Width of each illustration for its height (they are all drawn the same height) */
.bp-card--vendors { --bp-art-ratio: .748; }
.bp-card--consultants { --bp-art-ratio: .83; }
.bp-card--services { --bp-art-ratio: .803; }
.bp-card--offers { --bp-art-ratio: 0.816; }
.bp-card--ads { --bp-art-ratio: .744; }

/* Quarter circle with the illustration, standing on the bottom-left corner of the card's top */
.bp-card__art {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 0;
  display: block;
  width: auto;
  height: var(--bp-art-h);
  pointer-events: none;
}

.bp-card__head,
.bp-card__desc,
.bp-card__body {
  position: relative;
  z-index: 1;
}

.bp-card__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.bp-card__icon {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--tone);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--tone) 35%, transparent);
}

.bp-card__heading {
  flex: 1;
  min-width: 0;
}

.bp-card__title {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  font-size: 1.32rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--bp-ink);
}

.bp-card__tagline {
  margin: .2rem 0 0;
  font-size: .84rem;
  font-weight: 600;
  color: #3d4757;
}

.bp-card--services .bp-card__tagline {
  color: var(--tone-dark);
}

/* "Explore more" sits on the title's line, top right; the tagline below has the full width */
.bp-card__head {
  position: relative;
}

.bp-card__title {
  padding-right: 6.9rem;
}

.bp-card__view-all {
  position: absolute;
  top: 2px;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  flex-shrink: 0;
  margin-top: 4px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--tone-dark);
  text-decoration: none;
  white-space: nowrap;
}

.bp-card__view-all i {
  font-size: .7rem;
}

.bp-card__view-all:hover {
  color: var(--tone-dark);
  text-decoration: underline;
}

/* Lined up with the title, so the circle can rise beside it */
.bp-card__desc {
  margin: 10px 0 14px 60px;
  font-size: .76rem;
  line-height: 1.5;
  color: var(--bp-text);
}

/* Categories to the right of the illustration */
.bp-card__body {
  margin-top: auto;
  padding-left: calc(var(--bp-art-h) * var(--bp-art-ratio) - 18px + 6px);
}

.bp-card__chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0 0 16px;
  list-style: none;
}

.bp-card__chips li {
  min-width: 0;
}

.bp-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 100%;
  min-height: 44px;
  padding: 6px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
  color: var(--bp-ink);
  font-size: .66rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  transition: box-shadow .15s ease, color .15s ease, transform .15s ease;
}

.bp-chip i {
  flex: 0 0 14px;
  text-align: center;
  font-size: .82rem;
  color: var(--tone);
}

/* A word too long for the chip wraps with a hyphen instead of being cut off */
.bp-chip span {
  min-width: 0;
  overflow-wrap: break-word;
  hyphens: auto;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bp-chip:hover {
  color: var(--tone-dark);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--tone) 22%, transparent);
  transform: translateY(-1px);
}

.bp-card__foot {
  padding: 14px 18px 18px;
  background: #fff;
}

.bp-card__explore {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  min-height: 46px;
  border-radius: 11px;
  background: var(--tone);
  color: #fff;
  font-size: .92rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--tone) 28%, transparent);
  transition: background .15s ease, transform .15s ease;
}

.bp-card__explore i {
  font-size: .8rem;
}

.bp-card__explore:hover {
  background: var(--tone-dark);
  color: #fff;
  transform: translateY(-1px);
}

/* ---------- Responsive ---------- */
@media (max-width: 1199.98px) {
  .bp-card__title {
    font-size: 1.18rem;
  }

  .bp-card__top {
    --bp-art-h: 132px;
  }

  .bp-card__desc {
    font-size: .72rem;
  }

  .bp-chip {
    min-height: 40px;
    padding: 5px;
    font-size: .62rem;
  }
}

/* Stack to one card per row once three columns would crush the chips */
@media (max-width: 991.98px) {
  .bp-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .bp-card__top {
    --bp-art-h: 160px;
  }

  .bp-card__chips {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .bp-card__chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Short laptop screens: keep the three cards in view without clipping the buttons */
@media (max-height: 760px) {
  .bp-card__top {
    padding: 14px 14px 0;
  }

  .bp-card__top {
    --bp-art-h: 140px;
  }

  .bp-card__desc {
    margin: 8px 0 10px 56px;
    font-size: .78rem;
  }

  .bp-card__body {
    padding-left: calc(var(--bp-art-h) * var(--bp-art-ratio) - 14px + 6px);
  }

  .bp-chip {
    min-height: 38px;
    padding: 5px 6px;
  }

  .bp-card__foot {
    padding: 12px 14px 14px;
  }

  .bp-card__explore {
    min-height: 42px;
  }
}

@media (max-width: 575.98px) {
  .businesses-popup .businesses-popup__dialog,
  .businesses-popup .modal-dialog-centered.modal-dialog-scrollable {
    max-width: none;
    width: 100%;
    margin: 0;
    max-height: 100dvh;
    height: 100%;
  }

  .businesses-popup .modal-dialog-scrollable .businesses-popup__content,
  .businesses-popup.modal .businesses-popup__content {
    max-height: 100dvh;
    height: 100%;
    border-radius: 0;
  }

  /* Phones: tight spacing so all the cards fit on one screen */
  .businesses-popup__head {
    align-items: center;
    padding: 10px 14px 8px;
    border-bottom: 1px solid #e8edf3;
    background: #fff;
  }

  .businesses-popup__title {
    font-size: 1.05rem;
  }

  .businesses-popup__lead {
    margin-top: .1rem;
    font-size: .74rem;
  }

  .businesses-popup__close {
    margin-top: 0;
  }

  .businesses-popup__body {
    padding: 10px 10px 12px;
  }

  .bp-grid {
    gap: 10px;
  }

  .bp-card {
    border-radius: 16px;
  }

  .bp-card__top {
    --bp-art-h: 118px;
    min-height: 0;
    padding: 10px 12px 0;
  }

  .bp-card__head {
    align-items: center;
    gap: 10px;
  }

  .bp-card__icon {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: .95rem;
  }

  .bp-card__title {
    font-size: 1.05rem;
  }

  .bp-card__tagline {
    margin-top: .05rem;
    font-size: .72rem;
  }

  .bp-card__view-all {
    top: 1px;
    margin-top: 0;
    font-size: .74rem;
  }

  .bp-card__title {
    padding-right: 6.2rem;
  }

  /* One line under the title */
  .bp-card__desc {
    margin: 5px 0 7px 46px;
    font-size: .72rem;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bp-card__body {
    padding-left: calc(var(--bp-art-h) * var(--bp-art-ratio) - 12px + 4px);
  }

  .bp-card__chips {
    gap: 5px;
    padding-bottom: 9px;
  }

  .bp-chip {
    min-height: 32px;
    padding: 4px 6px;
    gap: 5px;
    border-radius: 9px;
    font-size: .64rem;
    line-height: 1.2;
  }

  .bp-chip i {
    flex-basis: 13px;
    font-size: .74rem;
  }

  .bp-card__foot {
    padding: 7px 12px 9px;
  }

  .bp-card__explore {
    min-height: 36px;
    border-radius: 10px;
    font-size: .84rem;
  }
}

/* Small phones: a smaller illustration leaves the categories room */
@media (max-width: 374.98px) {
  .bp-card__top {
    --bp-art-h: 104px;
  }
}

/* Three cards (Businesses) on phone screens under 860px tall (most, once the browser bars take
   their share): no description line, slimmer chips and button */
@media (max-width: 575.98px) and (max-height: 859.98px) {
  .businesses-popup--cards-3 .bp-card__desc {
    display: none;
  }

  .businesses-popup--cards-3 .bp-card__head {
    margin-bottom: 8px;
  }

  .businesses-popup--cards-3 .bp-chip {
    min-height: 30px;
  }

  .businesses-popup--cards-3 .bp-card__chips {
    padding-bottom: 7px;
  }

  .businesses-popup--cards-3 .bp-card__foot {
    padding: 5px 12px 7px;
  }

  .businesses-popup--cards-3 .bp-card__explore {
    min-height: 32px;
    font-size: .8rem;
  }
}

/* Three cards on short phone screens: the "Explore more" link in each card head replaces the
   big button */
@media (max-width: 575.98px) and (max-height: 750px) {
  .businesses-popup--cards-3 .bp-card__foot {
    display: none;
  }

  .businesses-popup--cards-3 .bp-card__chips {
    padding-bottom: 10px;
  }
}

/* Two cards (Offers & Ads) on phones: room to spare, so the description (two lines), roomier
   chips and the full Explore button stay */
@media (max-width: 575.98px) {
  .businesses-popup--cards-2 .bp-card__top {
    padding: 14px 14px 0;
  }

  .businesses-popup--cards-2 .bp-card__desc {
    display: -webkit-box;
    margin: 8px 0 10px 46px;
    white-space: normal;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .businesses-popup--cards-2 .bp-card__chips {
    gap: 6px;
    padding-bottom: 12px;
  }

  .businesses-popup--cards-2 .bp-chip {
    min-height: 36px;
    font-size: .68rem;
  }

  .businesses-popup--cards-2 .bp-card__foot {
    padding: 10px 14px 12px;
  }

  .businesses-popup--cards-2 .bp-card__explore {
    min-height: 42px;
    font-size: .88rem;
  }
}

/* Two cards on short phone screens: one line of description, slimmer chips */
@media (max-width: 575.98px) and (max-height: 699.98px) {
  .businesses-popup--cards-2 .bp-card__desc {
    -webkit-line-clamp: 1;
  }

  .businesses-popup--cards-2 .bp-chip {
    min-height: 32px;
  }

  .businesses-popup--cards-2 .bp-card__foot {
    padding: 8px 14px 10px;
  }

  .businesses-popup--cards-2 .bp-card__explore {
    min-height: 38px;
  }
}

/* Two cards on the smallest phones: no description, slim button */
@media (max-width: 575.98px) and (max-height: 599.98px) {
  .businesses-popup--cards-2 .bp-card__desc {
    display: none;
  }

  .businesses-popup--cards-2 .bp-card__head {
    margin-bottom: 8px;
  }

  .businesses-popup--cards-2 .bp-card__explore {
    min-height: 34px;
    font-size: .82rem;
  }
}
