/**
 * Chrome for the signup modal.
 *
 * Only the dialog shell lives here — the form inside is styled by the block's
 * own stylesheet, which the modal enqueues, so there is one set of field styles
 * rather than two that drift.
 */

.tys-modal {
	width: min(30rem, calc(100vw - 2rem));
	max-height: calc(100vh - 2rem);
	padding: 0;
	color: inherit;
	background: var(--wp--preset--color--background, #fff);
	border: 0;
	border-radius: 6px;
	box-shadow: 0 10px 40px rgb(0 0 0 / 25%);
	overflow: visible;
}

.tys-modal::backdrop {
	background: rgb(0 0 0 / 55%);
}

.tys-modal__inner {
	position: relative;
	padding: 2rem;
	max-height: calc(100vh - 2rem);
	overflow-y: auto;
}

/* The form is width-capped for inline use; inside the modal it should fill. */
.tys-modal .tys-form {
	max-width: none;
}

/* Close button ----------------------------------------------------------- */

.tys-modal__close {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	width: 2.25rem;
	height: 2.25rem;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
	line-height: 1;
	color: inherit;
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	opacity: 0.6;
}

.tys-modal__close:hover {
	opacity: 1;
	background: rgb(0 0 0 / 6%);
}

.tys-modal__close:focus-visible {
	opacity: 1;
	outline: 2px solid var(--wp--preset--color--primary, #005d70);
	outline-offset: 2px;
}

/* Opener button ---------------------------------------------------------- */

.tys-open-button {
	padding: 0.7em 1.6em;
	font: inherit;
	font-weight: 700;
	color: var(--wp--preset--color--background, #fff);
	background: var(--wp--preset--color--primary, #005d70);
	border: 0;
	border-radius: 4px;
	cursor: pointer;
}

.tys-open-button:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary, #005d70);
	outline-offset: 2px;
}

/* Entrance --------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {

	.tys-modal[open] {
		animation: tys-modal-in 200ms ease-out;
	}

	.tys-modal[open]::backdrop {
		animation: tys-backdrop-in 200ms ease-out;
	}
}

@keyframes tys-modal-in {

	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes tys-backdrop-in {

	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

/* Small screens ---------------------------------------------------------- */

@media (max-width: 480px) {

	.tys-modal__inner {
		padding: 1.5rem 1.25rem;
	}
}
