/* =============================================================================
 * Ohmania Menu Slider
 *
 * Deliberately low-specificity and self-contained. It runs inside a Hustle
 * popup, whose own stylesheet is loaded after this one, so everything is
 * namespaced under .rms and nothing relies on inherited typography.
 *
 * Colours are custom properties so a popup with a dark background can override
 * them from Hustle's own "Custom CSS" box without touching this file:
 *
 *   .rms { --rms-arrow-bg: rgba(255,255,255,.5); --rms-arrow-fg: #111; }
 * ============================================================================= */

.rms {
	--rms-max-width: 600px;
	--rms-arrow-bg: rgba(0, 0, 0, 0.45);
	--rms-arrow-bg-hover: rgba(0, 0, 0, 0.72);
	--rms-arrow-fg: #fff;
	--rms-dot: rgba(0, 0, 0, 0.25);
	--rms-dot-active: rgba(0, 0, 0, 0.78);
	--rms-focus: #fff;
	--rms-duration: 400ms;

	width: 100%;
	max-width: var(--rms-max-width);
	margin-inline: auto;
}

.rms *,
.rms *::before,
.rms *::after {
	box-sizing: border-box;
}

.rms__stage {
	position: relative;
}

/*
 * overflow:hidden is what clips the off-screen slides; touch-action:pan-y
 * hands vertical scrolling back to the browser so a swipe down the page still
 * scrolls while a swipe across still reaches the pointer handlers.
 */
.rms__viewport {
	overflow: hidden;
	touch-action: pan-y;
}

/*
 * Slide positions are percentages, never pixels. A percentage translate is
 * resolved by the browser against the track's own width at paint time, so the
 * slider needs no measurement at start-up and is therefore correct even when
 * it is initialised inside a popup that is still display:none.
 */
.rms__track {
	display: flex;
	align-items: flex-start;
	transition: transform var(--rms-duration) cubic-bezier(0.4, 0, 0.2, 1);
	will-change: transform;
}

/* While a finger is down the track must track the finger, not ease towards it. */
.rms.is-dragging .rms__track {
	transition: none;
}

.rms__slide {
	flex: 0 0 100%;
	width: 100%;
	min-width: 0;
}

.rms__link {
	display: block;
	text-decoration: none;
	border: 0;
	outline-offset: -3px;
}

.rms__link:focus-visible {
	outline: 3px solid var(--rms-arrow-bg-hover);
}

/*
 * No fixed height and no cropping: the image keeps its own aspect ratio and the
 * track is as tall as the tallest slide. Artwork of a consistent shape leaves
 * no gap; mixed shapes top-align, which is what align-items above sets.
 */
.rms__img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
}

/* -----------------------------------------------------------------------------
 * Arrows
 * -------------------------------------------------------------------------- */

.rms__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--rms-arrow-bg);
	color: var(--rms-arrow-fg);
	cursor: pointer;
	transition: background 200ms ease;
	-webkit-appearance: none;
	appearance: none;
}

.rms__arrow:hover {
	background: var(--rms-arrow-bg-hover);
}

.rms__arrow:focus-visible {
	background: var(--rms-arrow-bg-hover);
	outline: 3px solid var(--rms-focus);
	outline-offset: -2px;
}

.rms__arrow--prev {
	left: 8px;
}

.rms__arrow--next {
	right: 8px;
}

.rms__arrow svg {
	display: block;
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* -----------------------------------------------------------------------------
 * Dots
 * -------------------------------------------------------------------------- */

.rms__dots {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 4px;
	margin-top: 8px;
}

/*
 * The button is a 24px tap target; the visible dot is the 10px span inside it.
 * Sizing the button itself down to 10px would fail the minimum touch target.
 */
.rms__dot {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.rms__dot span {
	display: block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--rms-dot);
	transition: background 200ms ease, transform 200ms ease;
}

.rms__dot:hover span {
	background: var(--rms-dot-active);
}

.rms__dot.is-active span {
	background: var(--rms-dot-active);
	transform: scale(1.15);
}

.rms__dot:focus-visible {
	outline: 2px solid var(--rms-dot-active);
	outline-offset: -2px;
}

/* -----------------------------------------------------------------------------
 * Progressive enhancement and motion
 * -------------------------------------------------------------------------- */

/*
 * Controls stay hidden until the script has claimed the slider, so a visitor
 * with JavaScript blocked sees the first promotion rather than dead buttons.
 */
.rms:not([data-rms-ready]) .rms__arrow,
.rms:not([data-rms-ready]) .rms__dots {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.rms__track,
	.rms__arrow,
	.rms__dot span {
		transition: none;
	}
}

@media (max-width: 480px) {
	.rms__arrow {
		width: 34px;
		height: 34px;
	}

	.rms__arrow--prev {
		left: 4px;
	}

	.rms__arrow--next {
		right: 4px;
	}

	.rms__arrow svg {
		width: 16px;
		height: 16px;
	}
}
