/* Profile and listing detail pages share the same breakpoints and touch targets. */
#main-content :is(.profile-public-v2, #public-detail) {
  --work-columns: 3;
}
@media (min-width: 1024px) {
  #main-content :is(.profile-public-v2, #public-detail) { --work-columns: 5; }
}
@media (max-width: 820px) {
  #main-content :is(.profile-public-v2, #public-detail) { --work-columns: 2; }
}
html body.route-profile #main-content .profile-public-v2.profile-mobile-pilot #profile-services :is(.discovery-v1-offer-grid,.ms-product-grid),
html body.route-profile #main-content .profile-public-v2.profile-mobile-pilot :is(.discovery-v1-portfolio-grid,.public-related-grid),
html body #main-content #public-detail :is(#listing-related,#work-related,#profile-related) :is(.related-listing-grid,.public-offers-grid,.public-related-grid) {
  display: grid !important;
  grid-template-columns: repeat(var(--work-columns), minmax(0, 1fr)) !important;
  justify-content: start;
  gap: clamp(8px, 1vw, 16px) !important;
}

html body #main-content #public-detail [data-detail-navigation] {
  align-self: stretch;
  width: 100%;
  max-width: 100% !important;
  margin-block-start: .5rem !important;
}
html body #main-content #public-detail [data-detail-navigation] > a {
  display: flex !important;
  flex-flow: column;
  justify-content: center;
  align-items: center;
  gap: .25rem;
  min-height: 44px !important;
  padding: .45rem .2rem !important;
  text-decoration: none;
}
#public-detail [data-detail-navigation] svg { display: block; width: 19px; height: 19px; flex: none; }
#main-content #public-detail > section[id] { scroll-margin-top: calc(var(--ms-header-height, 80px) + .75rem); }
#main-content #public-detail .detail-action-status:empty { display: none; }
html body #main-content #public-detail.ms-listing-page > .offer-detail-provider {
  display: grid !important;
  grid-template-columns: minmax(9rem, 17rem) minmax(0, 1fr) !important;
  align-items: center;
  gap: .75rem clamp(1rem, 3vw, 2.5rem);
}
#public-detail .offer-detail-provider > h2 { grid-column: 1 / -1; }
#public-detail .offer-publisher-card { width: 100%; min-width: 0; }
#public-detail .offer-publisher-card .public-catalog-media { aspect-ratio: 1; }
#public-detail .offer-provider-experience { flex: 0 0 100%; }
#public-detail .offer-detail-provider .offer-provider-links { grid-column: 1 / -1; }
@media (max-width: 820px) {
  html body #main-content #public-detail :is(.ms-detail-visual-media,.curated-detail-media) {
    width: min(100%, 15rem, 34svh) !important;
    max-width: 100% !important;
    margin-inline: auto;
  }
  html body.route-profile #main-content .profile-public-v2.profile-mobile-pilot > .discovery-v1-profile__hero {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start;
    gap: .8rem !important;
  }
  html body.route-profile #main-content .profile-public-v2.profile-mobile-pilot .discovery-v1-profile__media {
    grid-area: auto;
    justify-self: center;
    width: min(100%, 15rem, 34svh) !important;
    max-width: 100% !important;
    margin-inline: auto !important;
  }
  html body.route-profile #main-content .profile-public-v2.profile-mobile-pilot .discovery-v1-profile__details {
    display: flex !important;
    flex-flow: column;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    gap: .4rem !important;
  }
  html body.route-profile #main-content .profile-public-v2.profile-mobile-pilot :is(.discovery-v1-profile__identity,.discovery-v1-profile__location) {
    align-self: auto;
    width: 100%;
  }
  html body.route-profile #main-content .profile-mobile-pilot .profile-provider-meta { display: grid; min-width: 0; gap: .25rem; }
  html body.route-profile #main-content .profile-mobile-pilot .profile-provider-facts {
    display: flex; flex-flow: row nowrap; gap: .3rem; overflow-x: auto;
    overscroll-behavior-inline: contain; align-items: center;
    padding-block: .1rem .3rem; min-width: 0;
  }
  html body.route-profile #main-content .profile-mobile-pilot .profile-provider-facts > span {
    flex: none; white-space: nowrap; max-width: none; padding: .2rem .45rem; font-size: .75rem;
  }
  html body.route-profile #main-content .profile-mobile-pilot .profile-provider-social {
    display: flex; flex-flow: row nowrap; gap: .3rem; overflow-x: auto; padding-block: .15rem;
  }
  html body.route-profile #main-content .profile-mobile-pilot .profile-provider-social :is(a, .is-unlinked) {
    display: inline-grid; place-items: center; flex: none; width: 44px; min-width: 44px;
    height: 44px; min-height: 44px; padding: 0;
  }
  html body.route-profile #main-content .profile-public-v2.profile-mobile-pilot .u1-profile-actions,
  html body #main-content #public-detail :is(.ms-detail-visual-copy .hero-actions,.curated-detail-actions) {
    display: flex !important; flex-flow: row nowrap; align-items: stretch !important;
    justify-content: start !important; gap: 4px !important; position: relative; width: 100%;
    max-width: 100%; padding: 0 !important; margin-block: .2rem !important;
  }
  html body.route-profile #main-content .profile-public-v2.profile-mobile-pilot .u1-profile-actions > .catalog-actions,
  html body #main-content #public-detail :is(.ms-detail-visual-copy,.curated-detail-copy) .catalog-actions {
    display: contents !important;
  }
  html body.route-profile #main-content .profile-public-v2.profile-mobile-pilot .u1-profile-actions :is(.ui-button,.catalog-action),
  html body #main-content #public-detail :is(.ms-detail-visual-copy .hero-actions,.curated-detail-actions) :is(.button,.catalog-action) {
    display: inline-flex !important; flex-flow: column; flex: 1 1 0 !important; gap: 2px;
    align-items: center; justify-content: center; min-width: 0 !important; width: auto !important;
    min-height: 44px !important; padding: 4px 1px !important; margin: 0 !important;
    font-size: .75rem !important; font-weight: 600; line-height: 1.15 !important;
    white-space: normal !important; text-align: center; text-wrap: balance;
  }
  #main-content :is(.u1-profile-actions,.ms-detail-visual-copy .hero-actions,.curated-detail-actions) .catalog-action-status:not(:empty) {
    position: absolute; z-index: 2; top: 100%; left: 0; max-width: 100%; background: var(--ms-public-surface, #fffaf6);
  }
  html body.route-profile #main-content .profile-public-v2.profile-mobile-pilot .profile-pilot-tabs {
    display: grid !important; grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    column-gap: 0 !important; min-width: 0; max-width: 100%;
  }
  html body.route-profile #main-content .profile-public-v2.profile-mobile-pilot .profile-pilot-tabs [data-profile-link] {
    min-width: 0; min-height: 44px !important; width: auto; padding: 3px 0 !important;
    font-size: clamp(.68rem, 3vw, .8rem) !important; gap: 2px; white-space: normal !important;
  }
  html body #main-content #public-detail .offer-detail-facts,
  html body #main-content #public-detail .portfolio-photo-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem .75rem; }
  #public-detail .portfolio-photo-facts :is(dt,dd) { overflow-wrap: anywhere; }
  html body #main-content #public-detail .offer-contact-actions { gap: .3rem; }
  html body #main-content #public-detail .offer-contact-actions .button { min-height: 44px !important; padding: .3rem .5rem; font-size: .8rem; }
  html body #main-content #public-detail.ms-listing-page > .offer-detail-provider {
    grid-template-columns: minmax(7rem, 1fr) minmax(0, 1fr) !important;
  }
}
