/* Public content cards: one responsive contract for server and JS renderers.
 * Keep theme colours in the design system; geometry and readable text live here.
 * Desktop cards wrap in full; mobile article rows reserve two title lines
 * followed by one author/views line. */
:root {
  --pg-content-card-gap: 1.25rem;
  --pg-content-card-padding: 1.25rem;
  --pg-content-card-title: 1.125rem;
  --pg-content-card-copy: .9375rem;
  --pg-content-card-radius: 1rem;
}
/* Card slide transforms must not create a horizontal page scrollbar. */
body :is([data-pg-knowledge-slider], [data-pg-news-slider]) { overflow-x: clip; }
.pg-content-card-picture { display: block; width: 100%; height: 100%; }
.pg-mobile-post-meta { display: none; }

body :is(.pg-article-grid, .pg-hub-grid, .pg-events-grid, .pg-services__grid, .pg-search-grid) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: var(--pg-content-card-gap);
}
body :is(.pg-article-grid, .pg-hub-grid, .pg-events-grid, .pg-services__grid, .pg-search-grid) > * {
  min-width: 0;
}
@media (min-width: 768px) {
  body :is(.pg-article-grid, .pg-hub-grid, .pg-events-grid, .pg-services__grid, .pg-search-grid) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  body :is(.pg-article-grid, .pg-hub-grid, .pg-events-grid, .pg-services__grid, .pg-search-grid) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1200px) {
  body :is(.pg-article-grid, .pg-hub-grid, .pg-events-grid, .pg-services__grid, .pg-search-grid) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

body :is(.pg-card-post, .pg-news-card, .pg-service-card, .pg-hub-card, .pg-event-card, .pg-search-card) {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-width: 0;
  height: 100%;
  margin: 0;
  border: 1px solid var(--pg-border);
  border-radius: var(--pg-content-card-radius);
  background: var(--pg-surface-strong);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
body :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) {
  display: block;
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 0;
  border-radius: 0;
  object-fit: cover;
  background: var(--pg-bg-soft);
  overflow: hidden;
}
body .pg-hub-card-fallback-img {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pg-muted);
}
body .pg-content-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--pg-muted);
  background: var(--pg-bg-soft);
}
body .pg-event-card__img.pg-content-card-placeholder,
body .pg-event-card-img.pg-content-card-placeholder { height: auto; }
body .pg-card-post__cat {
  position: absolute;
  top: .75rem;
  left: .75rem;
  max-width: calc(100% - 1.5rem);
  padding: .25rem .5rem;
  border-radius: .5rem;
  background: var(--pg-surface-strong);
  color: var(--pg-primary);
  font-size: .75rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
body :is(.pg-card-post__media, .pg-news-card__img, .pg-service-card__img-wrap, .pg-event-card__img) img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
body :is(.pg-card-post__body, .pg-news-card__body, .pg-service-card__body,
  .pg-hub-card-body, .pg-event-card__body, .pg-event-card-body, .pg-search-card__body) {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  gap: .75rem;
  padding: var(--pg-content-card-padding);
}

body .pg-hero-highlights.pg-block-count-1 .pg-highlight-title,
body :is(.pg-card-post__title, .pg-news-card__title, .pg-service-card__title, .pg-hub-card-title,
  .pg-event-card__title, .pg-event-card-title, .pg-highlight-title, .pg-event-item__title,
  .pg-related-post-title, .pg-carousel-card__title, .pg-book-related-card-title, .pg-search-card__title) {
  display: block;
  height: auto;
  min-height: 0;
  max-height: none;
  margin: 0;
  overflow: visible;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  text-overflow: clip;
  font-size: var(--pg-content-card-title);
  font-weight: 700;
  line-height: 1.45;
  color: var(--pg-dark);
  text-shadow: none;
}
body :is(.pg-card-post__title, .pg-news-card__title, .pg-service-card__title,
  .pg-event-card__title, .pg-carousel-card__title, .pg-book-related-card-title) a {
  color: inherit;
  text-decoration: none;
}
body.pg-article-card-excerpts-hidden :is(.pg-card-post__excerpt, .pg-news-card__excerpt,
  .pg-search-card--article .pg-search-card__excerpt, .pg-highlight-excerpt,
  .pg-carousel-card__excerpt, .pg-book-related-card-excerpt, .pg-featured-excerpt) {
  display: none !important;
}
body .pg-hero-highlights.pg-block-count-1 .pg-highlight-excerpt,
body :is(.pg-card-post__excerpt, .pg-news-card__excerpt, .pg-service-card__excerpt,
  .pg-hub-card-desc, .pg-event-card__excerpt, .pg-highlight-excerpt, .pg-carousel-card__excerpt,
  .pg-book-related-card-excerpt, .pg-search-card__excerpt) {
  display: block;
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  max-height: none;
  margin: 0;
  overflow: visible;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  font-size: var(--pg-content-card-copy);
  line-height: 1.65;
  color: var(--pg-muted);
  text-shadow: none;
}
body :is(.pg-card-post__footer, .pg-news-card__footer) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: .6rem;
  margin: auto 0 0;
  padding: .75rem 0 0;
  border-top: 1px solid var(--pg-border);
}
body :is(.pg-card-post__author, .pg-news-card__author) {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
body :is(.pg-card-post__author-img, .pg-news-card__author-img) {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  object-fit: cover;
}
body .pg-article-grid :is(.pg-card-post__author-name, .pg-news-card__author-name) {
  display: block;
  max-width: none;
  max-height: none;
  overflow: visible;
  -webkit-line-clamp: unset;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: .8125rem;
  line-height: 1.45;
}
body .pg-article-grid :is(.pg-news-card__meta, .pg-card-post__meta) {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  width: 100%;
  gap: .35rem .75rem;
  font-size: .75rem;
  overflow: visible;
}
body .pg-article-grid :is(.pg-news-card__published, .pg-card-post__published, .pg-news-card__meta-item, .pg-card-post__views) {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
body :is(.pg-card-post__read, .pg-news-card__read-btn, .pg-service-card__btn, .pg-event-card__actions .pg-btn) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 0;
  padding: .65rem 1rem;
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: normal;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
}
body .pg-card-post__read {
  border-radius: .75rem;
  background: var(--pg-gradient);
  color: var(--pg-color-white);
}
body .pg-card-post__body > :not(.pg-card-post__footer) + .pg-card-post__read { margin-top: auto; }
body .pg-hub-card-footer { min-height: 44px; font-size: .875rem; line-height: 1.4; }
body .pg-search-card__meta { margin-top: auto; }
body :is(.pg-service-card__btn, .pg-hub-card-footer, .pg-event-card__actions) { margin-top: auto; }
body .pg-event-card__actions { flex-wrap: wrap; }
body .pg-event-card__actions > * { flex: 1 1 9rem; }
body :is(.pg-event-card__info, .pg-event-card-meta, .pg-event-card-meta-item) {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: .875rem;
  line-height: 1.6;
}
body .pg-event-card-meta-item { align-items: flex-start; }
body .pg-event-card-meta-item svg { flex: 0 0 14px; margin-top: .25em; }

/* Featured horizontal cards share one breakpoint and media/content balance. */
body :is(.pg-featured-post, .pg-featured-event) { display: grid !important; grid-template-columns: minmax(0, 1fr); }
body :is(.pg-featured-img, .pg-featured-event__image) {
  width: 100% !important;
  height: auto;
  aspect-ratio: 16 / 9;
}
body :is(.pg-featured-content, .pg-featured-event__content) {
  width: auto !important;
  min-width: 0;
  padding: var(--pg-content-card-padding) !important;
}
body :is(.pg-featured-title, .pg-featured-event__title) {
  margin: 0 0 .75rem !important;
  font-size: clamp(1.125rem, 1.5vw, 1.5rem) !important;
  line-height: 1.45 !important;
  overflow-wrap: anywhere;
}
body :is(.pg-featured-excerpt, .pg-featured-event__excerpt) {
  display: block !important;
  font-size: var(--pg-content-card-copy) !important;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
@media (min-width: 1024px) {
  body :is(.pg-featured-post, .pg-featured-event) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  body :is(.pg-featured-img, .pg-featured-event__image) { height: 100%; aspect-ratio: auto !important; align-self: stretch; }
}

@media (max-width: 767.98px) {
  :root {
    --pg-content-card-padding: .75rem;
    --pg-content-card-gap: .75rem;
    --pg-content-card-title: 1rem;
    --pg-content-card-copy: .875rem;
  }
  /* Legacy newsroom !important rules are overridden only at this breakpoint. */
  body .pg-newsroom[data-pg-news-slider] .pg-newsroom__grid,
  body .pg-newsroom__grid { grid-template-columns: minmax(0, 1fr) !important; }
  body .pg-article-grid,
  body .pg-blog-index .pg-article-grid,
  body .pg-knowledge-page .pg-knowledge-grid { grid-template-columns: minmax(0, 1fr); }
  body .pg-search-grid { grid-template-columns: minmax(0, 1fr) !important; }
  body.blog .pg-blog-post-list { grid-template-columns: minmax(0, 1fr); gap: 1rem !important; }
  body.blog .pg-blog-post-list > .pg-article-grid { display: grid; }
  body.blog .pg-blog-grid-heading { order: 0; }
  body :is(.pg-card-post, .pg-news-card, .pg-search-card--article, .pg-featured-post,
    .pg-related-card--article, .pg-carousel-card) {
    --pg-mobile-card-image-width: clamp(88px, 27vw, 116px);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: .75rem;
    height: auto;
    padding: .625rem;
  }
  body .pg-featured-post { display: flex !important; flex-direction: row !important; }
  body :is(.pg-card-post__media, .pg-news-card__img, .pg-search-card--article .pg-search-card__img-wrap, .pg-featured-img,
    .pg-related-card--article .pg-related-thumb, .pg-carousel-card__img-wrap) {
    flex: 0 0 var(--pg-mobile-card-image-width) !important;
    width: var(--pg-mobile-card-image-width) !important;
    min-width: 0;
    height: auto !important;
    aspect-ratio: var(--pg-mobile-card-image-ratio, 16 / 9) !important;
    align-self: center;
    margin: 0;
    border-radius: .5rem;
    overflow: hidden;
  }
  body [data-pg-image-shape="square"] { --pg-mobile-card-image-ratio: 1 / 1; }
  body :is(.pg-card-post__media, .pg-news-card__img, .pg-search-card--article .pg-search-card__img-wrap, .pg-featured-img,
    .pg-related-card--article .pg-related-thumb, .pg-carousel-card__img-wrap) img {
    position: static !important;
    display: block;
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    opacity: 1 !important;
  }
  body :is(.pg-card-post__body, .pg-news-card__body, .pg-search-card--article .pg-search-card__body, .pg-featured-content,
    .pg-related-post-body, .pg-carousel-card__body) {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    width: auto !important;
    min-width: 0;
    gap: .375rem;
    padding: 0 !important;
    justify-content: center;
  }
  body :is(.pg-card-post__title, .pg-news-card__title, .pg-search-card--article .pg-search-card__title, .pg-featured-title,
    .pg-related-card--article .pg-related-post-title, .pg-carousel-card__title) {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    height: 2.8em;
    min-height: 2.8em;
    max-height: 2.8em;
    margin: 0 !important;
    overflow: hidden;
    font-size: 1rem !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    white-space: normal;
    text-overflow: ellipsis;
  }
  body :is(.pg-card-post__cat, .pg-news-card__cat, .pg-search-card--article .pg-search-card__label,
    .pg-card-post__excerpt, .pg-news-card__excerpt, .pg-search-card--article .pg-search-card__excerpt,
    .pg-card-post__footer, .pg-news-card__footer, .pg-search-card--article .pg-search-card__meta,
    .pg-card-post__read, .pg-news-card__read-btn, .pg-featured-label, .pg-featured-category,
    .pg-featured-excerpt, .pg-featured-author, .pg-featured-read,
    .pg-carousel-card__cat, .pg-carousel-card__date) { display: none !important; }
  body .pg-missed-posts .pg-carousel-track { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; overflow: visible; }
  body .pg-missed-posts .pg-carousel-nav { display: none; }
  body .pg-mobile-post-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
    max-width: 100%;
    color: var(--pg-muted);
    font-size: .75rem;
    line-height: 1.4;
    white-space: nowrap;
  }
  .pg-mobile-post-meta__author { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .pg-mobile-post-meta__views { display: inline-flex; flex: 0 0 auto; align-items: center; gap: .25rem; }
  .pg-mobile-post-meta__views svg { flex: 0 0 14px; }
  body .pg-home-grid { grid-template-columns: minmax(0, 1fr) !important; }
  body :is(.pg-home-col--left, .pg-home-col--right) { grid-column: 1 / -1; }
  body .pg-home-col--left .pg-home-side-card { border-right: 0; }
  body .pg-home-col--right { border-top: 1px solid var(--pg-border); }
  body .pg-side-header { min-height: 0; }
}

/* Small horizontal recommendation rows keep their image, while text can grow. */
body .pg-related-card { min-width: 0; align-items: start; }
body .pg-related-post-body { min-width: 0; flex: 1 1 0; }
.pg-related-thumb--placeholder { display: none; }
@media (max-width: 767.98px) {
  body .pg-related-card--article { align-items: center; }
  body .pg-related-thumb--placeholder { display: block; }
}
body .pg-related-card > div:not(.pg-related-thumb) { min-width: 0; }
body .pg-related-card .pg-related-post-title { font-size: .9375rem; }
body .pg-event-item__title { font-size: 1rem; }
@media (prefers-reduced-motion: reduce) {
  body :is(.pg-card-post, .pg-news-card, .pg-service-card, .pg-hub-card, .pg-event-card) { transition: none; }
}
