@use "@wordpress/base-styles/mixins" as *;
@use "../utils/theme-variables" as *;

.layout {
	height: auto;
	min-height: var(--wpds-dimension-size-lg);
	line-height: var(--wpds-typography-line-height-sm);
	// Fonts smaller than 16px cause mobile Safari to zoom on focus.
	font-size: max(var(--wpds-typography-font-size-md), 16px);

	@include break-small {
		font-size: var(--wpds-typography-font-size-md);
	}

	&:focus-within {
		@include outset-ring__focus();
	}
}

.editable {
	flex-grow: 1;
	min-width: 0;
	padding-block: calc((var(--wpds-dimension-size-lg) - var(--wpds-typography-line-height-sm)) / 2 - var(--wpds-border-width-xs));
	padding-inline: var(--wpds-dimension-padding-md);
	// `.layout` draws the focus ring.
	outline: none;

	// `::placeholder` only applies to native form fields, so draw the text
	// from the `aria-placeholder` attribute while the element has no content.
	&[aria-placeholder]:empty::before {
		content: attr(aria-placeholder);
		color: var(--wpds-color-foreground-interactive-neutral-weak);
	}

	&[aria-disabled="true"] {
		cursor: default;

		&:empty::before {
			color: inherit;
		}
	}
}
