/*
 * Homepage featured posts component.
 *
 * Post selection uses native WordPress sticky posts. Presentation stays
 * consistent from one to four selected posts and across all target widths.
 */

.home-popular {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #fff 0%, #fffafd 100%);
}

.home-popular::before {
  content: "";
  position: absolute;
  width: 240px;
  height: 200px;
  top: 48px;
  right: max(18px, calc((100vw - var(--isp-container)) / 2));
  background-image: radial-gradient(rgba(237, 115, 164, .20) 1.2px, transparent 1.2px);
  background-size: 18px 18px;
  opacity: .42;
  -webkit-mask-image: linear-gradient(135deg, #000 0%, transparent 76%);
  mask-image: linear-gradient(135deg, #000 0%, transparent 76%);
  pointer-events: none;
}

/* Use the theme-wide homepage content width. */
.home-popular .isp-container {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 32px), var(--isp-container));
}

.home-popular .home-section-head {
  margin-bottom: 32px;
  align-items: end;
}

.home-popular .section-kicker {
  color: #b44d79;
}

.home-popular .home-section-head h2 {
  max-width: 760px;
  font-size: clamp(2.35rem, 4.4vw, 3.65rem);
  letter-spacing: -.052em;
}

.home-popular .home-section-head p {
  max-width: 590px;
  color: #696567;
  line-height: 1.6;
}

.home-popular .popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 16px;
  align-items: stretch;
  justify-items: center;
}

.home-popular .popular-card {
  width: 100%;
  max-width: 360px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(68, 68, 68, .075);
  border-radius: 22px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 10px 30px rgba(68, 68, 68, .05);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.home-popular .popular-card:hover,
.home-popular .popular-card:focus-within {
  border-color: rgba(237, 115, 164, .28);
  box-shadow: 0 17px 38px rgba(68, 68, 68, .085);
  transform: translateY(-3px);
}

.home-popular .popular-card__link {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}

/*
 * Featured artwork often contains its own text and composition. Keep the full
 * image visible rather than cropping it to fill the media frame.
 */
.home-popular .popular-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #f7fafb;
  border-bottom: 1px solid rgba(68, 68, 68, .055);
}

.home-popular .popular-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform .28s ease;
}

.home-popular .popular-card:hover .popular-card__media img,
.home-popular .popular-card:focus-within .popular-card__media img {
  transform: scale(1.012);
}

.home-popular .popular-card__badge {
  position: absolute;
  top: 13px;
  left: 13px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 999px;
  background: rgba(255, 255, 255, .95);
  color: #b44d79;
  font-size: .64rem;
  font-weight: 850;
  letter-spacing: .075em;
  line-height: 1.2;
  text-transform: uppercase;
  box-shadow: 0 6px 16px rgba(68, 68, 68, .08);
  backdrop-filter: blur(7px);
}

.home-popular .popular-card__body {
  min-width: 0;
  min-height: 148px;
  padding: 19px 20px 20px;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.home-popular .popular-card__body h3 {
  margin: 0 0 16px;
  color: var(--isp-ink);
  font-size: 1.08rem;
  font-weight: 850;
  line-height: 1.3;
  letter-spacing: -.016em;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/*
 * Older articles may generate noisy automatic excerpts from legacy post body
 * markup. Keep this curated section focused on artwork, title and destination.
 */
.home-popular .popular-card__body p {
  display: none;
}

.home-popular .text-link {
  margin-top: auto;
  color: #3f7899;
  font-size: .84rem;
  font-weight: 850;
}

.home-popular .text-link svg {
  width: 15px;
  height: 15px;
}

.home-popular .popular-card--starter .popular-card__body {
  min-height: 126px;
}

@media (max-width: 960px) {
  .home-popular .popular-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-popular .popular-card {
    max-width: none;
  }

  .home-popular .popular-card__media {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 700px) {
  .home-popular::before {
    width: 170px;
    height: 145px;
    right: -38px;
    opacity: .28;
  }

  .home-popular .home-section-head {
    margin-bottom: 25px;
  }

  .home-popular .home-section-head h2 {
    font-size: clamp(2.1rem, 10vw, 2.9rem);
  }

  .home-popular .popular-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .home-popular .popular-card {
    max-width: 520px;
  }

  .home-popular .popular-card__media {
    aspect-ratio: 16 / 9;
  }

  .home-popular .popular-card__body {
    min-height: 128px;
    padding: 17px 18px 18px;
  }

  .home-popular .popular-card__body h3 {
    margin-bottom: 13px;
    font-size: 1.02rem;
    -webkit-line-clamp: 3;
  }
}

@media (max-width: 420px) {
  .home-popular .isp-container {
    width: min(calc(100% - 20px), var(--isp-container));
  }

  .home-popular .popular-card {
    border-radius: 18px;
  }

  .home-popular .popular-card__badge {
    top: 9px;
    left: 9px;
    padding: 5px 7px;
    font-size: .58rem;
  }

  .home-popular .popular-card__body {
    min-height: 118px;
    padding: 15px 16px 16px;
  }

  .home-popular .popular-card__body h3 {
    font-size: .96rem;
  }

  .home-popular .text-link {
    font-size: .78rem;
  }
}

@media (hover: none) {
  .home-popular .popular-card:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-popular .popular-card,
  .home-popular .popular-card__media img,
  .home-popular .text-link svg {
    transition: none;
  }
}
