.wp-block-acf-knowledge-hub-posts .khub-post-card {
  position: relative;
  display: block;
  height: 360px;
 /*  max-width: 325px; */
  overflow: hidden;
  --khub-cta-height: 32px;
  --khub-cta-pad-x: 24px;
  --khub-cta-pad-bottom: 24px;
  --khub-cta-gap: 16px;
}

@media (min-width: 767px) {
  .wp-block-acf-knowledge-hub-posts .khub-post-card {
    height: 500px;
    max-width: unset;
  }
}

.wp-block-acf-knowledge-hub-posts .khub-posts-grid {
  isolation: isolate;
}

.wp-block-acf-knowledge-hub-posts .khub-loadmore-hidden {
  display: none;
}

@keyframes khub-loadmore-card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wp-block-acf-knowledge-hub-posts .khub-loadmore-animate {
  animation: khub-loadmore-card-in 320ms ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  .wp-block-acf-knowledge-hub-posts .khub-loadmore-animate {
    animation: none;
  }
}

@media (min-width: 768px) {
  .wp-block-acf-knowledge-hub-posts .khub-posts-filters {
    position: sticky;
    top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--khub-sticky-top, 96px));
    border: 1px solid rgb(255 255 255);
    border-bottom-left-radius: 0px;
    border-bottom-right-radius: 0px;
    z-index: 40;
    padding: 24px;
    margin-left: -24px;
    margin-right: -24px;
    width: calc(100% + 48px);
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.95);

  }

  .wp-block-acf-knowledge-hub-posts .khub-posts-filters[data-khub-stuck="1"] {
    border-color: rgb(var(--primitive-neutral-4) / 0.1);
  }
}

.wp-block-acf-knowledge-hub-posts .khub-post-card__media {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 40%;
  overflow: hidden;
  z-index: 0;
  transition: top 320ms ease;
  will-change: top;
}

.wp-block-acf-knowledge-hub-posts .khub-post-card__body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 60%;
  background: none;
  overflow: hidden;
  isolation: isolate;
  z-index: 1;
  transition: height 450ms ease;
  will-change: height;
}

.wp-block-acf-knowledge-hub-posts .khub-post-card__content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
  padding-bottom: calc(var(--khub-cta-height) + var(--khub-cta-gap));
}

.wp-block-acf-knowledge-hub-posts .khub-post-card__cta {
  position: absolute;
  left: var(--khub-cta-pad-x);
  bottom: var(--khub-cta-pad-bottom);
  z-index: 2;
}

.wp-block-acf-knowledge-hub-posts .khub-post-card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  max-height: 132px;
  transition: max-height 450ms ease;
  will-change: max-height;
}

@media (hover: hover) and (pointer: fine) {
  .wp-block-acf-knowledge-hub-posts a.khub-post-card:hover .khub-post-card__title {
    -webkit-line-clamp: 4;
    line-clamp: 4;
    max-height: 999px;
  }
}

.wp-block-acf-knowledge-hub-posts a.khub-post-card:focus-visible .khub-post-card__title {
  -webkit-line-clamp: 4;
  line-clamp: 4;
  max-height: 999px;
}

.wp-block-acf-knowledge-hub-posts .khub-post-card__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 50ms ease, opacity 400ms ease;
  will-change: max-height, opacity;
}

@media (hover: hover) and (pointer: fine) {
  .wp-block-acf-knowledge-hub-posts a.khub-post-card:hover .khub-post-card__excerpt {
    max-height: 999px;
    opacity: 1;
  }
}

.wp-block-acf-knowledge-hub-posts a.khub-post-card:focus-visible .khub-post-card__excerpt {
  max-height: 999px;
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .wp-block-acf-knowledge-hub-posts a.khub-post-card:hover .khub-post-card__media {
    top: -40%;
  }

  .wp-block-acf-knowledge-hub-posts a.khub-post-card:hover .khub-post-card__body {
    height: 100%;
  }
}

.wp-block-acf-knowledge-hub-posts a.khub-post-card:focus-visible .khub-post-card__media {
  top: -40%;
}

.wp-block-acf-knowledge-hub-posts a.khub-post-card:focus-visible .khub-post-card__body {
  height: 100%;
}

.wp-block-acf-knowledge-hub-posts a.khub-post-card.khub-post-card--no-media .khub-post-card__body {
  height: 100%;
}

@media (max-width: 766.98px) {
  /* Auto-height card as flex column so CTA always sits at the bottom */
  .wp-block-acf-knowledge-hub-posts .khub-post-card {
    height: auto;
    display: flex;
    flex-direction: column;
  }

  /* Media becomes in-flow with aspect ratio instead of absolute % height */
  .wp-block-acf-knowledge-hub-posts .khub-post-card__media {
    position: relative;
    top: auto;
    height: auto;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    flex-shrink: 0;
  }

  /* Body grows to fill remaining card space, pushing CTA to the bottom */
  .wp-block-acf-knowledge-hub-posts .khub-post-card__body {
    position: relative;
    bottom: auto;
    height: auto;
    overflow: visible;
    flex: 1;
  }

  /* No extra bottom padding needed — CTA is now in-flow */
  .wp-block-acf-knowledge-hub-posts .khub-post-card__content {
    padding-bottom: 0;
  }

  /* Show full title — no line-clamp on mobile */
  .wp-block-acf-knowledge-hub-posts .khub-post-card__title {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
    max-height: none;
  }

  /* CTA is last flex child — naturally at the bottom of the card */
  .wp-block-acf-knowledge-hub-posts .khub-post-card__cta {
    position: relative;
    left: auto;
    bottom: auto;
    margin-top: auto;
    margin-left: var(--khub-cta-pad-x);
    margin-bottom: var(--khub-cta-pad-bottom);
    flex-shrink: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wp-block-acf-knowledge-hub-posts .khub-post-card__media,
  .wp-block-acf-knowledge-hub-posts .khub-post-card__body,
  .wp-block-acf-knowledge-hub-posts .khub-post-card__title,
  .wp-block-acf-knowledge-hub-posts .khub-post-card__excerpt {
    transition: none;
  }
}

.wp-block-acf-knowledge-hub-posts .khub-posts-filter-checkbox {
  min-width: 20px;
  min-height: 20px;
  width: 20px;
  height: 20px;
  border-radius: 2px;
  border: 1px solid #000;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  display: inline-block;
  vertical-align: middle;
}

.wp-block-acf-knowledge-hub-posts .khub-posts-filter-checkbox:checked {
  border-color: rgb(var(--primitive-blue-3) / 1);
  background-color: rgb(var(--primitive-blue-3) / 1);
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'10'%20height%3D'8'%20viewBox%3D'0%200%2010%208'%20fill%3D'none'%3E%3Cpath%20d%3D'M3.55775%207.104L9.954%200.70775L9.24625%200L3.55775%205.6885L0.70775%202.8385L0%203.54625L3.55775%207.104Z'%20fill%3D'%231B1B1B'%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px 8px;
}

.wp-block-acf-knowledge-hub-posts .khub-posts-filter-checkbox:focus-visible {
  outline: 2px solid rgb(var(--primitive-blue-3) / 1);
  outline-offset: 2px;
}

.wp-block-acf-knowledge-hub-posts .khub-posts-filter-trigger {
  min-width: 116px;
  position: relative;
}

.wp-block-acf-knowledge-hub-posts .khub-posts-filter-trigger::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgb(0 0 0);
  transition: height 180ms ease;
}

.wp-block-acf-knowledge-hub-posts .khub-posts-filter-trigger:hover::before,
.wp-block-acf-knowledge-hub-posts .khub-posts-filter-trigger:focus-visible::before {
  height: 3px;
}

.wp-block-acf-knowledge-hub-posts .khub-posts-search {
  position: relative;
  box-sizing: border-box;
}

.wp-block-acf-knowledge-hub-posts .khub-posts-search::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgb(0 0 0);
  transition: height 180ms ease;
}

.wp-block-acf-knowledge-hub-posts .khub-posts-search:hover::before,
.wp-block-acf-knowledge-hub-posts .khub-posts-search:focus-within::before {
  height: 3px;
}

@media (min-width: 768px) {
  .wp-block-acf-knowledge-hub-posts .khub-posts-filter-panel {
    width: 350px;
  }
}

@media (max-width: 767px) {
  .wp-block-acf-knowledge-hub-posts .khub-posts-filter-panel {
    position: fixed;
    left: var(--khub-panel-left, 0px);
    right: auto;
    width: var(--khub-panel-width, 100vw);
    box-sizing: border-box;
    max-width: var(--khub-panel-width, 100vw);
    margin-top: 0 !important;
    top: var(--khub-panel-top, 0px);
  }
}

.wp-block-acf-knowledge-hub-posts [data-khub-search]::-webkit-search-cancel-button,
.wp-block-acf-knowledge-hub-posts [data-khub-search]::-webkit-search-decoration,
.wp-block-acf-knowledge-hub-posts [data-khub-search]::-webkit-search-results-button,
.wp-block-acf-knowledge-hub-posts [data-khub-search]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.wp-block-acf-knowledge-hub-posts [data-khub-search]::-ms-clear,
.wp-block-acf-knowledge-hub-posts [data-khub-search]::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}

/* ─── Featured posts carousel ─────────────────────────────────────────────── */

/* Slide sizing on mobile/tablet (Swiper reads these when slidesPerView:'auto') */
.wp-block-acf-knowledge-hub-posts .khub-featured-slide {
  width: 330px;
  max-width: 330px;
}

@media (min-width: 768px) {
  .wp-block-acf-knowledge-hub-posts .khub-featured-slide {
    width: 424px;
    max-width: 424px;
  }
}

/* Pagination dots */
.wp-block-acf-knowledge-hub-posts .js-khub-featured-pagination {
  position: static !important;
  inset: auto !important;
  display: flex;
  justify-content: center;
  gap: 32px;
}

.wp-block-acf-knowledge-hub-posts .js-khub-featured-pagination .swiper-pagination-bullet {
  cursor: pointer;
  width: 18px;
  height: 18px;
  background: rgb(var(--primitive-neutral-2));
  opacity: 1;
  margin: 0;
  position: relative;
}

/* Expand interactive area to 44×44px without affecting visual layout (WCAG 2.5.8) */
/* gap: 32px ensures bullet centers are 44px apart — ::before targets touch but never overlap */
.wp-block-acf-knowledge-hub-posts .js-khub-featured-pagination .swiper-pagination-bullet::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 44px;
  min-height: 44px;
}

.wp-block-acf-knowledge-hub-posts .js-khub-featured-pagination .swiper-pagination-bullet-active {
  background: rgb(var(--primitive-neutral-4));
}

/* Desktop: override Swiper's flex/transform so slides render as a 3-column grid */
@media (min-width: 1024px) {
  .wp-block-acf-knowledge-hub-posts .khub-featured-swiper .swiper-wrapper {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    row-gap: 48px;
    transform: none !important;
    transition: none !important;
  }

  .wp-block-acf-knowledge-hub-posts .khub-featured-slide {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
}

.wp-block-acf-knowledge-hub-posts [data-khub-clear-all] {
  color: rgb(0 0 0 / 0.5) !important;
}

.wp-block-acf-knowledge-hub-posts [data-khub-clear-all][data-khub-clear-active="1"] {
  color: rgb(0 0 0) !important;
}

.wp-block-acf-knowledge-hub-posts [data-khub-search-clear] img,
.wp-block-acf-knowledge-hub-posts [data-khub-clear-all-icon] {
  transition: transform 220ms ease, opacity 180ms ease;
  transform-origin: 50% 50%;
}

.wp-block-acf-knowledge-hub-posts [data-khub-search-clear] img {
  opacity: 0.7;
}

.wp-block-acf-knowledge-hub-posts [data-khub-search-clear]:hover img,
.wp-block-acf-knowledge-hub-posts [data-khub-search-clear]:focus-visible img {
  opacity: 1;
  transform: rotate(-180deg);
}

.wp-block-acf-knowledge-hub-posts [data-khub-clear-all][data-khub-clear-active="1"]:hover [data-khub-clear-all-icon],
.wp-block-acf-knowledge-hub-posts [data-khub-clear-all][data-khub-clear-active="1"]:focus-visible [data-khub-clear-all-icon] {
  transform: rotate(-180deg);
}
