/* ─── Blog views ──────────────────────────────────────────────────────────────
   home.php (Posts page), archive.php, search.php, index.php and single.php:
   listing band + category chips, pagination, empty state, the article
   (cover, article typography on top of inner.css' .prose, tags, page links,
   previous/next navigation) and related posts. Cards: post-card.css. Loaded
   only on blog views (includes/assets.php). Mobile-first; 480/640/768/992/1200.
   ────────────────────────────────────────────────────────────────────────── */

/* ─── Listings ─── */
.listing {
  background: var(--paper);
  padding: 50px 0 100px;

  @media (min-width: 768px) {
    padding: 70px 0 120px;
  }
}

.related {
  background: var(--chalk);
  padding-top: 80px;
}

.related-title {
  margin-bottom: 34px;
}

/* ─── Category chips (design's pill/tab language) ─── */
.chips {
  margin: 0 -18px 34px;
  overflow-x: auto;
  scrollbar-width: none;

  &::-webkit-scrollbar {
    display: none;
  }

  ul {
    display: flex;
    gap: 8px;
    padding: 2px 18px;
    width: max-content;
  }

  @media (min-width: 768px) {
    margin: 0 0 44px;
    overflow: visible;

    ul {
      flex-wrap: wrap;
      padding: 0;
      width: auto;
    }
  }
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink-3);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--hover-duration), color var(--hover-duration), border-color var(--hover-duration);

  &:hover {
    border-color: var(--ink);
    color: var(--ink);
  }

  &.is-current {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--signal);
  }
}

/* ─── Pagination ─── */
.pagination {
  margin-top: 50px;

  .nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .page-numbers {
    min-width: 46px;
    height: 46px;
    padding: 0 12px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1.5px solid var(--line);
    background: var(--card);
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;

    &:hover {
      border-color: var(--ink);
    }

    &.current {
      background: var(--ink);
      border-color: var(--ink);
      color: var(--signal);
    }

    &.dots {
      border: 0;
      background: none;
    }

    &.prev,
    &.next {
      background: var(--signal);
      border-color: var(--signal);
      color: var(--ink);
    }
  }
}

/* ─── Empty state ─── */
.no-results {
  max-width: 620px;
  margin: 0 auto;
  padding: 44px 30px;
  text-align: center;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
}

.no-results__title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.no-results__text {
  color: var(--muted);
  margin: 12px 0 24px;
}

/* ─── Single post ─── */
.post-body {
  padding-top: 0;
}

.post-cover {
  aspect-ratio: 16 / 9;
  border-radius: var(--r);
  margin: 0 0 50px;
  transform: translateY(-20px);
  box-shadow: var(--shadow-lg);

  @media (min-width: 768px) {
    aspect-ratio: 21 / 9;
  }
}

.post-body:not(:has(.post-cover)) {
  padding-top: 50px;
}

.post-single .prose {
  margin: 0 auto;
}

.prose .post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 24px 0 0;
  margin-top: 30px;
  border-top: 1px solid var(--line);

  a {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--chalk);
    color: var(--ink-3);
    font-size: 0.82rem;
    text-decoration: none;

    &:hover {
      background: var(--ink);
      color: var(--on-dark);
    }
  }
}

/* ─── Article typography (on top of inner.css' .prose) ─── */
.prose--post {
  font-size: 1.04rem;
  line-height: 1.75;

  @media (min-width: 768px) {
    font-size: 1.1rem;
  }

  > * + * {
    margin-top: 1.1em;
  }

  > p:first-child {
    font-size: 1.15em;
    color: var(--ink);
  }

  h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.1;
    margin: 1.8em 0 0.6em;
  }

  h3 {
    font-size: clamp(1.2rem, 2.2vw, 1.4rem);
    line-height: 1.2;
    margin: 1.6em 0 0.5em;
  }

  h4 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 1.4em 0 0.4em;
  }

  h2 + *,
  h3 + *,
  h4 + * {
    margin-top: 0;
  }

  li::marker {
    color: var(--signal-d);
    font-weight: 700;
  }

  strong {
    color: var(--ink);
  }

  blockquote {
    margin: 1.8em 0;
    padding: 22px 24px;
    border-left: 4px solid var(--signal);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    background: var(--chalk);
    font-size: 1.25rem;
    line-height: 1.35;

    p {
      color: var(--ink);
    }

    cite {
      display: block;
      margin-top: 10px;
      font-family: var(--text-font);
      font-size: 0.85rem;
      font-style: normal;
      font-weight: 600;
      color: var(--muted);
    }
  }

  figure,
  .wp-block-image {
    margin: 1.8em 0;
    overflow: visible;
    border-radius: 0;

    img {
      border-radius: var(--r-sm);
    }
  }

  figcaption,
  .wp-element-caption {
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: center;
    color: var(--muted);
    margin-top: 10px;
  }

  .wp-block-table,
  figure:has(table) {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--card);
  }

  table {
    font-size: 0.95rem;

    thead th {
      background: var(--chalk);
      color: var(--ink);
      font-weight: 700;
    }

    tr:last-child td {
      border-bottom: 0;
    }
  }

  code,
  kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--chalk);
    color: var(--ink);
  }

  pre {
    overflow-x: auto;
    padding: 20px 22px;
    border-radius: var(--r-sm);
    background: var(--ink);
    color: var(--on-dark-soft);
    font-size: 0.9rem;
    line-height: 1.6;

    code {
      padding: 0;
      background: none;
      color: inherit;
      font-size: inherit;
    }
  }

  .wp-block-button__link {
    display: inline-flex;
    padding: 14px 24px;
    border-radius: 14px;
    background: var(--signal);
    color: var(--ink);
    text-decoration: none;
  }
}

/* ─── Multi-page posts (<!--nextpage-->) ─── */
.post-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 30px;

  a,
  > span {
    min-width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0 10px;
    border-radius: 10px;
    border: 1.5px solid var(--line);
    font-weight: 700;
    text-decoration: none;
  }

  > span:not(:has(a)) {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--signal);
  }
}

/* ─── Previous / next article ─── */
.post-nav {
  display: grid;
  gap: 14px;
  max-width: 760px;
  margin: 50px auto 0;

  @media (min-width: 640px) {
    grid-template-columns: 1fr 1fr;
  }

  .legal-grid + & {
    @media (min-width: 992px) {
      max-width: none;
      margin-left: 300px;
    }
  }
}

.post-nav__link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  text-decoration: none;
  transition: border-color var(--hover-duration), transform var(--hover-duration) var(--ease);

  &:hover {
    border-color: var(--ink);
    transform: translateY(-3px);
  }
}

.post-nav__link--next {
  text-align: right;
  align-items: flex-end;

  @media (min-width: 640px) {
    grid-column: 2;
  }
}

.post-nav__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--signal-d);
}

.post-nav__title {
  font-family: var(--title-font);
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1.2;
  color: var(--ink);
}
