/**
 * WooYoo LinkIt — front end.
 *
 * One stylesheet for every site: colours arrive as custom properties on the
 * wrapper, so nothing here needs regenerating when the settings change.
 */

.wyli {
	--wyli-bg: #111111;
	--wyli-fg: #ffffff;
	--wyli-radius: 4px;
	margin: 1em 0;
}

/**
 * Layout only. Anything that decides what a button *looks* like lives in
 * .wyli-btn, so that a themed button (.wyli-themed) keeps the theme's own
 * padding, colour, border and hover state untouched.
 */
.wyli-link {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	text-decoration: none;
}

.wyli-btn {
	background: var(--wyli-bg);
	color: var(--wyli-fg);
	border-radius: var(--wyli-radius);
	font-weight: 600;
	line-height: 1.2;
	padding: 0.85em 1.6em;
	transition: opacity 0.15s ease;
}

.wyli-btn:hover,
.wyli-btn:focus {
	color: var(--wyli-fg);
	opacity: 0.88;
	text-decoration: none;
}

/**
 * Fallback for a theme-styled button, at ZERO specificity.
 *
 * :where() means every one of these lines loses to any rule the theme has for
 * its own button classes — that is the point. A theme that styles the core
 * button classes takes over completely; a theme that styles nothing still gets
 * a real button rather than a bare underlined link.
 *
 * Core's own block styles are written with :where() too, so they tie with these
 * on specificity and lose on source order — which cost the button its pill
 * shape in Twenty Twenty-Five. Hence the :not(): when the core button classes
 * are in play, core and the theme own the styling outright and this says
 * nothing at all.
 */
:where( .wyli-themed:not( .wp-block-button__link ) ) {
	background: #111111;
	color: #ffffff;
	border-radius: 4px;
	padding: 0.85em 1.6em;
	font-weight: 600;
	line-height: 1.2;
}

:where( .wyli-themed:not( .wp-block-button__link ):hover, .wyli-themed:not( .wp-block-button__link ):focus ) {
	color: #ffffff;
	text-decoration: none;
}

.wyli-link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.wyli-icon {
	flex: 0 0 auto;
}

/* Sizes — only meaningful when LinkIt is drawing the button */

.wyli-size-small .wyli-btn {
	padding: 0.6em 1.1em;
	font-size: 0.9em;
}

.wyli-size-large .wyli-btn {
	padding: 1.05em 2.2em;
	font-size: 1.1em;
}

/* Alignment */

.wyli-align-center {
	text-align: center;
}

.wyli-align-right {
	text-align: right;
}

.wyli-align-full .wyli-link {
	display: flex;
	justify-content: center;
	width: 100%;
}

/* The core block wrapper is inline-block, so it has to stretch as well. */
.wyli-align-full .wp-block-button {
	display: block;
	width: 100%;
}

.wyli-align-center .wp-block-button,
.wyli-align-right .wp-block-button {
	display: inline-block;
}

/* Meta line */

.wyli-meta,
.wyli-note {
	margin: 0.5em 0 0;
	font-size: 0.85em;
	opacity: 0.75;
}

.wyli-credit {
	margin: 0.4em 0 0;
	font-size: 0.72em;
	opacity: 0.55;
}

.wyli-credit a {
	color: inherit;
	text-decoration: none;
}

/* Plain style — a text link, styled by the page it sits on */

.wyli-plain-link {
	background: none;
	color: inherit;
	padding: 0;
	font-weight: inherit;
	text-decoration: underline;
}

/* LinkIt colours chosen, but both boxes cleared: outline only */

.wyli-plain .wyli-btn {
	background: transparent;
	color: inherit;
	border: 1px solid currentColor;
}

/* Card */

.wyli-style-card .wyli-card {
	display: flex;
	align-items: center;
	gap: 1em;
	flex-wrap: wrap;
	padding: 1.1em 1.3em;
	border: 1px solid rgba( 0, 0, 0, 0.12 );
	border-radius: calc( var(--wyli-radius) + 4px );
	background: rgba( 0, 0, 0, 0.02 );
}

.wyli-card-type {
	flex: 0 0 auto;
	font-size: 0.7em;
	font-weight: 700;
	letter-spacing: 0.06em;
	padding: 0.45em 0.6em;
	border-radius: 3px;
	background: var(--wyli-bg);
	color: var(--wyli-fg);
}

.wyli-card-body {
	flex: 1 1 12em;
	min-width: 0;
}

.wyli-card-title {
	margin: 0;
	font-weight: 700;
}

.wyli-card-note {
	margin: 0.2em 0 0;
	font-size: 0.9em;
}

.wyli-card-action {
	flex: 0 0 auto;
}

.wyli-card .wyli-meta {
	margin-top: 0.25em;
}

.wyli-list .wyli {
	margin: 0 0 0.75em;
}

/* Only ever seen by someone who can fix it */

.wyli-hint {
	display: inline-block;
	padding: 0.5em 0.8em;
	border: 1px dashed #c00;
	border-radius: 3px;
	color: #c00;
	font-size: 0.85em;
}

@media ( max-width: 480px ) {
	.wyli-style-card .wyli-card {
		align-items: flex-start;
	}

	.wyli-card-action,
	.wyli-card-action .wyli-link {
		width: 100%;
		justify-content: center;
	}
}
