/**
 * Food Waste Reduction Quiz styles.
 * Colors chosen to meet WCAG 2.1 AA contrast (>= 4.5:1 for text).
 */

.fwrq-quiz {
	--fwrq-green: #2f7d32;      /* primary green, 5.0:1 on white */
	--fwrq-green-dark: #256428;
	--fwrq-correct-bg: #2e7d32; /* white text on this = 4.9:1 */
	--fwrq-incorrect-bg: #b3261e; /* white text on this = 5.9:1 */
	--fwrq-ink: #1f2328;
	--fwrq-muted: #4a5158;
	--fwrq-surface: #f2f3f2;
	--fwrq-border: #c9ccc9;
	--fwrq-focus: #0b57d0;

	max-width: 720px;
	margin: 0 auto;
	color: var(--fwrq-ink);
	font-size: 1rem;
	line-height: 1.5;
	box-sizing: border-box;
}

.fwrq-quiz *,
.fwrq-quiz *::before,
.fwrq-quiz *::after {
	box-sizing: inherit;
}

.fwrq-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.fwrq-panel {
	padding: 1.5rem;
	border-radius: 12px;
}

/* Intro ------------------------------------------------------------------ */
.fwrq-intro {
	text-align: center;
}

.fwrq-title {
	color: var(--fwrq-green);
	font-size: clamp( 1.6rem, 4vw, 2.25rem );
	margin: 0 0 1rem;
}

.fwrq-cover {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	border-radius: 12px;
	margin: 0 auto 1.25rem;
}

.fwrq-intro-text {
	color: var(--fwrq-muted);
	margin: 0 auto 1.25rem;
	max-width: 46ch;
}

/* Buttons ---------------------------------------------------------------- */
.fwrq-btn {
	display: inline-block;
	font: inherit;
	font-weight: 700;
	line-height: 1.2;
	padding: 0.85rem 1.75rem;
	border-radius: 8px;
	border: 2px solid transparent;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.15s ease, transform 0.05s ease;
}

.fwrq-btn-primary {
	background: var(--fwrq-green);
	color: #fff;
	width: 100%;
	max-width: 100%;
}

.fwrq-btn-primary:hover {
	background: var(--fwrq-green-dark);
}

.fwrq-btn-secondary {
	background: transparent;
	color: var(--fwrq-green);
	border-color: var(--fwrq-green);
}

.fwrq-btn-secondary:hover {
	background: rgba( 47, 125, 50, 0.08 );
}

/* Opaque per-state backgrounds so white text contrast is deterministic
   (>= 7:1) regardless of compositing. */
.fwrq-btn-onfeedback {
	background: #1e5620;
	color: #fff;
	border-color: rgba( 255, 255, 255, 0.9 );
	margin-top: 1.5rem;
}

.fwrq-correct .fwrq-btn-onfeedback {
	background: #1e5620; /* white text = 8.9:1 */
}

.fwrq-correct .fwrq-btn-onfeedback:hover {
	background: #17471a;
}

.fwrq-incorrect .fwrq-btn-onfeedback {
	background: #7d1a15; /* white text = 10.4:1 */
}

.fwrq-incorrect .fwrq-btn-onfeedback:hover {
	background: #5f130f;
}

/* Progress --------------------------------------------------------------- */
.fwrq-progress-label {
	color: var(--fwrq-muted);
	font-weight: 700;
	font-size: 0.9rem;
	margin: 0 0 0.5rem;
	text-align: center;
}

.fwrq-progressbar {
	height: 8px;
	background: var(--fwrq-border);
	border-radius: 999px;
	overflow: hidden;
	margin: 0 0 1.5rem;
}

.fwrq-progressbar-fill {
	display: block;
	height: 100%;
	background: var(--fwrq-green);
	transition: width 0.25s ease;
}

/* Question --------------------------------------------------------------- */
.fwrq-question {
	color: var(--fwrq-green);
	text-align: center;
	font-size: clamp( 1.3rem, 3.2vw, 1.9rem );
	margin: 0 0 1.5rem;
}

.fwrq-options {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.fwrq-option {
	font: inherit;
	text-align: left;
	background: var(--fwrq-surface);
	border: 2px solid var(--fwrq-border);
	border-radius: 10px;
	padding: 1rem 1.25rem;
	cursor: pointer;
	color: var(--fwrq-ink);
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.fwrq-option:hover {
	border-color: var(--fwrq-green);
	background: #eaf1ea;
}

/* Feedback --------------------------------------------------------------- */
.fwrq-feedback {
	text-align: center;
	color: #fff;
}

.fwrq-feedback.fwrq-correct {
	background: var(--fwrq-correct-bg);
}

.fwrq-feedback.fwrq-incorrect {
	background: var(--fwrq-incorrect-bg);
}

.fwrq-feedback-heading {
	color: white;
	font-size: clamp( 1.6rem, 4vw, 2.25rem );
	margin: 0 0 0.75rem;
}

.fwrq-icon {
	font-size: 1.1em;
}

.fwrq-feedback-question {
	color: white;
	font-weight: 700;
	font-size: 1.15rem;
	margin: 0 0 1rem;
}

.fwrq-feedback-row {
	color: white;
	margin: 0.5rem 0;
}

.fwrq-feedback-key {
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-size: 0.85em;
}

/* Result ----------------------------------------------------------------- */
.fwrq-result {
	text-align: center;
}

.fwrq-score {
	color: var(--fwrq-green);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin: 0 0 0.5rem;
}

.fwrq-result-heading {
	color: var(--fwrq-green);
	font-size: clamp( 1.5rem, 3.5vw, 2rem );
	margin: 0 0 0.75rem;
}

.fwrq-result-message {
	color: var(--fwrq-muted);
	max-width: 50ch;
	margin: 0 auto 1.5rem;
}

.fwrq-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	justify-content: center;
}

.fwrq-actions .fwrq-btn {
	width: auto;
}

/* No-JS ------------------------------------------------------------------ */
.fwrq-noscript {
	padding: 1rem;
	border: 1px solid var(--fwrq-border);
	border-radius: 8px;
}

/* Focus visibility ------------------------------------------------------- */
.fwrq-quiz :focus-visible {
	outline: 3px solid var(--fwrq-focus);
	outline-offset: 2px;
}

.fwrq-feedback :focus-visible {
	outline-color: #fff;
}

/* Headings that receive programmatic focus should not show an outline ring
   when focused by script (not keyboard), but keep it for keyboard users. */
.fwrq-title:focus:not(:focus-visible),
.fwrq-question:focus:not(:focus-visible),
.fwrq-feedback-heading:focus:not(:focus-visible),
.fwrq-result-heading:focus:not(:focus-visible) {
	outline: none;
}

/* Reduced motion --------------------------------------------------------- */
@media ( prefers-reduced-motion: reduce ) {
	.fwrq-quiz *,
	.fwrq-quiz *::before,
	.fwrq-quiz *::after {
		transition: none !important;
		animation: none !important;
	}
}
