/* Build Digital material-card refinements for the v0.7.2 release. */

/* Keep wide catalogues readable: never exceed four material cards per row. */
@media (min-width: 64.0625rem) {
  .bdk-client-demo--materials .bdk-demo__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* v0.7.5: rights-aware source-page previews extend the received 2D card direction. */
.bdk-demo-card__feature-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bdk-color-white);
}

/* Worksheet previews are wide source artefacts, not document pages. A shallow
   contained frame keeps their table structure legible without cropping. */
.bdk-demo-card__feature--worksheet .bdk-demo-card__feature-frame {
  aspect-ratio: 16 / 5;
}

.bdk-demo-card__feature-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: var(--bdk-color-muted);
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: center;
}

.bdk-demo-card__feature.is-loaded .bdk-demo-card__feature-status {
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Let the remaining width beside the evidence panel decide whether one, two
   or three cards fit. The 18rem floor protects the card hierarchy and logos. */
.bdk-client-demo--materials .bdk-demo__materials-workspace--evidence-open .bdk-demo__grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}

/* Evidence navigation is deliberately exclusive. Its selected material always
   takes the leading row, even if a reviewer manually expanded another card. */
.bdk-demo-card--material.is-evidence-selected {
  order: -2;
}

/* Restore the official Digi hub wordmarks used on the v0.6.6 material cards. */
.bdk-demo-card--material .bdk-demo-card__pillar {
  display: inline-flex;
  width: calc(6.3rem - 30px);
  box-sizing: border-box;
  justify-content: flex-start;
  border-radius: 999px;
}

.bdk-demo-card--material .bdk-demo-card__pillar img {
  display: block;
  width: calc(5.4rem - 30px);
  height: 1.15rem;
  object-fit: contain;
  object-position: left center;
}

.bdk-demo-card--material .bdk-demo-card__link--unavailable {
  justify-content: center;
  border-color: var(--bdk-color-border-warm);
  background: var(--bdk-color-surface-soft);
  color: var(--bdk-color-muted);
  cursor: not-allowed;
  text-align: center;
}

/* v0.9.2: keep evidence destinations explicit and subordinate to the cited
   passage. Original-file actions remain absent unless SMC supplies an
   approved HTTPS artefact URL. */
.bdk-evidence-group__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0 1rem 1rem 4.5rem;
}

/* WordPress grid wrappers otherwise stretch the sticky Evidence panel to the
   full catalogue height, preventing its sticky top from taking effect. */
.bdk-demo__materials-workspace--evidence-open .bdk-demo__evidence-drawer {
  align-self: start;
}

.bdk-evidence-group__passages {
  cursor: pointer;
}

.bdk-evidence-group__passages:hover {
  background: #f8fbfa;
}

.bdk-evidence-group__action,
.bdk-evidence-card__source-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  color: var(--bdk-pillar-color, var(--bdk-color-deep-teal));
  font-family: var(--bdk-font-interface);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  text-decoration-line: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

.bdk-evidence-card__source-link {
  margin-top: 0.65rem;
}

.bdk-evidence-link-unavailable {
  color: var(--bdk-neutral-600, #6f6b69);
  display: inline-block;
  font-size: 0.875rem;
  font-style: italic;
  line-height: 1.4;
}

.bdk-evidence-group__action:hover,
.bdk-evidence-card__source-link:hover {
  color: var(--bdk-pillar-color, var(--bdk-color-deep-teal));
  text-decoration-thickness: 0.12em;
}

.bdk-evidence-group__action:focus-visible,
.bdk-evidence-card__source-link:focus-visible {
  border-radius: var(--bdk-radius-control);
  outline: 0.16rem solid var(--bdk-pillar-color, var(--bdk-color-deep-teal));
  outline-offset: 0.2rem;
}

@media (max-width: 40rem) {
  .bdk-evidence-group__actions {
    padding-left: 1rem;
  }
}

/* A support Build Digital publishes under two Hubs wears both wordmarks. The
   card's border, tile and accent stay with the primary Hub, which is the one
   colour a single card can carry. */
.bdk-demo-card--material .bdk-demo-card__pillars {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
  align-items: center;
}
