.nous-glitch,
.nous-glitch__direct-wrapper {
  position: relative;
  overflow: hidden;
}

.nous-glitch--shortcode {
  aspect-ratio: var(--nous-glitch-ratio, 3 / 4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 1px;
}

.nous-glitch--shortcode > .nous-glitch__source {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nous-glitch__direct-wrapper {
  display: inline-block;
  line-height: 0;
}

.nous-glitch__source {
  display: block;
}

.nous-glitch__canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.nous-glitch--ready > .nous-glitch__canvas {
  opacity: 1;
  pointer-events: auto;
}

/* Shortcodes retain their original overlay blend. Other paths replace the
 * source only after the first successful WebGL draw. */
.nous-glitch--shortcode.nous-glitch--ready > .nous-glitch__canvas {
  mix-blend-mode: overlay;
}

.nous-glitch--replace.nous-glitch--ready > .nous-glitch__source {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .nous-glitch__canvas {
    display: none;
  }
}
