/*
 * Which Edition? game.
 *
 * Uses the Guides Guide's navy, Georgia headings, and spacing. Scoped to .iwe*
 * so it coexists with the theme. The map starts neutral on purpose: edition
 * colors appear only inside feedback, after the player has answered.
 */

.iwe {
	--iwe-ink: #1a1a1a;
	--iwe-muted: #5f6368;
	--iwe-line: #d8dde3;
	--iwe-navy: #1f3a5f;
	--iwe-navy-dark: #14283f;
	--iwe-land: #dfe4ea;
	--iwe-right: #2f7d5b;
	--iwe-missed: #b4472e;
	--iwe-display: Georgia, 'Iowan Old Style', 'Apple Garamond', serif;

	container-type: inline-size;
	width: 100%;
	max-width: 1040px;
	margin: 2rem auto;
	color: var(--iwe-ink);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
	line-height: 1.5;
}

.iwe *,
.iwe *::before,
.iwe *::after {
	box-sizing: border-box;
}

.iwe__layout {
	display: grid;
	gap: 1rem;
}

@container (min-width: 780px) {
	.iwe__layout {
		grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
		gap: 2.25rem;
		align-items: center;
	}
}

/* Map */

.iwe__svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.iwe__state {
	fill: var(--iwe-land);
	stroke: #fff;
	stroke-width: 0.75;
	stroke-linejoin: round;
	transition: fill 180ms ease;
}

.iwe__state.is-target {
	fill: var(--iwe-navy);
	stroke: var(--iwe-navy-dark);
	stroke-width: 1.5;
}

.iwe__state.is-right {
	fill: var(--iwe-right);
}

.iwe__state.is-missed {
	fill: var(--iwe-missed);
}

.iwe__ring {
	fill: none;
	stroke: var(--iwe-navy);
	stroke-width: 3;
	animation: iwe-ring 1.3s ease-in-out infinite alternate;
}

@keyframes iwe-ring {
	from { opacity: 1; }
	to   { opacity: 0.35; }
}

/* Panel */

.iwe__panel {
	min-width: 0;
}

.iwe .iwe__panel h2,
.iwe .iwe__panel h3,
.iwe .iwe__panel p {
	margin: 0;
	padding: 0;
	border: 0;
	letter-spacing: normal;
	text-transform: none;
}

.iwe .iwe__panel h2:focus {
	outline: none;
}

.iwe .iwe__panel .iwe__title {
	font-family: var(--iwe-display);
	font-size: clamp(2.25rem, 7cqi, 3rem);
	font-weight: 700;
	line-height: 1.08;
	color: var(--iwe-navy);
	margin-bottom: 0.75rem;
}

.iwe .iwe__panel .iwe__lede {
	font-size: 1.125rem;
	margin-bottom: 0.5rem;
}

.iwe .iwe__panel .iwe__meta {
	color: var(--iwe-muted);
	font-size: 0.9375rem;
	margin-bottom: 1.25rem;
}

.iwe__progress {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	color: var(--iwe-muted);
	font-size: 0.875rem;
	margin-bottom: 0.75rem;
}

.iwe .iwe__panel .iwe__state-name {
	font-family: var(--iwe-display);
	font-size: clamp(1.875rem, 6cqi, 2.5rem);
	font-weight: 700;
	line-height: 1.12;
	color: var(--iwe-navy);
}

.iwe .iwe__panel .iwe__prompt {
	color: var(--iwe-muted);
	font-size: 0.9375rem;
	margin: 0.25rem 0 0.875rem;
}

.iwe__choices {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.5rem;
}

/* Themes style buttons at high specificity (Twenty Twenty-One chains :not()
   selectors, Storefront adds Customizer colors inline), so the colors that
   carry meaning here use !important. Hover is limited to real pointers:
   on touch screens it would stick to the next button drawn in the same spot. */
.iwe .iwe__btn {
	display: inline-block;
	min-height: 44px;
	margin: 0;
	padding: 0.625rem 1rem;
	border: 1px solid var(--iwe-navy) !important;
	border-radius: 4px;
	box-shadow: none;
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 120ms ease, color 120ms ease;
}

.iwe .iwe__btn:focus-visible {
	outline: 3px solid var(--iwe-navy);
	outline-offset: 2px;
}

.iwe .iwe__btn--primary {
	background: var(--iwe-navy) !important;
	color: #fff !important;
}

.iwe .iwe__btn--secondary,
.iwe .iwe__choice {
	background: #fff !important;
	color: var(--iwe-navy) !important;
}

.iwe .iwe__choice {
	border-color: var(--iwe-line) !important;
	padding: 0.5rem 0.625rem;
	font-size: 0.875rem;
}

.iwe .iwe__choice:focus-visible {
	border-color: var(--iwe-navy) !important;
}

@media (hover: hover) {
	.iwe .iwe__btn--primary:hover {
		background: var(--iwe-navy-dark) !important;
	}

	.iwe .iwe__btn--secondary:hover,
	.iwe .iwe__choice:hover {
		background: #eaf0f7 !important;
		border-color: var(--iwe-navy) !important;
	}
}

/* Feedback */

.iwe .iwe__panel .iwe__verdict {
	font-family: var(--iwe-display);
	font-size: 1.875rem;
	font-weight: 700;
	line-height: 1.15;
	margin-bottom: 0.5rem;
}

.iwe .iwe__panel .iwe__verdict.is-right {
	color: #246147;
}

.iwe .iwe__panel .iwe__verdict.is-missed {
	color: #9c3a23;
}

.iwe .iwe__panel .iwe__answer {
	font-size: 1.0625rem;
	font-weight: 600;
}

.iwe__badge {
	display: inline-block;
	padding: 1px 9px;
	border-radius: 10px;
	color: #1a1a1a;
	font-size: 0.875rem;
}

.iwe .iwe__panel .iwe__chosen {
	color: var(--iwe-muted);
	font-size: 0.9375rem;
	margin-top: 0.125rem;
}

.iwe .iwe__panel .iwe__notes {
	font-size: 0.9375rem;
	margin-top: 0.75rem;
}

.iwe .iwe__panel .iwe__verify {
	color: #6a4b14;
	font-size: 0.8125rem;
	margin-top: 0.5rem;
}

.iwe .iwe__panel .iwe__links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.25rem;
	font-size: 0.875rem;
	margin: 0.75rem 0 1rem;
}

.iwe__links a,
.iwe__missed a {
	color: var(--iwe-navy);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Score */

.iwe .iwe__panel .iwe__score {
	font-family: var(--iwe-display);
	font-size: clamp(2.75rem, 10cqi, 3.75rem);
	font-weight: 700;
	line-height: 1.05;
	color: var(--iwe-navy);
	margin-bottom: 0.25rem;
}

.iwe .iwe__panel .iwe__subhead {
	font-size: 0.9375rem;
	font-weight: 600;
	margin-top: 1rem;
}

.iwe .iwe__missed {
	list-style: none;
	margin: 0.25rem 0 0;
	padding: 0;
	font-size: 0.9375rem;
}

.iwe__missed li {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	margin: 0;
	padding: 0.3125rem 0;
	border-bottom: 1px solid var(--iwe-line);
}

.iwe__missed-answer {
	color: var(--iwe-muted);
	text-align: right;
}

.iwe__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.625rem;
	margin-top: 1.25rem;
}

.iwe .iwe__disclaimer {
	color: var(--iwe-muted);
	font-size: 0.8125rem;
	margin: 1.25rem 0 0;
}

@media (prefers-reduced-motion: reduce) {
	.iwe__ring {
		animation: none;
	}
	.iwe__state,
	.iwe .iwe__btn {
		transition: none;
	}
}
