/*
 * CovertSwarm site styles.
 * Loaded on every front-end page by covertswarm-site-functions.php.
 */

/* ------------------------------------------------------------
 * Homepage hero: orange box locked over the face.
 * Cover block class: cs-hero / Orange group class: cs-hero-box
 *
 * The photo stays at its real size (no "cover" scaling), so the
 * box can sit at a fixed offset from the photo's centre. On shorter
 * screens the photo and box shrink together (--cs-s).
 * If hero2.jpg is replaced, update the width/height below.
 *
 * Motion (assets/hero-motion.js sets --sy and --fade on scroll):
 * the photo moves up slower than the page and fades into #222.
 * ------------------------------------------------------------ */
.cs-hero {
	--cs-s: 1;           /* scale for the photo and box together */
	--cs-header: 131px;  /* height of the header that sits over the hero */
	--sy: 0;             /* px the hero has scrolled (set by the script) */
	--fade: 0;           /* 0 = photo visible, 1 = gone (set by the script) */
	background: #222;
	overflow: hidden;
}

/* Shorter screens (laptops): shrink the photo and box together */
@media (max-height: 950px) { .cs-hero { --cs-s: .9; } }
@media (max-height: 820px) { .cs-hero { --cs-s: .8; } }
@media (max-height: 700px) { .cs-hero { --cs-s: .7; } }

/* Photo */
.cs-hero .wp-block-cover__image-background {
	width: 1784px !important;
	height: 1173px !important;
	max-width: none !important;
	max-height: none !important;
	left: 50% !important;
	top: calc(50% + var(--cs-header) / 2) !important;
	object-fit: cover !important;
	transform:
		translate(-50%, -50%)
		translate(0, calc(var(--sy) * 0.3px))
		scale(var(--cs-s));
	opacity: calc(1 - var(--fade));
	will-change: transform, opacity;
	-webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 70%, transparent 100%);
	        mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 70%, transparent 100%);
}

/* Orange box: pinned to the face, centred below the header */
.cs-hero .cs-hero-box {
	position: absolute;
	left: 50%;
	top: calc(50% + var(--cs-header) / 2);
	width: 710px;
	margin: 0 !important;
	transform:
		translate(-50%, -50%)
		translate(calc(-260px * var(--cs-s)), calc(-40px * var(--cs-s) - var(--sy) * 0.08px))
		scale(var(--cs-s));
	will-change: transform;
}

/* Phones and small tablets: drop the offset and centre the box */
@media (max-width: 900px) {
	.cs-hero .cs-hero-box {
		width: calc(100vw - 32px);
		transform: translate(-50%, -50%);
	}
}
