/*
 * Spotlight Reveal for Elementor
 *
 * --sr-p is the light level of one photo: 0 = dark, 1 = fully lit.
 * It is registered with @property so it can be transitioned; every visual
 * (reveal mask, opacity, glow) is derived from it, so light on/off reverse
 * smoothly from wherever they are.
 *
 * Tunable from the widget controls (set on the widget wrapper):
 *   --sr-in-duration, --sr-out-duration, --sr-light-x, --sr-glow-color,
 *   --sr-glow-strength, --sr-auto-dark, --sr-dim, --sr-divider-color,
 *   --sr-name-color, --sr-name-lit-color
 */

@property --sr-p {
	syntax: "<number>";
	inherits: true;
	initial-value: 0;
}

.sr-group {
	--sr-ease-in: cubic-bezier(0.3, 0, 0.2, 1);
	--sr-ease-out: cubic-bezier(0.4, 0, 0.2, 1);
	width: 100%;
	margin-left: auto;
	margin-right: auto;
}

/* ---------- One lightable item (photo + optional text) ---------- */

.sr-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 0;
	color: inherit;
	text-decoration: none;
	outline: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.sr-item:hover,
.sr-item:focus {
	color: inherit;
	text-decoration: none;
}

.sr-spotlight {
	--sr-p: 0;
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #0b0a09;
	isolation: isolate;
	filter: brightness(1);
	transition:
		--sr-p var(--sr-out-duration, 1.2s) var(--sr-ease-out),
		filter var(--sr-out-duration, 1.2s) ease;
}

.sr-spotlight__frame {
	position: absolute;
	inset: 0;
}

/* .sr-group prefix beats Elementor's / themes' generic "img { height: auto }" rules */
.sr-group .sr-spotlight img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
	pointer-events: none;
	user-select: none;
	-webkit-user-select: none;
	-webkit-user-drag: none;
}

/* No dark image uploaded: darken the light image instead (always pixel-aligned) */
.sr-spotlight__dark--auto {
	filter: brightness(var(--sr-auto-dark, 0.42)) saturate(0.85);
}

/* The lit photo is revealed by a pool of light spilling down from the lamp above */
.sr-spotlight__light {
	opacity: clamp(0, calc(var(--sr-p) * 1.6), 1);
	-webkit-mask-image: radial-gradient(
		ellipse calc(8% + var(--sr-p) * 192%) calc(0.5% + var(--sr-p) * 280%) at var(--sr-light-x, 50%) -8%,
		#000 50%,
		transparent 100%
	);
	mask-image: radial-gradient(
		ellipse calc(8% + var(--sr-p) * 192%) calc(0.5% + var(--sr-p) * 280%) at var(--sr-light-x, 50%) -8%,
		#000 50%,
		transparent 100%
	);
}

/* Warm beam that blooms while the light warms up, then settles */
.sr-spotlight__glow {
	--sr-glow: var(--sr-glow-color, rgba(255, 232, 196, 0.42));
	position: absolute;
	inset: 0;
	pointer-events: none;
	mix-blend-mode: screen;
	background:
		radial-gradient(ellipse 10% 6% at var(--sr-light-x, 50%) 0%, color-mix(in srgb, var(--sr-glow) 45%, #fff), transparent 100%),
		radial-gradient(ellipse 24% 80% at var(--sr-light-x, 50%) -6%, var(--sr-glow), color-mix(in srgb, var(--sr-glow) 25%, transparent) 55%, transparent 78%);
	opacity: calc(var(--sr-p) * (1 - var(--sr-p)) * 4 * var(--sr-glow-strength, 0.6) + var(--sr-p) * var(--sr-glow-strength, 0.6) / 6);
}

.sr-item__name {
	margin-top: 18px;
	font-family: Georgia, "Times New Roman", serif;
	font-size: clamp(20px, 3vw, 30px);
	line-height: 1.2;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	/* keep the text optically centered despite the trailing letter-spacing */
	padding-left: 0.22em;
	color: var(--sr-name-color, #857b6e);
	transition: color var(--sr-out-duration, 1.2s) ease;
}

.sr-item__cta {
	margin-top: 6px;
	font-size: 12px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #c9b696;
	opacity: 0;
	transition: opacity 0.6s ease;
}

/* ---------- Light ON (slow, soft warm-up) ---------- */

.sr-item.is-lit .sr-spotlight,
.sr-item:focus-visible .sr-spotlight {
	--sr-p: 1;
	transition-duration: var(--sr-in-duration, 2.2s);
	transition-timing-function: var(--sr-ease-in), ease;
}

.sr-item.is-lit .sr-item__name,
.sr-item:focus-visible .sr-item__name {
	color: var(--sr-name-lit-color, #f3ead9);
	transition-duration: var(--sr-in-duration, 2.2s);
}

.sr-item.is-lit .sr-item__cta,
.sr-item:focus-visible .sr-item__cta {
	opacity: 1;
	transition-delay: 0.6s;
}

.sr-item:focus-visible .sr-spotlight {
	box-shadow: 0 0 0 2px #0c0b0a, 0 0 0 4px #b9a98f;
}

@media (hover: hover) and (pointer: fine) {
	.sr-item:hover .sr-spotlight {
		--sr-p: 1;
		transition-duration: var(--sr-in-duration, 2.2s);
		transition-timing-function: var(--sr-ease-in), ease;
	}

	.sr-item:hover .sr-item__name {
		color: var(--sr-name-lit-color, #f3ead9);
		transition-duration: var(--sr-in-duration, 2.2s);
	}

	.sr-item:hover .sr-item__cta {
		opacity: 1;
		transition-delay: 0.6s;
	}
}

/* ---------- Split (e.g. Hosts & DJs) ---------- */

.sr-split {
	display: flex;
	align-items: stretch;
	gap: 32px;
}

.sr-split > .sr-item {
	flex: 1 1 0;
}

.sr-split__line {
	flex: 0 0 1px;
	width: 1px;
	background: linear-gradient(
		to bottom,
		transparent 0%,
		var(--sr-divider-color, rgba(201, 182, 150, 0.5)) 18%,
		var(--sr-divider-color, rgba(201, 182, 150, 0.5)) 72%,
		transparent 100%
	);
}

/* The panels that are not lit sink a little further into the dark */
.sr-split.has-lit .sr-item:not(.is-lit) .sr-spotlight {
	filter: brightness(var(--sr-dim, 0.7));
}

@media (hover: hover) and (pointer: fine) {
	.sr-split:hover .sr-item:not(:hover) .sr-spotlight {
		filter: brightness(var(--sr-dim, 0.7));
	}
}

@media (max-width: 767px) {
	.sr-split .sr-item__cta {
		font-size: 10px;
		letter-spacing: 0.1em;
	}

	.sr-split--stack-mobile-yes .sr-split {
		flex-direction: column;
	}

	.sr-split--stack-mobile-yes .sr-split__line {
		display: none;
	}
}

/* ---------- Fallbacks ---------- */

/* Browsers without @property (class added by the script): soft cross-fade */
.sr-no-property .sr-spotlight__light {
	-webkit-mask-image: none;
	mask-image: none;
	opacity: 0;
	transition: opacity var(--sr-out-duration, 1.2s) ease;
}

.sr-no-property .sr-spotlight__glow {
	display: none;
}

.sr-no-property .sr-item.is-lit .sr-spotlight__light {
	opacity: 1;
	transition-duration: var(--sr-in-duration, 2.2s);
}

@media (hover: hover) and (pointer: fine) {
	.sr-no-property .sr-item:hover .sr-spotlight__light {
		opacity: 1;
		transition-duration: var(--sr-in-duration, 2.2s);
	}
}

/* Reduced motion: quick plain fade, no spreading light */
@media (prefers-reduced-motion: reduce) {
	.sr-group {
		--sr-in-duration: 0.4s;
		--sr-out-duration: 0.3s;
	}

	.sr-spotlight__light {
		-webkit-mask-image: none;
		mask-image: none;
	}
}

/* -------------------------------------------------------------------
 * Mobile fix (sr-mobile-collapse-fix): an Elementor flex container that
 * holds a single Spotlight Image widget collapses to 0 height on phones
 * (the square uses aspect-ratio, whose height does not propagate up
 * through the nested flex-column on mobile), so the image overflows and
 * the following section overlaps it. Switch that container to block flow
 * on mobile so it sizes to the square image and stacks cleanly.
 * ------------------------------------------------------------------- */
@media (max-width: 767px) {
	[data-element_type="container"]:has(> .elementor-widget-sr-spotlight-image),
	[data-element_type="container"]:has(> .elementor-widget-sr-spotlight-split) {
		display: block;
	}
}
