/**
 * Programme Listing pages (page-programme-listing.php) and the programme card
 * component (template-parts/components/programme-card.php).
 * Desktop values follow Figma node 6413:40032 at 1440 px.
 */

.programme-listing {
  --pl-ink: #2e2d2c;
  --pl-card-bg: #002b27;
  --pl-yellow: #fc0;
  --pl-teal-light: #b4dac3;
}

/*
 * Figma: title top sits 95px below the breadcrumb top (same as the Resources page).
 * The theme's `.section.section-inner-hero { padding-top: 30px !important }`
 * otherwise wins over its own 80px desktop rule, so this needs !important too.
 */
@media (min-width: 768px) {
  .section.section-inner-hero.programme-listing {
    padding-top: 58px !important;
  }
}

/* Centred 996px content column in the 1441px Figma frame. */
.programme-listing__inner {
  max-width: 996px;
  margin: 0 auto;
}

/* ---------- Title & intro ---------- */

.programme-listing__header {
  margin-bottom: 48px;
}

/* Manrope 700, 72px / 110%, -1.44px. */
.programme-listing .section-heading .big {
  letter-spacing: -0.02em;
  margin-bottom: 0;
}

@media (min-width: 1400px) {
  .programme-listing .section-heading .big {
    font-size: 4.5rem;
  }
}

.programme-listing__intro {
  margin-top: 24px;
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--pl-ink);
}

.programme-listing__intro p {
  margin: 0 0 16px;
}

.programme-listing__intro > :last-child {
  margin-bottom: 0;
}

.programme-listing__intro strong,
.programme-listing__intro b {
  font-weight: 700;
}

.programme-listing__intro a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.programme-listing__programmes + .programme-listing__programmes {
  margin-top: 48px;
}

/* ---------- Card grid ---------- */

.programme-listing__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 992px) {
  .programme-listing__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.programme-listing__item {
  display: flex;
}

/* ---------- Programme card ---------- */

.programme-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--pl-card-bg, #002b27);
}

/*
 * Photo. WordPress crops it to the Figma frame (486 × 192) on upload
 * (NAYANTA_PL_CARD_IMAGE_SIZES), so the file already has the card's shape and
 * keeps it at every screen width.
 */
.programme-card__media {
  background: var(--pl-card-bg, #002b27);
}

.programme-card__media-link {
  display: block;
}

.programme-card__image {
  display: block;
  width: 100%;
  height: auto;
}

/* Body: 30 / 42 / 46 padding, 36px between title, meta and buttons. */
.programme-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 36px;
  padding: 30px 42px 46px;
}

.programme-card__title {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}

.programme-card__title a {
  color: inherit;
  text-decoration: none;
}

.programme-card__title a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

/* Inter 500, 14px / 140%, light teal. */
.programme-card__meta {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: "Inter", sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--pl-teal-light, #b4dac3);
}

.programme-card__meta p {
  margin: 0;
}

.programme-card__format {
  display: flex;
  align-items: center;
  gap: 6px;
}

.programme-card__format img {
  flex: 0 0 auto;
}

/*
 * Buttons: 193 × 40, 16px apart; pushed to the bottom so rows line up.
 * Side by side, stacked full width on the narrow cards (see the media
 * queries at the end, which use the theme's breakpoints).
 */
.programme-card__actions {
  display: flex;
  gap: 16px;
  margin-top: auto;
}

.programme-card__actions > * {
  flex: 1 1 0;
}

.programme-card__actions > :only-child {
  flex: 0 1 auto;
  min-width: calc(50% - 8px);
}

.programme-card__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--pl-yellow, #fc0);
  font-family: "Inter", sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
  text-transform: lowercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.programme-card__btn img {
  flex: 0 0 auto;
}

.programme-card__btn--primary {
  background: var(--pl-yellow, #fc0);
  color: var(--pl-ink, #2e2d2c);
}

.programme-card__btn--primary:hover {
  background: #e6b800;
  border-color: #e6b800;
  color: var(--pl-ink, #2e2d2c);
}

.programme-card__btn--outline {
  background: transparent;
  color: var(--pl-yellow, #fc0);
}

.programme-card__btn--outline:hover {
  background: rgba(255, 204, 0, 0.12);
  color: var(--pl-yellow, #fc0);
}

.programme-card a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/*
 * Stack the buttons where the card is too narrow for both labels:
 * phones (one card per row) and 992–1199px (two cards per row, ~470px each).
 */
@media (max-width: 575.98px), (min-width: 992px) and (max-width: 1199.98px) {
  .programme-card__actions {
    flex-direction: column;
  }

  /* In a column, "flex: 1 1 0" would size the height and squash the 40px buttons. */
  .programme-card__actions > * {
    flex: 0 0 auto;
  }

  .programme-card__actions > :only-child {
    min-width: 0;
  }
}

@media (max-width: 575.98px) {
  .programme-card__body {
    gap: 28px;
    padding: 24px 20px 32px;
  }

  .programme-card__title {
    font-size: 1.375rem;
  }
}
