/* =========================================================
   BUYER CONSULTING - DYNAMIC PROJECT HERO LINKS
   Structural layout only. Visual styling remains global.
   ========================================================= */

/*
 * Standalone use of [bc_project_hero_links].
 * One link fills the row. Two to four links use a two-column grid,
 * giving the hero a maximum height of two link rows.
 */
body.single-bc_project
.bc-project-hero__links.bc-project-hero__links--single {
  grid-template-columns: minmax(0, 1fr) !important;
}

body.single-bc_project
.bc-project-hero__links.bc-project-hero__links--multi {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

body.single-bc_project
.bc-project-hero__links[data-bc-project-hero-links] >
.bc-project-hero__external-link {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

/*
 * Cornerstone integration.
 *
 * The project template already has an outer .bc-project-hero__links
 * container. The dynamic shortcode normally sits inside one Raw Content
 * element. Flatten the Raw Content and generated shortcode wrapper so every
 * generated anchor becomes a grid item of the existing hero links container.
 */
body.single-bc_project
.bc-project-hero__links >
.x-raw-content:has(> .bc-project-hero__links[data-bc-project-hero-links]),
body.single-bc_project
.bc-project-hero__links >
:has(> .bc-project-hero__links[data-bc-project-hero-links]) {
  display: contents !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.single-bc_project
.bc-project-hero__links >
.x-raw-content >
.bc-project-hero__links[data-bc-project-hero-links],
body.single-bc_project
.bc-project-hero__links >
.bc-project-hero__links[data-bc-project-hero-links],
body.single-bc_project
.bc-project-hero__links >
:has(> .bc-project-hero__links[data-bc-project-hero-links]) >
.bc-project-hero__links[data-bc-project-hero-links] {
  display: contents !important;
}

/*
 * The outer Cornerstone grid follows the number of generated links.
 * A single link uses one column. Two to four use two columns, with the
 * shortcode enforcing the four-link maximum before layout.
 */
body.single-bc_project
.bc-project-hero__links:has(
  .bc-project-hero__links--single[data-bc-project-hero-links]
) {
  grid-template-columns: minmax(0, 1fr) !important;
}

body.single-bc_project
.bc-project-hero__links:has(
  .bc-project-hero__links--multi[data-bc-project-hero-links]
) {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

/* Generated links always fill their resolved grid column. */
body.single-bc_project
.bc-project-hero__links
.bc-project-hero__links[data-bc-project-hero-links]
.bc-project-hero__external-link,
body.single-bc_project
.bc-project-hero__links[data-bc-project-hero-links]
.bc-project-hero__external-link {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

@media (max-width: 767px) {
  body.single-bc_project
  .bc-project-hero__links.bc-project-hero__links--single,
  body.single-bc_project
  .bc-project-hero__links.bc-project-hero__links--multi,
  body.single-bc_project
  .bc-project-hero__links:has(
    .bc-project-hero__links[data-bc-project-hero-links]
  ) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
