/* Rabin Craft — Giant Wordmark. Needs core.css.
   wordmark.js measures the word and sets --fit (the font size that fills the width; 18cqi until then),
   --mkit-wm-w and each letter's --mkit-wm-x (so a gradient or picture spans the whole word) and, on scroll,
   --p (0 → 1 as it comes into view) and --mkit-wm-f (0 → 1, the ink fill). Each letter's own progress --q
   starts a little later than the one before, so the letters rise in a wave.

   Settable on the element or an ancestor: --mkit-wm-stroke (visible line thickness), --mkit-wm-stroke-color,
   --mkit-wm-fill, --mkit-wm-ink, --mkit-wm-g3, --mkit-wm-angle, --mkit-wm-image, --mkit-wm-depth,
   --mkit-wm-weight, --mkit-wm-spacing, --mkit-wm-width, --mkit-wm-crop (0–.6). Looks set the --wm-look-*
   starting values underneath them. */

@property --mkit-wm-f {
	syntax: "<number>";
	inherits: true;
	initial-value: 1;
}

.mkit-wordmark {
	--wm-line: var(--mkit-wm-stroke, var(--wm-look-stroke, max(1px, .012em)));
	--wm-line-color: var(--mkit-wm-stroke-color, var(--mkit-text));
	--wm-inside: var(--mkit-wm-fill, var(--mkit-surface));
	--wm-crop: var(--mkit-wm-crop, var(--wm-look-crop, 0));
	width: 100%;
	container-type: inline-size;
	overflow-x: clip;
	color: var(--mkit-text);
}

.mkit-wordmark p.mkit-wordmark__word {
	width: var(--mkit-wm-width, 100%);
	max-width: 100%;
	margin: 0 auto calc(var(--wm-crop) * -1.02em) !important; /* content styles often set a margin on every <p> */
	/* Only the bottom edge clips (the letters rise out of it); outlines and glows may reach past the sides */
	clip-path: inset(-1em -1em calc(var(--wm-crop) * 100%) -1em);
	padding-block: .02em .1em;
	font-size: var(--fit, 18cqi);
	font-weight: var(--mkit-wm-weight, var(--wm-look-weight, 700));
	line-height: .9;
	letter-spacing: var(--mkit-wm-spacing, -.045em);
	white-space: nowrap;
}

/* A crop clips at the root's own bottom edge. A clip-path alone leaves the hidden part stretching the page. */
.mkit-wordmark--crop {
	overflow-y: clip;
}

.mkit-wordmark--crop p.mkit-wordmark__word {
	clip-path: none;
	padding-top: .14em;
}

.mkit-wordmark--align-left p.mkit-wordmark__word {
	margin-left: 0 !important;
}

.mkit-wordmark--align-right p.mkit-wordmark__word {
	margin-right: 0 !important;
}

.mkit-wordmark__letters {
	display: inline-flex;
}

.mkit-wordmark__letters > span {
	--q: clamp(0, calc((var(--p, 1) - var(--i) / var(--n) * .45) / .55), 1);
	position: relative;
	display: inline-block;
	white-space: pre;
	translate: 0 calc((1 - var(--q)) * 108%);
}

/* The spacing after the last letter would push the word off its width */
.mkit-wordmark__letters > span:last-child {
	letter-spacing: 0;
}

/* Outline: variable fonts draw glyphs from overlapping shapes, and a bare stroke traces every overlap.
   The stroke is painted under a fill in the section colour, so only the outer half shows: the stroke is
   twice --wm-line, and the default spacing keeps neighbouring lines from running into each other. */
.mkit-wordmark:is(.mkit-wordmark--outline, .mkit-wordmark--ink) .mkit-wordmark__word {
	--wm-reach: var(--wm-line);
	letter-spacing: var(--mkit-wm-spacing, calc(var(--wm-reach) * 2 + .004em));
}

.mkit-wordmark:is(.mkit-wordmark--outline, .mkit-wordmark--ink) .mkit-wordmark__letters > span {
	color: var(--wm-inside);
	-webkit-text-stroke: calc(var(--wm-reach) * 2) var(--wm-line-color);
	paint-order: stroke fill;
}

/* Glow: it needs room below the word, and may spill past the sides of the column */
.mkit-wordmark--line-glow {
	overflow-x: visible;
}

.mkit-wordmark--line-glow p.mkit-wordmark__word {
	padding-bottom: .22em;
}

.mkit-wordmark--line-glow .mkit-wordmark__letters > span {
	filter: drop-shadow(0 0 .012em var(--wm-line-color)) drop-shadow(0 0 .07em var(--wm-line-color));
}

/* Double: one thick line, a thinner one in the fill colour on it, then the line again on that */
.mkit-wordmark--line-double .mkit-wordmark__word {
	--wm-reach: calc(var(--wm-line) * 3.2);
}

.mkit-wordmark--line-double .mkit-wordmark__letters > span::before,
.mkit-wordmark--line-double .mkit-wordmark__letters > span::after {
	content: attr(data-c);
	position: absolute;
	inset: 0;
	color: var(--wm-inside);
	paint-order: stroke fill;
}

.mkit-wordmark--line-double .mkit-wordmark__letters > span::before {
	-webkit-text-stroke: calc(var(--wm-line) * 4.4) var(--wm-inside);
}

.mkit-wordmark--line-double .mkit-wordmark__letters > span::after {
	-webkit-text-stroke: calc(var(--wm-line) * 2) var(--wm-line-color);
}

/* Dashed, dotted: the letter keeps its place in the layout, and an SVG copy on top draws the line.
   wordmark.js sets --mkit-wm-base to the baseline. */
.mkit-wordmark:is(.mkit-wordmark--line-dashed, .mkit-wordmark--line-dotted) .mkit-wordmark__letters > span {
	color: transparent;
	-webkit-text-stroke: 0;
}

.mkit-wordmark__line {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
	pointer-events: none;
}

.mkit-wordmark__line text {
	fill: var(--wm-inside);
	stroke: var(--wm-line-color);
	stroke-width: calc(var(--wm-line) * 2);
	stroke-dasharray: calc(var(--wm-line) * 5) calc(var(--wm-line) * 3.5);
	paint-order: stroke fill;
	transform: translateY(var(--mkit-wm-base, .72em));
}

.mkit-wordmark--line-dotted .mkit-wordmark__line text {
	stroke-linecap: round;
	stroke-dasharray: 0 calc(var(--wm-line) * 3.6);
}

/* Ink: the filled letter sits on the outline and is uncovered by --k, this letter's share of --mkit-wm-f */
.mkit-wordmark--ink .mkit-wordmark__letters > span::after {
	--k: clamp(0, calc(var(--mkit-wm-f) * var(--n) - var(--i)), 1);
	--wm-ink: var(--mkit-wm-ink, var(--wm-line-color));
	content: attr(data-c);
	position: absolute;
	inset: 0;
	color: var(--wm-ink);
	-webkit-text-stroke: calc(var(--wm-reach) * 2) var(--wm-ink);
	paint-order: stroke fill;
	clip-path: inset(-.2em calc((1 - var(--k)) * (100% + .2em) - .1em) -.2em -.1em);
}

.mkit-wordmark--ink-up .mkit-wordmark__letters > span::after {
	--k: clamp(0, calc(var(--mkit-wm-f) * 1.35 - var(--i) / var(--n) * .35), 1); /* the whole word rises, in a slight wave */
	clip-path: inset(calc((1 - var(--k)) * (100% + .2em) - .1em) -.1em -.2em -.1em);
}

.mkit-wordmark--trigger-hover {
	--mkit-wm-f: 0;
	transition: --mkit-wm-f 1.2s var(--mkit-ease);
}

.mkit-wordmark--trigger-hover:hover {
	--mkit-wm-f: 1;
}

@media (hover: none), (prefers-reduced-motion: reduce) {
	.mkit-wordmark--trigger-hover {
		--mkit-wm-f: 1;
		transition: none;
	}
}

/* Gradient and picture: each letter shows its own slice of one image that spans the whole word. Padding
   gives glyphs that reach past their box room to paint; wordmark.js sets --mkit-wm-w and --mkit-wm-x. */
.mkit-wordmark:is(.mkit-wordmark--gradient, .mkit-wordmark--image) .mkit-wordmark__letters > span {
	margin: -.1em -.06em;
	padding: .1em .06em;
	color: transparent;
	-webkit-background-clip: text;
	background-clip: text;
}

.mkit-wordmark--gradient .mkit-wordmark__letters > span {
	background-image: linear-gradient(var(--mkit-wm-angle, 100deg), var(--mkit-accent-soft), var(--mkit-accent) 50%, var(--mkit-wm-g3, color-mix(in srgb, var(--mkit-accent), #fff 35%)));
	background-size: var(--mkit-wm-w, calc(var(--n) * 100%)) 100%;
	background-position: var(--mkit-wm-x, calc(var(--i) / max(1, var(--n) - 1) * 100%)) 0;
}

.mkit-wordmark--image .mkit-wordmark__letters > span {
	background-color: var(--mkit-text);
	background-image: var(--mkit-wm-image);
	background-size: var(--mkit-wm-w, calc(var(--n) * 100%)) auto;
	background-position: var(--mkit-wm-x, calc(var(--i) / max(1, var(--n) - 1) * 100%)) 50%;
}

/* Extrude: a solid edge built from stacked shadows */
.mkit-wordmark--extrude .mkit-wordmark__word {
	--wm-d: calc(var(--mkit-wm-depth, .08em) / 8);
	--wm-edge: var(--mkit-wm-ink, var(--mkit-accent));
	padding-right: var(--mkit-wm-depth, .08em); /* wordmark.js fits the word inside this, so the edge stays in the column */
	padding-bottom: calc(.1em + var(--mkit-wm-depth, .08em));
	letter-spacing: var(--mkit-wm-spacing, -.015em);
}

.mkit-wordmark--extrude .mkit-wordmark__letters > span {
	text-shadow:
		var(--wm-d) var(--wm-d) 0 var(--wm-edge),
		calc(var(--wm-d) * 2) calc(var(--wm-d) * 2) 0 var(--wm-edge),
		calc(var(--wm-d) * 3) calc(var(--wm-d) * 3) 0 var(--wm-edge),
		calc(var(--wm-d) * 4) calc(var(--wm-d) * 4) 0 var(--wm-edge),
		calc(var(--wm-d) * 5) calc(var(--wm-d) * 5) 0 var(--wm-edge),
		calc(var(--wm-d) * 6) calc(var(--wm-d) * 6) 0 var(--wm-edge),
		calc(var(--wm-d) * 7) calc(var(--wm-d) * 7) 0 var(--wm-edge),
		calc(var(--wm-d) * 8) calc(var(--wm-d) * 8) 0 var(--wm-edge);
}

/* Starting values for the looks; the settings above override them */
.mkit-wordmark--look-billboard,
.mkit-wordmark--look-poster,
.mkit-wordmark--look-horizon {
	--wm-look-weight: 900;
}

.mkit-wordmark--look-ink,
.mkit-wordmark--look-liquid {
	--wm-look-stroke: max(1.5px, .012em);
	--wm-look-weight: 900;
}

.mkit-wordmark--look-neon {
	--wm-look-stroke: max(1px, .006em);
	--wm-look-weight: 500;
}

.mkit-wordmark--look-blueprint {
	--wm-look-stroke: max(1px, .005em);
	--wm-look-weight: 500;
}

.mkit-wordmark--look-retro {
	--wm-look-stroke: max(1px, .007em);
	--wm-look-weight: 900;
}

.mkit-wordmark--look-horizon {
	--wm-look-crop: .34;
}

.mkit-wordmark--look-photo {
	--wm-look-weight: 900;
}

/* Hover */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.mkit-wordmark:is(.mkit-wordmark--hover-lift, .mkit-wordmark--hover-color) .mkit-wordmark__letters > span {
		transition: transform .35s var(--mkit-spring), color .2s linear, -webkit-text-stroke-color .2s linear;
	}

	.mkit-wordmark--hover-lift .mkit-wordmark__letters > span:hover {
		transform: translateY(-.07em);
	}

	.mkit-wordmark--hover-lift .mkit-wordmark__letters > span:hover + span,
	.mkit-wordmark--hover-lift .mkit-wordmark__letters > span:has(+ span:hover) {
		transform: translateY(-.03em);
	}

	.mkit-wordmark--hover-color .mkit-wordmark__letters > span:hover {
		color: var(--mkit-wm-ink, var(--mkit-accent));
		-webkit-text-stroke-color: var(--mkit-wm-ink, var(--mkit-accent));
	}
}
