/*
 * finish.css: the finishing layer every Baron site carries (design-style, the polish system:
 * D-polish-motion, D-polish-states, D-polish-header). Load it before the site's own stylesheet
 * and mount finish.js. Every rule here has zero specificity (`:where`) or names finish.js's own
 * attributes, so the site's stylesheet overrides any of it.
 *
 * Tokens. Set the style's values on the site's own :root (styles.json, the style's `finish`):
 *   --ease        the one easing curve every transition and reveal uses
 *   --fast        colour and background changes (hover)
 *   --base        shadows, lifts and the header's change
 *   --slow        reveals: a heading rising, a panel playing
 *   --r-s, --r-m, --r-l   the family of radii: controls, cards, large panels (0 for a flat style)
 *   --shadow-1    a resting card or a button's hover
 *   --shadow-2    a lifted card or a floating panel
 *   --hairline    the 1px line between things
 *   --glass-blur  the header's backdrop blur past the hero
 * Use them in the site's own rules: `transition: transform var(--base) var(--ease)`,
 * `border-radius: var(--r-m)`, `box-shadow: var(--shadow-1)`, `border-top: 1px solid var(--hairline)`.
 *
 * States. finish.js marks each link, button and card by what it looks like (`data-finish-hover`),
 * and this file gives it a hover and a press state: a link is underlined 0.2em below its text
 * (design-style, D-links-buttons), a button lifts a pixel with a shadow, a card lifts 3px; pressed,
 * a button shrinks to 98%, a card settles and a link's line thickens and closes in. Nothing dims,
 * so text keeps its contrast, and only the line, shadow and transform change, so the layout stays
 * still. These rules (an attribute and a state, 0,2,0) outrank a site's resting rules for its
 * links, such as a nav's `text-decoration: none`. A site's own :hover or :active rule wins on a
 * property both set when it is as specific (`.button:hover`, loaded after this file) or more
 * (`.site-header a:hover`); a bare `nav a:hover` or `button:hover` is less specific, so name a
 * class in it. Hover rules apply only to a fine pointer that hovers.
 *
 * Header. finish.js keeps the site's header on screen (fixed over a full-bleed hero, sticky
 * otherwise) and sets `data-scrolled` on <html> once the hero has gone; the header then turns to
 * glass: a translucent surface (`--finish-glass`, which finish.js picks from the header's own type
 * colour and the page's ground), a backdrop blur and a hairline.
 *
 * Origin: whop.com, stripe.com, decagon.ai and pollensites.com as measured in the website unit's
 * reference/polish.md, November 2026.
 */

:where(:root) {
	--ease: cubic-bezier(0.23, 1, 0.32, 1);
	--fast: 150ms;
	--base: 300ms;
	--slow: 800ms;
	--r-s: 6px;
	--r-m: 12px;
	--r-l: 20px;
	--shadow-1: 0 1px 2px rgb(0 0 0 / 0.06), 0 2px 8px rgb(0 0 0 / 0.06);
	--shadow-2: 0 2px 6px rgb(0 0 0 / 0.08), 0 18px 48px rgb(0 0 0 / 0.14);
	--hairline: color-mix(in oklch, currentColor 14%, transparent);
	--glass-blur: 18px;
}

:where(a[href], button, [role="button"], summary, input, select, textarea, label, [data-finish-hover]) {
	transition:
		color var(--fast) var(--ease),
		background-color var(--fast) var(--ease),
		border-color var(--fast) var(--ease),
		text-decoration-color var(--fast) var(--ease),
		opacity var(--fast) var(--ease),
		box-shadow var(--base) var(--ease),
		transform var(--base) var(--ease);
}

@media (hover: hover) and (pointer: fine) {
	[data-finish-hover="link"]:hover {
		text-decoration-line: underline;
		text-decoration-thickness: 1px;
		text-underline-offset: 0.2em;
	}
	[data-finish-hover="button"]:hover {
		transform: translateY(-1px);
		box-shadow: var(--shadow-1);
	}
	[data-finish-hover="card"]:hover {
		transform: translateY(-3px);
		box-shadow: var(--shadow-2);
	}
}

[data-finish-hover="button"]:active {
	transform: translateY(0) scale(0.98);
}
[data-finish-hover="card"]:active {
	transform: translateY(-1px);
}
[data-finish-hover="link"]:active {
	text-decoration-line: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.12em;
}

[data-finish-header] {
	z-index: 50;
	transition:
		background-color var(--base) var(--ease),
		box-shadow var(--base) var(--ease),
		backdrop-filter var(--base) var(--ease),
		-webkit-backdrop-filter var(--base) var(--ease);
}

html[data-scrolled] [data-finish-header] {
	background-color: var(--finish-glass, color-mix(in oklch, Canvas 80%, transparent));
	-webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.6);
	backdrop-filter: blur(var(--glass-blur)) saturate(1.6);
	box-shadow: 0 1px 0 var(--finish-hairline, var(--hairline));
}

@media (prefers-reduced-motion: reduce) {
	:where(a[href], button, [role="button"], [data-finish-hover]),
	[data-finish-header] {
		transition-property: color, background-color, border-color, text-decoration-color, opacity;
	}
	[data-finish-hover]:hover,
	[data-finish-hover]:active {
		transform: none;
	}
}
