/**
 * FK Free Downloads.
 *
 * Deliberately minimal. The funnel reuses the theme's existing WooCommerce
 * form classes so it inherits the site's button and field styling; only the
 * genuinely new pieces are styled here.
 */

/*
 * The honeypot.
 *
 * Positioned off-screen rather than display:none or [hidden]. Naive form
 * fillers skip anything the CSS has hidden outright, so those would defeat the
 * trap; they do fill fields that are merely positioned away. aria-hidden and
 * tabindex="-1" in the markup keep screen readers and keyboard users out of
 * it, so nobody real is stranded in a field they cannot see.
 */
.fk-fd-hp {
	position: absolute !important;
	left: -9999px !important;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* The auto-start download frame. Never meant to be seen. */
.fk-fd-frame {
	position: absolute;
	width: 0;
	height: 0;
	border: 0;
	visibility: hidden;
}

.fk-fd-notice {
	margin-bottom: 1.5em;
}

.fk-fd-thankyou {
	max-width: 44em;
}

.fk-fd-thankyou-title {
	margin-top: 0;
}

.fk-fd-thankyou-intro {
	font-size: 1.1em;
}

/*
 * Cover image beside the download button.
 *
 * flex-wrap with a generous basis on the actions column rather than a media
 * query: below roughly 480px the two columns stack on their own, so there is
 * no breakpoint to keep in sync with the theme's.
 */
.fk-fd-thankyou-body {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 1.5em;
	margin: 1.5em 0;

	/*
	 * Centres the image once the columns stack, and does nothing before that
	 * — no breakpoint needed.
	 *
	 * Side by side, the actions column has flex-grow:1 and absorbs all the
	 * free space, so there is none left for justify-content to distribute and
	 * the image stays hard left against it. Once they wrap, the image sits
	 * alone on its line with grow:0, that line has free space, and it centres.
	 * Self-resolving, so there is no breakpoint to drift out of sync with the
	 * theme's.
	 */
	justify-content: center;
}

.fk-fd-thankyou-image {
	flex: 0 1 200px;
}

.fk-fd-thankyou-image img {
	display: block;
	width: 100%;
	height: auto;
}

.fk-fd-thankyou-actions {
	/* min-width:0 stops a long file name forcing the column wider than its
	   share and pushing the image off the row. */
	flex: 1 1 16em;
	min-width: 0;
}

.fk-fd-downloads {
	margin: 0 0 1em;
	padding: 0;
}

.fk-fd-download {
	margin: 0 0 0.75em;
}

/*
 * Full width of its column rather than shrink-to-fit.
 *
 * The actions column is already narrow beside the cover image, and on a phone
 * it is the full page width — where a shrink-to-fit button next to a long file
 * name wraps into an awkward two-line blob with a small tap target. Filling the
 * column keeps it a single obvious target at every width.
 */
.fk-fd-download-link {
	display: block;
	width: 100%;
	box-sizing: border-box;
	text-align: center;
}

/*
 * Applied a couple of seconds after load. If the automatic start worked the
 * visitor already has their file and never looks down here; if it was blocked,
 * this is the thing they need to find.
 */
.fk-fd-download-link.is-ready {
	animation: fk-fd-nudge 1.2s ease-in-out 2;
}

@keyframes fk-fd-nudge {
	0%, 100% { transform: translateY( 0 ); }
	50%      { transform: translateY( -4px ); }
}

@media ( prefers-reduced-motion: reduce ) {
	.fk-fd-download-link.is-ready {
		animation: none;
	}
}

.fk-fd-thankyou-note {
	font-size: 0.9em;
	opacity: 0.75;
}

.fk-fd-error {
	max-width: 40em;
}
