.cst-controls[hidden], .cst-source[hidden] { display: none !important; }
.cst-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  width: 100%;
}
.cst-stage > .cst-slide { grid-area: 1 / 1; align-self: start; touch-action: pan-y pinch-zoom; }
.cst-slider[data-cst-direction="vertical"] .cst-slide { touch-action: pan-x pinch-zoom; }
.cst-stage > .cst-slide[data-cst-inactive] { visibility: hidden !important; pointer-events: none; }
.cst-slider:is([data-cst-moving],[data-cst-dragging]) .cst-stage { overflow: clip; }
.cst-slider[data-cst-dragging] { user-select: none; cursor: grabbing; }
.cst-slide[data-cst-dragged] { translate: var(--cst-drag-offset, 0px); }
.cst-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(var(--cst-thumb-width, 84px) * .3);
  width: 100%;
  padding: .75rem 0;
}
.cst-controls button {
  width: min(100%, var(--cst-thumb-width, 84px));
  box-sizing: border-box;
  flex: none;
  align-self: start;
  position: relative;
  aspect-ratio: var(--cst-thumb-ratio, 4 / 3);
  border: 2px solid transparent;
  border-radius: 5px;
  padding: 2px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.cst-controls button img { position: absolute; inset: 2px; display: block; width: calc(100% - 4px); height: calc(100% - 4px); object-fit: cover; border-radius: 2px; }
.cst-controls button[aria-current="true"] { border-color: var(--cst-thumb-hover, var(--primary_color, currentColor)); }
@media (any-hover: hover) {
  .cst-controls button:hover { border-color: var(--cst-thumb-hover, var(--primary_color, currentColor)); }
}
.cst-controls button:focus-visible { border-color: var(--cst-thumb-hover, var(--primary_color, currentColor)); outline: 2px solid currentColor; outline-offset: 2px; }
.cst-controls [role="status"] { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 767px) {
  .cst-controls {
    /* Three buttons and two gaps, each gap 30% of one button. */
    --cst-mobile-width: min(var(--cst-thumb-width, 84px), calc(100% / 3.6));
    flex-wrap: nowrap;
    justify-content: flex-start;
    min-width: 0;
    max-width: 100%;
    column-gap: calc(var(--cst-mobile-width) * .3);
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
  .cst-controls button { width: var(--cst-mobile-width); }
  .cst-controls button:first-of-type { margin-inline-start: auto; }
  .cst-controls button:last-of-type { margin-inline-end: auto; }
}
