/*
 * The home-page banner (modules/slider.php), drawn the way Smart Slider 3 drew slider 9 at every screen width.
 *
 * How Smart Slider sized it ("auto" mode): the slide was designed 1920 x 800 and fills the page width, so the box keeps
 * that shape. The places and widths of the words scale with the box: a value of N design units becomes N x (width / 1920)
 * pixels across and N x (height / 800) down, rounded to whole pixels for places (as its script did), not for widths.
 * The letters themselves do NOT scale: the slide was made before Smart Slider 3.5 and keeps fixed sizes (76, 35 and
 * 22 px), so on narrow screens the words wrap inside their shrinking boxes and run past the bottom, where the box cuts them.
 * Below, --w and --h stand for the banner's width and height, and the bare numbers are Smart Slider's design units.
 */

.hrmg-vas-slider {
	position: relative;
	z-index: 0;                        /* its own layer, as before: the menu's drop-downs still open over the banner */
	clear: both;
	width: 100%;
	font-size: 16px;
	line-height: 1;
	text-align: left;
	-webkit-font-smoothing: antialiased;
	user-select: none;
	-webkit-user-select: none;
}

.hrmg-vas-slider__box {
	position: relative;
	overflow: hidden;                  /* words that run past the edges are cut off here, as before */
	aspect-ratio: 1920 / 800;
	cursor: grab;
	touch-action: pan-y;               /* the page still scrolls up and down; sideways moves drag the slide */
	-webkit-tap-highlight-color: transparent;
}

/* What moves when the slide changes. Its width and height are what the words are measured against. */
.hrmg-vas-slider__slide {
	position: absolute;
	inset: 0;
	--w: 100vw;                        /* browsers from before 2023: the page width, near enough */
	--h: calc(100vw * 800 / 1920);
}
@supports (width: 1cqw) {
	.hrmg-vas-slider__slide { container-type: size; --w: 100cqw; --h: 100cqh; }
}

/* The photo, filling the box and cropped evenly on both sides ("fill" at focus 50% 50%). */
.hrmg-vas-slider .hrmg-vas-slider__bg {
	position: absolute;
	left: 0;
	top: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
	object-position: 50% 50%;
	color: transparent;                /* no alt-text box while it loads */
	transform: translate3d(0, 0, 0);   /* its own GPU layer, as Smart Slider gave it: the slide change stays smooth, and the
	                                      browser draws the page below exactly as before (without it, photos further down
	                                      come out one shade in 255 different) */
}

/* The words fade in over 0.4 s when the page opens, as before. */
.hrmg-vas-slider__layers {
	position: absolute;
	inset: 0;
	animation: hrmg-vas-slider-in .4s ease;
}
.hrmg-vas-slider__slide--copy .hrmg-vas-slider__layers { animation: none; }
@keyframes hrmg-vas-slider-in { from { opacity: 0; } }

.hrmg-vas-slider__layer {
	position: absolute;
	left: 0;
	top: 0;
	transform: translate(var(--x), var(--y)) var(--shift,);
}
/* Whole pixels, as Smart Slider's script placed them. A place exactly half-way between two pixels goes to the larger,
   as its Math.round() did: the 0.0001px nudge decides those ties and nothing else (no other place comes nearer than
   0.00015px to half-way). */
@supports (width: round(1px, 1px)) {
	.hrmg-vas-slider__layer { transform: translate(round(var(--x) + 0.0001px, 1px), round(var(--y) + 0.0001px, 1px)) var(--shift,); }
}

.hrmg-vas-slider .hrmg-vas-slider__layer p {
	margin: 0;
	padding: 0;
	border: 0;
	box-shadow: none;
	background: transparent;
	font-style: normal;
	letter-spacing: normal;
	word-spacing: normal;
	text-transform: none;
	text-decoration: none;
	text-shadow: none;
	text-align: left;
	hyphens: manual;
	cursor: auto;
	user-select: text;
	-webkit-user-select: text;
}

/* "Vault And Safe": 767 across, 24 down, 639 wide; 76 px bold, colour d4ceaf. */
.hrmg-vas-slider__title {
	--x: calc(var(--w) * 767 / 1920);
	--y: calc(var(--h) * 24 / 800);
	width: calc(var(--w) * 639 / 1920);
}
.hrmg-vas-slider .hrmg-vas-slider__title p {
	font: 700 76px/1.5 'Open Sans', sans-serif;
	color: #d4ceaf;
}

/* The sentence below it: 960 across, 174 down, 756 x 167; 35 px, white, 10 px padding. */
.hrmg-vas-slider__text {
	--x: calc(var(--w) * 960 / 1920);
	--y: calc(var(--h) * 174 / 800);
	width: calc(var(--w) * 756 / 1920);
	height: calc(var(--h) * 167 / 800);
}
.hrmg-vas-slider .hrmg-vas-slider__text p {
	padding: 10px;
	font: 400 35px/1.5 'Open Sans', sans-serif;
	color: #fff;
}

/* BUY NOW: centred on a point 137 right and 10 up from the middle of the box (234 right, 75 down on phones). */
.hrmg-vas-slider__button {
	--x: calc(var(--w) / 2 + var(--w) * 137 / 1920);
	--y: calc(var(--h) / 2 - var(--h) * 10 / 800);
	/* Centred on that point. translateZ(0) gives the button its own GPU layer, as it had inside Smart Slider: its left
	   edge usually falls between two pixels, and only on a layer of its own is that edge smoothed exactly as before. */
	--shift: translate(-50%, -50%) translateZ(0);
	white-space: nowrap;
}
@media (orientation: landscape) and (max-width: 900px), (orientation: portrait) and (max-width: 700px) {
	.hrmg-vas-slider__button {
		--x: calc(var(--w) / 2 + var(--w) * 234 / 1920);
		--y: calc(var(--h) / 2 + var(--h) * 75 / 800);
	}
}
.hrmg-vas-slider .hrmg-vas-slider__button a {
	display: inline-block;
	padding: 10px 30px;
	border: 0;
	border-radius: 7px;
	box-shadow: none;
	background: #d09d33;
	font: 800 22px/1.5 'Open Sans', sans-serif;
	color: #000;
	letter-spacing: normal;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	text-shadow: none;
	transition: none;
}

/* The theme's style.css pushed the button by these amounts (its rules were written for Smart Slider's class names, so
   they are copied here). From 1600 px wide down they push it past the right edge, which is why it only shows on wider
   screens. */
@media only screen and (max-width: 1600px) { .hrmg-vas-slider__button { top: 317.5px; left: 840px; } }
@media only screen and (max-width: 1440px) { .hrmg-vas-slider__button { top: 287.5px; left: 768px; } }
@media only screen and (max-width: 1368px) { .hrmg-vas-slider__button { top: 283.5px; left: 739px; } }
@media only screen and (max-width: 1300px) { .hrmg-vas-slider__button { top: 255.5px; left: 704px; } }
@media only screen and (max-width: 1200px) { .hrmg-vas-slider__button { top: 244.5px; left: 649px; } }
@media only screen and (max-width: 1024px) { .hrmg-vas-slider__button { top: 213.5px; left: 551px; } }
@media only screen and (max-width: 768px)  { .hrmg-vas-slider__button { top: 154.5px; left: 421px; } }
@media only screen and (max-width: 480px)  { .hrmg-vas-slider__button { top: 100px; left: 230px; } }
@media only screen and (max-width: 380px)  { .hrmg-vas-slider__button { top: 93px; left: 206px; } }
@media only screen and (max-width: 320px)  { .hrmg-vas-slider__button { top: 78px; left: 180px; } }

/* Arrows: 15 px in from each side, centred top to bottom, 32 px wide (16 px on phones). */
.hrmg-vas-slider__controls {
	position: absolute;
	inset: 0;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: space-between;
	pointer-events: none;
}
.hrmg-vas-slider__arrow {
	margin: 0 15px;
	line-height: 0;
	overflow: hidden;
	cursor: pointer;
	pointer-events: auto;
}
.hrmg-vas-slider .hrmg-vas-slider__arrow img {
	display: block;
	width: 32px;
	height: auto;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	box-shadow: none;
}
@media (orientation: landscape) and (max-width: 900px), (orientation: portrait) and (max-width: 700px) {
	.hrmg-vas-slider .hrmg-vas-slider__arrow img { width: 16px; }
}

/* While the slide is being dragged. */
.hrmg-vas-slider__box.is-dragging,
.hrmg-vas-slider__box.is-dragging * { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.hrmg-vas-slider__box.is-dragging .hrmg-vas-slider__slide { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
	.hrmg-vas-slider__layers { animation: none; }
}
