/* =============================================================================
   Newsletter (bloque em-contact-form/newsletter) y patrón Club (em-wine-store/club)
   -----------------------------------------------------------------------------
   El CSS del plugin es solo disposición, con variables --em-nl-*: acá se les dan
   los tokens de theme.json. El campo y la casilla son el estándar de forms.css
   (por elemento, sin adaptador) y el botón es el del theme (wp-element-button).
   Se carga solo con el bloque (functions.php), también en el editor.
   Club (.club de docs/ux/index.html): foto a la izquierda y texto con el
   formulario a la derecha, en una tarjeta. Bajo 700 px, la foto arriba. El
   aviso de error flota bajo el formulario, sobre el relleno de la tarjeta, para
   no agrandarla al aparecer.
   ============================================================================= */

/* ---- Bloque newsletter (en cualquier lugar) ------------------------------------ */
.em-newsletter {
	--em-nl-gap: var(--wp--preset--spacing--30);
	--em-nl-row-gap: var(--wp--preset--spacing--20);
	--em-nl-consent-gap: var(--wp--preset--spacing--20);
	--em-nl-error-color: var(--wp--preset--color--danger);
	font-family: var(--wp--preset--font-family--body);
	color: var(--wp--preset--color--foreground);
}

/* El botón va junto al campo: con su alto (el de los campos es el alto chico de botón). */
.em-newsletter .em-newsletter__submit {
	min-height: var(--wp--custom--button--height-small);
	padding-block: 0;
}

.em-newsletter .em-newsletter__consent,
.em-newsletter .em-newsletter__error {
	font-size: var(--wp--preset--font-size--small);
	line-height: var(--wp--custom--line-height--normal);
}

.em-newsletter .em-newsletter__consent {
	color: var(--wp--preset--color--muted);
}

.em-newsletter .em-newsletter__privacy {
	color: var(--wp--preset--color--foreground);
	text-decoration-color: var(--wp--preset--color--primary);
	text-underline-offset: 0.2em;
}

/* Enviado: el mensaje reemplaza al formulario y recibe el foco (view.ts). */
.em-newsletter .em-newsletter__success:not([hidden]) {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	column-gap: var(--wp--preset--spacing--30);
	row-gap: var(--wp--preset--spacing--10);
	padding: var(--wp--preset--spacing--40);
	border-radius: var(--wp--preset--border-radius--large);
	background-color: var(--wp--preset--color--surface-sunken);
}

.em-newsletter .em-newsletter__success::before {
	content: "✓";
	display: grid;
	grid-row: 1 / span 2;
	place-items: center;
	width: 1.6em;
	height: 1.6em;
	border-radius: var(--wp--preset--border-radius--full);
	background-color: var(--wp--preset--color--success);
	color: var(--wp--preset--color--surface);
	font-size: var(--wp--preset--font-size--body);
}

.em-newsletter .em-newsletter__success-title {
	font-size: var(--wp--preset--font-size--body);
	font-weight: 700;
	line-height: var(--wp--custom--line-height--normal);
}

.em-newsletter .em-newsletter__success-text {
	font-size: var(--wp--preset--font-size--body-small);
	line-height: var(--wp--custom--line-height--normal);
	color: var(--wp--preset--color--muted);
}

/* Editor: el campo y la casilla son una vista previa; el texto de ayuda del campo y el del botón se
   escriben encima, con la letra y el color que tendrán en la tienda. */
.em-newsletter .em-newsletter__form--preview .em-newsletter__input,
.em-newsletter .em-newsletter__form--preview input[type="checkbox"] {
	pointer-events: none;
}

.em-newsletter .em-newsletter__placeholder {
	--em-nl-placeholder-inset: var(--wp--preset--spacing--30);
	--em-nl-placeholder-opacity: 1;
	font-size: var(--ws-field-font-size);
	color: var(--wp--preset--color--muted);
}

.em-newsletter span.em-newsletter__submit {
	display: inline-flex;
	align-items: center;
	cursor: text;
}

/* ---- Club --------------------------------------------------------------------- */
.ws-club {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	overflow: hidden;
	border-width: 1px;
	border-style: solid;
	border-color: var(--wp--preset--color--border);
	border-radius: var(--wp--preset--border-radius--xx-large);
	background-color: var(--wp--preset--color--surface);
}

.ws-club > * {
	margin-block: 0;
}

.ws-club .ws-club__photo {
	position: relative;
	min-height: var(--wp--custom--club--photo-min-height);
	margin: 0;
}

/* La foto llena su mitad (también en el editor, que envuelve la imagen en una caja redimensionable). */
.ws-club .ws-club__photo img,
.ws-club .ws-club__photo .components-resizable-box__container {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
}

.ws-club .ws-club__photo img {
	object-fit: cover;
	object-position: 60% center;
}

.ws-club .ws-club__body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: var(--wp--preset--spacing--80);
}

.ws-club .ws-club__body > * {
	margin-block: 0;
}

.ws-club .ws-club__kicker {
	margin-block-start: var(--wp--preset--spacing--20);
}

.ws-club .ws-club__lead {
	max-width: var(--wp--custom--club--lead-width);
	margin-block: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
	color: var(--wp--preset--color--muted);
}

.ws-club .em-newsletter__form {
	position: relative;
}

.ws-club .em-newsletter__error {
	position: absolute;
	inset-inline: 0;
	top: 100%;
	margin-block-start: var(--wp--preset--spacing--20);
}

/* ---- Breakpoints --------------------------------------------------------------- */
@media (min-width: 700px) and (max-width: 1023px) {
	.ws-club .ws-club__body {
		padding: var(--wp--preset--spacing--70) var(--wp--preset--spacing--60) var(--wp--preset--spacing--80);
	}
}

@media (max-width: 699px) {
	.ws-club {
		grid-template-columns: minmax(0, 1fr);
	}

	.ws-club .ws-club__photo {
		min-height: 0;
		aspect-ratio: 16 / 10;
	}

	.ws-club .ws-club__body {
		padding: var(--wp--preset--spacing--50) var(--wp--preset--spacing--50) var(--wp--preset--spacing--80);
	}

	.ws-club .ws-club__title {
		font-size: var(--wp--preset--font-size--large);
	}
}
