/**
 * Propague Compose Background
 *
 * Scoped styles for the compose-background hero widget.
 * Mirrors html/compose-background.html + assets/css/site.css + extra.css:
 * Earth backdrop, dark space palette, Archivo variable (font-stretch 118%),
 * radial scrim, logo halo with backdrop blur and the hero-field spiral of
 * sharp video cards (see assets/js/propague-compose-background.js).
 */

.pcb-hero {
	/* Dark palette of the reference (site.css prefers-color-scheme:dark). */
	--pcb-bg: #121316;
	--pcb-bg-sunken: #060607;
	--pcb-ink: #f2f1ee;
	--pcb-ink-strong: #fff;
	--pcb-muted: rgba(242, 241, 238, 0.6);
	--pcb-line-strong: rgba(242, 241, 238, 0.4);
	--pcb-invert-bg: #fff;
	--pcb-invert-fg: #0b0b0c;
	/* The reference scrim is built from --bg, so on the dark theme it is a
	   dark veil (#121316 at 78%) behind the logo and the copy. */
	--pcb-scrim-color: color-mix(in srgb, var(--pcb-bg) 78%, transparent);
	--pcb-font-display: "Archivo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--pcb-font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
	--pcb-font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--pcb-font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	--pcb-content-width: 42rem;
	--pcb-logo-scale: 100;
	--pcb-corner: 10px;
	--pcb-card-w: 320px;
	--pcb-card-h: 180px;

	position: relative;
	display: flex;
	align-items: stretch;
	justify-content: center;
	isolation: isolate;
	width: 100%;
	/* The decorative layers (radial scrim on .pcb-content::before and the
	   logo halo) are intentionally larger than the copy column. Clip them
	   horizontally so they never create a horizontal scrollbar, while
	   keeping the vertical axis visible (clip, not hidden, so no scroll
	   container is created and sticky children keep working). */
	overflow-x: clip;
	min-height: 100vh;
	min-height: 100svh;
	background-color: var(--pcb-bg);
	/* Earth backdrop, exactly like the reference body background. */
	background-image: url("../images/terra.webp");
	background-position: center center;
	background-repeat: no-repeat;
	background-size: cover;
	/* Anchored to the hero, so the Earth travels with the page as it scrolls
	   (it used to be `fixed`, pinned to the viewport). */
	background-attachment: scroll;
	color: var(--pcb-ink);
	font-family: var(--pcb-font-body);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

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

/* ------------------------------------------------------------------ layers */
/* Hero field: the spiral of sharp video cards drawn by the widget script.
   Same treatment as [data-hero-field] in the reference. */
.pcb-hero-field {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
	isolation: isolate;
	/* fade the field out at the very top so it never fights a sticky nav */
	-webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 46px);
	mask-image: linear-gradient(to bottom, transparent 0, #000 46px);
}

.pcb-hero-field .hf-underlay {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
	transition: opacity 0.35s ease;
}

.pcb-hero-field .hf-cards {
	position: absolute;
	inset: 0;
}

.pcb-hero-field .hf-card {
	position: absolute;
	left: 0;
	top: 0;
	width: var(--pcb-card-w);
	height: var(--pcb-card-h);
	overflow: hidden;
	border-radius: var(--pcb-corner);
	background-color: var(--pcb-bg-sunken);
	box-shadow: inset 0 0 0 1px rgba(242, 241, 238, 0.16);
	transform-origin: 50% 50%;
	will-change: transform, opacity;
	/* the field itself ignores the pointer; only the cards are hover targets */
	pointer-events: auto;
	cursor: pointer;
}

/* Vertical (9:16) videos: the JS swaps the card box to the portrait ratio and
   the player/thumbnail fill it the same way as the landscape cards. */
.pcb-hero-field .hf-card--vertical {
	width: var(--pcb-card-h);
	height: var(--pcb-card-w);
}

.pcb-hero-field .hf-card video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: transparent;
	/* a decoder with no frame yet paints black: keep it hidden until ready */
	opacity: 0;
	transition: opacity 0.35s linear;
	will-change: transform;
}

.pcb-hero-field .hf-card.is-ready video {
	opacity: 1;
}

/* YouTube mode: the IFrame API replaces the mount node with its iframe, so
   the card keeps a wrapper that is faded in only when real frames are ready */
.pcb-hero-field .hf-card > .hf-yt {
	position: absolute;
	inset: 0;
	display: block;
	overflow: hidden;
	background: transparent;
	/* hidden until the player is actually playing (is-playing); the static
	   thumbnail covers the YouTube paused/buffering overlays */
	opacity: 0;
	transition: opacity 0.35s linear;
	pointer-events: none;
}

.pcb-hero-field .hf-card.is-playing > .hf-yt {
	opacity: 1;
}

.pcb-hero-field .hf-card > .hf-yt iframe {
	position: absolute;
	inset: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	border: 0;
	background: transparent;
	pointer-events: none;
}

/* No edge covers. The player fills the card edge to edge: the former dark
   bands over the top (title/avatar) and bottom (logo) strips read as black
   bars across the video, so nothing is painted over the frame any more. */

/* When the native controls are enabled, let the player receive the pointer so
   play/pause/volume actually work (the rest of the content layer passes through). */
.pcb-hero-field.hf-yt-controls .hf-card > .hf-yt iframe {
	pointer-events: auto;
}

.pcb-hero-field.hf-yt-controls .hf-card {
	cursor: default;
}

/* No static YouTube thumbnail: a card only becomes visible when its video is
   really playing, so there is no still frame to paint under the player. */

.pcb-overlay {
	position: absolute;
	inset: 0;
	z-index: 2;
	background-color: #000;
	opacity: 0;
	pointer-events: none;
}

/* ----------------------------------------------------------------- content */
.pcb-inner {
	position: relative;
	z-index: 3;
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 1280px;
	margin: 0 auto;
	padding: 2.5rem 1.5rem;
	/* the copy layer must not swallow the pointer: the cards behind it are
	   hover targets, exactly like the reference (pointer-events-none on the
	   content wrapper, auto only on the buttons) */
	pointer-events: none;
}

@media (min-width: 768px) {
	.pcb-inner {
		padding-inline: 2.5rem;
	}
}

.pcb-content {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	max-width: var(--pcb-content-width);
	text-align: center;
}

/* Radial scrim that keeps the copy readable over the field. */
.pcb-content::before {
	content: "";
	position: absolute;
	inset: -88px -128px;
	z-index: 0;
	background: radial-gradient(closest-side, var(--pcb-scrim-color), transparent);
	pointer-events: none;
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
	.pcb-hero {
		--pcb-scrim-color: rgba(18, 19, 22, 0.78);
	}

	.pcb-content::before {
		background: radial-gradient(closest-side, rgba(18, 19, 22, 0.78), transparent);
	}
}

/* -------------------------------------------------------------------- logo */
.pcb-logo-wrap {
	position: relative;
	z-index: 2;
	width: 100%;
	container-type: inline-size;
}

.pcb-logo-halo {
	position: absolute;
	inset: -34% -6%;
	z-index: 1;
	pointer-events: none;
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	-webkit-mask-image: radial-gradient(closest-side, #000 45%, transparent 100%);
	mask-image: radial-gradient(closest-side, #000 45%, transparent 100%);
}

.pcb-logo {
	position: relative;
	z-index: 2;
	display: block;
	width: calc(10.3rem * var(--pcb-logo-scale) / 100);
	max-width: 100%;
	height: auto;
	margin: 0 auto;
}

/* ----------------------------------------------------------------- heading */
.pcb-heading {
	position: relative;
	z-index: 2;
	margin: 2rem 0 0;
	color: var(--pcb-ink-strong);
	font-family: var(--pcb-font-display);
	font-size: 1.875rem;
	font-stretch: 118%;
	font-weight: 620;
	line-height: 1.05;
	letter-spacing: -0.03em;
}

.pcb-heading-accent {
	color: var(--pcb-muted);
	font-family: var(--pcb-font-serif);
	font-style: italic;
	font-weight: 400;
}

/* ------------------------------------------------------------- description */
.pcb-desc {
	position: relative;
	z-index: 2;
	max-width: 28rem;
	margin: 1rem 0 0;
	color: var(--pcb-muted);
	font-size: 1.125rem;
	line-height: 1.625;
}

.pcb-desc > :first-child {
	margin-top: 0;
}

.pcb-desc > :last-child {
	margin-bottom: 0;
}

.pcb-desc a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
	/* the copy layer is pointer-events:none so the cards stay hoverable;
	   links inside the description must opt back in */
	pointer-events: auto;
}

/* ----------------------------------------------------------------- buttons */
.pcb-buttons {
	position: relative;
	z-index: 3;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	margin-top: 1.75rem;
	/* re-enable the pointer only where it is needed */
	pointer-events: auto;
}

.pcb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: -moz-fit-content;
	width: fit-content;
	height: 3rem;
	padding: 0 1.5rem;
	border: 1px solid transparent;
	border-radius: 0;
	font-family: var(--pcb-font-mono);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.12em;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	transition:
		background-color 0.15s ease,
		border-color 0.15s ease,
		color 0.15s ease,
		opacity 0.15s ease;
}

.pcb-btn span {
	display: inline-block;
}

.pcb-btn svg,
.pcb-btn i {
	display: inline-block;
	flex: none;
	width: 1rem;
	height: 1rem;
	font-size: 1rem;
	line-height: 1;
}

/* Elementor font icons render a bare <svg> (no fill attribute), which would
   default to black. Force them to inherit the button colour. */
.pcb-btn svg.e-font-icon-svg {
	fill: currentColor;
}

.pcb-btn--primary {
	background-color: var(--pcb-invert-bg);
	color: var(--pcb-invert-fg);
	/* like the reference: only the opacity animates on hover */
	transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.pcb-btn--primary:hover {
	opacity: 0.8;
}

.pcb-btn--secondary {
	background-color: var(--pcb-bg);
	border-color: var(--pcb-line-strong);
	color: var(--pcb-ink);
	/* .invert-block on the reference */
	transition: background-color 0.12s linear, color 0.12s linear, border-color 0.12s linear;
}

.pcb-btn--secondary:hover {
	background-color: var(--pcb-invert-bg);
	border-color: transparent;
	color: var(--pcb-invert-fg);
}

.pcb-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* ------------------------------------------------------------ slider mode */
/* Responsive switch (desktop/tablet/mobile): the orbiting cards become one
   horizontal band below the copy. The script positions the cards and this
   band is the drag surface — the cards themselves stay pointer-transparent. */
.pcb-hero-field.pcb-slider-field .hf-underlay {
	opacity: 0;
}

/* The strip dissolves into both hero edges: a single horizontal mask on the
   cards layer, so a half-visible card fades instead of being cut by the clip. */
.pcb-hero-field.pcb-slider-field .hf-cards {
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 64px, #000 calc(100% - 64px), transparent 100%);
	mask-image: linear-gradient(to right, transparent 0, #000 64px, #000 calc(100% - 64px), transparent 100%);
}

.pcb-hero-field .pcb-slider-track {
	position: absolute;
	left: 0;
	right: 0;
	z-index: 1;
	display: none;
	cursor: grab;
	pointer-events: auto;
	/* horizontal drags belong to the strip; vertical ones scroll the page */
	touch-action: pan-y;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.pcb-hero-field.pcb-slider-field .pcb-slider-track {
	display: block;
}

.pcb-hero-field .pcb-slider-track.is-dragging {
	cursor: grabbing;
}

/* The band reserves its own room: the centred copy slides up instead of
   sitting on top of the cards (the band height is measured by the script).
   min-height: 0 keeps the reserved padding from growing the hero itself,
   which would feed the measurement loop that positions the band. */
.pcb-hero.pcb-is-slider .pcb-inner {
	min-height: 0;
	padding-bottom: calc(var(--pcb-slider-space, 0px) + 1.5rem);
}

/* ---------------------------------------------------------------- entrance */
@keyframes pcb-rise {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.pcb-logo-wrap,
.pcb-heading,
.pcb-desc,
.pcb-buttons {
	animation: pcb-rise 0.7s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.pcb-heading {
	animation-delay: 0.08s;
}

.pcb-desc {
	animation-delay: 0.16s;
}

.pcb-buttons {
	animation-delay: 0.24s;
}

/* ---------------------------------------------------------------- responsive */
@media (min-width: 640px) {
	.pcb-heading {
		font-size: 2.25rem;
	}
}

@media (max-width: 767px) {
	/* The backdrop is `scroll` everywhere now (it must travel with the page),
	   so touch browsers no longer need the old `fixed` opt-out. */
	.pcb-content::before {
		/* Narrow screens stack the copy right on top of the card spiral, so the
		   scrim needs a wider, denser core to keep the text readable. */
		inset: -70px -60px;
		background: radial-gradient(
			closest-side,
			var(--pcb-scrim-color) 0%,
			var(--pcb-scrim-color) 55%,
			transparent 100%
		);
	}

	.pcb-desc {
		font-size: 1rem;
	}

	.pcb-btn {
		height: 2.75rem;
		padding: 0 1.125rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pcb-logo-wrap,
	.pcb-heading,
	.pcb-desc,
	.pcb-buttons {
		animation: none;
	}

	.pcb-hero-field .hf-card video,
	.pcb-hero-field .hf-card > .hf-yt {
		transition: none;
	}
}
