.rj-section {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-color: var(--ink);
  color: var(--cream, var(--cream));
}
.rj-section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(251, 247, 238, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(251, 247, 238, .06) 1px, transparent 1px);
  background-size: 48px 48px;
}
.rj-section::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.rj { width: 100%; min-width: 0; max-width: 100%; position: relative; }
.rj:focus-visible { outline: 3px solid var(--cream, var(--cream)); outline-offset: 6px; border-radius: 6px; }
.rj-header { margin-bottom: 2rem; }
.rj-header .eyebrow { color: var(--cream, var(--cream)); }
.rj-header h2 { font-size: clamp(2.5rem, 6vw, 4.5rem); margin-top: 1rem; color: var(--cream, var(--cream)); }

.rj-stage-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.rj-stage {
  --rj-near: clamp(85px, 20vw, 205px);
  --rj-far: clamp(125px, 33vw, 340px);
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 330px;
  perspective: 1200px;
  overflow: hidden;
  overflow: clip;
  overflow-clip-margin: 24px;
}

.rj-slide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 340px;
  min-width: 0;
  max-width: calc(100% - 16px);
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
  transition: transform 450ms cubic-bezier(.22, .61, .36, 1), opacity 450ms ease-out, filter 450ms ease-out;
  will-change: transform, opacity;
  z-index: 1;
}
.rj-slide[data-rj-offset="0"] { transform: translate(-50%, -50%); opacity: 1; z-index: 5; }
.rj-slide[data-rj-offset="-1"] { transform: translate(calc(-50% - var(--rj-near)), -50%) scale(.8) rotateY(30deg); opacity: .82; filter: brightness(.9); z-index: 3; }
.rj-slide[data-rj-offset="1"] { transform: translate(calc(-50% + var(--rj-near)), -50%) scale(.8) rotateY(-30deg); opacity: .82; filter: brightness(.9); z-index: 3; }
.rj-slide[data-rj-offset="-2"] { transform: translate(calc(-50% - var(--rj-far)), -50%) scale(.65) rotateY(45deg); opacity: .28; filter: brightness(.55); z-index: 1; }
.rj-slide[data-rj-offset="2"] { transform: translate(calc(-50% + var(--rj-far)), -50%) scale(.65) rotateY(-45deg); opacity: .28; filter: brightness(.55); z-index: 1; }
.rj-slide[data-rj-offset="hidden"] { transform: translate(-50%, -50%) scale(.5); opacity: 0; visibility: hidden; pointer-events: none; z-index: 0; }
.rj-slide:not([data-rj-offset="0"]) { cursor: pointer; }
/* Before JS assigns offsets: show first slide only, never hide it */
.rj-stage:not(:has([data-rj-offset])) .rj-slide:not(:first-child) { opacity: 0; visibility: hidden; }

.rj-frame {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: var(--ink);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7), 0 4px 10px rgba(0, 0, 0, .35);
}
.rj-media { min-width: 0; max-width: 100%; position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--ink); }
.rj-media img { display: block; position: absolute; inset: 0; width: 100%; height: 100%; max-width: 100%; object-fit: cover; user-select: none; }
.rj-stage { touch-action: pan-y; cursor: grab; }
.rj-dragging .rj-stage { cursor: grabbing; }

.rj-btn { width: 52px; height: 52px; min-width: 52px; padding: 0; flex: none; position: relative; z-index: 6; }
.rj-btn:focus-visible, .rj-play:focus-visible { outline: 3px solid var(--cream, var(--cream)); outline-offset: 3px; }
.rj-btn:disabled { opacity: .45; cursor: default; }

.rj-caption {
  margin: 1.25rem auto 0;
  max-width: 34rem;
  min-height: 1.5em;
  text-align: center;
  color: var(--cream, var(--cream));
  font-family: 'Archivo Black', sans-serif;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .85rem;
}
.rj-status {
  display: flex;
  min-height: 60px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  margin: 1rem auto 0;
  max-width: 30rem;
  padding-bottom: 6px;
}
.rj-progress {
  flex: 1 1 8rem;
  min-width: 6rem;
  height: 4px;
  border-radius: 4px;
  background: rgba(251, 247, 238, .2);
  overflow: hidden;
}
.rj-progress-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--cream, var(--cream));
  transform-origin: left center;
  transform: scaleX(var(--rj-progress, 0));
}
.rj-counter {
  min-width: 5ch;
  text-align: center;
  color: var(--cream, var(--cream));
  font-family: 'Archivo Black', sans-serif;
  font-variant-numeric: tabular-nums;
}
.rj-play { padding: .6rem .85rem; font-size: 1rem; }

.rj-single { width: min(340px, 100%); margin: 0 auto; }

.rj [hidden] { display: none !important; }
.rj:not(.rj-ready) .rj-btn { display: none; }

@media (max-width: 767px) {
  .rj-stage { height: 270px; flex-basis: 100%; }
  .rj-slide { width: 260px; }
  .rj-single { width: min(260px, 100%); }
  .rj-stage-shell { display: block; padding-bottom: 40px; }
  .rj-btn { position: absolute; bottom: 0; width: 48px; height: 48px; min-width: 48px; }
  .rj-prev { left: 0; }
  .rj-next { right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .rj-stage { perspective: none; }
  .rj-slide, .rj-slide[data-rj-offset] { transform: translate(-50%, -50%) !important; filter: none !important; transition: opacity 160ms linear !important; }
  .rj-slide:not([data-rj-offset="0"]):not(:only-child) { opacity: 0; visibility: hidden; pointer-events: none; }
  .rj-stage:not(:has([data-rj-offset])) .rj-slide:first-child { opacity: 1; visibility: visible; }
  .rj-progress-fill { transition: none; }
}
.rj-reduced .rj-stage { perspective: none; }
.rj-reduced .rj-slide, .rj-reduced .rj-slide[data-rj-offset] { transform: translate(-50%, -50%) !important; filter: none !important; transition: opacity 250ms linear; }
.rj-reduced .rj-slide[data-rj-offset]:not([data-rj-offset="0"]) { opacity: 0; visibility: hidden; pointer-events: none; }
.rj-reduced .rj-progress-fill { transition: none; }
