/* ============================================================
   Webrex — Sitewide pagination (see src/assets/js/pagination.js)
   Brand: black, white, Webrex blue (--w-accent).
   ============================================================ */

/* Before the script runs, show only page 1 so the page doesn't load
   long and then jump shorter (layout shift). Only applies when JS is
   on (html.wr-js is set by an inline script in the layouts); without
   JS every card stays visible. */
.wr-js [data-paginate="9"]:not(.wr-pg-ready) > :nth-child(n+10),
.wr-js [data-paginate="12"]:not(.wr-pg-ready) > :nth-child(n+13) { display: none !important; }
@media (max-width: 640px) {
  .wr-js [data-paginate-mobile="6"]:not(.wr-pg-ready) > :nth-child(n+7) { display: none !important; }
}

/* Cards on other pages */
.wr-pg-off { display: none !important; }

/* Cards fading in when you change page */
.wr-pg-in { animation: wr-pg-in .45s cubic-bezier(.22, 1, .36, 1) backwards; }
@keyframes wr-pg-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Stagger by position ON THE CURRENT PAGE (set by pagination.js as
   --wr-pg-i). Overrides per-card inline delays such as the blog grid's
   "card index x 0.07s", which would otherwise make cards on page 3 wait
   ~1.8s before appearing. Applies to the site's own slide-up animation too. */
.wr-pg-ready > * { animation-delay: calc(var(--wr-pg-i, 0) * 60ms) !important; }

/* ---- Controls ---- */
.wr-pg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 48px auto 8px;
  padding: 0 16px;
  font-family: var(--w-btn-font, "Poppins", system-ui, sans-serif);
}
.wr-pg[hidden] { display: none; }

.wr-pg__list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.wr-pg__pages { display: inline-flex; align-items: center; gap: 6px; }

.wr-pg__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border: 1.5px solid var(--w-black, #000);
  border-radius: var(--w-btn-radius, 999px);
  background: var(--w-white, #fff);
  color: var(--w-black, #000);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.wr-pg__nav { padding: 0 18px; }
.wr-pg__btn svg { flex: none; }

@media (hover: hover) {
  .wr-pg__btn:not(:disabled):not(.is-current):hover {
    background: var(--w-accent, #4065C3);
    border-color: var(--w-accent, #4065C3);
    color: #fff;
  }
}
.wr-pg__btn:not(:disabled):active { transform: scale(.96); }
/* Keyboard focus ring. The site removes outlines globally
   (main.css: *:focus-visible { outline: none !important }), so use a
   box-shadow ring instead. Only shows for keyboard users, not on click/tap. */
.wr-pg .wr-pg__btn:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--w-accent, #4065C3) !important; }
.wr-pg .wr-pg__btn:focus:not(:focus-visible) { box-shadow: none !important; }

.wr-pg__btn.is-current {
  background: var(--w-accent, #4065C3);
  border-color: var(--w-accent, #4065C3);
  color: #fff;
  cursor: default;
}
.wr-pg__btn:disabled { opacity: .35; cursor: not-allowed; }

.wr-pg__gap { min-width: 20px; text-align: center; color: #71717a; font-size: 15px; }

.wr-pg__status {
  margin: 0;
  font-size: 13px;
  color: #71717a;
  letter-spacing: .01em;
}

/* Compact "2 / 5" only on phones */
.wr-pg__compact { display: none; -webkit-user-select: none; user-select: none; }
.wr-pg__list { -webkit-user-select: none; user-select: none; }

@media (max-width: 640px) {
  .wr-pg { margin-top: 36px; }
  .wr-pg__pages { display: none; }
  .wr-pg__navtxt { display: none; }
  .wr-pg__nav { padding: 0; min-width: 48px; height: 48px; }
  .wr-pg__compact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    height: 48px;
    font-size: 15px;
    font-weight: 600;
    color: var(--w-black, #000);
  }
}

/* On a genuinely dark background (detected by pagination.js from the
   actual background colour, NOT from data-theme, which the site's scroll
   script toggles on <body> while scrolling) */
.wr-pg--on-dark .wr-pg__btn { background: transparent; border-color: rgba(255,255,255,.6); color: #fff; }
.wr-pg--on-dark .wr-pg__btn:disabled { opacity: .35; }
.wr-pg--on-dark .wr-pg__compact { color: #fff; }
.wr-pg--on-dark .wr-pg__status { color: rgba(255,255,255,.65); }

@media (prefers-reduced-motion: reduce) {
  .wr-pg-in { animation: none; }
  .wr-pg__btn { transition: none; }
}
