/* Ambient glow behind pictures — blurred, scaled copy of the same image */

.ambiance {
  position: relative;
  display: block;
  isolation: isolate;
  margin-left: auto;
  margin-right: auto;
}

.ambiance-glow {
  position: absolute;
  inset: 8%;
  width: 84%;
  height: 84%;
  object-fit: cover;
  transform: scale(1.25);
  filter: blur(28px) saturate(1.3) brightness(0.85);
  -webkit-filter: blur(28px) saturate(1.3) brightness(0.85);
  opacity: 0.7;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  border-radius: 1rem;
}

.ambiance-photo {
  position: relative;
  z-index: 1;
  display: block;
  margin-left: auto;
  margin-right: auto;
  border-radius: 0.85rem;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.16),
    0 8px 22px rgba(0, 0, 0, 0.22);
}

.ambiance-hero {
  max-width: 36rem;
  padding: 1.5rem 1rem 1.25rem;
}

.ambiance-hero .ambiance-photo {
  max-height: min(28rem, 55vh);
  width: auto;
  max-width: 100%;
  object-fit: contain;
  background: transparent;
}

.ambiance-round {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.45rem;
}

.ambiance-round .ambiance-glow {
  inset: 10%;
  width: 80%;
  height: 80%;
  border-radius: 9999px;
  transform: scale(1.18);
  filter: blur(16px) saturate(1.2) brightness(0.92);
  -webkit-filter: blur(16px) saturate(1.2) brightness(0.92);
  opacity: 0.55;
}

.ambiance-round .ambiance-photo {
  margin: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  object-fit: cover;
  object-position: center 32%;
}

.prose .ambiance:not(.ambiance-round):not(.ambiance-hero),
.article-content .ambiance:not(.ambiance-round):not(.ambiance-hero) {
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  padding: 1.1rem 0.75rem;
}

.prose .ambiance .ambiance-photo,
.prose .ambiance .ambiance-glow,
.article-content .ambiance .ambiance-photo,
.article-content .ambiance .ambiance-glow {
  margin-top: 0;
  margin-bottom: 0;
}

.prose .ambiance figcaption,
.article-content .ambiance figcaption {
  position: relative;
  z-index: 1;
  margin-top: 0.75rem;
}

/* Card / list thumbnails: sharp poster over a blurred fill of the same image */
.thumbnail_card,
.thumbnail_card_related,
.thumbnail_card_term,
.thumbnail {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background-color: rgba(0, 0, 0, 0.18);
  background-size: 0 0;
}

.thumbnail_card::before,
.thumbnail_card_related::before,
.thumbnail_card_term::before,
.thumbnail::before,
.thumbnail_card::after,
.thumbnail_card_related::after,
.thumbnail_card_term::after,
.thumbnail::after {
  content: "";
  background-image: inherit;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.thumbnail_card::before,
.thumbnail_card_related::before,
.thumbnail_card_term::before,
.thumbnail::before {
  position: absolute;
  inset: -20%;
  background-size: cover;
  filter: blur(18px) saturate(1.25) brightness(0.82);
  -webkit-filter: blur(18px) saturate(1.25) brightness(0.82);
  opacity: 0.65;
  transform: scale(1.1);
  z-index: 0;
}

.thumbnail_card::after,
.thumbnail_card_related::after,
.thumbnail_card_term::after,
.thumbnail::after {
  position: absolute;
  inset: 6%;
  background-size: contain;
  border-radius: 0.55rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  z-index: 1;
}

.thumbnail_card {
  height: 220px;
}

html:not(.dark) .ambiance-glow {
  filter: blur(28px) saturate(1.15) brightness(1.02);
  -webkit-filter: blur(28px) saturate(1.15) brightness(1.02);
  opacity: 0.5;
}

html:not(.dark) .thumbnail_card::before,
html:not(.dark) .thumbnail_card_related::before,
html:not(.dark) .thumbnail_card_term::before,
html:not(.dark) .thumbnail::before {
  filter: blur(18px) saturate(1.15) brightness(1);
  -webkit-filter: blur(18px) saturate(1.15) brightness(1);
  opacity: 0.5;
}

@media (prefers-reduced-transparency: reduce), (prefers-reduced-motion: reduce) {
  .ambiance-glow {
    display: none;
  }

  .thumbnail_card,
  .thumbnail_card_related,
  .thumbnail_card_term,
  .thumbnail {
    background-size: cover;
  }

  .thumbnail_card::before,
  .thumbnail_card_related::before,
  .thumbnail_card_term::before,
  .thumbnail::before,
  .thumbnail_card::after,
  .thumbnail_card_related::after,
  .thumbnail_card_term::after,
  .thumbnail::after {
    content: none;
  }
}

@media print {
  .ambiance-glow {
    display: none;
  }

  .thumbnail_card,
  .thumbnail_card_related,
  .thumbnail_card_term,
  .thumbnail {
    background-size: cover;
  }

  .thumbnail_card::before,
  .thumbnail_card_related::before,
  .thumbnail_card_term::before,
  .thumbnail::before,
  .thumbnail_card::after,
  .thumbnail_card_related::after,
  .thumbnail_card_term::after,
  .thumbnail::after {
    content: none;
  }
}
