/*
 * Hafdz Contact — front-end styles. Tokens, typography, and card patterns
 * mirror hafdz-donations so the contact form, company info card, and
 * floating dialog feel native to the rest of the suite.
 */

.hafdz-contact {
	--hc-accent:        #0d5c4a;
	--hc-accent-hover:  #0a4a3b;
	--hc-accent-soft:   #e6efec;
	--hc-accent-ink:    #073128;
	--hc-bg:            #fafaf7;
	--hc-surface:       #ffffff;
	--hc-surface-2:     #f5f4ef;
	--hc-ink:           #1a1a17;
	--hc-ink-2:         #4a4a44;
	--hc-ink-3:         #8a8880;
	--hc-ink-4:         #b8b6ad;
	--hc-border:        #e8e6df;
	--hc-border-strong: #d8d5cc;
	--hc-warm-soft:     #f6ecd9;
	--hc-warm-ink:      #8a5a1f;
	--hc-danger:        #c34a3a;
	--hc-danger-soft:   #fdecea;
	--hc-success:       #2e7d5b;

	--hc-radius-sm: 6px;
	--hc-radius-md: 10px;
	--hc-radius-lg: 14px;

	--hc-font-sans:  "Inter Tight", "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--hc-font-serif: "Instrument Serif", Georgia, serif;
	--hc-font-mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

	color: var(--hc-ink);
	font-family: var(--hc-font-sans);
	font-size: 14px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;

	display: block;
	width: 100%;
	box-sizing: border-box;
}

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

/* Host themes (e.g. Hafdz' `.article-body h2 { margin-top: 56px }` and the
 * lobotomized-owl `.article-body > * + * { margin-top: 1em }` rule) bleed
 * into our shell unless we reset every heading + paragraph inside it. The
 * doubled `.hafdz-contact.hafdz-contact` selector raises our specificity to
 * (0,2,1) — strictly greater than `.article-body h2` (0,1,1) — so the reset
 * always wins regardless of stylesheet load order. */
.hafdz-contact.hafdz-contact h1,
.hafdz-contact.hafdz-contact h2,
.hafdz-contact.hafdz-contact h3,
.hafdz-contact.hafdz-contact h4,
.hafdz-contact.hafdz-contact h5,
.hafdz-contact.hafdz-contact h6,
.hafdz-contact.hafdz-contact p {
	margin: 0;
}
/* Owl-selector reset: cancels `> * + *` patterns from host themes that
 * inject vertical rhythm into every direct child of an article body. */
.hafdz-contact.hafdz-contact > * + *,
.hafdz-contact.hafdz-contact .hafdz-contact-card > * + *,
.hafdz-contact.hafdz-contact .hafdz-contact-info > * + * {
	margin-top: 0;
}

/* ==========================================================================
 * Card shell + headings
 * ========================================================================== */

.hafdz-contact .hafdz-contact-card {
	background: var(--hc-surface);
	border: 1px solid var(--hc-border);
	border-radius: var(--hc-radius-md);
	padding: 28px;
	margin: 1.5rem 0;
}

.hafdz-contact .hafdz-contact-card--bleed { padding: 0; overflow: hidden; }

.hafdz-contact.hafdz-contact .hafdz-contact__header {
	margin: 0 0 24px;
}

.hafdz-contact.hafdz-contact .hafdz-contact__eyebrow {
	font-family: var(--hc-font-mono);
	font-size: 11px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--hc-ink-3);
	font-weight: 500;
	margin: 0 0 6px;
}

.hafdz-contact.hafdz-contact .hafdz-contact__title {
	font-family: var(--hc-font-serif);
	font-weight: 400;
	font-size: 28px;
	letter-spacing: -0.015em;
	line-height: 1.15;
	color: var(--hc-ink);
	margin: 0;
}

.hafdz-contact.hafdz-contact .hafdz-contact__lede {
	margin: 8px 0 0;
	color: var(--hc-ink-3);
	font-size: 13px;
}

/* ==========================================================================
 * Form
 * ========================================================================== */

.hafdz-contact-form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.hafdz-contact-form__types {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 4px;
	padding: 0;
	border: 0;
}

.hafdz-contact-form__type {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid var(--hc-border);
	border-radius: 999px;
	background: var(--hc-surface);
	color: var(--hc-ink-2);
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
	user-select: none;
}

.hafdz-contact-form__type:hover { background: var(--hc-surface-2); }
.hafdz-contact-form__type input { display: none; }
.hafdz-contact-form__type:has(input:checked) {
	background: var(--hc-accent-soft);
	border-color: var(--hc-accent);
	color: var(--hc-accent-ink);
	font-weight: 600;
}

.hafdz-contact-form__row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
}

@media (max-width: 540px) {
	.hafdz-contact-form__row { grid-template-columns: 1fr; }
}

.hafdz-contact-form__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.hafdz-contact-form__label {
	font-size: 12px;
	font-weight: 500;
	color: var(--hc-ink-2);
}

.hafdz-contact-form input[type="text"],
.hafdz-contact-form input[type="email"],
.hafdz-contact-form textarea {
	width: 100%;
	padding: 10px 12px;
	font: inherit;
	font-size: 14px;
	color: var(--hc-ink);
	background: var(--hc-surface);
	border: 1px solid var(--hc-border-strong);
	border-radius: var(--hc-radius-sm);
	transition: border-color 120ms ease, box-shadow 120ms ease;
	appearance: none;
}

.hafdz-contact-form input:focus,
.hafdz-contact-form textarea:focus {
	outline: none;
	border-color: var(--hc-accent);
	box-shadow: 0 0 0 3px var(--hc-accent-soft);
}

.hafdz-contact-form textarea {
	resize: vertical;
	min-height: 120px;
	line-height: 1.5;
}

.hafdz-contact-form input[readonly] {
	background: var(--hc-surface-2);
	color: var(--hc-ink-2);
	border-style: dashed;
}

.hafdz-contact-form__hint {
	font-size: 11px;
	color: var(--hc-ink-3);
	margin: 0;
}

.hafdz-contact-form__honeypot {
	position: absolute !important;
	left: -10000px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

.hafdz-contact-form__actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	margin-top: 6px;
}

.hafdz-contact-btn {
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 20px;
	border: 1px solid var(--hc-border-strong);
	border-radius: var(--hc-radius-sm);
	background: var(--hc-surface);
	color: var(--hc-ink);
	cursor: pointer;
	transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 80ms ease;
}

.hafdz-contact-btn:hover { background: var(--hc-surface-2); }

.hafdz-contact-btn--primary {
	background: var(--hc-accent);
	color: #fff;
	border-color: var(--hc-accent);
	padding: 12px 24px;
}
.hafdz-contact-btn--primary:hover { background: var(--hc-accent-hover); border-color: var(--hc-accent-hover); }
.hafdz-contact-btn--primary:active { transform: translateY(1px); }
.hafdz-contact-btn[disabled] { opacity: 0.65; cursor: progress; }

/* Status lines */
.hafdz-contact-form__error,
.hafdz-contact-form__notice {
	margin: 0;
	padding: 10px 12px;
	font-size: 13px;
	border-radius: var(--hc-radius-sm);
}
.hafdz-contact-form__error  { background: var(--hc-danger-soft); color: var(--hc-danger); border: 1px solid #f5b7b1; }
.hafdz-contact-form__notice { background: var(--hc-accent-soft); color: var(--hc-accent-ink); border: 1px solid #b9d3cc; }
.hafdz-contact-form__error:empty,
.hafdz-contact-form__notice:empty { display: none; }

/* Compact variant lives in the floating button dialog. */
.hafdz-contact-form.is-compact { gap: 10px; }
.hafdz-contact-form.is-compact .hafdz-contact-form__row { gap: 10px; }
.hafdz-contact-form.is-compact textarea { min-height: 96px; }

/* ==========================================================================
 * Company info card
 * ========================================================================== */

.hafdz-contact-info {
	background: var(--hc-surface);
	border: 1px solid var(--hc-border);
	border-radius: var(--hc-radius-md);
	padding: 28px;
	margin: 1.5rem 0;
}

.hafdz-contact.hafdz-contact .hafdz-contact-info__header { margin: 0 0 20px; }

.hafdz-contact-info__list {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--hc-border);
}

.hafdz-contact-info__row {
	display: grid;
	grid-template-columns: 28px 100px 1fr;
	gap: 12px;
	align-items: center;
	padding: 12px 0;
	border-bottom: 1px solid var(--hc-border);
	min-height: 44px;
}

@media (max-width: 540px) {
	.hafdz-contact-info__row {
		grid-template-columns: 28px 1fr;
	}
	.hafdz-contact-info__key { display: none; }
}

.hafdz-contact-info__icon {
	width: 28px; height: 28px;
	border-radius: 6px;
	background: var(--hc-accent-soft);
	color: var(--hc-accent);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.hafdz-contact-info__icon svg { display: block; }

.hafdz-contact-info__key {
	font-family: var(--hc-font-mono);
	font-size: 10px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--hc-ink-3);
	font-weight: 500;
}

.hafdz-contact-info__value {
	color: var(--hc-ink);
	font-size: 14px;
	line-height: 1.5;
	min-width: 0;
	word-break: break-word;
}

.hafdz-contact-info__value address {
	font-style: normal;
	margin: 0;
}

.hafdz-contact-info__value a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px dashed var(--hc-border-strong);
	transition: color 120ms ease, border-color 120ms ease;
}
.hafdz-contact-info__value a:hover {
	color: var(--hc-accent);
	border-bottom-color: var(--hc-accent);
}

.hafdz-contact-info__map {
	margin-top: 18px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--hc-warm-soft);
	color: var(--hc-warm-ink);
	font-size: 12px;
	font-weight: 500;
	text-decoration: none;
	border: 1px solid transparent;
	transition: background 120ms ease;
}
.hafdz-contact-info__map:hover { background: #f0e3c5; }

/* Embedded map sits at the top of the info card so the address/phone list
 * reads as a caption beneath it. Aspect-ratio keeps it stable while the
 * iframe loads, and the rounded mask matches the card chrome. */
.hafdz-contact-info__map-embed {
	margin: 0 0 20px;
	border: 1px solid var(--hc-border);
	border-radius: var(--hc-radius-md);
	overflow: hidden;
	background: var(--hc-surface-2);
	aspect-ratio: 16 / 9;
}

.hafdz-contact-info__map-embed iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

@media (max-width: 540px) {
	.hafdz-contact-info__map-embed { aspect-ratio: 4 / 3; }
}

.hafdz-contact-empty p {
	margin: 0;
	color: var(--hc-ink-3);
	font-style: italic;
	font-size: 13px;
}

/* ==========================================================================
 * Floating button — pinned to the bottom-right by default
 *
 * Edge spacing uses max(env(safe-area-inset-*), N) so the trigger clears
 * iOS home-indicator gestures and never sits flush with the viewport edge —
 * otherwise the soft drop-shadow gets clipped by the window frame and looks
 * "outside" the content. The shadow spread is also tuned so it stays inside
 * a 24px gutter.
 * ========================================================================== */

.hafdz-contact-fab {
	position: fixed;
	bottom: max( env( safe-area-inset-bottom, 0px ), 28px );
	z-index: 9000;
	font-family: var(--hc-font-sans);

	/* Size the wrapper from the button content alone — no auto-stretch from
	 * descendants — so the visible button never drifts past the viewport. */
	width: max-content;
	max-width: calc( 100vw - 56px );
	margin: 0;

	/* The wrapper is empty space around the button; let clicks fall through
	 * to whatever is underneath. The button inside re-enables pointer events. */
	pointer-events: none;
}

.hafdz-contact-fab > * { pointer-events: auto; }

.hafdz-contact-fab--bottom-right { right: max( env( safe-area-inset-right, 0px ), 28px ); }
.hafdz-contact-fab--bottom-left  { left:  max( env( safe-area-inset-left,  0px ), 28px ); }

/* Icon-only circular button. Width = height so the bubble stays circular
 * regardless of the icon's intrinsic size; padding sets the visual gutter
 * around the SVG. */
.hafdz-contact-fab__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--hc-accent);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(13, 92, 74, 0.26), 0 2px 4px rgba(0, 0, 0, 0.08);
	transition: background 120ms ease, transform 80ms ease, box-shadow 160ms ease;
}

.hafdz-contact-fab__btn:hover {
	background: var(--hc-accent-hover);
	box-shadow: 0 10px 22px rgba(13, 92, 74, 0.30), 0 3px 6px rgba(0, 0, 0, 0.10);
}
.hafdz-contact-fab__btn:active { transform: translateY(1px); }
.hafdz-contact-fab__btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
	box-shadow: 0 0 0 4px var(--hc-accent), 0 6px 18px rgba(13, 92, 74, 0.26);
}

.hafdz-contact-fab__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
}

/* When the dialog is open, hide the trigger so it doesn't peek through
 * the backdrop in the corner. The JS toggles `.is-open` (covers older
 * browsers); `:has()` covers the trigger living next to a dialog inside
 * the same shell when that ever happens. */
.hafdz-contact-fab.is-open .hafdz-contact-fab__btn,
.hafdz-contact-fab:has( dialog[open] ) .hafdz-contact-fab__btn {
	visibility: hidden;
}

@media (max-width: 540px) {
	.hafdz-contact-fab { bottom: max( env( safe-area-inset-bottom, 0px ), 18px ); }
	.hafdz-contact-fab--bottom-right { right: max( env( safe-area-inset-right, 0px ), 18px ); }
	.hafdz-contact-fab--bottom-left  { left:  max( env( safe-area-inset-left,  0px ), 18px ); }
	.hafdz-contact-fab__btn { width: 52px; height: 52px; }
}

/* ==========================================================================
 * Dialog
 * ========================================================================== */

.hafdz-contact-dialog {
	border: 0;
	padding: 0;
	max-width: min(560px, calc(100vw - 1.5em));
	width: 100%;
	border-radius: var(--hc-radius-lg);
	box-shadow: 0 32px 80px rgba(0, 0, 0, 0.30), 0 6px 18px rgba(0, 0, 0, 0.10);
	background: transparent;
	font-family: var(--hc-font-sans);
	color: var(--hc-ink);
}

.hafdz-contact-dialog::backdrop {
	background: rgba(15, 25, 22, 0.55);
	backdrop-filter: blur(3px);
}

.hafdz-contact-dialog__inner {
	background: var(--hc-surface);
	border-radius: var(--hc-radius-lg);
	overflow: hidden;
}

.hafdz-contact-dialog__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 20px;
	border-bottom: 1px solid var(--hc-border);
	background: linear-gradient(180deg, var(--hc-surface) 0%, var(--hc-surface-2) 100%);
}

.hafdz-contact-dialog__heading {
	min-width: 0;
}

.hafdz-contact-dialog__eyebrow {
	font-family: var(--hc-font-mono);
	font-size: 10px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--hc-ink-3);
	font-weight: 500;
	margin: 0 0 4px;
}

.hafdz-contact-dialog__title {
	font-family: var(--hc-font-serif);
	font-size: 22px;
	font-weight: 400;
	letter-spacing: -0.015em;
	margin: 0;
	line-height: 1.15;
}

.hafdz-contact-dialog__close {
	background: transparent;
	border: 1px solid transparent;
	padding: 6px;
	border-radius: var(--hc-radius-sm);
	cursor: pointer;
	color: var(--hc-ink-3);
	flex: 0 0 auto;
	transition: background 120ms ease, color 120ms ease;
}
.hafdz-contact-dialog__close:hover {
	background: var(--hc-surface-2);
	color: var(--hc-ink);
}

.hafdz-contact-dialog__body {
	padding: 20px;
}

/* Dialog body owns its padding; the embedded card should not double up. */
.hafdz-contact-dialog .hafdz-contact-card {
	padding: 0;
	border: 0;
	margin: 0;
	background: transparent;
}
