/* =========================================================================
   Luna Wellness Centre Referral Form — all styles scoped under .refform
   ========================================================================= */

.refform {
	--rf-bg:        #fbf4ec;
	--rf-surface:   #ffffff;
	--rf-ink:       #2b2a28;
	--rf-muted:     #6f6962;
	--rf-primary:   #2f4f51;
	--rf-primary-d: #25403f;
	--rf-accent:    #b9714f;
	--rf-line:      #e7dccd;
	--rf-line-2:    #d9cbb8;
	--rf-error:     #b3261e;
	--rf-error-bg:  #fcecea;
	--rf-ok:        #2e6b4f;
	--rf-radius:    12px;
	--rf-radius-sm: 8px;
	--rf-shadow:    0 1px 2px rgba(47,79,81,.06), 0 8px 24px rgba(47,79,81,.07);

	--rf-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
	--rf-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	max-width: 880px;
	margin: 0 auto;
	color: var(--rf-ink);
	font-family: var(--rf-sans);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.refform *, .refform *::before, .refform *::after { box-sizing: border-box; }

.rf-form {
	background: var(--rf-bg);
	border: 1px solid var(--rf-line);
	border-radius: var(--rf-radius);
	padding: clamp(20px, 4vw, 40px);
}

/* Screen-reader-only labels */
.rf-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Header --------------------------------------------------------------- */
.rf-head { text-align: center; margin-bottom: 28px; }
.rf-title {
	font-family: var(--rf-serif);
	font-weight: 600;
	font-size: clamp(26px, 4vw, 34px);
	letter-spacing: .01em;
	color: var(--rf-ink);
	margin: 0;
}

/* Cards ---------------------------------------------------------------- */
.rf-card {
	background: var(--rf-surface);
	border: 1px solid var(--rf-line);
	border-radius: var(--rf-radius);
	box-shadow: var(--rf-shadow);
	margin-bottom: 18px;
	overflow: hidden;
}
.rf-card__head {
	padding: 16px 22px;
	border-bottom: 1px solid var(--rf-line);
	background: linear-gradient(0deg, rgba(47,79,81,.03), rgba(47,79,81,.03));
}
.rf-card__head h3 {
	margin: 0;
	font-family: var(--rf-serif);
	font-size: 19px;
	font-weight: 600;
	color: var(--rf-primary);
}
.rf-card__body { padding: 22px; }
fieldset.rf-card__body { border: 0; margin: 0; min-width: 0; }

/* Collapsible consultation cards */
.rf-card--collapsible .rf-card__toggle {
	all: unset;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	box-sizing: border-box;
	padding: 16px 22px;
	cursor: pointer;
	font-family: var(--rf-serif);
	font-size: 19px;
	font-weight: 600;
	color: var(--rf-primary);
	background: linear-gradient(0deg, rgba(185,113,79,.05), rgba(185,113,79,.05));
	border-bottom: 1px solid var(--rf-line);
}
.rf-card--collapsible .rf-card__toggle:focus-visible { outline: 2px solid var(--rf-primary); outline-offset: -2px; }
.rf-chevron {
	width: 22px; height: 22px; flex: none;
	fill: none; stroke: var(--rf-primary); stroke-width: 2.2;
	stroke-linecap: round; stroke-linejoin: round;
	transition: transform .22s ease;
}
.rf-card.is-collapsed .rf-chevron { transform: rotate(-90deg); }
.rf-card.is-collapsed .rf-card__toggle { border-bottom-color: transparent; }
.rf-card.is-collapsed .rf-card__body { display: none; }

/* Selector ------------------------------------------------------------- */
.rf-selector {
	background: var(--rf-surface);
	border: 1px solid var(--rf-line);
	border-radius: var(--rf-radius);
	box-shadow: var(--rf-shadow);
	padding: 22px;
	margin-bottom: 18px;
}
.rf-selector__intro { margin: 0 0 14px; color: var(--rf-muted); font-size: 14px; }
.rf-label--lg { font-size: 17px; font-weight: 600; display: block; margin-bottom: 14px; }
.rf-hint { display: block; font-size: 13px; font-weight: 400; color: var(--rf-muted); margin-top: 2px; }

/* Grid + fields -------------------------------------------------------- */
.rf-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px 20px;
}
.rf-field { display: flex; flex-direction: column; min-width: 0; }
.rf-field--full { grid-column: 1 / -1; }

.rf-label {
	font-weight: 600;
	font-size: 14.5px;
	margin-bottom: 7px;
	color: var(--rf-ink);
}
.rf-req { color: var(--rf-accent); font-weight: 700; }

.rf-field input[type="text"],
.rf-field input[type="tel"],
.rf-field input[type="email"],
.rf-field input[type="date"],
.rf-field input[type="number"],
.rf-field textarea {
	width: 100%;
	font: inherit;
	color: var(--rf-ink);
	background: var(--rf-surface);
	border: 1px solid var(--rf-line-2);
	border-radius: var(--rf-radius-sm);
	padding: 11px 13px;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.rf-field textarea { resize: vertical; min-height: 96px; }
.rf-field input::placeholder, .rf-field textarea::placeholder { color: #a59c8f; }
.rf-field input:focus, .rf-field textarea:focus {
	outline: none;
	border-color: var(--rf-primary);
	box-shadow: 0 0 0 3px rgba(47,79,81,.14);
}

/* Choices -------------------------------------------------------------- */
.rf-choices { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.rf-choices--stack { flex-direction: column; gap: 10px; }
.rf-choice {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	cursor: pointer;
	font-size: 14.5px;
	color: var(--rf-ink);
	user-select: none;
}
.rf-choices--stack .rf-choice {
	border: 1px solid var(--rf-line-2);
	border-radius: var(--rf-radius-sm);
	padding: 11px 14px;
	transition: border-color .15s ease, background .15s ease;
}
.rf-choices--stack .rf-choice:hover { border-color: var(--rf-primary); background: rgba(47,79,81,.03); }
.rf-choice input { width: 17px; height: 17px; accent-color: var(--rf-primary); margin: 0; flex: none; }
.rf-choices--stack .rf-choice:has(input:checked) { border-color: var(--rf-primary); background: rgba(47,79,81,.05); }

/* Notes ---------------------------------------------------------------- */
.rf-note {
	font-size: 14px;
	font-weight: 600;
	color: var(--rf-muted);
	margin: 4px 0 -4px;
}

/* File drop zone ------------------------------------------------------- */
.rf-file { position: relative; }
.rf-file__input {
	position: absolute; inset: 0; width: 100%; height: 100%;
	opacity: 0; cursor: pointer;
}
.rf-file__drop {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	text-align: center;
	padding: 26px 18px;
	border: 1.5px dashed var(--rf-line-2);
	border-radius: var(--rf-radius-sm);
	background: #faf6f0;
	color: var(--rf-muted);
	font-size: 14px;
	transition: border-color .15s ease, background .15s ease;
}
.rf-file.is-drag .rf-file__drop { border-color: var(--rf-primary); background: rgba(47,79,81,.06); }
.rf-file__icon { width: 26px; height: 26px; fill: none; stroke: var(--rf-primary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rf-file__browse { color: var(--rf-primary); font-weight: 600; text-decoration: underline; }
.rf-file__name {
	margin-top: 10px;
	font-size: 13.5px;
	color: var(--rf-ink);
	background: #fff;
	border: 1px solid var(--rf-line-2);
	border-radius: var(--rf-radius-sm);
	padding: 8px 12px;
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.rf-file__remove { all: unset; cursor: pointer; color: var(--rf-accent); font-weight: 700; padding: 0 4px; }

/* Signature pad -------------------------------------------------------- */
.rf-sig { }
.rf-sig__canvas {
	display: block;
	width: 100%;
	height: 180px;
	background: #fff;
	border: 1px solid var(--rf-line-2);
	border-radius: var(--rf-radius-sm);
	touch-action: none;
	cursor: crosshair;
}
.rf-sig__bar { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.rf-sig__hint { font-size: 13px; color: var(--rf-muted); }
.rf-sig__clear {
	all: unset;
	cursor: pointer;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--rf-primary);
	border: 1px solid var(--rf-line-2);
	border-radius: var(--rf-radius-sm);
	padding: 6px 14px;
	background: #fff;
}
.rf-sig__clear:hover { border-color: var(--rf-primary); background: rgba(47,79,81,.04); }

/* Errors --------------------------------------------------------------- */
.rf-error { color: var(--rf-error); font-size: 13px; margin: 6px 0 0; }
.rf-field.has-error input,
.rf-field.has-error textarea { border-color: var(--rf-error); background: var(--rf-error-bg); }
.rf-field.has-error .rf-choices { padding: 4px 6px; border-radius: 6px; background: var(--rf-error-bg); }
.rf-selector.has-error { border-color: var(--rf-error); }

/* Alert banner --------------------------------------------------------- */
.rf-alert {
	border-radius: var(--rf-radius-sm);
	padding: 14px 16px;
	margin-bottom: 20px;
	font-size: 14.5px;
	border: 1px solid transparent;
}
.rf-alert--ok { background: #eaf4ee; border-color: #bcdcc8; color: var(--rf-ok); }
.rf-alert--err { background: var(--rf-error-bg); border-color: #f0c5c1; color: var(--rf-error); }

/* Actions -------------------------------------------------------------- */
.rf-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.rf-submit {
	font: inherit;
	font-weight: 600;
	color: #fff;
	background: var(--rf-primary);
	border: 0;
	border-radius: var(--rf-radius-sm);
	padding: 13px 30px;
	cursor: pointer;
	transition: background .15s ease, transform .05s ease;
}
.rf-submit:hover { background: var(--rf-primary-d); }
.rf-submit:active { transform: translateY(1px); }
.rf-submit:disabled { opacity: .6; cursor: default; }

.rf-spinner {
	width: 20px; height: 20px;
	border: 2.5px solid rgba(47,79,81,.25);
	border-top-color: var(--rf-primary);
	border-radius: 50%;
	animation: rf-spin .7s linear infinite;
}
@keyframes rf-spin { to { transform: rotate(360deg); } }

/* Success -------------------------------------------------------------- */
.rf-done { text-align: center; padding: 48px 24px; }
.rf-done h3 { font-family: var(--rf-serif); color: var(--rf-primary); font-size: 24px; margin: 0 0 8px; }
.rf-done p { color: var(--rf-muted); margin: 0; }

/* Honeypot ------------------------------------------------------------- */
.rf-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
	.rf-chevron, .rf-submit, .rf-field input, .rf-field textarea { transition: none; }
	.rf-spinner { animation-duration: 1.4s; }
}

/* Mobile --------------------------------------------------------------- */
@media (max-width: 600px) {
	.rf-grid { grid-template-columns: 1fr; }
	.rf-field--full { grid-column: auto; }
}
