/**
 * Audience Section / Audience Card — horizontal flex row (max 4 per line), wrap.
 * Section background matches Quote Section: .quote-section .bg-green (see Twig).
 */

.audience-section {
  --audience-card-gap: 1.25rem;
  /* Cap tall images while filling card width */
  --audience-card-image-max-height: 16.5rem;
  --audience-card-image-min-height: 2rem;
}

/* Header on green (same intent as .quote-section copy) */
.audience-section.quote-section .audience-section__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem 2rem;
  margin-bottom: 1.25rem;
  color: #fff;
}

.audience-section.quote-section .audience-section__title {
  color: #fff;
  margin: 0;
}

.audience-section.quote-section .audience-section__intro {
  flex: 1 1 18rem;
  max-width: 40rem;
  margin: 0;
  font-family: Archivo, system-ui, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: #eee;
}

.audience-section.quote-section .audience-section__intro p {
  margin: 0;
}

.audience-section.quote-section .audience-section__rule {
  height: 1px;
  margin: 0 0 2rem;
  border: 0;
  background: rgba(255, 255, 255, 0.35);
}

/*
 * Card row: flex, max 4 columns (then wrap).
 *
 * Current DOM (typical): .audience-section__cards > article.audience-card (direct)
 *
 * Legacy: .audience-section__cards > div > div:last-child > div > article
 */
.audience-section__cards {
  display: flex;
  flex-wrap: wrap;
  /* flex-start when :has() unavailable — avoids all cards stretching to a hovered one */
  align-items: flex-start;
  gap: var(--audience-card-gap);
  width: 100%;
  max-width: 100%;
  margin-top: 2.5rem;
}

@supports selector(:has(*)) {
  .audience-section__cards {
    /* Same row height when nothing is expanded; :has() below switches layout */
    align-items: stretch;
  }

  .audience-section__cards:has(.audience-card--expanded) {
    align-items: flex-start;
  }

  /* While a reveal is collapsing, keep flex-start so stretch does not follow
     the in-flight height (see audience-section-reveal.js). */
  .audience-section--reveal-collapsing .audience-section__cards {
    align-items: flex-start;
  }
}

/* Single field wrapper row (old markup): keep full width so inner flex runs */
.audience-section__cards > div {
  flex: 1 1 100%;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Hide leaked machine-name label text. */
.audience-section__cards > div > div:first-child {
  display: none;
}

.audience-section__cards > div > div:last-child {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--audience-card-gap);
  width: 100%;
  max-width: 100%;
}

@supports selector(:has(*)) {
  .audience-section__cards > div > div:last-child {
    align-items: stretch;
  }

  .audience-section__cards
    > div
    > div:last-child:has(.audience-card--expanded) {
    align-items: flex-start;
  }

  .audience-section--reveal-collapsing
    .audience-section__cards
    > div
    > div:last-child {
    align-items: flex-start;
  }
}

/* ----- Direct children: article (current DOM) -----
 * flex-grow: 1 so fewer than max columns (e.g. 3 of 4) share the full row width */
.audience-section__cards > article {
  box-sizing: border-box;
  margin: 0;
  min-width: 0;
  flex: 1 1 100%;
  width: auto;
  max-width: none;
}

@media print, screen and (min-width: 40.0625em) {
  .audience-section__cards > article {
    flex: 1 1 calc((100% - var(--audience-card-gap)) / 2);
  }
}

@media print, screen and (min-width: 64.0625em) {
  .audience-section__cards > article {
    flex: 1 1 calc((100% - 2 * var(--audience-card-gap)) / 3);
  }
}

@media print, screen and (min-width: 80.0625em) {
  .audience-section__cards > article {
    flex: 1 1 calc((100% - 3 * var(--audience-card-gap)) / 4);
  }
}

/* ----- Legacy: item wrappers around each article ----- */
.audience-section__cards > div > div:last-child > div {
  box-sizing: border-box;
  margin: 0;
  min-width: 0;
  flex: 1 1 100%;
  width: auto;
  max-width: none;
}

@media print, screen and (min-width: 40.0625em) {
  .audience-section__cards > div > div:last-child > div {
    flex: 1 1 calc((100% - var(--audience-card-gap)) / 2);
  }
}

@media print, screen and (min-width: 64.0625em) {
  .audience-section__cards > div > div:last-child > div {
    flex: 1 1 calc((100% - 2 * var(--audience-card-gap)) / 3);
  }
}

@media print, screen and (min-width: 80.0625em) {
  .audience-section__cards > div > div:last-child > div {
    flex: 1 1 calc((100% - 3 * var(--audience-card-gap)) / 4);
  }
}

/* ----- Card: image natural height, text panel below ----- */

/* Don’t clip expanded reveal (links) — equal-height flex siblings were hiding
   quote/CTA on cards 2+ when overflow was hidden on the card shell. */
.audience-card {
  position: relative;
  z-index: 1;
  margin: 0;
  height: auto;
  overflow: visible;
  will-change: height;
}

/* Smoothen snap back to row-equal heights after collapse lock (see
   audience-section-reveal.js — inline height + this transition). */
.audience-card--row-height-animating {
  box-sizing: border-box;
  transition: height 0.45s ease;
}

@media (prefers-reduced-motion: reduce) {
  .audience-card--row-height-animating {
    transition: none;
  }
}

.audience-card:hover,
.audience-card:focus-within,
.audience-card--expanded {
  z-index: 5;
}

.audience-card__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: visible;
  background: #fff;
  border-radius: 16px;
}

.audience-card__media {
  position: relative;
  z-index: 0;
  flex: 0 0 auto;
  width: 100%;
  max-height: var(--audience-card-image-max-height);
  min-height: var(--audience-card-image-min-height);
  overflow: hidden;
  line-height: 0;
  border-radius: 16px 16px 0 0;
  background-color: #0a3941;
}

.audience-card__media-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0rem 1.75rem;
  gap: 0.5rem;
}

/* Media field / Drupal wrappers: let image size the block */
.audience-card__media > *,
.audience-card__media .field,
.audience-card__media .field__items,
.audience-card__media .field__item {
  margin: 0;
  width: 100%;
}

.audience-card__media img,
.audience-card__media picture img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: var(--audience-card-image-max-height);
  max-height: var(--audience-card-image-max-height);
  object-fit: cover;
  object-position: center;
  transform: scale(1);
  transition: transform 0.45s ease;
}

.audience-card:hover .audience-card__media img,
.audience-card:focus-within .audience-card__media img,
.audience-card:hover .audience-card__media picture img,
.audience-card:focus-within .audience-card__media picture img {
  transform: scale(1.03);
}

.audience-card__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex: 1 1 auto;
  padding: 1.75rem;
  padding-bottom: 2rem;
  color: #121212;
  background-color: #fff;
  border-radius: 0 0 16px 16px;
}

.audience-card__reveal {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(0.35rem);
  pointer-events: none;
  transition:
    max-height 0.62s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.45s ease,
    transform 0.45s ease;
}

.audience-card:not(.audience-card--expanded) .audience-card__reveal {
  max-height: 0;
  opacity: 0;
  transform: translateY(0.35rem);
}

.audience-card--expanded .audience-card__reveal {
  /* Large enough for long quotes + many links; avoids clipping card 2/3 */
  max-height: min(120rem, 200vh);
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .audience-card__media img,
  .audience-card__media picture img {
    transition: none;
  }

  .audience-card__reveal {
    transition: none;
  }

  .audience-card--expanded .audience-card__reveal {
    max-height: none;
    opacity: 1;
  }
}

.audience-card__label {
  font-family: Archivo, system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #104f5a;
  margin-bottom: 0.5em !important;
}

.audience-card__description {
  font-family: Archivo, system-ui, sans-serif;
  font-size: 0.99rem;
  line-height: 1.45;
  color: #2a2a2a;
}

.audience-card__description p {
  font-size: 0.99rem;
  margin-top: 0.5rem !important;
}
.audience-card__description ul {
  list-style-type: disc;
  margin-left: -0.5em;
  margin-top: 0.7em;
  margin-bottom: 1.5rem;
}

.audience-card__description ol {
  list-style-type: decimal;
  padding-left: 1.5rem;
}

.audience-card__description p:last-child {
  margin-bottom: 0;
}

/* Pinned toward the panel bottom via margin-top:auto (equal-height stretch rows).
   Styled as plain text + chevron — reset native <button>. */
.audience-card__expand-hint {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  margin-top: auto;
  margin-bottom: 0;
  margin-left: 0;
  margin-right: 0;
  padding: 1rem 0 0;
  border: none;
  background: none;
  cursor: pointer;
  font-family: Archivo, system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  color: #104f5a;
  text-align: center;
  transition:
    opacity 0.25s ease,
    color 0.2s ease;
}

.audience-card__expand-hint:focus-visible {
  outline: 2px solid #104f5a;
  outline-offset: 2px;
}

.audience-card__expand-hint:hover,
.audience-card__expand-hint:focus-visible {
  color: #0a3941;
}

/* inline-flex: text + ::after chevron share one row, vertically centered together */
.audience-card__expand-hint__text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  line-height: 1;
}

/* Font Awesome 6 Pro chevron-down (same glyph as .main-menu .menu-item__button::before) */
.audience-card__expand-hint__text::after {
  color: currentColor;
  content: '\f078';
  display: block;
  font-family: 'Font Awesome 6 Pro';
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.075em;
  transform-origin: center;
  transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

.audience-card--expanded .audience-card__expand-hint__text::after {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .audience-card__expand-hint__text::after {
    transition: none;
  }

  .audience-card--expanded .audience-card__expand-hint__text::after {
    transform: rotate(180deg);
  }
}

.audience-card__panel a {
  color: #166a79;
}

.audience-card__panel a:hover,
.audience-card__panel a:focus {
  color: #104f5a;
}

.audience-card__quote {
  font-family: Archivo, system-ui, sans-serif;
  font-size: 0.8125rem;
  line-height: 1.45;
  padding: 1.5rem;
  background-color: rgba(69, 69, 69, 0.07);
  border-radius: 10px;
  color: #454545;
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 0;
}

.audience-card__quote p {
  font-size: 1.3rem;
  line-height: 1.2;
}

.audience-card__quote::before {
  background: linear-gradient(84.92deg, #a51c30 0%, #6d0946 100%);
  content: '';
  height: 23px;
  -webkit-mask-image: url(../img/quote-icon.svg);
  mask-image: url(../img/quote-icon.svg);
  -webkit-mask-size: 100%;
  mask-size: 100%;
  position: absolute;
  width: 31px;
  top: -0.4375rem;
  left: 15px;
}

.audience-card__quote_attribution {
  margin-top: 0.75rem;
  text-align: right;
  font-size: 1em;
}

.audience-card__headline {
  font-family: 'DM Serif Text', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1.25;
  margin: 0.5em 0.85rem;
  color: #121212;
}

/* Standard theme: overlay typography */
.audience-card--standard-theme
  .audience-card__media-overlay
  .audience-card__headline {
  font-family: Archivo, system-ui, sans-serif;
  font-weight: bold !important;
  font-size: 1.95rem;
  line-height: 1.25;
  color: #fff;
  margin: 0 0 0.25em;
}

.audience-card--standard-theme
  .audience-card__media-overlay
  .audience-card__label {
  font-family: Archivo, system-ui, sans-serif;
  font-weight: 200;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #fff;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1.1;
}

.audience-section__description {
  font-family: Archivo, system-ui, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: #fff;
  margin-bottom: 1.25rem;
}

.audience-card__reveal > .audience-card__headline:first-child {
  margin-top: 0;
}

.audience-card__reveal > *:last-child {
  margin-bottom: 0;
}

@media print, screen and (min-width: 40.0625em) {
  .audience-card__headline {
    font-size: 1.5rem;
  }
}

.audience-card__cta_wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1em;
}

.audience-card__cta {
  font-family: Archivo, system-ui, sans-serif;
  font-size: 0.99rem;
  margin-top: -0.35em;
}

.audience-card__cta a {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: #166a79;
  text-decoration: underline;
  font-weight: 800;
  width: 100%;
  justify-content: flex-start;
  margin-top: 0.25em;
}

.audience-card__cta a:hover,
.audience-card__cta a:focus {
  color: #104f5a;
}

.audience-card__cta a::before {
  content: '';
  display: inline-block;
  background-color: #a51c30;
  border-radius: 50%;
  color: #a51c30;
  content: '';
  height: 4px;
  width: 4px;
  min-width: 4px;
  min-height: 4px;
  transition: background-color 0.2s ease;
}
