/**
 * Blog & release-notes archive listing — SaaS styling aligned with Workzilla static site.
 * WordPress: wrap the post grid in a template that uses WP_Query (see HTML comments on each page).
 */

.page-blog,
.page-release-notes {
  --bg: #fff;
  --text: #0b1220;
  --muted: #5b677a;
  --border: rgba(15, 23, 42, 0.1);
  --brand: #f97316;
  --brand2: #ea580c;
  --blog-surface: #f8fafc;
  --blog-card-radius: 14px;
}

/* --- Shared hero (matches videos / about rhythm) --- */
.page-blog .blog-archive-intro,
.page-release-notes .blog-archive-intro {
  border-bottom: 1px solid var(--border);
}
.page-blog .blog-archive-hero,
.page-release-notes .blog-archive-hero {
  text-align: center;
  padding: clamp(36px, 6vw, 56px) 20px clamp(28px, 5vw, 40px);
}
.page-blog .blog-archive-eyebrow,
.page-release-notes .blog-archive-eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9a3412;
}
.page-blog .blog-archive-title,
.page-release-notes .blog-archive-title {
  margin: 0 0 14px;
  font-size: clamp(36px, 5.2vw, 52px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  position: relative;
  display: inline-block;
  padding-bottom: 12px;
  max-width: 100%;
}
.page-blog .blog-archive-title::after,
.page-release-notes .blog-archive-title::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 56px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
}
.page-blog .blog-archive-lead,
.page-release-notes .blog-archive-lead {
  margin: 0 auto;
  max-width: 52ch;
  font-size: clamp(16px, 1.9vw, 18px);
  line-height: 1.6;
  color: var(--muted);
}

.page-blog .blog-archive-body,
.page-release-notes .blog-archive-body {
  padding: clamp(32px, 5vw, 56px) 0 clamp(64px, 8vw, 96px);
}

/* --- Post grid --- */
.post-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: clamp(20px, 3vw, 28px);
}

/* Release notes should read as a full-width changelog list. */
.page-release-notes .post-grid {
  grid-template-columns: 1fr;
}

.page-release-notes .post-card__link {
  flex-direction: row;
}

.page-release-notes .post-card__media {
  flex: 0 0 clamp(220px, 28vw, 320px);
  aspect-ratio: auto;
  min-height: 100%;
}

.page-release-notes .post-card__body {
  padding: clamp(18px, 2.2vw, 24px);
}

@media (max-width: 860px) {
  .page-blog .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (max-width: 860px) {
  .page-release-notes .post-card__link {
    flex-direction: column;
  }

  .page-release-notes .post-card__media {
    flex: 0 0 auto;
    aspect-ratio: 16 / 9;
    min-height: 0;
  }
}

/* --- Cards --- */
.post-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--blog-card-radius);
  background: #fff;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 24px -8px rgba(15, 23, 42, 0.08);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  position: relative;
}
.post-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: calc(100% - 24px);
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  transform: translateX(-50%) scaleX(0);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
  pointer-events: none;
  z-index: 1;
}
.post-card:hover {
  border-color: rgba(249, 115, 22, 0.35);
  box-shadow:
    0 4px 12px rgba(15, 23, 42, 0.06),
    0 16px 40px -12px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(249, 115, 22, 0.15);
  transform: translateY(-2px);
}
.post-card:hover::before {
  transform: translateX(-50%) scaleX(1);
  opacity: 1;
}

.post-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
  outline: none;
}
.post-card__link:focus-visible {
  outline: 2px solid rgba(249, 115, 22, 0.55);
  outline-offset: 2px;
}

.post-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(145deg, #e2e8f0, #f1f5f9);
  overflow: hidden;
}
.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.post-card__media--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1c1917 100%);
}
.post-card__media-icon {
  width: clamp(40px, 10vw, 56px);
  height: clamp(40px, 10vw, 56px);
  color: rgba(255, 255, 255, 0.88);
  opacity: 0.9;
}

.post-card__body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}

.post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}
.post-card__date {
  font-variant-numeric: tabular-nums;
}
.post-card__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.post-card__cat {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  background: var(--blog-surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.post-card__cat--product {
  border-color: rgba(249, 115, 22, 0.35);
  color: #9a3412;
  background: #fff7ed;
}
.post-card__cat--release {
  border-color: rgba(59, 130, 246, 0.35);
  color: #1d4ed8;
  background: #eff6ff;
}
.post-card__cat--company {
  color: #475569;
}

.post-card__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--text);
}
.post-card__excerpt {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  flex: 1;
}

.post-card__footer {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.post-card__read {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.post-card__read svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}
.post-card:hover .post-card__read svg {
  transform: translateX(3px);
}

/* Version chip (used on release notes and optionally blog cards) */
.post-card__version {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.12), rgba(234, 88, 12, 0.08));
  border: 1px solid rgba(249, 115, 22, 0.25);
  color: #c2410c;
}

/* Pagination (WordPress paginate_links type=list + static preview) */
.post-list-pagination {
  margin-top: clamp(36px, 5vw, 48px);
  padding-top: clamp(28px, 4vw, 36px);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.post-list-pagination:has(.post-list-pagination__note) {
  justify-content: space-between;
}
/* WordPress core: ul.page-numbers */
.post-list-pagination ul.page-numbers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 100%;
}
.post-list-pagination ul.page-numbers li {
  margin: 0;
  padding: 0;
  list-style: none;
}
.post-list-pagination ul.page-numbers a,
.post-list-pagination ul.page-numbers span.page-numbers {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 40px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  text-decoration: none;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.post-list-pagination ul.page-numbers a:hover {
  border-color: rgba(249, 115, 22, 0.45);
  background: #fffaf5;
  color: var(--text);
}
.post-list-pagination ul.page-numbers span.page-numbers.current {
  border-color: rgba(249, 115, 22, 0.55);
  background: rgba(249, 115, 22, 0.1);
  color: var(--text);
  cursor: default;
}
.post-list-pagination ul.page-numbers span.page-numbers.dots {
  min-width: auto;
  padding: 0 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}
.post-list-pagination ul.page-numbers a.prev,
.post-list-pagination ul.page-numbers a.next {
  padding: 0 16px;
  min-width: auto;
}
.post-list-pagination ul.page-numbers a.prev {
  margin-right: 4px;
}
.post-list-pagination ul.page-numbers a.next {
  margin-left: 4px;
}
.post-list-pagination__note {
  font-size: 13px;
  color: var(--muted);
  max-width: 48ch;
  line-height: 1.5;
}
.post-list-pagination__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.post-list-pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.post-list-pagination__btn:hover:not([disabled]) {
  border-color: rgba(249, 115, 22, 0.45);
  background: #fffaf5;
}
.post-list-pagination__btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.post-list-pagination__btn--primary {
  border-color: rgba(249, 115, 22, 0.45);
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color: #fff;
  border: none;
}
.post-list-pagination__btn--primary:hover:not([disabled]) {
  filter: brightness(1.03);
  background: linear-gradient(135deg, var(--brand), var(--brand2));
}

@media (max-width: 520px) {
  .post-list-pagination {
    flex-direction: column;
  }
  .post-list-pagination:has(.post-list-pagination__note) {
    align-items: flex-start;
  }
  .post-list-pagination:not(:has(.post-list-pagination__note)) {
    align-items: center;
  }
}
