/* ---------- Archive page ---------- */
/* All posts page */
.page-all-posts .site-grid { grid-template-columns: minmax(0, 1fr); max-width: 1200px; }

.archive__title { font-size: 2.4rem; line-height: 1.15; margin: 0 0 0.5rem; }
.archive__intro { color: var(--subtle); margin-bottom: 1.5rem; }
.archive__fallback { list-style: none; padding: 0; }
.archive__fallback li { padding: 0.4rem 0; display: flex; gap: 1rem; }
.archive__fallback time { color: var(--muted); min-width: 7rem; }

/* Controls */
.archive__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.archive__controls[hidden] { display: none; }
.seg { display: inline-flex; border: 1px solid var(--line); }
.seg[hidden] { display: none; }
.seg button {
  font: inherit;
  font-family: var(--gh-font-heading, system-ui, sans-serif);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  background: none;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--subtle);
  cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button[hidden] { display: none; }
.seg button:has(+ button[hidden]:last-child) { border-right: 0; }
.seg button:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--surface); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }
.seg--periods { border-color: var(--accent); }

.archive__count { font-size: 0.85rem; color: var(--muted); margin: 1rem 0; }
.archive__empty { color: var(--muted); padding: 2rem 0; }

/* Card view */
.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 2rem 1.5rem;
}
.archive-card__media {
  display: block;
  position: relative;
  aspect-ratio: 3 / 2;
  background: var(--surface);
  margin-bottom: 0.6rem;
  overflow: hidden;
}
.archive-card__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.archive-card__rank {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 2.2rem;
  padding: 0.3rem 0.5rem;
  text-align: center;
  font-weight: 700;
  background: var(--accent);
  color: var(--on-accent);
}
.archive-card__tag { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.archive-card__title { font-size: 1.05rem; line-height: 1.3; margin: 0.2rem 0 0.35rem; }
.archive-card__title a { color: inherit; text-decoration: none; }
.archive-card__title a:hover, .archive-card__media:hover + * + .archive-card__title a { text-decoration: underline; }
.archive-card__excerpt { font-size: 0.9rem; color: var(--subtle); margin: 0 0 0.4rem; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.archive-card__meta { font-size: 0.75rem; color: var(--muted); }

/* "All posts →" link next to the Latest heading on the front page */
.recent__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}
.recent__head .section-heading { border: 0 !important; padding: 0 !important; margin: 0 !important; }
.recent__all { font-size: 0.85rem; color: var(--accent); text-decoration: none; font-weight: 600; }
.recent__all:hover { text-decoration: underline; }

/* ---------- /articles/ and tag pages ---------- */
.tag-template .site-grid,
.site-grid:has(.articles-page) { grid-template-columns: minmax(0, 1fr); max-width: 1200px; }
.tag-header { padding-bottom: 1rem; margin-bottom: 1.75rem; border-bottom: 1px solid var(--line); }
.tag-header__desc { color: var(--subtle); margin: 0; max-width: 60ch; }
.recent__row .archive__empty { grid-column: 1 / -1; }
.pagination { font-size: 0.9rem; color: var(--muted); }
.pagination a { color: var(--accent); text-decoration: none; font-weight: 600; }
.pagination a:hover { text-decoration: underline; }
