/*
 * Ultimate Subscriber List: basic layout CSS, loaded only for forms with
 * "Use basic layout CSS" turned on (Sign-up form screen, Fields card).
 * Those forms carry the .usub-layout class; nothing here touches other forms.
 *
 * It adds a little spacing, full-width boxes, and a fallback look for the
 * Subscribe button so it never shows as the browser's bare default button.
 * Stacked or side by side is set on the Sign-up form screen, not here.
 *
 * Your theme always wins: every rule sits in the "usub" cascade layer and is
 * wrapped in :where() (zero specificity), so any theme or Additional CSS rule
 * for these elements, buttons included, takes priority.
 */
@layer usub {
	:where(.usub-layout .usub-field) { margin: 0 0 1em; }
	:where(.usub-layout .usub-label) { margin-bottom: 0.25em; }
	:where(.usub-layout .usub-input) {
		box-sizing: border-box;
		width: 100%;
		max-width: 100%;
		min-height: 2.75em;
		font: inherit;
	}
	:where(.usub-layout.usub-message, .usub-layout .usub-message) { margin: 0 0 1em; }
	:where(.usub-layout .usub-submit) { margin: 0 0 1em; }

	/*
	 * Subscribe button fallback, for themes that do not style buttons.
	 * Filled with the theme's own color presets when it has them (primary, then
	 * accent, then contrast, then foreground), with text picked light or dark
	 * for contrast. With no presets it is an outline button in the text color
	 * around the form. Same height as the text boxes above.
	 */
	:where(.usub-layout .usub-button) {
		--usub-button-fill: var(--wp--preset--color--primary, var(--wp--preset--color--accent, var(--wp--preset--color--contrast, var(--wp--preset--color--foreground))));
		-webkit-appearance: none;
		appearance: none;
		box-sizing: border-box;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-height: 2.75em;
		margin: 0;
		padding: 0.5em 1.25em;
		border: 1px solid currentColor;
		border-radius: 0.375em;
		background: transparent;
		color: inherit;
		font: inherit;
		font-weight: 600;
		line-height: 1.25;
		text-align: center;
		text-decoration: none;
		cursor: pointer;
	}
	@supports (color: oklch(from red l c h)) {
		:where(.usub-layout .usub-button) {
			border-color: var(--usub-button-fill, currentColor);
			background: var(--usub-button-fill, transparent);
			/* Light text on a dark fill, dark text on a light fill. Without a fill this falls back to the surrounding text color. */
			color: oklch(from var(--usub-button-fill) clamp(0, (0.62 - l) * 1000, 1) 0 0);
		}
	}
	:where(.usub-layout .usub-button:hover) { filter: brightness(0.92); }
	:where(.usub-layout .usub-button:focus-visible) { outline: 2px solid currentColor; outline-offset: 2px; }
}
