/*
 * Sai Lux Sunrise Living — page loader
 *
 * The splash hides itself three ways (see includes/loader.php). The pure-CSS
 * escape hatch is the `sls-load-selfhide` animation below: with
 * `animation-fill-mode: forwards` it ends at opacity 0 / visibility hidden and
 * STAYS there, so even with JavaScript completely broken the site is reachable.
 */

.sls-load {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background:
		radial-gradient(60% 60% at 50% 42%, rgba(var(--b-gold-rgb, 177, 137, 84), .16), transparent 68%),
		var(--b-navy-d, #0D1B2B);
	animation: sls-load-selfhide .45s ease 8s forwards;
}

/* JS adds this the moment the page is ready. */
.sls-load.is-done {
	opacity: 0;
	visibility: hidden;
	transition: opacity .45s ease, visibility 0s linear .45s;
}

@keyframes sls-load-selfhide {
	to { opacity: 0; visibility: hidden; }
}

/* --- Top progress bar ----------------------------------------------------- */
.sls-load__bar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: rgba(255, 255, 255, .08);
	overflow: hidden;
}

.sls-load__bar span {
	display: block;
	width: 100%;
	height: 100%;
	transform-origin: 0 50%;
	background: linear-gradient(90deg, var(--b-gold, #B18954), var(--b-gold-l, #D4AC74), var(--b-gold-pale, #E3C9A0));
	/* Eases towards 90% and waits there — the last 10% is completed by JS when
	   the page actually finishes, which is how a progress bar should behave. */
	animation: sls-load-progress 2.6s cubic-bezier(.2, .8, .2, 1) forwards;
}

@keyframes sls-load-progress {
	0%   { transform: scaleX(0); }
	45%  { transform: scaleX(.6); }
	80%  { transform: scaleX(.85); }
	100% { transform: scaleX(.92); }
}

.sls-load.is-done .sls-load__bar span {
	animation: none;
	transform: scaleX(1);
	transition: transform .3s ease;
}

/* --- Branded splash ------------------------------------------------------- */
.sls-load__splash { text-align: center; }

.sls-load__splash img {
	display: block;
	width: 116px;
	height: 116px;
	border-radius: 50%;
	box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
	/* A gentle breathing pulse rather than a spin: the logo has readable text
	   in it, and spinning type is unreadable and cheap-looking. */
	animation: sls-load-pulse 1.5s ease-in-out infinite;
}

@keyframes sls-load-pulse {
	0%, 100% { transform: scale(1);    opacity: 1; }
	50%      { transform: scale(.94);  opacity: .82; }
}

/* Gold ring sweeping around the logo — this is the "spinner" part.
   It sits on a wrapper around the IMAGE only. Centring it on
   `.sls-load__splash` put its midpoint halfway down the logo AND the caption
   together, so the ring hung below the logo and read as a broken arc. */
.sls-load__ring {
	position: relative;
	display: block;
	width: 116px;
	height: 116px;
	margin: 0 auto;
}

.sls-load__ring::before {
	content: "";
	position: absolute;
	/* Concentric with the logo: inset equally on all four sides. */
	inset: -15px;
	border-radius: 50%;
	border: 2px solid transparent;
	border-top-color: var(--b-gold-l, #D4AC74);
	border-right-color: rgba(var(--b-gold-rgb, 177, 137, 84), .35);
	animation: sls-load-spin 1s linear infinite;
}

@keyframes sls-load-spin {
	to { transform: rotate(360deg); }
}

.sls-load__splash img,
.sls-load__splash p { position: relative; z-index: 1; }

.sls-load__splash p {
	margin: 22px 0 0;
	font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .22em;
	text-transform: uppercase;
	color: var(--b-gold-pale, #E3C9A0);
}

/* --- Navigation progress -------------------------------------------------- */
/* Shown when the visitor clicks through to another page, so there is feedback
   during the server round-trip. Only the bar — no full splash on navigation. */
.sls-navbar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	z-index: 999998;
	background: transparent;
	pointer-events: none;
}

.sls-navbar span {
	display: block;
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--b-gold, #B18954), var(--b-gold-l, #D4AC74));
	box-shadow: 0 0 10px rgba(var(--b-gold-rgb, 177, 137, 84), .7);
	transition: width .28s ease;
}

@media (max-width: 520px) {
	.sls-load__splash img { width: 92px; height: 92px; }
	.sls-load__ring { width: 92px; height: 92px; }
}

/* Someone who asked for less motion gets no spin and no pulse — but the loader
   must still disappear, so the self-hide animation is deliberately kept. */
@media (prefers-reduced-motion: reduce) {
	.sls-load__splash img { animation: none; }
	.sls-load__ring::before { animation: none; border-top-color: var(--b-gold, #B18954); }
	.sls-load__bar span { animation: none; transform: scaleX(.9); }
}

@media print {
	.sls-load, .sls-navbar { display: none !important; }
}
