/* Gallery block style "Porträts" (inc/blocks.php): a centred grid of equal portrait cards with the name below
   each photo. Deliberately quieter than "Prinzenpaare": thin gold border, soft shadow, no tilt, no crown.
   Selectors carry :not(#individual-image) because core's own gallery rules do. */

.wp-block-gallery.has-nested-images.is-style-kg-portraits {
  justify-content: center;
  /* Cards in a row share one height even when a long name wraps to two lines. */
  align-items: stretch;
  gap: 1.5rem;
  padding-block: 1rem;
}

/* Fixed card width so a short last row stays the same size and sits centred instead of stretching.
   15rem gives four per row on desktop; phones get two. */
.wp-block-gallery.has-nested-images.is-style-kg-portraits
  figure.wp-block-image:not(#individual-image) {
  flex-grow: 0;
  flex-shrink: 0;
  justify-content: flex-start;
  width: min(15rem, calc(50% - 0.75rem));
  margin: 0;
  padding: 0.5rem 0.5rem 0;
  background: var(--global-palette9);
  border: 2px solid var(--global-palette10);
  border-radius: 12px;
  box-shadow: 0 8px 18px -10px rgb(29 26 43 / 30%);
}

/* No blurred backdrop behind the caption. */
.wp-block-gallery.has-nested-images.is-style-kg-portraits figure.wp-block-image::before {
  content: none;
}

/* Same photo shape on every card; the crop keeps the head and the hat. */
.wp-block-gallery.has-nested-images.is-style-kg-portraits figure.wp-block-image img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: 50% 20%;
  border-radius: 6px;
}

.wp-block-gallery.has-nested-images.is-style-kg-portraits figure.wp-block-image figcaption {
  position: static;
  flex: none;
  width: auto;
  max-height: none;
  overflow: visible;
  margin: 0;
  padding: 0.6rem 0.25rem 0.75rem;
  background: none;
  color: var(--global-palette3);
  text-shadow: none;
  -webkit-mask-image: none;
  mask-image: none;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-wrap: balance;
}

/* Cards with more than a name (Ehrenmitglieder): the name stays bold, the offices below it are lighter. */
.wp-block-gallery.has-nested-images.is-style-kg-portraits
  figure.wp-block-image
  figcaption:has(strong) {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--global-palette5);
}

.wp-block-gallery.has-nested-images.is-style-kg-portraits figure.wp-block-image figcaption strong {
  display: inline-block;
  margin-bottom: 0.2rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--global-palette3);
}

/* A member without a photo yet: the club crest stands in, shown whole on the card background. */
.wp-block-gallery.has-nested-images.is-style-kg-portraits figure.wp-block-image.kg-no-photo img {
  object-fit: contain;
  padding: 1.25rem;
  background: var(--global-palette7);
}
