/**
 * RSI Toolkit — Film Feature ("Our Purpose" on About).
 *
 * A near-black card in the media card's proportions (8px radius, copy column vs
 * film column) with a faint brand glow behind the copy. The silent preview
 * covers the film column and dissolves into the card on the copy side, so the
 * two read as one surface rather than "text next to a video box".
 *
 * Logical properties + grid areas: the film sits on the inline END by default,
 * which is the right in English and the left in Arabic, with no rtl.css entry.
 * Only the dissolve gradient needs a direction-specific rule.
 */

.rsi-film {
	--rsi-film-bg: #050608;
	--rsi-film-accent: #bf0031;
	font-family: var(--rsi-font, 'Alexandria', sans-serif);
}

.rsi-film__card {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
	grid-template-areas: "copy media";
	min-height: 540px;
	overflow: hidden;
	border-radius: 8px;
	background:
		radial-gradient(70% 90% at 0% 0%, rgba(191, 0, 49, .22), transparent 60%),
		var(--rsi-film-bg);
	color: #fff;
	isolation: isolate;
}

.rsi-film--media-start .rsi-film__card {
	grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
	grid-template-areas: "media copy";
}

/* The glow sits behind the copy, so it follows it to the other side. */
.rsi-film--media-start .rsi-film__card,
[dir="rtl"] .rsi-film--media-end .rsi-film__card {
	background:
		radial-gradient(70% 90% at 100% 0%, rgba(191, 0, 49, .22), transparent 60%),
		var(--rsi-film-bg);
}

[dir="rtl"] .rsi-film--media-start .rsi-film__card {
	background:
		radial-gradient(70% 90% at 0% 0%, rgba(191, 0, 49, .22), transparent 60%),
		var(--rsi-film-bg);
}

/* -------------------------------- film --------------------------------- */

.rsi-film__media {
	grid-area: media;
	position: relative;
	min-height: 100%;
	overflow: hidden;
}

/* !important: Woodmart's img{height:auto!important} would letterbox a poster. */
.rsi-film__poster,
.rsi-film__loop {
	position: absolute;
	inset: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover;
	z-index: 0;
}

/* The loop sits over the poster and only shows once it is really playing. */
.rsi-film__poster + .rsi-film__loop {
	opacity: 0;
	transition: opacity .8s ease;
}

.rsi-film.is-playing .rsi-film__poster + .rsi-film__loop {
	opacity: 1;
}

/* Dissolve into the card on the copy side, plus a soft floor for the button. */
.rsi-film__fade {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background:
		linear-gradient(to right, var(--rsi-film-bg) 0%, rgba(5, 6, 8, .55) 22%, rgba(5, 6, 8, 0) 55%),
		linear-gradient(to top, rgba(5, 6, 8, .7) 0%, rgba(5, 6, 8, 0) 40%);
}

.rsi-film--media-start .rsi-film__fade,
[dir="rtl"] .rsi-film--media-end .rsi-film__fade {
	background:
		linear-gradient(to left, var(--rsi-film-bg) 0%, rgba(5, 6, 8, .55) 22%, rgba(5, 6, 8, 0) 55%),
		linear-gradient(to top, rgba(5, 6, 8, .7) 0%, rgba(5, 6, 8, 0) 40%);
}

[dir="rtl"] .rsi-film--media-start .rsi-film__fade {
	background:
		linear-gradient(to right, var(--rsi-film-bg) 0%, rgba(5, 6, 8, .55) 22%, rgba(5, 6, 8, 0) 55%),
		linear-gradient(to top, rgba(5, 6, 8, .7) 0%, rgba(5, 6, 8, 0) 40%);
}

/* Glass pill; own classes + resets because the theme styles links by tag. */
.rsi-film__play,
.rsi-film__play:hover,
.rsi-film__play:focus {
	text-decoration: none !important;
	color: #fff !important;
}

.rsi-film__play {
	position: absolute;
	z-index: 2;
	inset-block-end: 32px;
	inset-inline-end: 32px;
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 8px 20px 8px 8px;
	padding-inline: 8px 20px;
	border: 1px solid rgba(255, 255, 255, .28);
	border-radius: 999px;
	background: rgba(255, 255, 255, .12);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .3px;
	line-height: 1;
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.rsi-film__play-icon {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--rsi-film-accent);
	color: #fff;
	transition: transform .25s cubic-bezier(.16, 1, .3, 1);
}

/* The triangle is optically off-centre; nudge it toward the point. Arabic
   keeps a right-pointing play symbol (the universal sign), so no flip. */
.rsi-film__play-icon svg {
	margin-left: 2px;
}

.rsi-film__play-time {
	padding-inline-start: 12px;
	border-inline-start: 1px solid rgba(255, 255, 255, .3);
	font-weight: 400;
	color: rgba(255, 255, 255, .78);
	font-variant-numeric: tabular-nums;
	direction: ltr;
	unicode-bidi: isolate;
}

@media (hover: hover) {
	.rsi-film__play:hover {
		background: rgba(255, 255, 255, .2);
		border-color: rgba(255, 255, 255, .5);
	}
	.rsi-film__play:hover .rsi-film__play-icon {
		transform: scale(1.08);
	}
}

.rsi-film__play:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* -------------------------------- copy --------------------------------- */

.rsi-film__copy {
	grid-area: copy;
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 72px 64px;
	min-width: 0;
}

.rsi-film__bar {
	display: block;
	width: 48px;
	height: 6px;
	margin-bottom: 26px;
	background: var(--rsi-film-accent);
}

.rsi-film__title {
	margin: 0 0 22px;
	font-family: inherit;
	font-weight: 700;
	font-size: var(--rsi-h2-size, 34px);
	line-height: 1.2;
	color: #fff;
}

.rsi-film__lead {
	margin: 0 0 22px;
	font-weight: 600;
	font-size: 30px;
	line-height: 1.38;
	letter-spacing: -.3px;
	color: #fff;
}

.rsi-film__text {
	max-width: 520px;
	margin: 0;
	font-weight: 400;
	font-size: var(--rsi-body-size, 18px);
	line-height: 1.7;
	color: rgba(255, 255, 255, .72);
}

/* ------------------------------- dialog -------------------------------- */

.rsi-film__dialog {
	width: min(1200px, 92vw);
	max-width: none;
	max-height: none;
	margin: auto;
	padding: 0;
	border: 0;
	overflow: visible;
	background: transparent;
	color: #fff;
}

.rsi-film__dialog::backdrop {
	background: rgba(4, 4, 6, .88);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.rsi-film__dialog[open] {
	animation: rsi-film-in .45s cubic-bezier(.16, 1, .3, 1);
}

@keyframes rsi-film-in {
	from {
		opacity: 0;
		transform: translateY(16px) scale(.98);
	}
}

.rsi-film__frame {
	position: relative;
	aspect-ratio: 16 / 9;
	max-height: 82vh;
	margin: 0 auto;
	overflow: hidden;
	border-radius: 8px;
	background: #000;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

.rsi-film__full {
	display: block;
	width: 100% !important;
	height: 100% !important;
	object-fit: contain;
	background: #000;
}

.rsi-film__close,
.rsi-film__close:hover,
.rsi-film__close:focus {
	text-decoration: none !important;
	color: #0a0a0a !important;
}

.rsi-film__close {
	position: absolute;
	inset-block-start: -56px;
	inset-inline-end: 0;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #fff;
	transition: transform .2s ease;
}

@media (hover: hover) {
	.rsi-film__close:hover {
		transform: rotate(90deg);
	}
}

.rsi-film__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.rsi-film__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

html.rsi-film-open {
	overflow: hidden;
}

/* ----------------------------- responsive ------------------------------ */

@media (max-width: 1024px) {
	.rsi-film__card,
	.rsi-film--media-start .rsi-film__card {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas: "media" "copy";
		min-height: 0;
	}
	.rsi-film__media {
		aspect-ratio: 16 / 9;
		min-height: 0;
	}
	/* Stacked: dissolve downward into the copy instead of sideways. */
	.rsi-film__fade,
	.rsi-film--media-start .rsi-film__fade,
	[dir="rtl"] .rsi-film--media-end .rsi-film__fade,
	[dir="rtl"] .rsi-film--media-start .rsi-film__fade {
		background: linear-gradient(to top, var(--rsi-film-bg) 0%, rgba(5, 6, 8, 0) 45%);
	}
	.rsi-film__play {
		inset-block-end: 20px;
		inset-inline-end: 20px;
	}
	.rsi-film__copy {
		padding: 16px 40px 48px;
	}
}

@media (max-width: 767px) {
	.rsi-film__media {
		aspect-ratio: 4 / 3;
	}
	.rsi-film__play {
		inset-block-end: 16px;
		inset-inline-end: 16px;
		font-size: 14px;
	}
	.rsi-film__play-icon {
		width: 34px;
		height: 34px;
	}
	.rsi-film__copy {
		padding: 8px 24px 36px;
	}
	.rsi-film__title {
		font-size: 28px;
		margin-bottom: 16px;
	}
	.rsi-film__lead {
		font-size: 22px;
		line-height: 1.45;
		margin-bottom: 16px;
	}
	.rsi-film__text {
		font-size: 16px;
		line-height: 1.7;
	}
	.rsi-film__close {
		inset-block-start: -52px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rsi-film__dialog[open] {
		animation: none;
	}
}
