/**
 * Food26 reader photos (includes/reader-photos.php): the photo field in the comment form and the photo under a comment.
 * The "Made by Readers" strip is the Reader Photos widget's. Colours read the Food26 Design Scheme with the design's
 * values as fallbacks; four-class selectors keep a comment widget's or theme's form rules off the field's parts.
 */
.food26-photo-field {
	--food26-pf-primary: var(--inoforest-color-primary, #b23a1e);
	--food26-pf-heading: var(--inoforest-color-heading, #2b1a12);
	--food26-pf-muted: var(--inoforest-custom-muted, #6e5f55);
	--food26-pf-border: var(--inoforest-color-border, #ece2d6);
	display: grid;
	grid-column: 1 / -1;
	gap: 10px;
	margin-bottom: 18px;
}

.food26-photo-field .food26-photo-field__label {
	font-weight: 600;
	color: var(--food26-pf-heading);
}

.food26-photo-field__label .optional {
	font-weight: 400;
	color: var(--food26-pf-muted);
}

.comment-form .food26-photo-field .food26-photo-field__input {
	position: absolute;
	width: 1px;
	height: 1px;
	min-height: 0;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.comment-form .food26-photo-field .food26-photo-field__drop {
	display: grid;
	justify-items: center;
	gap: 4px;
	margin: 0;
	padding: 26px 20px;
	font-size: 0.9rem;
	font-weight: 400;
	line-height: 1.7;
	text-align: center;
	color: var(--food26-pf-muted);
	background: #fff;
	border: 2px dashed var(--food26-pf-border);
	border-radius: 16px;
	cursor: pointer;
	transition: border-color 0.3s, background-color 0.3s;
}

.food26-photo-field__drop i {
	font-size: 2rem;
	color: var(--food26-pf-primary);
}

.food26-photo-field__drop strong {
	color: var(--food26-pf-heading);
}

.food26-photo-field__drop span {
	font-size: 0.875rem;
}

.comment-form .food26-photo-field .food26-photo-field__drop:hover,
.comment-form .food26-photo-field .food26-photo-field__drop.is-dragover {
	background: var(--inoforest-custom-primary-light, #fbeae4);
	border-color: var(--food26-pf-primary);
}

.food26-photo-field__input:focus-visible + .food26-photo-field__drop {
	outline: 2px solid var(--food26-pf-primary);
	outline-offset: 2px;
}

.food26-photo-field__input.is-invalid + .food26-photo-field__drop {
	border-color: var(--food26-pf-primary);
}

.food26-photo-field__preview {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 16px;
	padding: 12px;
	background: #fff;
	border: 1px solid var(--food26-pf-border);
	border-radius: 16px;
}

.food26-photo-field__preview[hidden] {
	display: none;
}

.food26-photo-field .food26-photo-field__preview img {
	width: 88px;
	height: 88px;
	max-width: none;
	object-fit: cover;
	border-radius: 10px;
}

.food26-photo-field__name {
	flex: 1 1 140px;
	min-width: 0;
	font-weight: 600;
	color: var(--food26-pf-heading);
	overflow-wrap: anywhere;
}

.comment-form .food26-photo-field .food26-photo-field__remove {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 0;
	margin: 0;
	padding: 0;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	color: var(--food26-pf-primary);
	background: none;
	border: 0;
	cursor: pointer;
}

/* While a photo is chosen, the drop zone hides (the preview takes its place). */
.food26-photo-field__preview:not([hidden]) ~ .food26-photo-field__drop,
.food26-photo-field__input:has(~ .food26-photo-field__preview:not([hidden])) + .food26-photo-field__drop {
	display: none;
}

.food26-photo-field .food26-photo-field__error {
	margin: 0;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--inoforest-custom-primary-dark, #8e2c15);
}

.food26-photo-field .food26-photo-field__consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0;
	font-size: 0.9rem;
}

.food26-photo-field .food26-photo-field__consent[hidden] {
	display: none;
}

.food26-photo-field__check input {
	width: 18px;
	height: 18px;
	margin: 4px 0 0;
	accent-color: var(--food26-pf-primary);
}

.comment-form .food26-photo-field .food26-photo-field__consent label {
	margin: 0;
	font-size: inherit;
	font-weight: 400;
	color: inherit;
}

/* The photo under a comment (inside its text, after the last paragraph: 16 px below it, as in the design) */
.food26-comment-photo {
	width: min(240px, 100%);
	margin: 16px 0 12px;
	overflow: hidden;
	border-radius: 10px;
}

.food26-comment-photo a {
	display: block;
}

.food26-comment-photo img {
	display: block;
	width: 100%;
	height: auto;
	max-width: none;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	transition: transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.food26-comment-photo a:hover img,
.food26-comment-photo a:focus-visible img {
	transform: scale(1.05);
}

@media (prefers-reduced-motion: reduce) {
	.food26-comment-photo img,
	.comment-form .food26-photo-field .food26-photo-field__drop {
		transition: none;
	}
}
