/* File field: own file button over the visually hidden input, requirements hint and the list of chosen files. */
.prf-upload {
	position: relative;
}

/* The input stays focusable for keyboards and screen readers; its native file name never shows. */
.prf-upload > input[type='file'] {
	position: absolute !important;
	width: 1px !important;
	height: 1px;
	margin: 0;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Same tokens as the native file button (prontoforms.css) and the profile photo button. */
.prf-upload__pick {
	display: inline-block;
	box-sizing: border-box;
	max-width: 100%;
	margin: 0;
	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;
	overflow-wrap: anywhere;
	cursor: pointer;
}

.prf-upload__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)));
}

/* Files dragged over the field: the drop zone is outlined like the focus, the button shows its hover colours. */
.prf-upload.prf-dragover {
	outline: 2px dashed var(--prf-focus, #2271b1);
	outline-offset: 2px;
	border-radius: var(--prf-radius, 4px);
}

.prf-upload.prf-dragover .prf-upload__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-upload > input:focus-visible + .prf-upload__pick {
	outline: 2px solid var(--prf-focus, #2271b1);
	outline-offset: 2px;
}

.prf-upload > input:disabled + .prf-upload__pick {
	cursor: default;
	opacity: .55;
}

/* Flush below the button: theme rules for lists in content areas must not indent the list. */
.prf-upload .prf-upload__list {
	display: grid;
	gap: .4em;
	list-style: none;
	margin: .65em 0 0 !important;
	padding: 0 !important;
}

.prf-upload .prf-upload__list[hidden] {
	display: none;
}

.prf-upload .prf-upload__row {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: .75em;
	margin: 0 !important;
	padding: .5em .625em;
	border: var(--prf-border-width, 1px) solid var(--prf-border, #c3c4c7);
	border-radius: var(--prf-radius, 4px);
	background: var(--prf-bg, #fff);
	color: var(--prf-text, #1d2327);
	line-height: 1.4;
}

.prf-upload__media {
	display: grid;
	place-items: center;
	width: 2.75em;
	height: 2.75em;
	overflow: hidden;
	color: var(--prf-muted, #50575e);
	background: var(--prf-file-button-bg, #f6f7f7);
	border-radius: var(--prf-radius, 4px);
}

.prf-upload__media svg,
.prf-upload__remove svg {
	width: 1.5em;
	height: 1.5em;
}

.prf-upload__preview {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.prf-upload__details {
	display: grid;
	gap: .125em;
	overflow-wrap: anywhere;
}

.prf-upload__name {
	font-size: 1em;
	font-weight: 600;
}

.prf-upload__size {
	color: var(--prf-muted, #50575e);
	font-size: .875em;
}

.prf-upload__row--invalid .prf-upload__size {
	color: var(--prf-error, #b32d2e);
}

.prf-upload .prf-upload__remove {
	display: grid;
	place-items: center;
	width: 2.75em;
	height: 2.75em;
	margin: 0;
	padding: 0;
	font: inherit;
	color: inherit;
	background: transparent;
	border: 0;
	border-radius: var(--prf-file-button-radius, var(--prf-radius, 4px));
	cursor: pointer;
}

.prf-upload__remove:focus-visible {
	outline: 2px solid var(--prf-focus, #2271b1);
	outline-offset: 1px;
}

.prf-upload .prf-upload__remove:is(:hover, :focus-visible) {
	background: var(--prf-file-button-hover-bg, #f0f0f1);
}
