/* ===== Typography ===== */
#aecMPResults h3 {
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 36px;
  line-height: 34px;
  color: var(--black);
}

.mpHeading {
  font-family: var(--font-primary);
  font-weight: 500;
  color: #999999;
}
.mpResults-fullwidth .mpHeading { font-size: 13px; }

/* ===== Generic layout ===== */
.row {display: flex;/* margin: 0 auto; */}
.column { flex: 1; min-width: 0; }

.mpResults {
  display: flex;
  flex-wrap: wrap;
  box-sizing: border-box;
  font-family: var(--font-primary);
}

.mpResults-fullwidth {
  position: relative;           /* for safe interior positioning */
  width: 100%;
  background: #F9F9F9;
  border-radius: 12px;
  margin: 10px 0;
  box-shadow: 0 0 12px rgba(0,0,0,0.25);
}

/* ===== Card: top area ===== */
.mpContainer {
  display: flex;
  flex-wrap: wrap;
  height: 520px;
}

.mpFullWidthImage {
  text-align: center;
  padding-top: 20px;
  padding-left: 10px;
  max-width: 200px;
}
.mpResults-fullwidth .mpFullWidthImage img {
  border-radius: 50%;
  width: 140px;
  height: 140px;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.mpFullWidthImage .mpRating img {
    border-radius: 0;
}

.mpFullWidthAbout {
  padding-top: 50px;
  margin-right: 18px;
}
.mpFullWidthAbout .row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  flex-wrap: wrap;
  padding-bottom: 10px;
}

.mpAdvisorName-main {
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 19px;
}
.mpCompany-main {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 18px;
  line-height: 23px;
}
.headlineOnly {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  max-height: 100px;
  max-width: 93%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: justify;
}

/* Verified / Best Match badges */
.mpFullWidthVerified,
.mpFullWidthBestMatch { flex: 1; padding: 10px; }
.mpFullWidthVerified { max-width: 175px; }
.mpFullWidthVerified img,
.mpFullWidthBestMatch img { max-width: 100%; height: auto; }

/* ===== Utilities ===== */
.mpLets { text-align: right; padding-right: 20px; }
.messaging { display: flex; align-items: center; justify-content: center; }

/* Rating (stars under image handled by markup order) */
.rating1 { text-align: right; padding-top: 5px; }
.mpRating img {
  border-radius: 0;
  width: 140px;
  height: auto;
}

/* Icon image defaults (used elsewhere too) */
img.spec-icon { width: 32px; height: 32px; }

/* ===== Bottom row (specialties + button) ===== */
/* Grid: icons block grows, button hugs its content on the right */
.mpResults-fullwidth .bottomRow .specialtiesRow {
  display: grid;
  grid-template-columns: 1fr max-content;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0 10px;            /* controls interior right/left spacing */
  box-sizing: border-box;
}

.mpResults-fullwidth .bottomRow .mpSpecialtyIcons {
  display: flex;
  flex-direction: column;
  min-width: 0;               /* allow shrink so button never wraps */
}

.mpResults-fullwidth .bottomRow .mpCertIcon {
  display: flex;
  flex-wrap: nowrap;          /* single line (max 5 per your spec) */
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.mpResults-fullwidth .bottomRow .mpCertIcon li {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 0 0 56px;             /* tile width to fit 5 comfortably */
  width: 56px;
}
.mpResults-fullwidth .bottomRow .mpCertIcon li .spec-icon { width: 32px; height: 32px; }

/* Button pinned to the interior right edge, vertically centered in its column */
.mpResults-fullwidth .bottomRow .button-fixed-bottom {
  justify-self: end;
  align-self: center;
  white-space: nowrap;
}
.mpResults-fullwidth .bottomRow .button-fixed-bottom .PrimaryButton {
  display: inline-block;
}


/* --- Base (desktop-first) --- */
.mpResults-fullwidth.mp-desktop { display: block; }
.mpResults-fullwidth.mp-mobile  { display: none;  }

/* --- Tablets & below (covers all iPads, incl. 12.9" landscape 1366px) --- */
@media (max-width: 1194px),
       (max-width: 1366px) and (orientation: landscape) {
  .mpResults-fullwidth.mp-desktop { display: none; }
  .mpResults-fullwidth.mp-mobile  { display: block; }
}

/* --- Extra safety for touch-first large tablets --- */
@media (hover: none) and (pointer: coarse) and (max-width: 1600px) {
  .mpResults-fullwidth.mp-desktop { display: none; }
  .mpResults-fullwidth.mp-mobile  { display: block; }
}

/* ===== Bottom row (specialties + button) ===== */
/* Desktop/base: icons block grows, button hugs right */
.mpResults-fullwidth .bottomRow .specialtiesRow {
  display: grid;
  grid-template-columns: 1fr max-content;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0 10px;       /* interior spacing */
  box-sizing: border-box;
}

.mpResults-fullwidth .bottomRow .mpSpecialtyIcons {
  display: flex;
  flex-direction: column;
  min-width: 0;          /* allows shrink so button never wraps */
}

.mpResults-fullwidth .bottomRow .mpHeading {
  margin: 0 0 6px 0;
}

.mpResults-fullwidth .bottomRow .mpCertIcon {
  display: flex;
  flex-wrap: nowrap;     /* single line (max 5) */
  justify-content: flex-start;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.mpResults-fullwidth .bottomRow .mpCertIcon li {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 0 0 56px;
  width: 56px;
}

.mpResults-fullwidth .bottomRow .mpCertIcon li .spec-icon {
  width: 32px;
  height: 32px;
}

.mpResults-fullwidth .bottomRow .button-fixed-bottom {
  justify-self: end;     /* right edge of grid */
  align-self: center;
  white-space: nowrap;
}

.mpResults-fullwidth .bottomRow .button-fixed-bottom .PrimaryButton {
  display: inline-block;
}

/* --- Show desktop by default, hide mobile --- */
.mpResults-fullwidth.mp-desktop { display: block; }
.mpResults-fullwidth.mp-mobile  { display: none;  }

/* --- Tablets & large iPads (portrait/landscape) switch to mobile markup --- */
@media (max-width: 1194px),
       (max-width: 1366px) and (orientation: landscape) {
  .mpResults-fullwidth.mp-desktop { display: none; }
  .mpResults-fullwidth.mp-mobile  { display: block; }
}

/* Extra safety for touch-first big tablets */
@media (hover: none) and (pointer: coarse) and (max-width: 1600px) {
  .mpResults-fullwidth.mp-desktop { display: none; }
  .mpResults-fullwidth.mp-mobile  { display: block; }
}

/* ===== Tablet & below tweaks ===== */
@media (max-width: 1199px) {
  /* center heading + icons on tablet */
  .mpResults-fullwidth .bottomRow .mpSpecialtyIcons {
    align-items: center;
    text-align: center;
  }
  .mpResults-fullwidth .bottomRow .mpHeading {
    text-align: center;
  }
  .mpResults-fullwidth .bottomRow .mpCertIcon {
    justify-content: center;
  }

  /* neutralize any legacy absolute button rules */
  .headlineOnly1 .PrimaryButton {
    position: static;
    right: auto;
    bottom: auto;
  }
}

/* ===== Phones: stack and make button full width ===== */
@media (max-width: 767px) {
  .mpResults-fullwidth .bottomRow .specialtiesRow {
    grid-template-columns: 1fr;   /* button on its own line */
    gap: 12px;
    padding: 8px 10px;
  }

  .mpResults-fullwidth .bottomRow .mpCertIcon {
    flex-wrap: wrap;              /* allow wrapping on narrow screens */
    justify-content: center;
    gap: 8px 12px;
  }

  .mpResults-fullwidth .bottomRow .button-fixed-bottom {
    justify-self: stretch;        /* span full width of the grid */
  }
  .mpResults-fullwidth .bottomRow .button-fixed-bottom .PrimaryButton {
    display: block;
    width: 100%;
    text-align: center;
  }

  .row.bottomRow {
    /* text-align: center; */
    margin: 0;
}
}



/* ===== Bottom row (specialties + button) ===== */
/* Desktop/base: icons block grows, button hugs right */

/* --- Show desktop by default, hide mobile --- */
.mpResults-fullwidth.mp-desktop { display: block; }
.mpResults-fullwidth.mp-mobile  { display: none;  }

/* --- Tablets & large iPads (portrait/landscape) switch to mobile  --- */
@media (max-width: 1194px),
       (max-width: 1366px) and (orientation: landscape) {
  .mpResults-fullwidth.mp-desktop { display: none; }
  .mpResults-fullwidth.mp-mobile  { display: block; }
}

/* Extra safety for touch-first big tablets */
@media (hover: none) and (pointer: coarse) and (max-width: 1600px) {
  .mpResults-fullwidth.mp-desktop { display: none; }
  .mpResults-fullwidth.mp-mobile  { display: block; }
}

/* --- Kill the stray grid on tablet/mobile --- */
@media (max-width: 1199.98px) {

  .mpResults-fullwidth.mp-mobile .bottomRow .mpSpecialties .specialtiesRow {
    display: flex;               /* overrides earlier grid */
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 10px;
  }

  .mpResults-fullwidth.mp-mobile .bottomRow .mpSpecialtyIcons {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .mpResults-fullwidth.mp-mobile .bottomRow .mpCertIcon {
    display: flex;
    flex-wrap: nowrap;           /* one line for up to 5 icons */
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    min-width: 0;
  }

  .mpResults-fullwidth.mp-mobile .bottomRow .button-fixed-bottom {
    margin-left: auto;           
    align-self: center;
    /* width: 100%; */
    white-space: nowrap;
  }
}

/* --- Desktop keeps the grid --- */
@media (min-width: 1200px) {
  .mpResults-fullwidth.mp-desktop .bottomRow .specialtiesRow {
    display: grid;
    grid-template-columns: 1fr max-content;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
  }
}

@media (max-width: 1199.98px) {
  .mpResults-fullwidth.mp-mobile .bottomRow .specialtiesRow {
    flex-wrap: wrap;              
  }

  .mpResults-fullwidth.mp-mobile .bottomRow .button-fixed-bottom {
    order: 2;                     
    flex: 0 0 100%;               
    margin: 10px 0 0 0;           
    margin-left: 0;               
    white-space: normal;
  }

  .mpResults-fullwidth.mp-mobile .bottomRow .button-fixed-bottom .PrimaryButton {
    display: block;
    width: 100%;                  
    text-align: center;
  }
}

/* PHONES: one column, natural height, comfy spacing */
@media (max-width: 767px) {
  .mpResWrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .mpResWrap .mpResults {
    flex: 1 1 100%;
    width: 100%;
  }

  
  .mpContainer {
    height: auto;
    padding: 16px 12px;
  }

  /* Image block */
  .mpFullWidthImage {
    max-width: none;
    width: 100%;
    padding: 12px 0 8px;
    text-align: center;
  }
  .mpResults-fullwidth .mpFullWidthImage img {
    width: 120px;
    height: 120px;
  }

  /* About block */
  .mpFullWidthAbout {
    padding-top: 12px;
    margin-right: 0;
  }
  .mpFullWidthAbout .row {
    justify-content: center;
  }
  .headlineOnly {
    max-width: 100%;
  }

  /* Bottom row: stack, center icons, full-width button */
  .mpResults-fullwidth .bottomRow .specialtiesRow {
    display: grid;
    grid-template-columns: 1fr;  
    gap: 12px;
    padding: 8px 12px;
  }
  .mpResults-fullwidth .bottomRow .mpSpecialtyIcons {
    align-items: center;
    text-align: center;
  }
  .mpResults-fullwidth .bottomRow .mpCertIcon {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .mpResults-fullwidth .bottomRow .button-fixed-bottom {
    justify-self: stretch;       
  }
  .mpResults-fullwidth .bottomRow .button-fixed-bottom .PrimaryButton {
    display: block;
    width: 100%;
    text-align: center;
  }
}

/* Desktop/tablet two-up */
@media (min-width: 768px) {
  .mpResWrap {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
  }
  .mpResWrap .mpResults {
    width: calc(50% - 10px); 
  }
}

/* Phones: full-width cards */
@media (max-width: 767px) {
  .mpResWrap .mpResults {
    width: 100%;
    flex: 1 0 100%;
  }
  
  .mpContainer {
    height: auto;
    padding: 16px 12px;
  }

  .mpRating {
        margin-top:0px
    }
  .mpCompany-main, .mpAdvisorName-main{
        text-align:center;
    }
  .row.topRow {
    width: 100%;
    margin: 0;
  }
}


@media (min-width: 768px) {
  .mpResults-fullwidth.mp-mobile .bottomRow .mpSpecialties .specialtiesRow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 10px;
  }
}

/* Phones: stack, center icons, full-width button */
@media (max-width: 767px) {
  .mpResults-fullwidth.mp-mobile .bottomRow .mpSpecialties .specialtiesRow {
    display: flex;
    flex-direction: column;   
    align-items: stretch;     
    gap: 12px;
    padding: 8px 12px;
  }

  .mpResults-fullwidth.mp-mobile .bottomRow .mpCertIcon {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;  /* center icons */
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .mpResults-fullwidth.mp-mobile .bottomRow .button-fixed-bottom {
    width: 100%;
  }
  .mpResults-fullwidth.mp-mobile .bottomRow .button-fixed-bottom .PrimaryButton {
    display: block;
    width: 100%;
    text-align: center;
  }
}