/* SAJ Gallery — Sliders ("sajs" namespace)
   Templates: classic (full-bleed) · deck (slide cards rail) · frame (rounded panel)
   Inline custom props from settings: --sajs-h (height), --sajs-overlay (colour)
--------------------------------------------------------------- */

.sajs {
	--sajs-ink: #10141c;
	/* Kicker, text and buttons inherit the theme font; the big title uses
	   --sajs-display so it stays a clean bold sans regardless of theme. */
	--sajs-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	position: relative;
	width: 100%;
	min-height: max(440px, var(--sajs-h, 78vh));
	color: #fff;
	font-family: inherit;
	isolation: isolate;
}

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

/* Full-width: escape the theme's constrained content column. Centring on
   the parent then pulling back half the viewport works for both margin- and
   padding-based theme gutters (unlike the 50% − 50vw margin trick). Clipping
   body overflow-x absorbs the sliver classic scrollbars would otherwise add. */
.sajs--full {
	position: relative;
	left: 50%;
	transform: translateX(-50%);
	width: 100vw;
	max-width: none;
}

body:has(.sajs--full) { overflow-x: clip; }

.sajs-shell {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

/* Frame template: contained rounded panel with breathing room. */
.sajs--frame { padding: clamp(10px, 2vw, 24px); }
.sajs--frame .sajs-shell {
	position: relative;
	min-height: max(420px, calc(var(--sajs-h, 78vh) - 48px));
	border-radius: clamp(20px, 3vw, 34px);
	box-shadow: 0 30px 70px rgba(15, 20, 30, 0.25);
}

/* Slides ------------------------------------------------------- */

.sajs-slides { position: absolute; inset: 0; }

.sajs-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.75s ease, visibility 0s linear 0.75s;
	pointer-events: none;
	display: flex;
	align-items: flex-end;
}

.sajs-slide.is-active {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.75s ease;
	pointer-events: auto;
	z-index: 1;
}

.sajs-bg,
.sajs-bg img,
.sajs-bg video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Slow settle-in on the active background (skipped under reduced motion). */
.sajs-bg img,
.sajs-bg video { transform: scale(1.07); transition: transform 8s cubic-bezier(0.2, 0.6, 0.2, 1); }
.sajs-slide.is-active .sajs-bg img,
.sajs-slide.is-active .sajs-bg video { transform: scale(1); }

.sajs-shade {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(to top, rgba(8, 11, 18, 0.72) 0%, rgba(8, 11, 18, 0.15) 48%, rgba(8, 11, 18, 0.3) 100%),
		var(--sajs-overlay, rgba(12, 15, 22, 0.45));
}

/* Copy ---------------------------------------------------------- */

.sajs-inner {
	position: relative;
	z-index: 2;
	width: 100%;
	max-width: 1240px;
	margin: 0 auto;
	padding: clamp(24px, 4vw, 56px) clamp(18px, 4vw, 48px) clamp(84px, 10vw, 120px);
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 24px;
}

.sajs--align-center .sajs-inner { justify-content: center; text-align: center; }

/* Desktop content width is user-controlled (--sajs-copy-width, default 60%);
   mobile always goes full width (see the max-width:820px override below).
   Plain `width` (not max-width) so the box reliably occupies that percentage
   and wraps text accordingly — max-width alone only caps growth, so short
   copy would just shrink to fit and ignore the setting. flex-shrink:1 still
   lets it yield space to a sibling (e.g. the frame template's floating
   card) if the two together would otherwise overflow. */
.sajs-copy { width: var(--sajs-copy-width, 60%); max-width: 100%; }

.sajs-kicker {
	display: inline-block;
	font-size: 0.82rem;
	font-weight: 650;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.85);
	padding: 6px 14px;
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.1);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	margin-bottom: 18px;
}

.sajs-title {
	font-family: var(--sajs-title-font, "Playfair Display", Georgia, serif);
	margin: 0 0 14px;
	font-size: calc(clamp(2rem, 5.6vw, 4rem) * var(--sajs-title-scale, 1));
	line-height: 1.04;
	font-weight: var(--sajs-title-weight, 800);
	letter-spacing: -0.02em;
	text-transform: var(--sajs-title-case, none);
	/* !important so the chosen colour always beats theme heading rules. */
	color: var(--sajs-title-color, #fff) !important;
	text-shadow: 0 2px 30px rgba(0, 0, 0, 0.35);
	text-wrap: balance;
}

.sajs-text {
	margin: 0 0 24px;
	max-width: 54ch;
	font-family: var(--sajs-body-font, "Poppins", sans-serif);
	font-weight: var(--sajs-body-weight, 400);
	font-size: calc(clamp(0.95rem, 1.4vw, 1.08rem) * var(--sajs-body-scale, 1));
	line-height: 1.65;
	color: var(--sajs-body-color, rgba(255, 255, 255, 0.85)) !important;
}

.sajs-kicker { font-family: var(--sajs-body-font, "Poppins", sans-serif); }

.sajs--align-center .sajs-text { margin-left: auto; margin-right: auto; }

.sajs-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.sajs--align-center .sajs-actions { justify-content: center; }

.sajs-btn {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	padding: 13px 26px;
	border-radius: 999px;
	font-family: var(--sajs-btn-font, "Poppins", sans-serif);
	font-size: 0.92rem;
	font-weight: var(--sajs-btn-weight, 600);
	text-decoration: none;
	transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.sajs-btn:hover { transform: translateY(-2px); }

/* Button icons (inline SVG) — sized to the text, recolour via currentColor. */
.sajs-btn-icon {
	display: inline-flex;
	width: 1.05em;
	height: 1.05em;
	transition: transform 0.3s ease;
}

.sajs-btn-icon svg,
.sajs-btn-icon .sajs-icon-img {
	width: 100%;
	height: 100%;
	display: block;
	fill: currentColor;
}

/* Icon hover animations (class on the slider root). */
.sajs--icon-rotate .sajs-btn:hover .sajs-btn-icon { transform: rotate(45deg); }
.sajs--icon-spin .sajs-btn:hover .sajs-btn-icon { transform: rotate(360deg); }
.sajs--icon-slide .sajs-btn:hover .sajs-btn-icon { transform: translateX(4px); }
.sajs--icon-pop .sajs-btn:hover .sajs-btn-icon { transform: scale(1.25); }

.sajs-btn--solid { background: var(--sajg-accent, #1d3b45); color: #fff; }
.sajs-btn--solid:hover { filter: brightness(0.92); color: #fff; }

.sajs-btn--ghost {
	color: #fff;
	border: 1.5px solid rgba(255, 255, 255, 0.55);
	background: rgba(255, 255, 255, 0.06);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.sajs-btn--ghost:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

/* Floating card (frame template) -------------------------------- */

.sajs-float-card {
	align-self: flex-start;
	margin-top: clamp(8px, 4vh, 40px);
	max-width: 300px;
	padding: 18px 22px;
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.22);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
	box-shadow: 0 18px 40px rgba(8, 11, 18, 0.25);
}

.sajs-float-card-title {
	display: block;
	font-size: 1.15rem;
	font-weight: 750;
	color: #fff;
	margin-bottom: 6px;
}

.sajs-float-card-text {
	display: block;
	font-size: 0.85rem;
	line-height: 1.55;
	color: rgba(255, 255, 255, 0.82);
}

/* Deck rail (deck template) -------------------------------------- */

.sajs-deck {
	position: absolute;
	right: clamp(18px, 3vw, 44px);
	bottom: clamp(96px, 14vh, 150px);
	z-index: 3;
	display: flex;
	gap: 14px;
	max-width: min(46%, 560px);
	overflow-x: auto;
	padding: 6px;
	scrollbar-width: none;
}

.sajs-deck::-webkit-scrollbar { display: none; }

/* Keep the copy clear of the deck rail so long titles never run under it. */
/* Never wider than the user's setting, but also never wider than the space
   actually left beside the deck rail. */
.sajs--deck .sajs-copy { width: min(var(--sajs-copy-width, 60%), 44%, 540px); padding-right: 16px; }
.sajs--deck .sajs-title { font-size: clamp(1.8rem, 4.2vw, 3.4rem); }

.sajs-deck-card {
	appearance: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	position: relative;
	flex: 0 0 132px;
	aspect-ratio: 9 / 16;
	max-height: 236px;
	border-radius: 14px;
	overflow: hidden;
	background: #2a3140;
	box-shadow: 0 12px 30px rgba(8, 11, 18, 0.35);
	opacity: 0.72;
	transform: translateY(0);
	transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
	text-align: left;
	isolation: isolate;
}

.sajs-deck-card:hover { opacity: 1; transform: translateY(-4px); }

.sajs-deck-card.is-active {
	opacity: 1;
	outline: 2px solid rgba(255, 255, 255, 0.85);
	outline-offset: 2px;
}

.sajs-deck-card img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sajs-deck-card-scrim {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(8, 11, 18, 0.75), rgba(8, 11, 18, 0) 55%);
	z-index: 1;
}

.sajs-deck-card-body {
	position: absolute;
	left: 10px;
	right: 10px;
	bottom: 10px;
	z-index: 2;
}

.sajs-deck-card-kicker {
	display: block;
	font-size: 0.6rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.75);
	margin-bottom: 3px;
}

.sajs-deck-card-title {
	display: block;
	font-size: 0.8rem;
	font-weight: 750;
	line-height: 1.25;
	color: #fff;
}

/* Controls -------------------------------------------------------- */

.sajs-controls {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 4;
	max-width: 1240px;
	margin: 0 auto;
	padding: 0 clamp(18px, 4vw, 48px) clamp(20px, 3vw, 34px);
	display: flex;
	align-items: center;
	gap: 18px;
}

/* Enforced against theme button styles. */
.sajs-arrow {
	cursor: pointer;
	width: 46px !important;
	height: 46px !important;
	flex: 0 0 auto;
	padding: 0 !important;
	border-radius: 999px !important;
	border: 1.5px solid rgba(255, 255, 255, 0.4) !important;
	background: rgba(255, 255, 255, 0.08) !important;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	color: #fff !important;
	font-size: 1.05rem;
	line-height: 1 !important;
	display: grid;
	place-items: center;
	box-shadow: none !important;
	transition: background 0.18s ease, transform 0.18s ease;
}

.sajs-arrow:hover { background: rgba(255, 255, 255, 0.22) !important; transform: scale(1.06); }

.sajs-progress {
	flex: 1 1 auto;
	height: 2px;
	background: rgba(255, 255, 255, 0.25);
	border-radius: 999px;
	overflow: hidden;
}

.sajs-progress-fill {
	display: block;
	height: 100%;
	width: 0%;
	background: #fff;
	border-radius: 999px;
}

.sajs-progress-fill.is-running { transition: width var(--sajs-speed, 6000ms) linear; width: 100%; }

.sajs-counter {
	flex: 0 0 auto;
	font-weight: 800;
	letter-spacing: 0.04em;
	display: flex;
	align-items: baseline;
	gap: 6px;
}

.sajs-counter-current { font-size: 1.6rem; color: #fff; }
.sajs-counter-total { font-size: 0.85rem; color: rgba(255, 255, 255, 0.55); }

/* Text & entrance animations ------------------------------------
   Animations play when a slide gains .is-active (JS toggles it), so they
   replay every time a slide becomes active. */

@keyframes sajs-a-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sajs-a-fade-up { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes sajs-a-slide-right { from { opacity: 0; transform: translateX(-34px); } to { opacity: 1; transform: none; } }
@keyframes sajs-a-zoom { from { opacity: 0; transform: scale(0.88); } to { opacity: 1; transform: none; } }
@keyframes sajs-a-blur { from { opacity: 0; filter: blur(14px); } to { opacity: 1; filter: blur(0); } }

/* Entrance for the whole copy block, staggered. */
[data-entrance="rise"] .sajs-slide.is-active .sajs-copy > * { animation: sajs-a-fade-up 0.7s both; }
[data-entrance="fade"] .sajs-slide.is-active .sajs-copy > * { animation: sajs-a-fade 0.7s both; }
[data-entrance="zoom"] .sajs-slide.is-active .sajs-copy > * { animation: sajs-a-zoom 0.7s both; }

.sajs-slide.is-active .sajs-copy > *:nth-child(1) { animation-delay: 0.04s; }
.sajs-slide.is-active .sajs-copy > *:nth-child(2) { animation-delay: 0.13s; }
.sajs-slide.is-active .sajs-copy > *:nth-child(3) { animation-delay: 0.22s; }
.sajs-slide.is-active .sajs-copy > *:nth-child(4) { animation-delay: 0.31s; }

/* Title / description specific animations (override the entrance for them). */
[data-title-anim="fade"] .sajs-slide.is-active .sajs-title { animation: sajs-a-fade 0.85s both; }
[data-title-anim="fade-up"] .sajs-slide.is-active .sajs-title { animation: sajs-a-fade-up 0.85s both; }
[data-title-anim="slide-right"] .sajs-slide.is-active .sajs-title { animation: sajs-a-slide-right 0.85s both; }
[data-title-anim="zoom"] .sajs-slide.is-active .sajs-title { animation: sajs-a-zoom 0.85s both; }
[data-title-anim="blur"] .sajs-slide.is-active .sajs-title { animation: sajs-a-blur 0.85s both; }
[data-title-anim="none"] .sajs-slide.is-active .sajs-title { animation: none; }

[data-text-anim="fade"] .sajs-slide.is-active .sajs-text { animation: sajs-a-fade 0.85s 0.12s both; }
[data-text-anim="fade-up"] .sajs-slide.is-active .sajs-text { animation: sajs-a-fade-up 0.85s 0.12s both; }
[data-text-anim="slide-right"] .sajs-slide.is-active .sajs-text { animation: sajs-a-slide-right 0.85s 0.12s both; }
[data-text-anim="zoom"] .sajs-slide.is-active .sajs-text { animation: sajs-a-zoom 0.85s 0.12s both; }
[data-text-anim="blur"] .sajs-slide.is-active .sajs-text { animation: sajs-a-blur 0.85s 0.12s both; }
[data-text-anim="none"] .sajs-slide.is-active .sajs-text { animation: none; }

/* --- Split template: image one side, content panel the other --- */
.sajs--split .sajs-slide { background: linear-gradient(120deg, #12151c 0%, #1d2632 100%); }
.sajs--split .sajs-bg { left: auto; right: 0; width: 46%; }
.sajs--split .sajs-shade {
	left: auto;
	right: 0;
	width: 46%;
	background: linear-gradient(to left, rgba(8, 11, 18, 0) 60%, rgba(8, 11, 18, 0.5) 100%);
}
.sajs--split .sajs-inner { justify-content: flex-start; align-items: center; }
/* Never wider than the user's setting, but also never wider than the space
   actually left beside the split image panel. */
.sajs--split .sajs-copy,
.sajs--split.sajs--align-center .sajs-copy { width: min(var(--sajs-copy-width, 60%), 46%); }

/* --- Editorial template: centered magazine cover --- */
.sajs--editorial .sajs-inner {
	justify-content: center;
	align-items: center;
	text-align: center;
	padding-bottom: clamp(96px, 12vw, 150px);
}
.sajs--editorial .sajs-copy { width: min(var(--sajs-copy-width, 60%), 840px); }
.sajs--editorial .sajs-title { font-size: calc(clamp(2.4rem, 7vw, 5rem) * var(--sajs-title-scale, 1)); }
.sajs--editorial .sajs-text { margin-left: auto; margin-right: auto; }
.sajs--editorial .sajs-actions { justify-content: center; }
.sajs--editorial .sajs-shade {
	background:
		radial-gradient(120% 120% at 50% 40%, rgba(8, 11, 18, 0.15) 0%, rgba(8, 11, 18, 0.6) 100%),
		var(--sajs-overlay, rgba(12, 15, 22, 0.45));
}

@media (prefers-reduced-motion: reduce) {
	[data-entrance] .sajs-slide.is-active .sajs-copy > *,
	.sajs-slide.is-active .sajs-title,
	.sajs-slide.is-active .sajs-text { animation: none !important; }
}

/* Responsive ------------------------------------------------------ */

@media (max-width: 1024px) {
	.sajs-deck { max-width: 52%; bottom: 92px; }
	.sajs-deck-card { flex-basis: 116px; }
}

@media (max-width: 820px) {
	/* Mobile has its own height setting (--sajs-h-mobile, default 100vh) —
	   independent of the desktop height, since a desktop vh percentage looks
	   very different on a phone. Content stays vertically centered (below)
	   regardless of how tall this is, so title/description/buttons remain
	   visible without scrolling even at the full-bleed 100vh default. */
	.sajs { min-height: max(380px, var(--sajs-h-mobile, 100vh)); }

	/* Frame's shell is in-flow (not absolutely positioned like the other
	   templates), so it needs its own matching rule — otherwise it ignores
	   the .sajs height above and falls back to the desktop vh setting. */
	.sajs--frame .sajs-shell { min-height: max(340px, calc(var(--sajs-h-mobile, 100vh) - 40px)); }

	/* .sajs-slide sets align-items:flex-end unconditionally (desktop bottom-
	   anchoring) — since .sajs-inner isn't stretched, its box only ever grows
	   to fit its own content, so that whole compact block still gets pushed
	   to the slide's bottom regardless of .sajs-inner's own justify-content.
	   Stretching it here is what actually lets the centering below work. */
	.sajs-slide { align-items: stretch; }

	.sajs-inner {
		flex-direction: column;
		align-items: flex-start;
		/* Was flex-end (pinned to the bottom of a possibly-tall box, forcing a
		   scroll to reach it) — centering keeps title/text/buttons in view. */
		justify-content: center;
		padding-bottom: 96px;
	}

	.sajs--align-center .sajs-inner { align-items: center; }
	.sajs--deck .sajs-copy,
	.sajs--split .sajs-copy,
	.sajs--editorial .sajs-copy,
	.sajs-copy { width: 100%; max-width: 100%; }

	/* Split stacks: image becomes a top band, copy sits below. Centre the copy
	   like every other template, but only within the space below the image
	   band — padding-top scales with the mobile height setting (42% to match
	   the image band above) so the text can never ride up into the image. */
	.sajs--split .sajs-bg { left: 0; right: 0; width: 100%; height: 42%; top: 0; }
	.sajs--split .sajs-shade { left: 0; right: 0; width: 100%; height: 42%; background: linear-gradient(to bottom, rgba(8, 11, 18, 0.1), rgba(8, 11, 18, 0.4)); }
	.sajs--split .sajs-inner { padding-top: calc(var(--sajs-h-mobile, 100vh) * 0.42); justify-content: center; }

	/* The rail becomes a horizontal strip above the controls. */
	.sajs-deck {
		left: clamp(18px, 4vw, 48px);
		right: 0;
		bottom: 84px;
		max-width: none;
	}

	/* Reserve the rail's full height (cards ≤236px + rail bottom offset)
	   below the copy so the CTA never sits under the cards. */
	.sajs--deck .sajs-inner { padding-bottom: 348px; }

	.sajs-float-card { align-self: flex-start; max-width: 100%; margin-top: 0; margin-bottom: 12px; order: -1; }
}

@media (max-width: 520px) {
	.sajs-arrow { width: 38px; height: 38px; font-size: 0.95rem; }
	.sajs-counter-current { font-size: 1.25rem; }
	.sajs-deck-card { flex-basis: 96px; max-height: 176px; }
	.sajs--deck .sajs-inner { padding-bottom: 288px; }
	.sajs-deck { bottom: 78px; }
	.sajs-btn { padding: 11px 20px; font-size: 0.88rem; }
}

@media (prefers-reduced-motion: reduce) {
	.sajs-slide { transition: none; }
	.sajs-bg img,
	.sajs-bg video { transform: none; transition: none; }
	.sajs-progress-fill.is-running { transition: none; }
}
