/**
 * Part Identification Request modal — thin layout glue only.
 *
 * Reuses the existing .modal component (see assets/css/global.css) and the
 * :root brand variables. No new colours or component designs are introduced;
 * these rules only make the Contact Form 7 controls match the .modal__field
 * styling the original Upload a Photo mockup used, stack the three [file] slots
 * behind one dropzone, and lay the photo previews out.
 *
 * With a single photo the result is identical to the previous static markup.
 */

/* ---- Fields -------------------------------------------------------------- */

/* CF7 runs the form body through wpcf7_autop(), which wraps each field's inline
   content in a <p>. Zero its margins so .modal__field's own 18px spacing is the
   only gap, exactly as in the original static markup. */
#partRequestModal .pir-form p {
	margin: 0;
}

/* CF7 wraps each control in a span — make it fill its field. */
#partRequestModal .wpcf7-form-control-wrap {
	display: block;
}

/* global.css styles input[type=text] and [type=tel] only; CF7 also renders
   [type=email] and a textarea, which must look identical to them. */
#partRequestModal .modal__field input[type="email"],
#partRequestModal .modal__field textarea {
	width: 100%;
	padding: 12px 14px;
	border: 2px solid var(--color-border);
	border-radius: var(--radius-md);
	font-size: 1rem;
	font-family: inherit;
	transition: border-color 0.2s;
	box-sizing: border-box;
}

/* The form-tag asks for 3 rows; height keeps it compact regardless of the rows
   attribute, and the field stays user-resizable. */
#partRequestModal .modal__field textarea {
	display: block;
	height: 88px;
	min-height: 88px;
	resize: vertical;
}

#partRequestModal .modal__field input[type="email"]:focus,
#partRequestModal .modal__field textarea:focus {
	outline: none;
	border-color: var(--color-red);
}

/* Muted "(optional)" / "(up to 3)" hint inside a field label. */
#partRequestModal .pir-optional {
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
	color: var(--color-text-light);
}

/* ---- Photo slots --------------------------------------------------------- */

/* CF7's wrapper span would otherwise sit between the dropzone and its inputs,
   breaking the absolutely-positioned overlay and boxing in the error tip. */
#partRequestModal .modal__dropzone .wpcf7-form-control-wrap {
	display: contents;
}

/* Three [file] tags, one visible dropzone: only the next free slot is exposed
   as the invisible full-bleed overlay (same technique as .modal__file-input). */
#partRequestModal .pir-file {
	display: none;
}

#partRequestModal .pir-file--active {
	display: block;
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

/* ---- Previews ------------------------------------------------------------ */

/* One photo fills the row exactly as the original single preview did; two or
   three split into columns rather than stacking full-height. */
#partRequestModal .pir-previews {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
	gap: 10px;
}

/* The gap lives on the previews themselves, not the container: CF7 leaves
   whitespace inside #pirPreviews so :empty never matches, and an empty
   container must add no space at all between the label and the dropzone. */
#partRequestModal .pir-previews .modal__preview {
	margin-top: 0;
	margin-bottom: 12px;
}

#partRequestModal .pir-previews--multi .modal__preview img {
	max-height: 120px;
}

/* ---- Submit -------------------------------------------------------------- */

/* The form-tag adds .btn .btn--primary, but those are single-class selectors
   that other input resets out-rank, so re-declare the same look at higher
   specificity (#partRequestModal …) to win — reusing the exact brand values
   from global.css (.btn + .btn--primary), not new ones. */
#partRequestModal input.wpcf7-submit {
	display: inline-block;
	width: 100%;
	padding: 14px 32px;
	font-family: var(--font-heading);
	font-size: 16px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 1px;
	border: none;
	border-radius: var(--radius-sm);
	cursor: pointer;
	position: relative;
	overflow: hidden;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	background: linear-gradient(135deg, var(--color-red), var(--color-red-dark));
	color: var(--color-white);
	transition: all var(--transition);
}

#partRequestModal input.wpcf7-submit:hover:not(:disabled) {
	transform: translateY(-3px);
	box-shadow: var(--shadow-glow-red);
}

#partRequestModal input.wpcf7-submit:disabled {
	opacity: 0.6;
	cursor: default;
	transform: none;
	box-shadow: none;
}

/* CF7 spinner sits next to the button, not on its own line. */
#partRequestModal .wpcf7-spinner {
	margin: 0 0 0 10px;
}

/* ---- Messaging ----------------------------------------------------------- */

#partRequestModal .wpcf7-not-valid-tip {
	color: var(--color-red);
	font-size: 0.8rem;
	margin-top: 4px;
}

/* Inside the dropzone the tip flows under the prompt text rather than sitting
   on top of the invisible file input. */
#partRequestModal .modal__dropzone .wpcf7-not-valid-tip {
	position: relative;
	z-index: 1;
	margin-top: 8px;
}

#partRequestModal .wpcf7-response-output {
	margin: 14px 0 0;
	padding: 12px 14px;
	border-radius: var(--radius-md);
	font-size: 0.9rem;
}

/* ---- Modal chrome -------------------------------------------------------- */

/* Modern, slim scroll thumb for the modal's overflow area. */
#partRequestModal .modal {
	scrollbar-width: thin;
	scrollbar-color: var(--color-gray-medium) transparent;
}

#partRequestModal .modal::-webkit-scrollbar {
	width: 10px;
}

#partRequestModal .modal::-webkit-scrollbar-track {
	background: transparent;
	margin: 10px 0;
}

#partRequestModal .modal::-webkit-scrollbar-thumb {
	background: var(--color-gray-medium);
	border-radius: 999px;
	border: 2px solid var(--color-white);
}

#partRequestModal .modal::-webkit-scrollbar-thumb:hover {
	background: var(--color-gray);
}
