.resource-card {
  transition: transform .2s, box-shadow .2s;
}
.resource-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
}
/* enforce same height bodies + truncate descriptions */
.resource-card .card-body {
  display: flex;
  flex-direction: column;
}

.resource-card .card-text.truncate {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;    /* show up to 3 lines */
  -webkit-box-orient: vertical;
}

/* Compact subcategory chips on list/featured cards (first 3 + “+N more”) */
.resource-card .resource-subcat-badge {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.28em 0.55em;
  line-height: 1.25;
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

/* Visually hidden but focusable via associated labels */
.resource-card .resource-subcat-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/*
 * All chips share one flex-wrap row so overflow continues the sequence.
 * Extras / "Show less" stay hidden until expanded. Base chip styles must not
 * override these with a later display:inline-block (same specificity).
 */
.resource-card .resource-subcat-more-summary {
  cursor: pointer;
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.28em 0.55em;
  line-height: 1.25;
  border: 1px solid #ced4da;
  border-radius: var(--bs-border-radius, 0.375rem);
  background-color: #f8f9fa;
  color: #495057;
  user-select: none;
  margin: 0;
}

.resource-card .resource-subcat-more-summary:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
}

.resource-card .resource-subcat-extra,
.resource-card .resource-subcat-more-summary.resource-subcat-more-close {
  display: none;
}

.resource-card .resource-subcat-toggle:checked ~ .resource-subcat-row .resource-subcat-extra {
  display: inline-block;
  animation: resource-subcat-fade-in 0.22s ease 0.04s both;
}

.resource-card .resource-subcat-toggle:checked ~ .resource-subcat-row .resource-subcat-more-open {
  display: none;
}

.resource-card .resource-subcat-toggle:checked ~ .resource-subcat-row .resource-subcat-more-summary.resource-subcat-more-close {
  display: inline-block;
  animation: resource-subcat-fade-in 0.22s ease 0.04s both;
}

@keyframes resource-subcat-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .resource-card .resource-subcat-toggle:checked ~ .resource-subcat-row .resource-subcat-extra,
  .resource-card .resource-subcat-toggle:checked ~ .resource-subcat-row .resource-subcat-more-summary.resource-subcat-more-close {
    animation: none;
  }
}

/* Featured row: do not stretch sibling cards when one expands */
.resource-featured-row {
  align-items: flex-start;
}
