/**
 * Resource Hub topics landing card treatments.
 *
 * Styles the stable markup prepared by resource_hub and rendered in
 * views-view-fields--resource-hub-topics.html.twig. The design uses an airy
 * three-column topic catalogue: rendered count metadata introduces each card,
 * while the topic title, short description, and subtopic labels form a clear
 * reading sequence.
 */

.resource-hub-topics__catalogue {
  --rh-red: #b30125;
  --rh-blue: #072c45;
  --rh-ink: #181818;
  --rh-muted: #555;
  --rh-rule: #d9d9d9;
  --rh-card-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);

  max-width: 1422px;
  margin: 0 auto;
  padding: 70px 15px 80px;
}

/* Views groups cards into horizontal row wrappers. Keep that structure but
 * establish the Figma gap and leave each card column free to stretch. */
.resource-hub-topics__catalogue .views-view-grid {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.resource-hub-topics__catalogue .views-view-grid > .views-row {
  display: flex;
  align-items: stretch;
  gap: 30px;
  margin: 0;
}

.resource-hub-topics__catalogue .views-view-grid > .views-row > .views-col {
  display: flex;
  flex: 1 1 0;
  width: auto !important;
  margin: 0;
}

/* A lone final card remains centered; two trailing cards keep the natural
 * left alignment required by the landing-grid contract. */
.resource-hub-topics__catalogue .views-view-grid > .views-row > .views-col:only-child,
.view-resource-hub-topics .views-view-grid > .views-row > .views-col:only-child {
  max-width: calc((100% - 60px) / 3);
  margin-right: auto;
  margin-left: auto;
}

.hub-card {
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
  min-height: 397px;
  padding: 30px;
  border: 0;
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--rh-card-shadow);
  color: var(--rh-ink);
  font-family: "Poppins", "Helvetica Neue", Arial, sans-serif;
}

.hub-card__header {
  display: flex;
  align-items: center;
  min-height: 33px;
  gap: 8px;
}

.hub-card__icon-wrapper {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 33px;
}

.hub-card__icon {
  display: block;
  width: auto;
  max-width: 34px;
  height: auto;
  max-height: 33px;
}

/* Resource count and its optional New badge are formatter output. Their
 * placement is visual only, leaving the count field's cache metadata intact. */
.resource-hub-topic__count-wrapper {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.resource-hub-topic__counts {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 33px;
}

.resource-hub-topic__count {
  color: var(--rh-red);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
}

.resource-hub-topic__badge--new {
  margin-left: auto;
  padding: 5px 12px;
  border: 1px solid rgba(22, 179, 1, 0.5);
  border-radius: 40px;
  background: rgba(22, 179, 1, 0.1);
  color: #16b301;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-transform: uppercase;
}

.hub-card__label--type {
  display: inline-flex;
  align-items: center;
  min-height: 33px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--rh-red);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
}

.hub-card__content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  padding-top: 20px;
}

.hub-card__title,
.resource-hub-topic__title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--rh-blue);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

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

/* Preserve the single semantic title link while extending its hit area across
 * the card. This avoids nested anchors, preserves Drupal's URL/cache/analytics
 * attributes, and leaves intentionally unlinked cards non-interactive. */
.hub-card__title a::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: 4px;
  content: "";
  cursor: pointer;
}

.hub-card__title a:hover {
  color: var(--rh-red);
  text-decoration: none;
}

.hub-card__title a:focus-visible {
  outline: 0;
}

.hub-card__title a:focus-visible::after {
  outline: 3px solid var(--rh-red);
  outline-offset: 3px;
}

.resource-hub-topic__description {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--rh-ink);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.5;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
}

.resource-hub-topic__description > :last-child {
  margin-bottom: 0;
}

.hub-card__divider {
  width: 100%;
  height: 1px;
  margin: 20px 0;
  background: var(--rh-rule);
}

.resource-hub-topic__subtopics-wrapper,
.resource-hub-topic__subtopics {
  min-width: 0;
  margin: 0;
  overflow: hidden;
}

.resource-hub-topic__subtopics {
  display: block;
  color: var(--rh-muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: -0.14px;
  list-style: none;
  text-transform: uppercase;
}

.resource-hub-topic__subtopics > li {
  display: inline;
}

.resource-hub-topic__subtopics > li + li::before {
  content: " / ";
}

/* Flex children otherwise retain their intrinsic minimum width. Allow the
 * existing desktop, tablet, and mobile grid to shrink safely when an editor
 * supplies a long Topic_Type label, count, or subtopic name. The header wraps
 * only when necessary; its normal metadata order and the right-aligned NEW
 * badge remain unchanged. */
.resource-hub-topics__catalogue .views-view-grid > .views-row > .views-col,
.hub-card,
.hub-card__header,
.hub-card__content,
.resource-hub-topic__counts,
.hub-card__label--type {
  min-width: 0;
}

.hub-card__header,
.resource-hub-topic__counts {
  flex-wrap: wrap;
}

.hub-card__label--type,
.resource-hub-topic__count,
.resource-hub-topic__subtopics {
  overflow-wrap: anywhere;
}

/* Links-out topics have no count or subtopic output. Retain their icon/type
 * label but suppress the divider reserved for topic subtopics. */
.resource-hub-topics__catalogue .hub-card--tool {
  border: 0;
  background: #fff;
}

.resource-hub-topics__catalogue .hub-card--tool .hub-card__divider {
  display: none;
}

.resource-hub-topics__catalogue .hub-row__outbound-link::after {
  /* content: "\2197"; */
  display: inline-block;
  margin-left: 0.25rem;
  font-size: 0.85em;
  line-height: 1;
  text-decoration: none;
}

@media (max-width: 1199px) {
  .resource-hub-topics__catalogue {
    padding-top: 50px;
  }

  .resource-hub-topics__catalogue .views-view-grid > .views-row {
    flex-wrap: wrap;
  }

  .resource-hub-topics__catalogue .views-view-grid > .views-row > .views-col {
    flex-basis: calc((100% - 30px) / 2);
  }

  .resource-hub-topics__catalogue .views-view-grid > .views-row > .views-col:only-child {
    max-width: calc((100% - 30px) / 2);
  }
}

@media (max-width: 767px) {
  .resource-hub-topics__catalogue {
    padding: 50px 15px 55px;
  }

  .resource-hub-topics__catalogue .views-view-grid {
    gap: 24px;
  }

  .resource-hub-topics__catalogue .views-view-grid > .views-row {
    gap: 24px;
  }

  .resource-hub-topics__catalogue .views-view-grid > .views-row > .views-col,
  .resource-hub-topics__catalogue .views-view-grid > .views-row > .views-col:only-child {
    flex-basis: 100%;
    max-width: none;
  }

  .hub-card {
    min-height: 0;
    padding: 24px;
  }

  .hub-card__title,
  .resource-hub-topic__title {
    font-size: 28px;
  }

  .resource-hub-topic__description {
    font-size: 18px;
    line-height: 1.45;
  }
}

/* Approved landing introduction. It sits outside the card catalogue so the
 * muted surface spans the viewport while its content aligns to the grid. */
.resource-hub-topics__intro {
  padding: 50px 15px 70px;
  background: #f5f5f5;
}

.resource-hub-topics__intro-inner {
  max-width: 1380px;
  margin: 0 auto;
}

.resource-hub-topics__intro .resource-hub-topics__title {
  margin: 0 0 25px;
  color: #02254a;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 70px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
}

.resource-hub-topics__intro .resource-hub-topics__description {
  max-width: 100%;
  margin: 0;
  color: #181818;
  font-family: "Poppins", "Helvetica Neue", Arial, sans-serif;
  font-size: 20px;
  font-weight: 400;
  line-height: normal;
  letter-spacing: 0;
}

@media (max-width: 767px) {
  .resource-hub-topics__intro {
    padding: 30px 20px 50px;
  }

  .resource-hub-topics__intro .resource-hub-topics__title {
    margin-bottom: 25px;
    font-size: 70px;
  }

  .resource-hub-topics__intro .resource-hub-topics__description {
    font-size: 20px;
    line-height: normal;
  }
}
