/* Profile image cropper: dialog styled like the form popup, buttons from the button tokens, also in Naked/Divi mode. */
.prf-profile [hidden] {
	display: none !important;
}

/* Dialog: width, corners, padding, background and backdrop come from the popup settings. */
.prf-profile__dialog {
	box-sizing: border-box;
	width: min(var(--prf-popup-width, 560px), calc(100vw - 2rem));
	max-height: calc(100dvh - 2rem);
	overflow: auto;
	margin: auto;
	padding: var(--prf-popup-pad, 32px);
	border: 0;
	border-radius: var(--prf-popup-radius, 12px);
	background: var(--prf-popup-bg, #fff);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	color: var(--prf-text, #1d2327);
	font-family: var(--prf-font, inherit);
	font-size: 16px;
	line-height: 1.5;
}

.prf-profile__dialog::backdrop {
	background: var(--prf-popup-backdrop, rgba(15, 23, 42, 0.6));
}

.prf-profile__title {
	margin: 0 0 6px;
	padding: 0;
	color: inherit;
	font: 600 20px/1.4 var(--prf-font, inherit);
}

.prf-profile__hint,
.prf-profile__status,
.prf-profile__message {
	font-size: 14px;
	line-height: 1.5;
}

.prf-profile__hint {
	margin: 0 0 16px;
	color: var(--prf-muted, #50575e);
}

.prf-profile__status:empty,
.prf-profile__message:empty {
	display: none;
}

/* Stage: whole photo, centred. */
.prf-profile__stage {
	display: flex;
	justify-content: center;
	width: 100%;
	margin: 0 0 16px;
	line-height: 0;
}

.prf-profile__canvas {
	display: block;
	max-width: 100%;
	touch-action: none;
	cursor: default;
}

.prf-profile__controls,
.prf-profile__actions,
.prf-profile__footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.prf-profile__footer {
	justify-content: flex-end;
	margin-top: 20px;
}

.prf-profile__zoom {
	display: grid;
	flex: 1;
	gap: 4px;
	min-width: 0;
	font-size: 14px;
}

/* Custom track and thumb, so theme rules for input fields do not render the zoom as a text field. */
.prf-profile__dialog .prf-profile__zoom input[type='range'] {
	-webkit-appearance: none;
	appearance: none;
	display: block;
	width: 100%;
	height: 36px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}

.prf-profile__dialog .prf-profile__zoom input[type='range']::-webkit-slider-runnable-track {
	height: 4px;
	border-radius: 2px;
	background: var(--prf-border, #c3c4c7);
}

.prf-profile__dialog .prf-profile__zoom input[type='range']::-moz-range-track {
	height: 4px;
	border-radius: 2px;
	background: var(--prf-border, #c3c4c7);
}

.prf-profile__dialog .prf-profile__zoom input[type='range']::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	margin-top: -8px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--prf-button-bg, var(--prf-accent, #2271b1));
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.prf-profile__dialog .prf-profile__zoom input[type='range']::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--prf-button-bg, var(--prf-accent, #2271b1));
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

/* All buttons share shape and size; “Apply” is filled, the others are outline buttons of the same colour. */
.prf-profile__button {
	box-sizing: border-box;
	appearance: none;
	min-height: 44px;
	margin: 0;
	padding: 0.6em 1.2em;
	border: max(1px, var(--prf-button-border-width, 0px)) solid var(--prf-button-bg, var(--prf-accent, #2271b1));
	border-radius: var(--prf-button-radius, 4px);
	background: transparent;
	color: var(--prf-button-bg, var(--prf-accent, #2271b1));
	font: inherit;
	font-size: 15px;
	font-weight: var(--prf-button-weight, 600);
	line-height: 1.4;
	letter-spacing: normal;
	text-transform: none;
	cursor: pointer;
}

.prf-profile__button:hover {
	background: color-mix(in srgb, var(--prf-button-bg, var(--prf-accent, #2271b1)) 8%, transparent);
}

.prf-profile__button--primary {
	background: var(--prf-button-bg, var(--prf-accent, #2271b1));
	color: var(--prf-button-text, var(--prf-accent-text, #fff));
}

.prf-profile__button--primary:hover {
	background: var(--prf-button-hover-bg, var(--prf-button-bg, var(--prf-accent, #2271b1)));
	color: var(--prf-button-hover-text, var(--prf-button-text, var(--prf-accent-text, #fff)));
}

.prf-profile__tools {
	display: flex;
	gap: 8px;
}

.prf-profile__button--icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	padding: 0;
}

.prf-profile__button--icon svg {
	width: 24px;
	height: 24px;
}

.prf-profile__button:disabled {
	opacity: 0.6;
	cursor: wait;
}

.prf-profile__button:focus-visible,
.prf-profile__canvas:focus-visible,
.prf-profile__zoom input:focus-visible {
	outline: 2px solid var(--prf-focus, #2271b1);
	outline-offset: 3px;
}

.prf-profile--ready {
	position: relative;
}

.prf-profile--ready input[type='file'] {
	position: absolute !important;
	width: 1px !important;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.prf-profile__panel {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: center;
	gap: 0.6em 1em;
	padding: 0.9em;
	border: 1px solid var(--prf-border, #c3c4c7);
	border-radius: var(--prf-radius, 4px);
	background: var(--prf-bg, #fff);
	color: var(--prf-text, #1d2327);
}

.prf-profile__visual {
	display: grid;
	place-items: center;
	width: 3.75em;
	aspect-ratio: 1;
	border-radius: 50%;
	color: var(--prf-muted, #50575e);
	background: color-mix(in srgb, currentcolor 9%, transparent);
}

.prf-profile__visual::before {
	content: '';
	width: 2.5em;
	height: 2.5em;
	background: currentcolor;
	mask: url(../icons/wordpress/comment-author-avatar.svg) center / contain no-repeat;
}

.prf-profile--chosen .prf-profile__visual {
	border-radius: var(--prf-radius, 4px);
	background: transparent;
}

.prf-profile__preview {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	border-radius: inherit;
}

.prf-profile__name {
	font-weight: var(--prf-label-weight, 600);
	line-height: 1.35;
}

.prf-profile--chosen .prf-profile__visual::before,
.prf-profile--chosen .prf-profile__pick,
.prf-profile__name:empty {
	display: none;
}

/* The requirements hint keeps the description styles; the panel's gap spaces it. */
.prf-profile .prf-profile__details > .prf-upload__hint {
	margin: 0;
}

.prf-profile__details {
	display: grid;
	justify-items: start;
	gap: 0.3em;
	min-width: 0;
	overflow-wrap: anywhere;
}

.prf-profile__meta {
	color: var(--prf-muted, #50575e);
	font-size: 0.875em;
	line-height: 1.4;
}

.prf-profile__meta:empty {
	display: none;
}

.prf-profile__panel .prf-profile__button,
.prf-profile__panel .prf-profile__pick {
	box-sizing: border-box;
	margin: 0;
	min-height: 2.25em;
	max-width: 100%;
	padding: var(--prf-file-button-pad-y, .45em) var(--prf-file-button-pad-x, .8em);
	border: var(--prf-border-width, 1px) solid var(--prf-file-button-border, var(--prf-border, #c3c4c7));
	border-radius: var(--prf-file-button-radius, var(--prf-radius, 4px));
	background: var(--prf-file-button-bg, #f6f7f7);
	color: var(--prf-file-button-text, var(--prf-text, #1d2327));
	font: inherit;
	font-size: var(--prf-file-button-size, .875em);
	line-height: 1.4;
	cursor: pointer;
}

.prf-profile__panel .prf-profile__button:hover,
.prf-profile__panel .prf-profile__pick:hover {
	background: var(--prf-file-button-hover-bg, #f0f0f1);
	color: var(--prf-file-button-hover-text, var(--prf-file-button-text, var(--prf-text, #1d2327)));
}

/* Photo dragged over the field: the panel is outlined like the focus, the button shows its hover colours. */
.prf-profile.prf-dragover .prf-profile__panel {
	outline: 2px dashed var(--prf-focus, #2271b1);
	outline-offset: 2px;
}

.prf-profile.prf-dragover .prf-profile__panel .prf-profile__pick {
	background: var(--prf-file-button-hover-bg, #f0f0f1);
	color: var(--prf-file-button-hover-text, var(--prf-file-button-text, var(--prf-text, #1d2327)));
}

.prf-profile input:focus-visible ~ .prf-profile__panel .prf-profile__pick,
.prf-profile--chosen input:focus-visible ~ .prf-profile__panel {
	outline: 2px solid var(--prf-focus, #2271b1);
	outline-offset: 2px;
}

.prf-profile__actions {
	grid-column: 1 / -1;
	gap: 0.5em;
}

.prf-profile__actions .prf-profile__button:last-child {
	margin-inline-start: auto;
}

.prf-busy .prf-profile__actions {
	opacity: 0.6;
	pointer-events: none;
}

@media (max-width: 480px) {

	.prf-profile__dialog {
		padding: min(var(--prf-popup-pad, 32px), 16px);
	}
}
