/*
 * Rahkar — «تماس با ما» (templates/contact.tpl + assets/js/contact-form.js).
 * Registered for the contact page only, by rahkarchrome's setMedia hook.
 *
 * Minimal on purpose: one centered column, no card box, hairline
 * underline fields that darken on focus, one solid button. Everything else is
 * type and whitespace.
 */

.rh-contact {
	--rhc-ink: var(--wp--preset--color--contrast, #0f1115);
	--rhc-muted: var(--wp--preset--color--text-muted, #5b6271);
	--rhc-line: var(--wp--preset--color--border, #e2e4e9);
	--rhc-accent: var(--wp--preset--color--primary, #3e4a3f);
	--rhc-error: #b3261e;

	max-width: 520px;
	margin: 0 auto;
	padding: clamp(32px, 7vw, 88px) 20px clamp(48px, 9vw, 120px);
	color: var(--rhc-ink);
}

/* ---- Heading ----------------------------------------------------------- */
.rh-contact__head {
	text-align: center;
	margin-bottom: clamp(36px, 6vw, 56px);
}
.rh-contact__eyebrow {
	margin: 0 0 12px;
	font-size: 12px;
	letter-spacing: .08em;
	color: var(--rhc-muted);
}
.rh-contact__title {
	margin: 0 0 14px;
	font-size: clamp(1.6rem, 4.5vw, 2.2rem);
	font-weight: var(--rh-fw-strong);
	line-height: 1.4;
	color: var(--rhc-ink);
}
.rh-contact__lead {
	max-width: 400px;
	margin: 0 auto;
	font-size: .95rem;
	line-height: 2;
	color: var(--rhc-muted);
}

/* ---- Fields ------------------------------------------------------------ */
.rh-contact__field {
	margin-bottom: 30px;
}
.rh-contact__label {
	display: block;
	margin-bottom: 4px;
	font-size: 13px;
	color: var(--rhc-muted);
	transition: color .2s ease;
}
.rh-contact__field:focus-within .rh-contact__label {
	color: var(--rhc-ink);
}

.rh-contact__input {
	display: block;
	width: 100%;
	padding: 10px 0 12px;
	border: 0;
	border-bottom: 1px solid var(--rhc-line);
	border-radius: 0;
	background: transparent;
	color: var(--rhc-ink);
	font: inherit;
	font-size: 16px; /* ≥16px: no iOS zoom-on-focus */
	line-height: 1.8;
	box-shadow: none;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.rh-contact__input::placeholder {
	color: #a4a9b3;
	opacity: 1;
}
.rh-contact__input:focus {
	outline: none;
	border-bottom-color: var(--rhc-ink);
	box-shadow: 0 1px 0 0 var(--rhc-ink);
}
.rh-contact__input[aria-invalid="true"] {
	border-bottom-color: var(--rhc-error);
	box-shadow: 0 1px 0 0 var(--rhc-error);
}

.rh-contact__input--ltr {
	direction: ltr;
	text-align: right;
	letter-spacing: .04em;
	font-variant-numeric: tabular-nums;
}

/* Native select (best picker on phones), stripped to the same underline. */
.rh-contact__select {
	position: relative;
}
.rh-contact__select::after {
	content: '';
	position: absolute;
	left: 2px;
	top: 50%;
	width: 7px;
	height: 7px;
	margin-top: -6px;
	border-bottom: 1.5px solid var(--rhc-muted);
	border-left: 1.5px solid var(--rhc-muted);
	transform: rotate(-45deg);
	pointer-events: none;
}
.rh-contact__select select {
	appearance: none;
	-webkit-appearance: none;
	padding-left: 24px;
	cursor: pointer;
}
/* The "انتخاب کن" placeholder option reads as a placeholder, not a value. */
.rh-contact__select select:invalid {
	color: #a4a9b3;
}
.rh-contact__select option {
	color: var(--rhc-ink);
}

.rh-contact__textarea {
	min-height: 112px;
	max-height: 50vh;
	resize: none;
	overflow-y: auto;
}

.rh-contact__meta {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
}
.rh-contact__count {
	margin-top: 8px;
	margin-inline-start: auto;
	font-size: 12px;
	color: #a4a9b3;
	direction: ltr;
	font-variant-numeric: tabular-nums;
	transition: color .2s ease;
}
.rh-contact__count.is-near {
	color: var(--rhc-error);
}

.rh-contact__error {
	margin: 8px 0 0;
	font-size: 12.5px;
	line-height: 1.7;
	color: var(--rhc-error);
	animation: rhc-fade .2s ease-out;
}
.rh-contact__error--form {
	margin: -8px 0 18px;
	text-align: center;
}

/* ---- Submit ------------------------------------------------------------ */
.rh-contact__submit {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	height: 54px;
	margin-top: 8px;
	border: 0;
	border-radius: 999px;
	background: var(--rhc-accent);
	color: #fff;
	font: inherit;
	font-size: 15px;
	font-weight: var(--rh-fw-strong);
	cursor: pointer;
	transition: transform .15s ease, opacity .2s ease, box-shadow .2s ease;
}
.rh-contact__submit:hover {
	box-shadow: 0 8px 22px color-mix(in srgb, var(--rhc-accent) 28%, transparent);
}
.rh-contact__submit:active {
	transform: scale(.985);
}
.rh-contact__submit:focus-visible {
	outline: 2px solid var(--rhc-accent);
	outline-offset: 3px;
}
.rh-contact__spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, .35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: rhc-spin .7s linear infinite;
}
.rh-contact__submit[aria-busy="true"] {
	cursor: progress;
	opacity: .85;
}
.rh-contact__submit[aria-busy="true"] .rh-contact__spinner {
	display: inline-block;
}

.rh-contact__note {
	margin: 14px 0 0;
	text-align: center;
	font-size: 12px;
	color: #a4a9b3;
}

/* Honeypot — off-screen, not display:none (some bots skip hidden fields). */
.rh-contact__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---- Thank-you --------------------------------------------------------- */
.rh-contact__thanks {
	text-align: center;
	padding-top: 8px;
	animation: rhc-rise .45s cubic-bezier(.2, .7, .3, 1);
}
.rh-contact__thanks:focus {
	outline: none;
}
.rh-contact__thanks-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 68px;
	height: 68px;
	margin-bottom: 22px;
	border-radius: 50%;
	background: color-mix(in srgb, var(--wp--preset--color--success, #2e7d4f) 12%, transparent);
	color: var(--wp--preset--color--success, #2e7d4f);
	animation: rhc-pop .5s cubic-bezier(.3, 1.6, .5, 1) .1s both;
}
.rh-contact__tick {
	stroke-dasharray: 24;
	stroke-dashoffset: 24;
	animation: rhc-draw .45s ease-out .35s forwards;
}
.rh-contact__thanks-title {
	margin: 0 0 10px;
	font-size: clamp(1.3rem, 4vw, 1.6rem);
	font-weight: var(--rh-fw-strong);
	color: var(--rhc-ink);
}
.rh-contact__thanks-text {
	max-width: 380px;
	margin: 0 auto;
	line-height: 2;
	color: var(--rhc-muted);
}
.rh-contact__thanks-actions {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	margin-top: 32px;
}
.rh-contact__btn-ghost {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 220px;
	height: 50px;
	padding: 0 28px;
	border: 1px solid var(--rhc-ink);
	border-radius: 999px;
	color: var(--rhc-ink);
	font-weight: var(--rh-fw-strong);
	text-decoration: none;
	transition: background .2s ease, color .2s ease;
}
.rh-contact__btn-ghost:hover {
	background: var(--rhc-ink);
	color: #fff;
}
.rh-contact__btn-link {
	padding: 4px;
	border: 0;
	background: none;
	color: var(--rhc-muted);
	font: inherit;
	font-size: 14px;
	text-decoration: underline;
	text-underline-offset: 4px;
	cursor: pointer;
}

@keyframes rhc-spin { to { transform: rotate(360deg); } }
@keyframes rhc-fade { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@keyframes rhc-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes rhc-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rhc-draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
	.rh-contact__thanks,
	.rh-contact__thanks-icon,
	.rh-contact__error { animation: none; }
	.rh-contact__tick { animation: none; stroke-dashoffset: 0; }
}
