/* Post card. Self-contained: used on the author page, in related posts, later on home/category. */
.blog-post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  padding: 12px 12px 22px;   /* 22px under the author row, as in the design */
  border-radius: 24px;
  background: var(--background-white-to-black2);
  color: var(--text-main);
  font-family: "Inter", sans-serif;
  text-align: left;
}

/* Local resets (the card must not depend on the page it is placed in) */
.blog-post-card *,
.blog-post-card *::before,
.blog-post-card *::after { box-sizing: border-box; }
.blog-post-card ul { margin: 0; padding: 0; list-style: none; }
.blog-post-card li { margin: 0; }
.blog-post-card a { color: inherit; text-decoration: none; }
.blog-post-card img { display: block; max-width: 100%; }
.blog-post-card h2,
.blog-post-card h3,
.blog-post-card h4,
.blog-post-card p { margin: 0; text-transform: none; }

.blog-post-card .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.blog-post-card__wrapper { position: relative; width: 100%; }

.blog-post-card__image-wrapper {
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 12px;
  overflow: hidden;
  background: var(--image-placeholder); /* placeholder while the image loads or is missing */
}
.blog-post-card__image-wrapper img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* z-index above the full-card link (8) so the category chips stay clickable */
.blog-post-card__categories {
  position: absolute;
  z-index: 9;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0 4px;
}
.blog-post-card__categories li {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;             /* a chip may shrink below its text width */
  flex: 0 1 auto;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
  color: var(--badge-Light-text-default);
  background-color: rgba(255, 255, 255, 0.66);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  border-radius: 4px;
}
.blog-post-card__categories li a {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;  /* "Immigration & Resid…" */
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
}

.blog-post-card__content {
  flex: 1;                   /* grows to the row height, pushes the author to the bottom */
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.blog-post-card__content .blog-post-card__content-title {
  margin-top: 8px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  letter-spacing: -0.12px;
  color: var(--text-main);
}

.blog-post-card__meta {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  color: var(--input-text-default);
}
.blog-post-card__date,
.blog-post-card__reading-time { white-space: nowrap; }

.blog-post-card__author {
  position: relative;
  z-index: 9;
  width: 100%;
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.blog-post-card__author-avatar {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}
.blog-post-card__author-name {
  min-width: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 21px;
  color: inherit;
  text-decoration: none;
}
.blog-post-card__author-name:hover { color: inherit; text-decoration: none; }

/* Likes counter (shown only when > 0) */
.blog-post-card__likes {
  margin-left: auto;
  margin-right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--input-text-default, rgba(0, 0, 0, 0.46));
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
  line-height: 16px;
}
.blog-post-card .blog-post-card__likes svg {
  width: 12px;
  height: 12px;
  flex: none;
}


.blog-post-card__link {
  position: absolute;
  inset: 0;
  z-index: 8;
}

@media (min-width: 768px) {
  .blog-post-card { transition: box-shadow 0.3s ease; }

  .blog-post-card:hover {
    z-index: 1;   /* the shadow must not go under the cards of the next row */
    box-shadow: var(--card-hover-shadow);
  }
}


/* Shared grid of post cards */
.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 768px)  { .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1200px) { .post-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }



@media (max-width: 767px) {
  [data-steps] > .blog-post-card:nth-child(n+5):not(.is-shown) { display: none; }
}
@media (min-width: 768px) and (max-width: 1199px) {
  [data-steps] > .blog-post-card:nth-child(n+7):not(.is-shown) { display: none; }
}
@media (min-width: 1200px) {
  [data-steps] > .blog-post-card:nth-child(n+9):not(.is-shown) { display: none; }
}
