/* ==========================================================================
   SUDAIR PHARMA — CEO MESSAGE VIDEO
   The video half of the CEO statement on Leadership & Governance.

   Everything here is scoped under .sud-ceo. Nothing in this file can reach an
   existing component: the section reuses the design system's own split
   container, type scale and spacing, and this file only dresses the video frame
   that has no equivalent elsewhere on the site.
   ========================================================================== */

.sud-ceo {
	margin: 0;
	inline-size: 100%;
}

/* --------------------------------------------------------------------------
   FRAME
   Same radius, border and shadow language as .sud-media, so the video sits in
   the page as another piece of brand imagery rather than an embed.
   -------------------------------------------------------------------------- */

.sud-ceo__frame {
	position: relative;
	overflow: hidden;
	border-radius: var(--sud-radius-lg);
	background: var(--sud-green-900);
	box-shadow: var(--sud-shadow-lg);
	isolation: isolate;

	/* Source is 3840×2160. Holding 16:9 means the frame never jumps between
	   poster and first frame. */
	aspect-ratio: 16 / 9;
}

/* A hairline of brand green over the frame edge — the same detail the image
   plates carry, so the video reads as part of the set. */
.sud-ceo__frame::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	border: 1px solid rgba(255, 255, 255, .10);
	pointer-events: none;
	z-index: 3;
}

/*
 * FILLING THE FRAME, AND WHY IT TAKES position: absolute
 *
 * `block-size: 100%` below is the right intent and was quietly doing nothing.
 * A percentage height resolves against the PARENT, and the video's parent is
 * not the frame: WordPress wraps it in a <p> on the way out of the text editor,
 *
 *     .sud-ceo__frame > p > video
 *
 * and that <p> is auto-height, so the percentage is indefinite and dropped.
 *
 * With its height ignored the element fell back to the only ratio it had.
 * `preload="none"` means no media metadata until someone presses play, so that
 * ratio came from the POSTER — the CEO's board portrait, 1991x2560, portrait.
 * At 512px wide the video box became 658px tall inside a 288px 16:9 frame, and
 * `overflow: hidden` on the frame cut off the bottom 370px.
 *
 * The native control bar lives at the bottom of a <video>. It was being clipped
 * away with everything else below 288px, which is why the player looked like a
 * still photograph with no way to start it.
 *
 * Positioning it against the frame — which is already `position: relative` —
 * sidesteps the <p> altogether: `inset: 0` is measured from the frame whatever
 * markup sits in between, so the box is 512x288 and the controls land inside
 * it. `object-fit: cover` and the object-position below then do exactly the
 * job they were written for, on a box that is finally the right shape.
 */
.sud-ceo__video {
	position: absolute;
	inset: 0;

	inline-size: 100%;
	block-size: 100%;
	display: block;
	object-fit: cover;
	background: var(--sud-green-900);

	/*
	 * Framing is for the POSTER, not the video. The poster is the CEO's board
	 * portrait — 1991×2560 — and a 16:9 frame crops 56% of it away. Left at the
	 * default centre it would sit on his chest and cut off the top of his head.
	 * Biasing towards the top keeps head and shoulders in frame, the same
	 * reasoning as `object-position: center 12%` on the board cards.
	 *
	 * The video itself is 3840×2160 — already 16:9, so `cover` crops nothing and
	 * this value has no effect once playback starts.
	 */
	object-position: center 15%;
}

/* --------------------------------------------------------------------------
   PLAY AFFORDANCE
   Chrome shows only a thin control bar over a poster, which reads as a still
   image with a strip along the bottom. This is the "there is a video here"
   signal. Inert to the pointer, so the click that dismisses it is the same
   click that reaches the video underneath and starts playback.
   -------------------------------------------------------------------------- */

.sud-ceo__play {
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: 50%;
	translate: -50% -50%;
	z-index: 2;

	display: grid;
	place-items: center;
	inline-size: clamp(64px, 8vw, 88px);
	aspect-ratio: 1;
	border-radius: 50%;

	color: #fff;
	background: rgba(0, 99, 68, .92);           /* --sud-green-700 */
	box-shadow: 0 10px 40px rgba(0, 48, 31, .45);
	pointer-events: none;

	transition:
		opacity .45s var(--sud-ease, cubic-bezier(.22,1,.36,1)),
		scale .45s var(--sud-ease, cubic-bezier(.22,1,.36,1));
}

.sud-ceo__play svg {
	inline-size: 42%;
	block-size: 42%;
	margin-inline-start: 8%;     /* optical centring — the triangle leans right */
}

/* A single slow pulse ring. One ring, not a loop of them: this sits beside a
   formal statement from the chief executive. */
.sud-ceo__play::before {
	content: '';
	position: absolute;
	inset: -10px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, .35);
	opacity: 0;
	animation: sud-ceo-pulse 3.2s var(--sud-ease, cubic-bezier(.22,1,.36,1)) infinite;
}

@keyframes sud-ceo-pulse {
	0%        { transform: scale(.9);  opacity: 0; }
	18%       { opacity: .8; }
	60%, 100% { transform: scale(1.18); opacity: 0; }
}

/* Set by ceo.js once playback starts. */
.sud-ceo.is-playing .sud-ceo__play {
	opacity: 0;
	scale: .8;
}

.sud-ceo.is-playing .sud-ceo__play::before { animation: none; }

/* The frame lifts a little on hover, matching the media plates. */
@media (hover: hover) {
	.sud-ceo__frame { transition: box-shadow .5s var(--sud-ease, cubic-bezier(.22,1,.36,1)); }
	.sud-ceo:hover .sud-ceo__play { scale: 1.06; }
	.sud-ceo.is-playing:hover .sud-ceo__play { scale: .8; }
}

/* --------------------------------------------------------------------------
   FALLBACK
   -------------------------------------------------------------------------- */

.sud-ceo__fallback {
	padding: 2rem;
	color: #fff;
	font-size: var(--sud-text-sm);
}

.sud-ceo__fallback a { color: #7EE07F; }

/* --------------------------------------------------------------------------
   SCROLL REVEAL
   Uses the shared motion mechanism, so it arrives on the same curve and at the
   same moment as the rest of the page rather than on a second timing.
   -------------------------------------------------------------------------- */

.sud-motion .sud-ceo:not(.is-visible) {
	opacity: 0;
	transform: translate3d(0, 24px, 0);
}

.sud-motion .sud-ceo {
	transition:
		opacity var(--sud-t-slow, .72s) var(--sud-ease-out, cubic-bezier(.16,1,.3,1)),
		transform var(--sud-t-slow, .72s) var(--sud-ease-out, cubic-bezier(.16,1,.3,1));
}

.sud-motion .sud-ceo.is-visible { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   RESPONSIVE
   The columns stack via the design system's own .sud-split breakpoint; only the
   video's own proportions need adjusting.
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
	.sud-ceo__frame { border-radius: var(--sud-radius-md, 16px); }
	.sud-ceo__play { inline-size: 60px; }

	/*
	 * Once the columns stack, the split container and each column still charge
	 * 24px of inline padding apiece — so at 375px the content came out 183px
	 * wide against the 279px of the board grids directly above and below it.
	 * A 183px video is too small to watch, and the section read as indented
	 * from its own neighbours.
	 *
	 * Dropping that padding while stacked puts text and video back on the same
	 * 279px measure as the sections either side.
	 *
	 * Selected by what the split CONTAINS rather than by a class on the section.
	 * This was scoped to `.sud-ceo-section`, which no longer exists in the page
	 * data — an editor save dropped it, the rule silently stopped matching, and
	 * the video went back to 183px with nothing to show a rule had been lost.
	 * `:has(.sud-ceo)` cannot be dropped by an editor save, and it still reaches
	 * exactly one split on the site: the one holding the CEO video.
	 */
	.sud-split:has(.sud-ceo),
	.sud-split:has(.sud-ceo) > .e-con {
		padding-inline: 0;
	}
}

/* --------------------------------------------------------------------------
   REDUCED MOTION / PRINT
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.sud-ceo__play,
	.sud-motion .sud-ceo { transition: none !important; }
	.sud-ceo__play::before { animation: none; }
	.sud-motion .sud-ceo,
	.sud-motion .sud-ceo:not(.is-visible) { opacity: 1 !important; transform: none !important; }
}

@media print {
	.sud-ceo__frame { box-shadow: none; aspect-ratio: auto; }
	.sud-ceo__play { display: none; }
}

/* --------------------------------------------------------------------------
   THE PLAY AFFORDANCE, IN ARABIC

   It is pinned with:

     inset-block-start: 50%;
     inset-inline-start: 50%;
     translate: -50% -50%;

   The block axis is unaffected by direction, so the vertical half stays
   correct. The inline half does not: `inset-inline-start` becomes `right: 50%`
   in Arabic, putting the circle's RIGHT edge on the middle, while `translate`
   stays physical and keeps pulling LEFT. The circle lands a full width off
   centre — measured 88px on a desktop, 60px on a phone, against 0 in English.

   That single offset is both faults reported. On a phone the browser draws its
   own centred play overlay on a paused <video controls>; in English the
   affordance sits exactly on top of it and the two read as one, while in
   Arabic it slid aside and revealed both. And a circle sitting off to one side
   is no longer over the thing it appears to offer to play.

   Pulling the other way on the inline axis puts it back on centre, which
   restores the single button on a phone at the same time.

   The pointer handling that follows is NOT direction-specific and applies to
   both languages; only the translate above is Arabic's.
   -------------------------------------------------------------------------- */

/* Arabic only: the inline half of the centring, pulled the other way. */
[dir="rtl"] .sud-ceo__play {
	translate: 50% -50%;
}

/*
 * BOTH LANGUAGES: the circle answers to the pointer.
 *
 * This started as an Arabic-only repair, because that was where the circle
 * had slid off centre and drew attention to itself. The inertness was never
 * Arabic-specific though: on a desktop, in either language, clicking a
 * video's surface does not start it, so a centred circle that plainly invites
 * a click did nothing. On a phone it always worked by accident — the click
 * fell through to the browser's own overlay sitting underneath.
 *
 * So the circle takes the click everywhere. Still the same element, given a
 * job, rather than a second control beside it; still aria-hidden, with the
 * native controls untouched for keyboard and screen-reader users.
 */
.sud-ceo__play {
	pointer-events: auto;
	cursor: pointer;
}

/* Once playing it fades out, and hands the pointer back at the same moment so
   the controls underneath stay reachable. */
.sud-ceo.is-playing .sud-ceo__play {
	pointer-events: none;
}
