/* Shared frontend pagination. Load after template.css, custom.css and component CSS.
   Uses the approved knowledge-base buttons; preserves real links and page counters.
   Article-to-article navigation in .pagenavigation has its own existing layout. */
.site :is(ul, ol).pagination:not(:where(.pagenavigation *)) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  max-width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li { display: flex; align-items: center; margin: 0; padding: 0; border: 0; box-shadow: none; }
/* The current HTML contains duplicate empty li wrappers. This only removes their
   visual gap; the pagination renderer should still be corrected separately. */
.site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li:not(:has(*)) { display: contents; }
.site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li > :is(.page-link, a, span, button) {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid #d8e1eb;
  border-radius: 8px;
  background: #fff;
  color: #172334;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  text-decoration: none;
  box-shadow: none;
}
.site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li.active > :is(a, span, button),
.site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li > :is([aria-current="page"], [aria-current="true"]) {
  border-color: #115a91;
  background-color: #115a91;
  color: #fff;
}
.site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li:not(.active):not(.disabled) > :is(a, button):not([aria-current="page"]):not(:disabled):hover {
  border-color: #aacbdd;
  background-color: #edf6fc;
}
.site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li.disabled > :is(a, span, button),
.site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li > :is([aria-disabled="true"], :disabled) {
  border-color: #d8e1eb;
  color: #94a8b5;
  background-color: #f8fafb;
  pointer-events: none;
}
.site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li > :is(a, button):focus-visible {
  outline: 2px solid #397fb8;
  outline-offset: 3px;
}
.site :is(nav.pagination-wrapper, .com-finder__navigation) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding: 18px 20px;
  border: 1px solid #d8e1eb;
  border-radius: 10px;
  background: #fff;
}
.site :is(nav.pagination-wrapper, .com-finder__navigation, .com-content-category__navigation) :is(ul, ol).pagination {
  flex: 1 1 auto;
  min-width: 0;
  margin-inline-start: auto;
  margin-bottom: 0 !important; /* Bootstrap mb-4 on the native list. */
}
.site :is(nav.pagination-wrapper, .com-finder__navigation) :is(.counter, .pagination-counter) {
  margin: 0;
  color: #61758c;
  font-size: 13px;
}
.site .com-finder__navigation > .com-finder__pagination { display: block; flex: 1 1 360px; min-width: 0; max-width: 100%; }
.site .com-finder__navigation > .com-finder__counter { order: -1; margin: 0; color: #61758c; font-size: 13px; }
.site .com-content-category__navigation > .com-content-category__pagination { flex: 1 1 360px; min-width: 0; max-width: 100%; }
@media (max-width: 575px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)) { gap: 4px; }
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li > :is(.page-link, a, span, button) { min-width: 36px; padding-inline: 8px; }
  .site :is(nav.pagination-wrapper, .com-finder__navigation) { padding: 16px; }
}

/* Knowledge-base footer, moved from listextended.css and consolidated here. */
#sp-component .list-extended .com-content-category__articles .le-article-list:has(~ .com-content-category__navigation) { border-bottom: 0; border-radius: 8px 8px 0 0; }
#sp-component .list-extended .com-content-category__articles .com-content-category__navigation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 0!important;
  padding: 16px 28px 24px;
  border: 1px solid var(--jc-line, #d8e1eb);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #fff;
}
#sp-component .list-extended .com-content-category__articles .counter { float: none !important; margin: 0; padding: 0 !important; color: var(--kb-muted, #536274); font-size: 13px; }
@media (max-width: 575px) {
  #sp-component .list-extended .com-content-category__articles .com-content-category__navigation { justify-content: flex-start; padding: 16px; }
}

/* CSS-only responsive pagination. A bounded window of numbers follows the active page.
   The first/previous and next/last controls use the standard Joomla order.
   Empty duplicate li wrappers are excluded from positional counting. */
@supports (container-type: inline-size) and selector(li:nth-child(1 of :has(> a))) {
  .site :where(:has(> :is(ul, ol).pagination)):not(:where(.pagenavigation, .pagenavigation *)) {
    container: jc-pagination / inline-size;
    min-width: 0;
    max-width: 100%;
  }
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { flex-wrap: nowrap; width: 100%; }
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li:has(> :is(.page-link, a, span, button)) { display: var(--jc-pg-item-display, var(--jc-pg-far, flex)); }
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li:where(
    :nth-last-child(-n + 4 of li:has(> :is(a, span, button)):has(~ li.active)),
    :nth-child(-n + 4 of li.active ~ li:has(> :is(a, span, button))),
    li.active ~ li:nth-child(-n + 11 of li:has(> :is(a, span, button))),
    :nth-last-child(-n + 11 of li:has(> :is(a, span, button))):has(~ li.active)
  ) { --jc-pg-item-display: var(--jc-pg-near-4, var(--jc-pg-far, flex)); }
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li:where(
    :nth-last-child(-n + 3 of li:has(> :is(a, span, button)):has(~ li.active)),
    :nth-child(-n + 3 of li.active ~ li:has(> :is(a, span, button))),
    li.active ~ li:nth-child(-n + 9 of li:has(> :is(a, span, button))),
    :nth-last-child(-n + 9 of li:has(> :is(a, span, button))):has(~ li.active)
  ) { --jc-pg-item-display: var(--jc-pg-near-3, var(--jc-pg-far, flex)); }
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li:where(
    :nth-last-child(-n + 2 of li:has(> :is(a, span, button)):has(~ li.active)),
    :nth-child(-n + 2 of li.active ~ li:has(> :is(a, span, button))),
    li.active ~ li:nth-child(-n + 7 of li:has(> :is(a, span, button))),
    :nth-last-child(-n + 7 of li:has(> :is(a, span, button))):has(~ li.active)
  ) { --jc-pg-item-display: var(--jc-pg-near-2, var(--jc-pg-far, flex)); }
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li:where(
    :nth-last-child(-n + 1 of li:has(> :is(a, span, button)):has(~ li.active)),
    :nth-child(-n + 1 of li.active ~ li:has(> :is(a, span, button))),
    li.active ~ li:nth-child(-n + 5 of li:has(> :is(a, span, button))),
    :nth-last-child(-n + 5 of li:has(> :is(a, span, button))):has(~ li.active)
  ) { --jc-pg-item-display: var(--jc-pg-near-1, var(--jc-pg-far, flex)); }
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li:where(
    :nth-child(1 of li.active ~ li:has(> :is(a, span, button))),
    :nth-last-child(-n + 4 of li:has(> :is(a, span, button))):has(~ li.active)
  ) { --jc-pg-item-display: var(--jc-pg-near-half, var(--jc-pg-far, flex)); }
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li:where(
    :nth-child(-n + 2 of li:has(> :is(a, span, button))),
    :nth-last-child(-n + 2 of li:has(> :is(a, span, button)))
  ) { --jc-pg-item-display: var(--jc-pg-nav, flex); }
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li:where(
    :nth-child(1 of li:has(> :is(a, span, button))),
    :nth-last-child(1 of li:has(> :is(a, span, button)))
  ) { --jc-pg-item-display: var(--jc-pg-edge, var(--jc-pg-nav, flex)); }
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)) > li:where(
    .active,
    :has(> [aria-current="page"]),
    :has(> [aria-current="true"])
  ) { --jc-pg-item-display: flex; }
  @container jc-pagination (max-width: 637.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-far: none; --jc-pg-near-4: flex; --jc-pg-near-3: flex; --jc-pg-near-2: flex; --jc-pg-near-1: flex; --jc-pg-near-half: flex; --jc-pg-nav: flex; --jc-pg-edge: flex; }
}
  @container jc-pagination (max-width: 591.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-near-4: none; }
}
  @container jc-pagination (max-width: 499.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-near-3: none; }
}
  @container jc-pagination (max-width: 407.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-near-2: none; }
}
  @container jc-pagination (max-width: 315.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-near-1: none; }
}
  @container jc-pagination (max-width: 269.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-near-half: none; }
}
  @container jc-pagination (max-width: 223.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-edge: none; }
}
  @container jc-pagination (max-width: 131.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-nav: none; }
}
  @media (max-width: 575px) {
    @container jc-pagination (min-width: 0px) {
      .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-far: flex; --jc-pg-near-4: flex; --jc-pg-near-3: flex; --jc-pg-near-2: flex; --jc-pg-near-1: flex; --jc-pg-near-half: flex; --jc-pg-nav: flex; --jc-pg-edge: flex; }
    }
    @container jc-pagination (max-width: 555.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-far: none; --jc-pg-near-4: flex; --jc-pg-near-3: flex; --jc-pg-near-2: flex; --jc-pg-near-1: flex; --jc-pg-near-half: flex; --jc-pg-nav: flex; --jc-pg-edge: flex; }
}
    @container jc-pagination (max-width: 515.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-near-4: none; }
}
    @container jc-pagination (max-width: 435.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-near-3: none; }
}
    @container jc-pagination (max-width: 355.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-near-2: none; }
}
    @container jc-pagination (max-width: 275.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-near-1: none; }
}
    @container jc-pagination (max-width: 235.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-near-half: none; }
}
    @container jc-pagination (max-width: 195.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-edge: none; }
}
    @container jc-pagination (max-width: 115.98px) {
  .site :is(ul, ol).pagination:not(:where(.pagenavigation *)):has(> li.active) { --jc-pg-nav: none; }
}
  }
}
.site .pagination-wrapper > .pagination__wrapper {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}
