/* Pagination — compact page navigator (prev · windowed numbers · next), ported from the FR
 * directory's inline pagination. Token-only; plain global wi-pagination__* classes.
 * Scoped box-sizing — the package ships no global reset and the steps mix min-width + padding.
 * The app's modes set the `--wi-pagination-*` hooks (surface.css): its compact density the size
 * and corners, its surface the hover and the current page. The fallbacks are the website values. */
.wi-pagination,
.wi-pagination * {
  box-sizing: border-box;
}

.wi-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-10);
  font-family: var(--font-family-sans);
}

.wi-pagination__list {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.wi-pagination__step,
.wi-pagination__page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-width: var(--wi-pagination-height, var(--size-control-md));
  height: var(--wi-pagination-height, var(--size-control-md));
  padding: 0 var(--space-3);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  text-decoration: none;
  background: var(--background-page);
  border: 1px solid var(--border-default);
  border-radius: var(--wi-pagination-radius, var(--radius-full));
  cursor: pointer;
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out, background-color 120ms ease-out;
}

.wi-pagination__step:hover,
.wi-pagination__page:hover {
  border-color: var(--wi-pagination-hover-border, var(--brand-accent-hover));
  background: var(--wi-pagination-hover-bg, var(--background-page));
  box-shadow: var(--wi-pagination-hover-shadow, var(--shadow-sm));
}

.wi-pagination__step:focus-visible,
.wi-pagination__page:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Disabled step (link mode, first/last page): a non-link, no hover affordance. */
.wi-pagination__step--disabled,
.wi-pagination__step--disabled:hover {
  color: var(--text-disabled);
  background: var(--background-disabled);
  box-shadow: none;
  border-color: var(--border-default);
  cursor: default;
}

/* Current page — a non-link (no hover affordance): an inverted pill on websites, the app's selected
 * state (a light accent fill) in the app. */
.wi-pagination__page--current,
.wi-pagination__page--current:hover {
  background: var(--wi-pagination-current-bg, var(--background-inverse));
  color: var(--wi-pagination-current-fg, var(--text-primary-inverse));
  border-color: var(--wi-pagination-current-border, var(--background-inverse));
  font-weight: var(--wi-pagination-current-weight, var(--font-weight-medium));
  box-shadow: none;
  cursor: default;
}

.wi-pagination__page {
  padding: 0;
}

/* A gap takes a full slot, so the row is the same width on every page. */
.wi-pagination__gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--wi-pagination-height, var(--size-control-md));
  color: var(--text-tertiary);
}

.wi-pagination__chevron {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
}

/* Above a long list on a phone: its range, and "Page 2 of 15 ↓", a link down to the pages at its end (the
 * `pagination_jump` helper). A desktop sees the pages without scrolling far, so it has none. */
.wi-pagination-jump {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-2);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-sm);
  line-height: var(--font-line-height-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.wi-pagination-jump__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--size-button-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-link);
  text-decoration: none;
}

.wi-pagination-jump__link:hover {
  text-decoration: underline;
}

.wi-pagination-jump__link:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--focus-ring);
}

.wi-pagination-jump__icon {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
}

/* Phone: no numbers, just Previous and Next, half the width each and tall enough for a thumb. The step that goes
 * nowhere keeps its slot, empty, so the other one never moves; hidden, it leaves the accessibility tree too. */
@media (max-width: 767.98px) {
  .wi-pagination {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .wi-pagination__list {
    display: none;
  }

  .wi-pagination__step {
    height: var(--size-button-md);
    font-weight: var(--font-weight-semibold);
  }

  .wi-pagination__step--disabled {
    visibility: hidden;
  }

  .wi-pagination-jump {
    display: flex;
  }
}

/* Reduced motion: drop the hover transition. */
@media (prefers-reduced-motion: reduce) {
  .wi-pagination__step,
  .wi-pagination__page {
    transition: none;
  }
}
