/* V39 — one uncut AI visual row, sized by each work's original proportion. */
.visual-grid {
  --poster-height: clamp(220px, 25vw, 330px);
  --ppt-height: clamp(160px, 17vw, 225px);
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: center;
  width: min(1240px, 100%);
  gap: 18px;
}

body .visual-grid .work-item {
  flex: 0 1 auto;
  grid-column: auto;
  width: auto;
  min-width: 0;
  height: auto;
  margin: 0;
}

.visual-grid .work-item img,
.visual-grid .work-item:hover img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: contain !important;
  object-position: center;
}

/* Keep the four editorial pieces on one precise baseline once revealed.
   Earlier gallery styles add individual depth transforms; those offsets make
   a flex row look visually uneven, so this gallery intentionally opts out. */
.visual-grid .work-item {
  opacity: 0;
  filter: blur(4px);
  transform: translateY(20px);
  transition: opacity 760ms ease, filter 760ms ease, transform 760ms ease;
}

.visual-grid .work-item.is-revealed {
  opacity: 1;
  filter: blur(0);
  transform: none !important;
}

/* The first asset is the presentation; show it after the three posters. */
.visual-grid .work-item:nth-child(1) { order: 4; }
.visual-grid .work-item:nth-child(n + 2) { order: 1; }
.visual-grid .work-item:nth-child(n + 2) img { max-height: var(--poster-height); }
.visual-grid .work-item:nth-child(1) img { max-height: var(--ppt-height); }

.visual-grid .work-item figcaption {
  position: static;
  max-width: 100%;
  margin: 0;
  padding: 9px 0 0;
  background: transparent;
  opacity: 1;
  transform: none;
}

.visual-grid .work-item:before { display: none; }

@media (max-width: 767px) {
  .visual-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
  }

  body .visual-grid .work-item { width: 100%; }
  .visual-grid .work-item:nth-child(1),
  .visual-grid .work-item:nth-child(n + 2) { order: initial; }
  .visual-grid .work-item img,
  .visual-grid .work-item:nth-child(1) img,
  .visual-grid .work-item:nth-child(n + 2) img { width: 100%; height: auto; max-height: none; }
}
