/* Shared helpers for the case-study drafts: real media in panels, image grids. */
body.case-page {
  & main {
    & .dx-media {
      position: relative;
      border-radius: var(--r-lg);
      overflow: hidden;
      background: var(--fig-bg);
      & > img,
      & > video {
        display: block;
        inline-size: 100%;
        block-size: 100%;
        object-fit: cover;
      }
    }
    & .dx-grid {
      display: grid;
      gap: var(--space-0);
      &.ig-split {
        gap: var(--space-1);
      }
    }
    & .dx-grid--2 {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-1);
    }
    & .dx-cell {
      margin: 0;
      & .dx-media {
        border-radius: var(--r-md);
      }
      & figcaption {
        font-size: var(--fs-base);
        line-height: var(--lh-snug);
        color: var(--ink);
        & span {
          display: block;
          color: var(--muted);
        }
      }
    }
  }
}
.fig {
  & .mini,
  & .mid,
  & .img {
    position: relative;
    overflow: hidden;
  }
}

/* Grouped grid: one lead cell + a nested group (e.g. Instagram edit flows) */

/* Phones: videos never sit side by side; each takes its own row */
@media (width < 600px) {
  body.case-page {
    & main {
      & .dx-grid--2:has(video) {
        grid-template-columns: minmax(0, 1fr);
      }
    }
  }
}

/* Case-study media galleries: large, full-width images and clips (acuity, forage). */
.cs-gallery {
  display: grid;
  gap: var(--space-0);
}
.cs-gallery.cs-n1 {
  grid-template-columns: 1fr;
}
.cs-gallery.cs-n2 {
  grid-template-columns: repeat(2, 1fr);
}
.cs-cell {
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--fig-bg);
  & > img,
  & > video {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
  }
}
.cs-gallery.cs-n1 {
  & .cs-cell {
    & > img,
    & > video {
      block-size: auto;
    }
  }
}
.cs-gallery.cs-n2 {
  & .cs-cell {
    aspect-ratio: 4/3;
  }
}
@media (width < 760px) {
  .cs-gallery.cs-n2 {
    grid-template-columns: 1fr;
  }
}
.cs-gallery {
  & .cs-cell {
    & > video.nt-video {
      block-size: 100%;
      background: transparent;
    }
  }
}
.cs-gallery.cs-n1 {
  & .cs-cell {
    & > video.nt-video {
      block-size: auto;
    }
  }
}

/* Shared exploration slideshow: offset glass arrows and compact progress dots. */
.igx__stage {
  position: relative;
}
.igx__track {
  display: flex;
  gap: var(--space-0);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  border-radius: var(--r-lg);
  &::-webkit-scrollbar {
    display: none;
  }
}
.igx__btn {
  position: absolute;
  inset-block-start: 50%;
  z-index: 3;
  inline-size: var(--s-9);
  block-size: var(--s-9);
  translate: 0 -50%;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  color: var(--ink);
  cursor: pointer;
  transition: opacity var(--dur-1) ease;
  & svg {
    inline-size: var(--s-5);
    block-size: var(--s-5);
    display: block;
    fill: currentColor;
  }
  &:disabled {
    opacity: 0;
    pointer-events: none;
  }
}
.igx__btn--prev {
  inset-inline-start: max(calc(var(--s-6) * -1), calc(var(--gutter) * -1));
}
.igx__btn--next {
  inset-inline-end: max(calc(var(--s-6) * -1), calc(var(--gutter) * -1));
}
.igx__dots {
  display: flex;
  justify-content: center;
  gap: var(--s-2);
  & span {
    inline-size: calc(var(--space-0) * 0.75);
    block-size: calc(var(--space-0) * 0.75);
    border-radius: var(--r-sm);
    background: var(--line);
    transition:
      inline-size var(--dur-1),
      background var(--dur-1);
    &.is-on {
      inline-size: calc(var(--s-6) * 0.75);
      background: var(--ink);
    }
  }
}
@media (width < 760px) {
  .igx__btn--prev {
    inset-inline-start: calc(var(--space-0) * -1.5);
  }
  .igx__btn--next {
    inset-inline-end: calc(var(--space-0) * -1.5);
  }
}
