/* Shared cover geometry, loaded after page presentation layers.
 * Keep each card's existing width/layout; only its media frame is 16:9.
 * Contain preserves cover lettering/logos and never stretches source images.
 * Author portraits, content images and embedded application frames are excluded. */
html body.wp-theme-psyguild-theme :is(
  .pg-card-post__media,
  .pg-news-card__img,
  .pg-service-card__img-wrap,
  .pg-event-card__img,
  .pg-hub-card-img,
  .pg-hub-card-fallback-img,
  .pg-event-card-img,
  .pg-search-card:not([data-type="author"]) .pg-search-card__img-wrap,
  .pg-featured-img,
  .pg-featured-event__image,
  .pg-related-thumb,
  .pg-carousel-card__img-wrap,
  .pg-highlight-img,
  .pg-profile-post-image,
  .pg-book-card-media,
  .pg-book-related-card-media
){
  --pg-mobile-card-image-ratio:16 / 9!important;
  position:relative;
  box-sizing:border-box;
  aspect-ratio:16 / 9!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  align-self:start!important;
  overflow:hidden;
  object-fit:contain!important;
  object-position:center!important;
}

/* Search covers previously relied on flex stretch for their width. Keep that
 * full width; native !important mobile article-row widths still take priority. */
html body.wp-theme-psyguild-theme .pg-search-card:not([data-type="author"]) .pg-search-card__img-wrap{
  width:100%;flex-shrink:0;
}

/* Remove intrinsic picture/image height from wrapper sizing. Native image
 * sources, sizes/srcset, lazy loading and shape metadata remain unchanged. */
html body.wp-theme-psyguild-theme :is(
  .pg-card-post__media,.pg-news-card__img,.pg-service-card__img-wrap,
  .pg-event-card__img,
  .pg-search-card:not([data-type="author"]) .pg-search-card__img-wrap,
  .pg-featured-img,.pg-featured-event__image,.pg-related-thumb,
  .pg-carousel-card__img-wrap,.pg-highlight-img,.pg-profile-post-image,
  .pg-book-card-media,.pg-book-related-card-media
) :is(picture,img){
  position:absolute!important;
  inset:0;
  display:block;
  width:100%!important;
  height:100%!important;
  max-width:100%;
  max-height:100%;
  margin:0;
  object-fit:contain!important;
  object-position:center!important;
  transform:none!important;
}

/* Placeholder covers follow the same frame without clipping their icon. */
html body.wp-theme-psyguild-theme :is(
  .pg-hub-card-fallback-img,.pg-event-card-img.pg-content-card-placeholder,
  .pg-event-card__img.pg-content-card-placeholder
)>svg{max-width:70%;max-height:70%}

/* The featured application carousel is media; the animated PsyGuild brand
 * hero and all interactive embeds retain their own dimensions. */
html body.wp-theme-psyguild-theme .pg-brand-home #pgHeroCarousel.pg-hero-main{
  width:100%;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  aspect-ratio:16 / 9!important;
}
html body.wp-theme-psyguild-theme #pgHeroCarousel .pg-hero-bg{
  width:100%;height:100%;object-fit:contain!important;object-position:center;
}

/* Horizontal mini-tool cards keep the artwork beside the title and action. */
html body.wp-theme-psyguild-theme .pg-brand-tool{
  display:grid;grid-template-columns:minmax(96px,32%) minmax(0,1fr);
  grid-template-rows:1fr auto;min-height:112px;padding:0;overflow:hidden;
}
html body.wp-theme-psyguild-theme .pg-brand-tool .pg-brand-tool__art{
  position:relative;grid-column:1;grid-row:1 / 3;width:auto;height:auto!important;
  min-height:112px;margin:0;aspect-ratio:auto!important;align-self:stretch;
  border-radius:0;
}
html body.wp-theme-psyguild-theme .pg-brand-tool__art>svg{
  position:absolute;inset:0;width:100%;height:100%;
}
html body.wp-theme-psyguild-theme .pg-brand-tool>strong{
  grid-column:2;align-self:center;min-width:0;padding:16px 16px 0;
}
html body.wp-theme-psyguild-theme .pg-brand-tool .pg-brand-tool__open{
  grid-column:2;margin:0;padding:10px 16px 16px;
}

@media(min-width:768px) and (max-width:1100px){
  html body.wp-theme-psyguild-theme .pg-brand-tools__list{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media(max-width:767.98px){
  html body.wp-theme-psyguild-theme .pg-brand-tools__list{grid-template-columns:1fr;}
  /* Keep the two-column mobile launcher; its cover fills each tile width. */
  html body.wp-theme-psyguild-theme .pg-app-page :is(.pg-hub-card-img,.pg-hub-card-fallback-img){
    width:100%!important;flex:0 0 auto;
  }
}
