/* ==========================================================================
   Solar Storage scene — /solar-storage/

   A full-viewport photograph of one house in two lights. Everything here is
   scoped to `.vbsc` because main.css is not loaded on this route: the poster
   ships type.css (fonts + the size ladder) and this file, nothing else. `--u`
   (a single unit that falls out of the viewport) governs geometry locally,
   while words lean on the shared `--fs-*` tokens so the poster cannot drift
   from the rest of the store.

   The one idea holding the layout together: three layers, and only the middle
   one moves. Sky stands still, house sinks and rises, fog is drawn last so it
   can rise over both, and every word sits above the fog.

   Colours are mixed rather than swapped. `--k` runs 0 (morning) to 1 (night)
   and each text colour is a `color-mix()` on it, so there is no moment where a
   label is the wrong colour for the frame behind it.
   ========================================================================== */

/* Manrope arrives with type.css, which this sheet depends on: the poster route
   has no other stylesheet, so the fonts and the size ladder both come from
   there. Nothing to re-declare here. */

/* Scoped, not global. This sheet started life on a route where it was the only
   stylesheet in the document, so a bare `*` reset was free. It now also loads on
   /solar-panels/, where the same reset would strip every margin the store's own
   layout is built on — so it reaches only into the scene. `:where()` keeps the
   reset at zero specificity, which is what lets the component rules below win
   without anyone having to think about order. */
.vbsc,
.vbsc *,
.vbsc *::before,
.vbsc *::after {
	box-sizing: border-box;
}

.vbsc :where(*) {
	margin: 0;
	padding: 0;
}

/* Only the standalone route pins the document. Embedded in a page, the scene is
   a block like any other and the page owns the scroll. */
body.vbsc-page {
	height: 100%;
	overflow: hidden;
	background: #0b1426;
	font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		"Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* Wrapped in `:where()` so the reset carries no specificity. Written plainly as
   `.vbsc a` it outranks a single class, and it silently repainted the quote
   button's label with the inherited colour — white text on a white pill. */
:where(.vbsc) a {
	color: inherit;
	text-decoration: none;
}

:where(.vbsc) button {
	font: inherit;
	color: inherit;
	background: none;
	border: 0;
	cursor: pointer;
}

/* --------------------------------------------------------------------------
   The frame
   -------------------------------------------------------------------------- */

.vbsc {
	/* One unit for every desktop size. At 1600×900 this is 1px, so the numbers
	   below read exactly like the design; below 820px it is pinned to 1px and
	   the type switches to a fixed ladder. */
	--u: min(calc(100vw / 1600), calc(100svh / 900));

	/* Type gets its own unit with a floor. Geometry should keep shrinking with
	   the window — that is what holds the composition together at any width —
	   but words must not: at 1024px `--u` is 0.64, which put the nav at 10.5px
	   and the toggle captions at 9.6px. 0.8px of `--u` is roughly 13px of nav,
	   the same floor the rest of the store uses. */
	--ut: max(var(--u), 0.8px);

	/* 0 = morning, 1 = night. The stylesheet has to agree with the template's
	   `$start` and with the first frame the script paints: these three are the
	   same number, and a stylesheet that assumed night would flash dark type on
	   a daylight photograph for the one frame before the shader runs. */
	--k: 0;
	--k2: 0;
	--dip: 0;

	--ink: color-mix(in srgb, #14202f calc((1 - var(--k)) * 100%), #fff);
	--nav: color-mix(in srgb, #1b2736 calc((1 - var(--k)) * 100%), #eef1f6);
	--soft: color-mix(in srgb, #1b2736 calc((1 - var(--k)) * 100%), #dfe5ee);

	position: relative;
	height: 100svh;
	min-height: 520px;
	overflow: hidden;
	isolation: isolate;
	background: #0b1426;
	color: var(--ink);
}

/* --------------------------------------------------------------------------
   Embedded — the hero slot of /solar-panels/, not the whole document
   -------------------------------------------------------------------------- */

/* `container-type: size` turns the block into a query container so the scene's
   single unit can come from the box it was handed instead of the window. Without
   it the unit is computed against the viewport, and on a 2560px monitor a hero
   that is only 1600px wide would be sized for widths it does not have.

   The height is "one screen minus the header". The header is `position: sticky`
   and therefore occupies its own row, so `100svh` here would push the hero's
   bottom a header's-height past the fold. The number cannot be written down:
   the announcement bar is one line at 1600px and two at 390px, which moves the
   header between 102px and 142px. `--vbsc-head` is measured by the script on
   load and on resize; 108px is the desktop measurement and only stands in when
   the script never runs. */
.vbsc-stage {
	container-type: size;
	height: clamp(520px, calc(100svh - var(--vbsc-head, 108px)), 1000px);
	overflow: hidden;
	background: #0b1426;
}

.vbsc-stage > .vbsc {
	--u: min(calc(100cqw / 1600), calc(100cqh / 900));
	height: 100%;
	min-height: 0;
}

/* The page's own header already carries the wordmark, the five sections and the
   quote button. Repeating them inside the frame would put two identical bars
   sixty pixels apart, and the second one would be a dead end — it links to the
   page you are already on. The headline and the switch are all this needs. */
.vbsc-stage .vbsc-bar {
	display: none;
}

.vbsc-layer,
.vbsc-layer img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.vbsc-layer img {
	display: block;
	object-fit: cover;
	object-position: 50% 62%;
}

/* 1. Sky — still. Blurred hard enough that the panels read as light rather than
   detail, which is what makes the cutout's outline look sharp by comparison. */
.vbsc-sky img {
	filter: blur(calc(7 * var(--u)));
	transform: scale(1.05);
}

#vbsc-sky-night {
	opacity: var(--k);
}

/* 2. House — the only layer that moves. */
.vbsc-home {
	will-change: transform;
	transform: translate3d(0, var(--sink, 0px), 0);
}

.vbsc-set {
	position: absolute;
	inset: 0;
	visibility: hidden;
}

.vbsc-set.is-on {
	visibility: visible;
}

/* Only the bottom of the ground frame is real: the top half of that photograph
   is sky the blurred layer already draws. Masking it keeps the two from
   fighting and stops the shrubs from arriving with a visible seam. */
.vbsc-ground {
	-webkit-mask-image: linear-gradient(transparent 54%, #000 64%);
	mask-image: linear-gradient(transparent 54%, #000 64%);
}

/* The cutout sits on the ground rather than inside `.vbsc-layer`, because it
   must not inherit the ground's mask: the whole silhouette, roof included, has
   to stay crisp against the blurred sky. */
.vbsc-cut {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 62%;
}

/* 3. Tilt — a blur that only bites in the foreground, like a tilt-shift lens. */
.vbsc-tilt {
	position: absolute;
	inset: 0;
	pointer-events: none;
	-webkit-backdrop-filter: blur(calc(9 * var(--u)));
	backdrop-filter: blur(calc(9 * var(--u)));
	-webkit-mask-image: linear-gradient(transparent 70%, #000 92%);
	mask-image: linear-gradient(transparent 70%, #000 92%);
}

/* 4. Fog — a live shader, so it never loops and never has a seam. */
#vbsc-fog {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

/* When WebGL2 is missing the fog is a pair of soft gradients instead. It cannot
   surge, so the script simply fades it during the dive. */
.vbsc-fogfallback {
	position: absolute;
	inset: 0;
	pointer-events: none;
	opacity: 0;
	transition: opacity .4s;
	background:
		linear-gradient(to top, rgba(190, 196, 200, .42), rgba(190, 196, 200, 0) 46%),
		radial-gradient(120% 60% at 50% 108%, rgba(210, 214, 216, .5), rgba(210, 214, 216, 0) 70%);
}

.vbsc--noGl .vbsc-fogfallback {
	opacity: 1;
}

/* 5. Words. */
.vbsc-ui {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	pointer-events: none;
}

.vbsc-ui a,
.vbsc-ui button {
	pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Bar
   -------------------------------------------------------------------------- */

.vbsc-bar {
	width: 100%;
	display: flex;
	align-items: center;
	padding: calc(22 * var(--u)) calc(38 * var(--u)) 0;
	color: var(--nav);
}

.vbsc-logo {
	display: flex;
	align-items: center;
	gap: calc(9 * var(--u));
	font-size: calc(24 * var(--ut));
	font-weight: 500;
	letter-spacing: -.025em;
	color: var(--ink);
	flex: 1 1 0;
}

.vbsc-logo svg {
	width: calc(38 * var(--u));
	height: calc(38 * var(--u));
	flex: none;
}

/* Both flanks take the same width, so the link row lands on the true centre of
   the page rather than the centre of whatever space is left. */
.vbsc-links {
	display: flex;
	gap: calc(42 * var(--u));
	list-style: none;
	font-size: calc(16 * var(--ut));
	font-weight: 500;
	opacity: calc(1 - var(--dip) * .82);
}

.vbsc-side {
	flex: 1 1 0;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: calc(40 * var(--u));
	font-size: calc(16 * var(--ut));
	font-weight: 500;
}

.vbsc-side > a:first-child {
	opacity: calc(1 - var(--dip) * .82);
}

.vbsc-cta {
	display: inline-flex;
	align-items: center;
	height: calc(46 * var(--u));
	padding: 0 calc(26 * var(--u));
	border-radius: 99px;
	background: color-mix(in srgb, #0d1117 calc((1 - var(--k)) * 100%), #fff);
	color: color-mix(in srgb, #fff calc((1 - var(--k)) * 100%), #0d1117);
	opacity: calc(1 - var(--dip) * .62);
	transition: transform .25s;
}

.vbsc-cta:hover {
	transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Headline
   -------------------------------------------------------------------------- */

.vbsc-h1 {
	margin-top: calc(58 * var(--u));
	padding: 0 calc(16 * var(--u));
	text-align: center;
	font-size: calc(64 * var(--ut));
	line-height: var(--lh-tight);
	font-weight: 500;
	letter-spacing: -.022em;
	color: var(--ink);
}

.vbsc-h1 span {
	display: block;
}

.vbsc-h1 .vbsc-l1,
.vbsc-h1 .vbsc-y {
	opacity: calc(1 - var(--dip) * .8);
}

/* Two-tone by day, one tone by night — `--k2` trails `--k` by about a third of
   a second, so the clause joins the rest of the headline late and reads as a
   second thought rather than a jump cut. */
.vbsc-h1 i {
	font-style: normal;
	color: color-mix(
		in srgb,
		#14202f calc((1 - var(--k2)) * 42%),
		color-mix(in srgb, #fff calc(var(--k2) * 100%), #7c8794)
	);
}

.vbsc-h1 .vbsc-y {
	display: inline;
}

/* --------------------------------------------------------------------------
   Dock — the switch and the line under it
   -------------------------------------------------------------------------- */

.vbsc-dock {
	margin-top: auto;
	padding-bottom: calc(40 * var(--u));
	display: flex;
	flex-direction: column;
	align-items: center;
}

.vbsc-toggle {
	position: relative;
	display: grid;
	grid-template-columns: 1fr 1fr;
	width: calc(524 * var(--u));
	height: calc(86 * var(--u));
	padding: calc(2 * var(--u));
	border-radius: calc(16 * var(--u));
	overflow: hidden;
	background: rgba(120, 132, 140, .34);
	border: 1px solid rgba(255, 255, 255, .2);
	-webkit-backdrop-filter: blur(calc(14 * var(--u)));
	backdrop-filter: blur(calc(14 * var(--u)));
}

.vbsc-toggle button {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: calc(3 * var(--u));
	border-radius: calc(13 * var(--u));
	color: #fff;
	overflow: hidden;
}

/* The two highlights crossfade in place rather than sliding: a sliding pill
   would imply the buttons are one control being moved, and they are two. */
.vbsc-toggle button::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(160deg, #f7f8dc, #e2ee9f 90%);
	box-shadow: inset 0 0 calc(18 * var(--u)) rgba(255, 255, 255, .65);
	opacity: var(--on);
}

.vbsc-toggle b,
.vbsc-toggle small {
	position: relative;
	color: color-mix(in srgb, #1c2316 calc(var(--on) * 100%), #fff);
}

.vbsc-toggle b {
	font-size: calc(24 * var(--ut));
	font-weight: 500;
	letter-spacing: -.012em;
}

.vbsc-toggle small {
	font-size: calc(16 * var(--ut));
	opacity: .72;
}

.vbsc-toggle button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -4px;
}

#vbsc-bm {
	--on: calc(1 - var(--k));
}

#vbsc-bn {
	--on: var(--k);
}

.vbsc-cap {
	margin-top: calc(22 * var(--u));
	text-align: center;
	font-size: calc(16 * var(--ut));
	line-height: var(--lh-ui);
	color: var(--soft);
}

/* --------------------------------------------------------------------------
   Phones
   -------------------------------------------------------------------------- */

@media (max-width: 820px) {
	.vbsc {
		--u: 1px;
	}

	.vbsc-bar {
		padding: 16px 16px 0;
	}

	.vbsc-logo {
		font-size: var(--fs-20);
	}

	.vbsc-logo svg {
		width: 32px;
		height: 32px;
	}

	.vbsc-links,
	.vbsc-side > a:first-child {
		display: none;
	}

	.vbsc-cta {
		height: 40px;
		padding: 0 16px;
		font-size: var(--fs-14);
	}
		margin-top: 34px;
		letter-spacing: var(--tr-h1);
	line-height: var(--lh-tight);
	font-size: var(--fs-h1);
	

	/* The portrait crop matters more than the landscape one: this keeps the
	   panel and the lamp inside the frame when the box goes tall. 78% is where
	   the wall-mounted unit sits in the current frame — at 72% its right-hand
	   lamp fell off the edge. */
	.vbsc-layer img,
	.vbsc-cut {
		object-position: 78% 62% !important;
	}

	.vbsc-dock {
		width: 100%;
		padding: 0 16px 24px;
	}

	.vbsc-toggle {
		width: 100%;
		max-width: 440px;
		height: 74px;
	}

	.vbsc-toggle b {
		font-size: var(--fs-20);
	}

	.vbsc-toggle small {
		font-size: var(--fs-14);
	}

	.vbsc-cap {
		font-size: var(--fs-14);
		max-width: 360px;
	}

	.vbsc-cap br {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vbsc-cta {
		transition: none;
	}

	.vbsc-fogfallback {
		transition: none;
	}
}

/* The scene is a poster: printing it would spend a page on a dark photograph. */
@media print {
	.vbsc {
		height: auto;
		min-height: 0;
	}

	.vbsc-layer,
	.vbsc-tilt,
	#vbsc-fog,
	.vbsc-fogfallback {
		display: none;
	}

	.vbsc {
		background: #fff;
		color: #14202f;
	}
}
