/**
 * Front-end styling for the sweepstakes entry and mailing-address screens.
 *
 * Colours follow the New Horizons TV palette the entrant has just come through, so the
 * sweepstakes screens do not read as a different site: #004c97 blue for primary actions and
 * #2e5811 green for secondary links.
 *
 * The rules are deliberately scoped to .ffasw- classes. These screens render inside whichever
 * theme the site runs, and a bare `input` selector here would restyle every form on the page.
 */

/* Single-sweepstakes template -------------------------------------------- */

/*
 * The main region of the template the plugin registers. Carried here rather than borrowed from
 * the theme so the template does not depend on a theme class it cannot guarantee: without a
 * width and some padding the entry page would sit flush against the site header.
 */
.ffasw-entry-main {
	max-width: 880px;
	margin: 0 auto;
	padding: 2.5rem 1.5rem 4rem;
}

/*
 * The prize image, between the title and the copy.
 *
 * The width and height rules are not redundant with the theme: a featured image is uploaded at
 * whatever size somebody had to hand, and without them a tall or oversized file pushes the entry
 * control off the first screen on a phone. Constraining the width and letting the height follow
 * keeps the aspect ratio intact rather than cropping a prize photo.
 */
.ffasw-featured-image {
	margin: 0 0 2rem;
}

.ffasw-featured-image img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 4px;
}

/* Notices ---------------------------------------------------------------- */

.ffasw-notice {
	border-left: 4px solid #004c97;
	background: #f0f5ff;
	padding: 12px 16px;
	margin: 0 0 24px;
}

.ffasw-notice > p:first-child {
	margin-top: 0;
}

.ffasw-notice > p:last-child {
	margin-bottom: 0;
}

.ffasw-notice--failure {
	border-left-color: #a02020;
	background: #fdf2f2;
}

.ffasw-notice--closed {
	border-left-color: #8a6d00;
	background: #fffaeb;
}

/* Address form ----------------------------------------------------------- */

.ffasw-address-form {
	max-width: 480px;
	margin: 0 0 24px;
}

.ffasw-field {
	margin: 0 0 18px;
}

.ffasw-field label {
	display: block;
	font-weight: 700;
	margin: 0 0 6px;
}

.ffasw-required {
	color: #a02020;
}

/*
 * width:100% with border-box, rather than a fixed width: the entrant may be on a phone, and
 * the previous inline style set width without box-sizing, so a padded input overflowed its
 * container.
 */
.ffasw-field input[type="text"],
.ffasw-field select {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	font-size: 1rem;
	line-height: 1.4;
	color: #1a1a1a;
	background: #fff;
	border: 1px solid #7a8596;
	border-radius: 4px;
}

/*
 * The select is sized in the same rule as the text inputs so the two line up, but it needs
 * three properties they do not. A select inherits the browser's own font rather than the
 * page's, so without `font-family` the state field renders in a different typeface from the
 * city field directly above it. `height: auto` stops a theme's fixed select height fighting
 * the padding above. And 16px on small screens is what prevents iOS Safari zooming the whole
 * page when the picker is focused — the same trap as any undersized form control on a phone.
 */
.ffasw-field select {
	height: auto;
	font-family: inherit;
	appearance: none;
	background-image: url( 'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 8"><path fill="%237a8596" d="M1 1l5 5 5-5"/></svg>' );
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 12px 8px;
	padding-right: 36px;
}

@media ( max-width: 782px ) {
	.ffasw-field select {
		font-size: 16px;
	}
}

.ffasw-field input[type="text"]:focus,
.ffasw-field select:focus {
	border-color: #004c97;
	outline: 2px solid #004c97;
	outline-offset: 1px;
}

/* Entry confirmation ----------------------------------------------------- */

/*
 * The receipt shown under the congratulations message. Bordered rather than filled so it
 * reads as a record of what was entered, and does not compete with the success notice
 * directly above it, which is the one thing on the page that should be loud.
 */
.ffasw-receipt {
	margin: 1.5rem 0 0;
	padding: 20px 22px;
	border: 1px solid #d3d8e0;
	border-radius: 4px;
	background: #fbfcfd;
}

.ffasw-receipt-drawn {
	margin: 0 0 1rem;
	font-weight: 700;
	color: #2e5811;
}

.ffasw-receipt-heading {
	margin: 0 0 0.75rem;
	font-size: 1.05rem;
	line-height: 1.3;
}

/*
 * Two columns on anything with room, label beside value. The grid collapses to one column on
 * a phone rather than squeezing a 6rem label against a long street address.
 */
.ffasw-receipt-list {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.5rem 1.25rem;
	margin: 0;
}

.ffasw-receipt-list dt {
	margin: 0;
	font-weight: 700;
	color: #4a5568;
}

.ffasw-receipt-list dd {
	margin: 0;
	color: #1a1a1a;
}

@media ( max-width: 600px ) {
	.ffasw-receipt-list {
		grid-template-columns: 1fr;
		gap: 0.15rem;
	}

	.ffasw-receipt-list dd {
		margin: 0 0 0.6rem;
	}
}

/* Buttons ---------------------------------------------------------------- */

.ffasw-button {
	display: inline-block;
	padding: 12px 26px;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.2;
	color: #fff;
	background: #004c97;
	border: 0;
	border-radius: 4px;
	text-decoration: none;
	cursor: pointer;
}

.ffasw-button:hover,
.ffasw-button:focus {
	color: #fff;
	background: #00396f;
}
