.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(38rem, 100%), 1fr));
  gap: 3rem;
  margin-block: 4rem;
}

.post-card {
  display: block;
}

.post-card__link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.post-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.post-card__image-container {
  position: relative;
  overflow: hidden;
  border-radius: 2.4rem;
  border-radius: clamp(0.6rem, 0.6rem + 1vw, 2.4rem);
  --badge-s: 0.001;
  transition:
    --badge-s 0.25s ease,
    border-radius 0.25s ease;
}

.post-card__image-container::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  pointer-events: none;
}

.post-card__image {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: var(--image-aspect-ratio);
  background-color: #e8e8e8;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.post-card__author-cutout {
  --cutout-r: clamp(1rem, 1rem + 1vw, 2.4rem);
  position: absolute;
  bottom: 0;
  left: 0;
  width: clamp(3rem, 3rem + 2vw, 9rem);
  height: clamp(3rem, 3rem + 2vw, 9rem);
  padding: 1.2rem 1.2rem 0.8rem 0.8rem;
  background: white;
  box-shadow: -1px 1px 0 0 white;
  border-radius: 0 var(--cutout-r) 0 0;
  z-index: 2;
  transform: scale(var(--badge-s));
  transform-origin: bottom left;
}

.post-card__author-cutout::before,
.post-card__author-cutout::after {
  content: "";
  position: absolute;
  width: var(--cutout-r);
  height: var(--cutout-r);
}

.post-card__author-cutout::before {
  top: calc(-1 * var(--cutout-r));
  left: -1px;
  width: calc(var(--cutout-r) + 1px);
  background: radial-gradient(
    circle at 100% 0%,
    transparent calc(var(--cutout-r) - 0.5px),
    white calc(var(--cutout-r) + 0.5px)
  );
}

.post-card__author-cutout::after {
  bottom: -1px;
  right: calc(-1 * var(--cutout-r));
  height: calc(var(--cutout-r) + 1px);
  background: radial-gradient(
    circle at 100% 0%,
    transparent calc(var(--cutout-r) - 0.5px),
    white calc(var(--cutout-r) + 0.5px)
  );
}

.post-card__author-reveal {
  --size: clamp(4.2rem, 4.2rem + 1vw, 8rem);
  position: absolute;
  bottom: 0;
  left: 0;
  width: var(--size);
  height: var(--size);
  z-index: 3;
  clip-path: inset(
    calc(var(--size) - 9.2rem * var(--badge-s))
      calc(var(--size) - 9.2rem * var(--badge-s)) 0 0 round
      calc(1.2rem * var(--badge-s))
  );
}

.post-card__author-image {
  /* Chrome fix: transitioned property is required to be defined on the element itself */
  --badge-s-local: var(--badge-s);
  --td: clamp(0.2rem, 0.2rem + 1vw, 1rem); /* transition gap */
  display: block;
  width: 100%;
  height: 100%;
  border-radius: clamp(0.8rem, 0.8rem + 0.5vw, 1.6rem);
  object-fit: cover;
  transition: --badge-s-local 0.25s ease;
  transform: translate(
    calc(var(--td) * var(--badge-s-local)),
    calc(var(--td) * var(--badge-s-local) * -1)
  );
}

@media (hover: hover) {
  .post-card__link:hover .post-card__image-container::after {
    background: rgba(0, 0, 0, 0.05);
  }

  .post-card__link:hover .post-card__image {
    transform: scale(1.05);
  }

  .post-card__link:hover
    .post-card__image-container:has(.post-card__author-cutout) {
    --badge-s: 1;
    border-bottom-left-radius: 0;
  }

  .post-card__link:hover .post-card__title {
    text-decoration: underline;
    text-underline-offset: 0.5rem;
  }
}

.post-card__meta {
  display: flex;
  align-items: center;
  margin-top: 2.4rem;
  font-size: 1.4rem;
  color: var(--color-text);
}

.post-card__title {
  margin: 0.5rem 0 0 0;
  font-size: 2.4rem;
  line-height: 1.3;
  color: var(--color-secondary);
}

.post-card__learn-more {
  align-self: start;
  margin-top: auto;
  padding-top: 1.6rem;
}

@media (hover: hover) {
  .post-card__link:hover .post-card__learn-more {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
  }
}

.tag {
  display: inline-block;
}

.tag--subcategory {
  font-family: var(--font-light);
  font-size: 1.2rem;
  color: var(--color-primary);
  background-color: #e7f1fc;
  border: 1px solid var(--color-primary);
  border-radius: 0.3rem;
  padding: 0.2rem 0.8rem;
}

.post-card__category {
  font-family: var(--font-medium);
}

.post-card__separator {
  margin-left: 1.2rem;
  margin-right: 0.8rem;
}

.post-card__separator::after {
  content: "";
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background-color: currentColor;
  vertical-align: middle;
}

.post-card__reading-time {
  font-family: var(--font-regular);
}
