/*
 * "Say Hi" email dialog (footer.php). Native <dialog>, brand-styled: paper
 * panel, square corners (matches the features panel), ink text, pill mailto
 * button mirroring .hp-cta__button / .hp-header__cta.
 */

.hp-say-hi {
	box-sizing: border-box;
	width: calc(100% - 2 * var(--hp-container-pad));
	max-width: 560px;
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--hp-color-paper);
	color: var(--hp-color-ink);
}

.hp-say-hi::backdrop {
	background: rgba(0, 0, 0, 0.5);
}

/* Lock page scroll while the modal is open (no-op where :has is unsupported). */
body:has(.hp-say-hi[open]) {
	overflow: hidden;
}

/* Padding lives on the inner wrapper so a click on the dialog element itself
   can only be the backdrop (see assets/js/say-hi.js). */
.hp-say-hi__inner {
	position: relative;
	padding: 56px;
	text-align: center;
}

.hp-say-hi__eyebrow {
	margin: 0 0 8px;
	font-family: var(--hp-font-display);
	font-style: italic;
	font-weight: 400;
	font-size: 32px;
	line-height: 40px;
}

.hp-say-hi__heading {
	margin: 0 0 16px;
	font-family: var(--hp-font-display);
	font-style: normal;
	font-weight: 400;
	font-size: 46px;
	line-height: 52px;
}

.hp-say-hi__text {
	margin: 0 0 28px;
	font-family: var(--hp-font-body);
	font-weight: 300;
	font-size: 18px;
	line-height: 26px;
}

/* Pill mailto button — metrics + typography only; colors and the hover sweep
   come from the shared .hp-button class (assets/css/buttons.css), which is
   what actually keeps it in step with .hp-cta__button / .hp-header__cta. */
.hp-say-hi__mailto {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	max-width: 100%;
	min-height: 54px;
	padding: 8px 40px;
	border-radius: 27px;
	font-family: var(--hp-font-body);
	font-size: 20px;
	font-weight: 400;
	line-height: 1.2;
	text-decoration: none;
	overflow-wrap: anywhere;
}

.hp-say-hi__close {
	position: absolute;
	top: 8px;
	right: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--hp-color-ink);
	font-family: var(--hp-font-body);
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

/*
 * THE second bug the client reported (2026-09, item 5, screenshot 2): a 2px ink
 * outline at a 3px offset around the 44x44 close button read as a black square
 * on the white dialog. footer.php also carried `autofocus` on that button, so
 * showModal() landed focus there and Safari painted the ring immediately after
 * a POINTER open — focus now goes to .hp-say-hi__inner instead, so this only
 * ever paints when a keyboard user tabs to the X.
 *
 * What it paints is the theme's icon-button language: an inverted ink disc
 * with the glyph in paper (21:1 both ways on the paper panel), not a ring.
 * The mailto pill's ring lives once in assets/css/buttons.css.
 */
.hp-say-hi__close:focus-visible {
	outline: none;
	border-radius: 50%;
	background: var(--hp-focus-color);
	color: var(--hp-focus-contrast);
}

/*
 * The dialog's initial focus target is a CONTAINER (footer.php gives
 * .hp-say-hi__inner tabindex="-1" + autofocus), never a control, so it must
 * never show an indicator — screen readers announce the dialog from
 * aria-labelledby. The dialog element itself is covered too, for a UA that
 * falls back to focusing it.
 */
.hp-say-hi:focus,
.hp-say-hi:focus-visible,
.hp-say-hi__inner:focus,
.hp-say-hi__inner:focus-visible {
	outline: none;
}

@media (max-width: 480px) {
	.hp-say-hi__inner {
		padding: 28px;
	}

	.hp-say-hi__eyebrow {
		font-size: 22px;
		line-height: 28px;
	}

	.hp-say-hi__heading {
		font-size: 32px;
		line-height: 38px;
	}

	.hp-say-hi__text {
		font-size: 16px;
		line-height: 24px;
	}

	.hp-say-hi__mailto {
		min-height: 48px;
		padding: 8px 32px;
		border-radius: 24px;
		font-size: 17px;
	}
}

/*
 * Open/close fade + rise. Double-gated behind html.js (set pre-paint by
 * header.php) and prefers-reduced-motion per the animations policy — the
 * dialog is fully functional with none of this. Browsers without
 * allow-discrete/@starting-style drop the transition and simply snap.
 */
@media (prefers-reduced-motion: no-preference) {
	html.js .hp-say-hi {
		opacity: 0;
		transform: translateY(12px);
		transition:
			opacity 0.25s ease,
			transform 0.25s ease,
			overlay 0.25s ease allow-discrete,
			display 0.25s ease allow-discrete;
	}

	html.js .hp-say-hi[open] {
		opacity: 1;
		transform: none;
	}

	@starting-style {
		html.js .hp-say-hi[open] {
			opacity: 0;
			transform: translateY(12px);
		}
	}

	html.js .hp-say-hi::backdrop {
		opacity: 0;
		transition:
			opacity 0.25s ease,
			overlay 0.25s ease allow-discrete,
			display 0.25s ease allow-discrete;
	}

	html.js .hp-say-hi[open]::backdrop {
		opacity: 1;
	}

	@starting-style {
		html.js .hp-say-hi[open]::backdrop {
			opacity: 0;
		}
	}
}
