/* Safeguard: blog cards, the homepage "Explore insights in our blog" section and
   the /blogs/ index. A centred heading and intro, then cards with a rounded
   photograph, the date, a bold title, a three-line excerpt and category tags,
   and a "View More" link. Tokens come from safeguard-home.css. */

.sg-blog {
  padding: 2.75rem 0;
  background: #fff;
}

@media (min-width: 768px) {
  .sg-blog {
    padding: 4.5rem 0;
  }
}

.sg-blog--index {
  padding-top: 2.5rem;
}

.sg-blog__head {
  max-width: 40rem;
  margin: 0 auto 2.25rem;
  text-align: center;
}

.sg-blog .sg-blog__title {
  margin: 0 0 0.9rem;
  font-family: var(--sg-font-head);
  font-size: clamp(1.75rem, 3.4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--sg-navy);
}

.sg-blog .sg-blog__lead {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--sg-muted);
}

/* Cards */
.sg-blog .sg-blog-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem 2rem;
  margin: 0;
  padding: 0;
  padding-inline-start: 0;
  list-style: none;
}

@media (min-width: 560px) {
  .sg-blog .sg-blog-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 860px) {
  .sg-blog .sg-blog-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.sg-blog-card {
  margin: 0;
  min-width: 0;
}

.sg-blog .sg-blog-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.sg-blog-card__media {
  display: block;
  aspect-ratio: 4 / 3;
  margin-bottom: 1.1rem;
  overflow: hidden;
  border-radius: var(--sg-radius);
  background: var(--sg-navy);
}

.sg-blog-card__img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.sg-blog-card__date {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.875rem;
  line-height: 1.3;
  color: var(--sg-muted);
}

.sg-blog .sg-blog-card__title {
  margin: 0 0 0.6rem;
  font-family: var(--sg-font-head);
  font-size: clamp(1.2rem, 1.9vw, 1.45rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.01em;
  color: var(--sg-navy);
}

.sg-blog .sg-blog-card__excerpt {
  display: -webkit-box;
  margin: 0 0 1rem;
  overflow: hidden;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--sg-muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.sg-blog-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sg-blog-card__tag {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--sg-line);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--sg-navy);
}

/* View more */
.sg-blog .sg-blog__more {
  margin: 2.5rem 0 0;
  text-align: right;
}

.sg-blog .sg-blog__more-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sg-font-btn);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  color: var(--sg-blue);
}

.sg-blog .sg-blog__more-link:hover,
.sg-blog .sg-blog__more-link:focus-visible {
  color: var(--sg-blue-dark);
}

.sg-blog__more-link .sg-icon {
  flex-shrink: 0;
}

/* Index: pagination and empty state */
.sg-blog__pagination {
  margin-top: 3rem;
}

.sg-blog .sg-blog__pagination ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg-blog .sg-blog__pagination a,
.sg-blog .sg-blog__pagination span {
  display: inline-block;
  min-width: 2.5rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--sg-line);
  border-radius: var(--sg-radius);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: var(--sg-navy);
}

.sg-blog .sg-blog__pagination .current {
  border-color: var(--sg-navy);
  background: var(--sg-navy);
  color: #fff;
}

.sg-blog .sg-blog__empty {
  text-align: center;
  color: var(--sg-muted);
}

/* Hover: pointer devices only */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .sg-blog-card__img {
    transition: transform 0.4s ease-out;
  }

  .sg-blog-card__link:hover .sg-blog-card__img {
    transform: scale(1.04);
  }
}

.sg-blog-card__link:focus-visible {
  outline: 3px solid var(--sg-orange);
  outline-offset: 4px;
  border-radius: var(--sg-radius);
}
