/*
 * SHSAT Practice. Theme-neutral: no fonts or brand colours of its own. Lines and tints are
 * mixed from currentColor, so they follow whatever text colour the theme uses, light or dark.
 */

.shsat-practice {
	--shsat-line: color-mix(in srgb, currentColor 22%, transparent);
	--shsat-tint: color-mix(in srgb, currentColor 5%, transparent);
}

.shsat-practice img {
	max-width: 100%;
	height: auto;
}

/* Formula images sit in the line of text. */
.shsat-practice img[src*="latex.codecogs.com"] {
	display: inline;
	vertical-align: middle;
}

.shsat-practice table {
	border-collapse: collapse;
	margin: 1em 0;
}

.shsat-practice th,
.shsat-practice td {
	border: 1px solid var(--shsat-line);
	padding: 0.3em 0.7em;
}

.shsat-question__meta {
	font-size: 0.9em;
}

.shsat-passage,
.shsat-answer {
	margin: 1.5em 0;
	padding: 0.75em 1em;
	border: 1px solid var(--shsat-line);
	border-radius: 6px;
	background: var(--shsat-tint);
}

.shsat-passage > summary,
.shsat-answer > summary {
	cursor: pointer;
	font-weight: 600;
}

.shsat-passage__text {
	margin-top: 0.75em;
}

.shsat-question__stem {
	margin: 1.5em 0 1em;
}

.shsat-choices {
	list-style: none;
	margin: 0 0 1.5em;
	padding: 0;
}

.shsat-choices li {
	display: flex;
	gap: 0.75em;
	align-items: baseline;
	margin: 0 0 0.5em;
	padding: 0.6em 0.9em;
	border: 1px solid var(--shsat-line);
	border-radius: 6px;
}

.shsat-choices__letter {
	flex: none;
	min-width: 1.2em;
	font-weight: 700;
}

.shsat-choices__text > :first-child {
	margin-top: 0;
}

.shsat-choices__text > :last-child {
	margin-bottom: 0;
}

.shsat-question__gridin {
	font-style: italic;
}

.shsat-answer {
	border-left: 4px solid currentColor;
}

.shsat-answer__key {
	margin-top: 0.75em;
}

.shsat-figure-missing {
	display: inline-block;
	margin: 0.5em 0;
	padding: 0.4em 0.8em;
	border: 1px dashed var(--shsat-line);
	border-radius: 4px;
	font-size: 0.85em;
	font-style: italic;
}

.shsat-question__nav {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 1em;
	margin-top: 2em;
	padding-top: 1em;
	border-top: 1px solid var(--shsat-line);
}

.shsat-test__meta {
	margin: 0.25em 0 0;
	font-size: 0.9em;
}

.shsat-test__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(2.75em, 1fr));
	gap: 0.4em;
	margin: 0.75em 0 2em;
	padding: 0;
	list-style: none;
}

.shsat-test__grid a {
	display: block;
	padding: 0.45em 0;
	border: 1px solid var(--shsat-line);
	border-radius: 4px;
	text-align: center;
	text-decoration: none;
}

.shsat-test__grid a:hover,
.shsat-test__grid a:focus {
	background: var(--shsat-tint);
}

/* Handbooks: a grid of covers. */
.shsat-handbooks__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
	gap: 1.75em 1.25em;
	margin: 1.5em 0;
	padding: 0;
	list-style: none;
}

.shsat-handbook p {
	margin: 0.35em 0 0;
	line-height: 1.3;
}

.shsat-handbook__cover {
	display: block;
}

.shsat-handbook__cover img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 360 / 466;
	object-fit: cover;
	border: 1px solid var(--shsat-line);
	box-shadow: 0 2px 6px color-mix(in srgb, currentColor 18%, transparent);
}

.shsat-handbook__year {
	font-weight: 700;
}

.shsat-handbook__meta,
.shsat-handbook__download {
	font-size: 0.85em;
}

/*
 * Quiz (assets/shsat-practice.js). Green and red are the only colours the plugin sets, and
 * every result also carries a mark or words, so it never depends on colour alone.
 */
.shsat-question {
	--shsat-right: #1a7f37;
	--shsat-wrong: #c62828;
}

.shsat-tally {
	margin: 0.25em 0 0;
	font-size: 0.9em;
}

.shsat-tally__reset,
.shsat-gridin__check {
	font: inherit;
	color: inherit;
	cursor: pointer;
}

.shsat-tally__reset {
	padding: 0;
	border: 0;
	background: none;
	text-decoration: underline;
}

.shsat-choices li.is-selectable {
	cursor: pointer;
}

.shsat-choices li.is-selectable:hover,
.shsat-choices li.is-selectable:focus-visible {
	border-color: currentColor;
	background: var(--shsat-tint);
	outline: none;
}

.shsat-choices.is-answered li {
	cursor: default;
}

.shsat-choices.is-answered li:not(.is-correct):not(.is-wrong):not(.is-answer) {
	opacity: 0.65;
}

.shsat-choices li.is-correct,
.shsat-choices li.is-answer {
	border-color: var(--shsat-right);
	box-shadow: inset 0 0 0 1px var(--shsat-right);
}

.shsat-choices li.is-correct {
	background: color-mix(in srgb, var(--shsat-right) 14%, transparent);
}

.shsat-choices li.is-wrong {
	border-color: var(--shsat-wrong);
	box-shadow: inset 0 0 0 1px var(--shsat-wrong);
	background: color-mix(in srgb, var(--shsat-wrong) 12%, transparent);
}

.shsat-choices li.is-correct::after,
.shsat-choices li.is-answer::after,
.shsat-choices li.is-wrong::after {
	margin-left: auto;
	padding-left: 0.5em;
	font-weight: 700;
}

.shsat-choices li.is-correct::after,
.shsat-choices li.is-answer::after {
	content: "✓";
	color: var(--shsat-right);
}

.shsat-choices li.is-wrong::after {
	content: "✗";
	color: var(--shsat-wrong);
}

.shsat-gridin {
	margin: 0 0 1.5em;
}

.shsat-gridin input {
	width: 8em;
	margin-left: 0.4em;
	padding: 0.35em 0.5em;
	font: inherit;
	color: inherit;
	background: transparent;
	border: 1px solid var(--shsat-line);
	border-radius: 4px;
}

.shsat-gridin__check {
	padding: 0.35em 0.9em;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 4px;
}

.shsat-gridin.is-correct input {
	border-color: var(--shsat-right);
	box-shadow: inset 0 0 0 1px var(--shsat-right);
	background: color-mix(in srgb, var(--shsat-right) 14%, transparent);
}

.shsat-gridin.is-wrong input {
	border-color: var(--shsat-wrong);
	box-shadow: inset 0 0 0 1px var(--shsat-wrong);
	background: color-mix(in srgb, var(--shsat-wrong) 12%, transparent);
}

.shsat-gridin.is-answered .shsat-gridin__check {
	display: none;
}

.shsat-result {
	margin: 0.75em 0 0;
	font-weight: 700;
}

.shsat-result--correct {
	color: var(--shsat-right);
}

.shsat-result--wrong {
	color: var(--shsat-wrong);
}
