/*
 * Blog archives: category, author and tag pages and their pagination
 * (src/components/templates/Listing.astro). Loaded after /styles/home.css and
 * /styles/stories.css, whose base rules, text styles (.hm-sub, .hm-small),
 * hero and breadcrumb these pages reuse, and before /styles/site.css, which
 * supplies the tokens, bands, type classes and links.
 *
 * Calm rules (review/DESIGN-SPEC.md): no new text styles; cards have one
 * hairline and no shadow; the only accent is the focus ring and the current
 * page number, which is Ink. Mobile first.
 */

/* ---------- Cards ---------- */

.ls-grid {
  display: grid;
  gap: 40px 32px;
}
@media (min-width: 640px) {
  .ls-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .ls-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.ls-grid > li {
  display: flex;
}

.ls-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* The artwork is a mix of photographs and renders on transparent
   backgrounds, so each image says how it sits in the frame. Both sit on the
   same snow panel, which keeps a row even. */
.ls-media {
  overflow: hidden;
  border-radius: var(--dz-radius-md);
  background: var(--dz-snow);
}
.ls-media img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  transition: transform var(--dz-base) var(--dz-ease);
}
.ls-media img[data-fit='cover'] {
  object-fit: cover;
}
.ls-media img[data-fit='contain'] {
  object-fit: contain;
  padding: 12px;
}

.ls-body {
  display: grid;
  align-content: start;
  gap: 8px;
}
.ls-body .dz-h3 {
  font-size: clamp(19px, 1.7vw, 22px);
  line-height: 1.15;
}

/* The heading is the whole card's link: it stretches over the card, while
   the link text stays the title alone. */
.ls-body .dz-h3 a {
  color: var(--dz-ink);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color var(--dz-fast) var(--dz-ease);
}
.ls-body .dz-h3 a::after {
  content: '';
  position: absolute;
  inset: 0;
}
.ls-card:hover .dz-h3 a,
.ls-body .dz-h3 a:focus-visible {
  text-decoration-color: currentColor;
}
.ls-card:hover .ls-media img {
  transform: scale(1.02);
}

/* ---------- Pagination ---------- */

.ls-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: var(--hm-band);
  padding-top: 24px;
  border-top: 1px solid var(--dz-line-strong);
}
.ls-pager ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ls-pager :is(a, span) {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: var(--dz-radius-full);
  font-weight: 700;
  color: var(--dz-ink);
  text-decoration: none;
  transition: background-color var(--dz-fast) var(--dz-ease);
}
.ls-pager a:hover {
  background: var(--dz-snow);
}
.ls-pager [aria-current='page'] {
  background: var(--dz-ink);
  color: var(--dz-white);
}
.ls-pager .ls-step {
  text-decoration: underline;
  text-decoration-color: var(--dz-link-line);
  text-underline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .ls-media img {
    transition: none;
  }
  .ls-card:hover .ls-media img {
    transform: none;
  }
}
