/*
 * Craft details (R-REMEDIATION-BRIEF §R3.8) — the difference between
 * competent and considered. Custom focus rings and button states already
 * live in base.css (R3.4); this file covers what's genuinely new: text
 * selection, the desktop scrollbar, skeleton loaders that match real
 * content shape, `@starting-style` entry transitions, and typographic
 * detail (orphan control, real punctuation).
 */

/* ---------- Selection ---------- */

::selection {
	background: var(--wp--preset--color--terracotta-200);
	color: var(--wp--preset--color--forest-900);
}

/* ---------- Scrollbar (desktop, subtle) ---------- */

html {
	scrollbar-color: var(--wp--preset--color--sand-400) var(--wp--preset--color--cream-100);
	scrollbar-width: thin;
}

::-webkit-scrollbar {
	width: 12px;
	height: 12px;
}

::-webkit-scrollbar-track {
	background: var(--wp--preset--color--cream-100);
}

::-webkit-scrollbar-thumb {
	background-color: var(--wp--preset--color--sand-400);
	border-radius: var(--wp--custom--radius--pill);
	border: 3px solid var(--wp--preset--color--cream-100);
}

::-webkit-scrollbar-thumb:hover {
	background-color: var(--wp--preset--color--sand-500);
}

/* ---------- Typographic detail ---------- */

h1, h2, h3, h4 {
	text-wrap: balance;
}

p {
	text-wrap: pretty;
}

/* Non-breaking space before a unit, so "500 ml" or "15 cm" never breaks
   across a line end — applied via a utility class where copy renders a
   number/unit pair server-side, e.g. product dimensions. */
.vv-nowrap {
	white-space: nowrap;
}

/* ---------- Skeleton loader — matches real content shape, never a bare
 * spinner on a content area (R3.8). Its one real consumer today is the
 * address-autocomplete and PUDO-locker-picker dropdowns (assets/js/
 * address-autocomplete.js, locker-picker.js) — both use `.vv-skeleton`
 * for three placeholder rows shaped like the real result option while
 * their REST search is in flight, the one genuine async-content gap this
 * server-rendered site has. See quote-request.css for the option-row
 * sizing (`--skeleton` modifier on the shared dropdown option classes).
 * ---------- */

@keyframes vv-skeleton-shimmer {
	0% { background-position: -200% 0; }
	100% { background-position: 200% 0; }
}

.vv-skeleton {
	display: block;
	background: linear-gradient(
		90deg,
		var(--wp--preset--color--cream-200) 25%,
		var(--wp--preset--color--cream-100) 37%,
		var(--wp--preset--color--cream-200) 63%
	);
	background-size: 200% 100%;
	animation: vv-skeleton-shimmer 1.6s ease-in-out infinite;
	border-radius: var(--wp--custom--radius--sm);
}

@media (prefers-reduced-motion: reduce) {
	.vv-skeleton {
		animation: none;
		background: var(--wp--preset--color--cream-200);
	}
}

/* ---------- @starting-style entry (R3.8) — clean entry with no JS mount
 * flash. `assets/js/consent-banner.js` reveals the banner by clearing the
 * `hidden` attribute directly (`banner.hidden = false`) rather than
 * toggling a class from an already-primed "invisible" state, so a plain
 * opacity/transform transition alone wouldn't fire — the element jumps
 * straight from `display: none` to fully visible in one frame, the exact
 * "JavaScript mount flash" this rule exists to avoid. `allow-discrete` +
 * `@starting-style` lets the `display`/`hidden` change itself participate
 * in the transition, so the banner genuinely fades and slides up on the
 * frame it appears instead of snapping into place.
 */
@supports (transition-behavior: allow-discrete) {
	.vv-consent-banner {
		display: block;
		opacity: 1;
		transform: translateY(0);
		transition:
			opacity 240ms cubic-bezier(0.16, 1, 0.3, 1),
			transform 240ms cubic-bezier(0.16, 1, 0.3, 1),
			display 240ms allow-discrete;
	}

	.vv-consent-banner[hidden] {
		display: none;
		opacity: 0;
		transform: translateY(12px);
	}

	@starting-style {
		.vv-consent-banner:not([hidden]) {
			opacity: 0;
			transform: translateY(12px);
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	.vv-consent-banner {
		transition: none;
	}
}
