/* ============================================================
   IMAGE BLOCK
   ============================================================ */

.image-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
}

/* Position — aligns both figure and caption together */
.image-block--left {
  align-items: flex-start;
}

.image-block--center {
  align-items: center;
}

.image-block--right {
  align-items: flex-end;
}

.image-block__figure {
  display: block;
  width: var(--image-width, 100%);
  max-width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background-color: var(--color-bg-soft);
  line-height: 0;
}

:root.dark .image-block__figure {
  border-color: rgba(255, 255, 255, 0.08);
}

.image-block__figure img {
  display: block;
  width: 100%;
  height: auto;
}

.image-block__link {
  display: block;
  width: var(--image-width, 100%);
  max-width: 100%;
  transition: opacity var(--duration-fast) var(--ease);
}

.image-block__link:hover {
  opacity: 0.9;
}

.image-block__link .image-block__figure {
  width: 100%;
}

/* Caption follows the image width and alignment */
.image-block__caption {
  width: var(--image-width, 100%);
  max-width: 100%;
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.6;
  text-align: center;
  font-style: italic;
  padding: 0 var(--space-2);
}

/* On narrow screens, force full width regardless of setting */
@media screen and (max-width: 640px) {
  .image-block__figure,
  .image-block__link,
  .image-block__caption {
    width: 100% !important;
  }
}
