/* 3D card behind the home page hero (js/card3d.js). Where 3D works, the hero's photo is hidden from the start
   (card3d-pending, set by an inline script in tmpl-credit-cards.php) so it never flashes before the card fades in. */
.card3d {
	position: fixed;
	top: 0;
	left: 0;
	z-index: -1;
	width: 100%;
	height: 100vh;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.8s ease;
}
.card3d canvas {
	display: block;
	width: 100%;
	height: 100%;
}
html.card3d-ready {
	background: #191919;
}
html.card3d-ready .card3d {
	opacity: 1;
}
html.card3d-ready .custom-top.custom-top--credit,
html.card3d-ready .custom-top.custom-top--business {
	background: transparent;
}
html.card3d-ready .custom-top.custom-top--credit::after,
html.card3d-pending .custom-top.custom-top--credit::after,
html.card3d-ready .custom-top.custom-top--business::after,
html.card3d-pending .custom-top.custom-top--business::after {
	display: none;
}

/* Builder: one 3D card (js/card3d-builder.js) in place of the two flat ones. The flat canvases keep
   drawing underneath, invisibly, because the 3D card copies them and the order uses them. */
html.card3d-builder-on .builder-cards-wrapper {
	position: relative;
	aspect-ratio: 446 / 280;
}
html.card3d-builder-on .builder-cards-wrapper > .card_front_side_wrapper,
html.card3d-builder-on .builder-cards-wrapper > .card_back_side_wrapper {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	opacity: 0;
	pointer-events: none;
}
.card3d-builder {
	position: absolute;
	top: -18%;
	right: -12%;
	bottom: -18%;
	left: -12%;
	z-index: 2;
}
.card3d-builder canvas {
	display: block;
	width: 100%;
	height: 100%;
	cursor: grab;
	touch-action: pan-y;
}
.card3d-builder.-dragging canvas {
	cursor: grabbing;
}
.card3d-sides {
	position: relative;
	z-index: 3;
	display: flex;
	justify-content: center;
	gap: 8px;
	margin: 30px 0 26px;
}
.card3d-sides button {
	min-width: 96px;
	padding: 8px 18px;
	border: 1px solid #4F4F4F;
	border-radius: 40px;
	background: transparent;
	color: #fff;
	font: inherit;
	font-size: 14px;
	cursor: pointer;
	transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.card3d-sides[data-showing="front"] button[data-side="front"],
.card3d-sides[data-showing="back"] button[data-side="back"] {
	border-color: #FAD60E;
	background: #FAD60E;
	color: #191919;
}

/* Builder on phones: the options panel is pinned to the bottom of the screen; keep it above the card so the
   card (and its extra room for turning) never sits over the fields and swallows taps. */
@media (max-width: 991px) {
	html.card3d-builder-on .builder .config-wrapper {
		z-index: 4;
	}
	.card3d-builder {
		top: -8%;
		bottom: -8%;
	}
	/* nothing may make the page wider than the screen (iPhones then shift everything right) */
	html.card3d-builder-on,
	html.card3d-builder-on body {
		overflow-x: clip;
	}
	/* The panel can't grow past part of the screen: the step's options scroll between the step title and
	   Continue, so Continue is always reachable. */
	.builder .config-wrapper > .inner-wrapper {
		display: flex;
		flex-direction: column;
		max-height: 60vh;
		max-height: 60svh;
	}
	.builder .config-wrapper > .inner-wrapper > .mobile-step-header,
	.builder .config-wrapper > .inner-wrapper > .mobile-step-footer {
		flex: none;
	}
	.builder .config-wrapper > .inner-wrapper > .step-wrapper {
		flex: 0 1 auto;
		min-height: 0;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
	}
}

/* Builder on desktop: the card column stays put while the options on the right scroll. */
@media (min-width: 992px) {
	.builder .card-wrapper .inner-wrapper {
		position: sticky;
		top: 90px;
	}
}
