/*
 * RMHC Core — Elementor widget styles.
 *
 * Structural only. Colour, typography and spacing are exposed as Elementor
 * controls, so setting them here would mean overriding the site editor from a
 * file the site editor cannot see.
 */

.rmhc-stat__value {
	display: block;
	line-height: 1.1;
	/* Stops the number jittering horizontally as digits change while counting. */
	font-variant-numeric: tabular-nums;
}

.rmhc-stat__label {
	display: block;
	margin-block-start: 0.35em;
}

/* ---------------------------------------------------------------------------
 * Tabbed Gallery (rmhc-gallery)
 *
 * Follows the Global guidelines' Image Gallery block: red active tab
 * underline, arrows at the upper right, dark caption strip, red border on the
 * active thumbnail. Colours are the brand constants rather than controls
 * because the block is specified exactly and reused unchanged on every page.
 * ------------------------------------------------------------------------ */

.rmhc-gallery {
	--rmhc-gallery-accent: #DB0007;
	--rmhc-gallery-ink: #000000;
	--rmhc-gallery-radius: 12px;
	--rmhc-gallery-ratio: 16 / 9;
	/* Shrunken sticky header, gallery heading, tabs, thumbnails and breathing room. */
	--rmhc-gallery-reserve: 300px;
}

/*
 * On desktop, narrow the gallery until tabs, image and thumbnails fit in one
 * screen, so visitors never scroll past the image to change it. Keeping the
 * width tied to the image shape avoids cropping the photo any further, and
 * centring it balances the space either side.
 */
@media (min-width: 1025px) {
	.rmhc-gallery {
		max-width: calc((100svh - var(--rmhc-gallery-reserve)) * var(--rmhc-gallery-ratio));
		min-width: min(100%, 640px);
		margin-inline: auto;
	}

	.rmhc-gallery .rmhc-gallery__thumb {
		flex-basis: 120px;
	}
}

/*
 * Elementor's lightbox sits at z-index 9999, under the sticky site header
 * (10020), which would cover its close button. Lift only gallery lightboxes.
 */
[id^="elementor-lightbox-slideshow-rmhc-gallery-"] {
	z-index: 10050;
}

.rmhc-gallery__bar {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	margin-block-end: 14px;
}

.rmhc-gallery__tabs {
	display: flex;
	gap: 28px;
	min-width: 0;
	overflow-x: auto;
	scrollbar-width: none;
}

.rmhc-gallery__tabs::-webkit-scrollbar {
	display: none;
}

.rmhc-gallery__tab {
	flex: none;
	padding: 6px 0;
	border: 0;
	border-block-end: 3px solid transparent;
	border-radius: 0;
	background: none;
	color: var(--rmhc-gallery-ink);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.rmhc-gallery__tab:hover {
	color: var(--rmhc-gallery-accent);
	background: none;
}

.rmhc-gallery__tab[aria-selected="true"] {
	color: var(--rmhc-gallery-accent);
	border-block-end-color: var(--rmhc-gallery-accent);
}

.rmhc-gallery__arrows {
	display: flex;
	flex: none;
	gap: 8px;
}

.rmhc-gallery__arrow {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--rmhc-gallery-ink);
	cursor: pointer;
}

.rmhc-gallery__arrow:hover {
	background: rgba(0, 0, 0, 0.08);
	color: var(--rmhc-gallery-ink);
}

.rmhc-gallery__arrow svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.rmhc-gallery__stage {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--rmhc-gallery-radius);
	background: #E6E2FF;
}

.rmhc-gallery__slide {
	position: absolute;
	inset: 0;
	margin: 0;
}

.rmhc-gallery__slide[hidden] {
	display: none;
}

/* The whole slide is the lightbox link. */
.rmhc-gallery__zoom {
	display: block;
	height: 100%;
	cursor: zoom-in;
}

.rmhc-gallery__zoom-icon {
	position: absolute;
	inset-block-start: 12px;
	inset-inline-end: 12px;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.62);
	color: #FFFFFF;
	transition: background-color 0.15s ease;
}

.rmhc-gallery__zoom-icon svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.25;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.rmhc-gallery__zoom:hover .rmhc-gallery__zoom-icon {
	background: var(--rmhc-gallery-accent);
}

.rmhc-gallery__zoom:focus-visible {
	outline: 3px solid var(--rmhc-gallery-accent);
	outline-offset: -6px;
}

.rmhc-gallery__zoom:focus-visible .rmhc-gallery__zoom-icon {
	background: var(--rmhc-gallery-accent);
}

/* Doubled class beats Elementor's `.elementor img { height: auto }`. */
.rmhc-gallery .rmhc-gallery__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

.rmhc-gallery__caption {
	position: absolute;
	inset-inline: 0;
	inset-block-end: 0;
	padding: 10px 16px;
	background: rgba(0, 0, 0, 0.62);
	color: #FFFFFF;
	font-size: 15px;
	line-height: 1.3;
	/* Sits over the lightbox link; let clicks through to it. */
	pointer-events: none;
}

.rmhc-gallery__thumbs {
	display: flex;
	gap: 12px;
	margin-block-start: 14px;
	overflow-x: auto;
	padding-block-end: 4px;
}

.rmhc-gallery__thumb {
	flex: 0 0 calc((100% - 48px) / 5);
	min-width: 96px;
	aspect-ratio: 4 / 3;
	padding: 0;
	overflow: hidden;
	border: 3px solid transparent;
	border-radius: 8px;
	background: none;
	cursor: pointer;
}

.rmhc-gallery__thumb[aria-pressed="true"] {
	border-color: var(--rmhc-gallery-accent);
}

.rmhc-gallery__thumb:hover {
	background: none;
	border-color: rgba(219, 0, 7, 0.45);
}

.rmhc-gallery__thumb[aria-pressed="true"]:hover {
	border-color: var(--rmhc-gallery-accent);
}

.rmhc-gallery .rmhc-gallery__thumb-image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

/*
 * Hello Elementor's reset paints a pink background and white text on every
 * focused or hovered button. Neutralise it for all gallery controls; focus is
 * shown with the outline below instead.
 */
.rmhc-gallery .rmhc-gallery__tab:focus,
.rmhc-gallery .rmhc-gallery__tab:active,
.rmhc-gallery .rmhc-gallery__thumb:focus,
.rmhc-gallery .rmhc-gallery__thumb:active {
	background: none;
}

.rmhc-gallery .rmhc-gallery__tab:focus {
	color: var(--rmhc-gallery-ink);
}

.rmhc-gallery .rmhc-gallery__tab[aria-selected="true"]:focus {
	color: var(--rmhc-gallery-accent);
}

.rmhc-gallery .rmhc-gallery__arrow:focus,
.rmhc-gallery .rmhc-gallery__arrow:active {
	background: transparent;
	color: var(--rmhc-gallery-ink);
}

.rmhc-gallery__tab:focus-visible,
.rmhc-gallery__arrow:focus-visible,
.rmhc-gallery__thumb:focus-visible {
	outline: 3px solid var(--rmhc-gallery-ink);
	outline-offset: 3px;
}

@media (max-width: 767px) {
	.rmhc-gallery__tabs {
		gap: 20px;
	}

	.rmhc-gallery__thumb {
		flex-basis: 30%;
	}
}
