/*
 * Academy feedback widget.
 *
 * PALETTE AND SHAPE ARE BORROWED, NOT INVENTED. Every value below is already in
 * ezycollect-academy's own stylesheets: #111827 body text, #6b7280 secondary,
 * #e5e7eb borders, #f3f4f6 hover, #0D1232 the footer navy used for focus, and
 * Jost with the same fallback stack academy-fonts.css declares. The academy look
 * is owner accepted after a week of iteration, so this introduces no new colour,
 * no new radius and no new typeface.
 *
 * NO TAILWIND CLASSES. The academy Tailwind build is compiled and purged, so a
 * utility class that is not already in use does not exist and would fail silently.
 * Everything here is explicit CSS on `ezy-fb-` classes of our own.
 *
 * The floating variant is `position: fixed`, so it is out of flow and cannot
 * lengthen the document or widen it. Its width is clamped against the viewport so
 * it cannot push horizontal overflow at 390 either.
 */

.ezy-fb[hidden] {
	display: none;
}

/*
 * `hidden` has to be restated, not assumed.
 *
 * The `hidden` attribute only carries `display: none` from the UA stylesheet, so any
 * explicit `display` here outranks it. That is not theoretical: `.ezy-fb-actions` is
 * `display: flex`, so hiding it from JS left both answer buttons on screen next to
 * the thank you line, which a screenshot caught and a class-name check never would
 * have. One rule, covering every descendant, so a future element cannot reintroduce it.
 */
.ezy-fb [hidden] {
	display: none;
}

.ezy-fb-card {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
	box-sizing: border-box;
	padding: 0.875rem 2.25rem 0.875rem 1.125rem;
	border: 1px solid #e5e7eb;
	border-radius: 0.5rem;
	background: #ffffff;
	font-family: 'Jost', ui-sans-serif, system-ui, sans-serif;
}

.ezy-fb--floating {
	position: fixed;
	right: 1rem;
	bottom: 1rem;
	z-index: 90;
	width: max-content;
	max-width: calc(100vw - 2rem);
}

.ezy-fb--floating .ezy-fb-card {
	box-shadow: 0 4px 16px rgba(13, 18, 50, 0.12);
}

.ezy-fb--inline {
	margin: 2rem 0 0;
}

.ezy-fb-q {
	margin: 0;
	color: #111827;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.3;
}

.ezy-fb-actions {
	display: flex;
	gap: 0.5rem;
}

.ezy-fb-btn {
	min-width: 3.5rem;
	margin: 0;
	padding: 0.375rem 0.875rem;
	border: 1px solid #d1d5db;
	border-radius: 9999px;
	background: #ffffff;
	color: #374151;
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.4;
	cursor: pointer;
}

.ezy-fb-btn:hover {
	border-color: #9ca3af;
	background: #f3f4f6;
	color: #111827;
}

/*
 * A visible focus state is a requirement, not a nicety, and it has to survive
 * tailwind.css preflight, which sets `outline: 2px solid transparent` on focus.
 * Hence an explicit colour and an offset rather than relying on the UA default.
 */
.ezy-fb-btn:focus-visible,
.ezy-fb-close:focus-visible {
	outline: 2px solid #0D1232;
	outline-offset: 2px;
	border-color: #0D1232;
}

.ezy-fb-done {
	margin: 0;
	color: #374151;
	font-size: 0.875rem;
	line-height: 1.4;
}

.ezy-fb-done[hidden] {
	display: none;
}

.ezy-fb-close {
	position: absolute;
	top: 0.375rem;
	right: 0.375rem;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
	padding: 0;
	border: 0;
	border-radius: 9999px;
	background: transparent;
	color: #9ca3af;
	cursor: pointer;
}

.ezy-fb-close:hover {
	background: #f3f4f6;
	color: #374151;
}

/*
 * At 390 the question and the buttons stop sharing a line, so the card is given
 * the full width minus the same 1rem gutter the academy uses, and the two answers
 * sit under the question rather than being squeezed to two characters each.
 */
@media (max-width: 480px) {
	.ezy-fb--floating {
		right: 0.75rem;
		left: 0.75rem;
		bottom: 0.75rem;
		width: auto;
		max-width: none;
	}

	.ezy-fb-card {
		padding: 0.75rem 2rem 0.75rem 1rem;
	}

	.ezy-fb-actions {
		flex: 1 1 100%;
	}

	.ezy-fb-btn {
		flex: 1 1 auto;
	}
}
