/*
 * Space Adventure theme: the galaxy as a screen-fold codex.
 * Story text sits on lime-plaster pages framed with red rules; choice numbers are bar-and-dot numerals.
 */

@font-face {
	font-family: 'Bungee';
	src: url('fonts/bungee-latin-400-normal.woff2') format('woff2');
	font-weight: 400;
	font-display: swap;
}

@font-face {
	font-family: 'Alegreya';
	src: url('fonts/alegreya-latin-400-normal.woff2') format('woff2');
	font-weight: 400;
	font-display: swap;
}

@font-face {
	font-family: 'Alegreya';
	src: url('fonts/alegreya-latin-400-italic.woff2') format('woff2');
	font-weight: 400;
	font-style: italic;
	font-display: swap;
}

@font-face {
	font-family: 'Alegreya';
	src: url('fonts/alegreya-latin-700-normal.woff2') format('woff2');
	font-weight: 700;
	font-display: swap;
}

.ak-root {
	--codex-plaster: #efe3c4;
	--codex-plaster-deep: #e2d1a8;
	--codex-carbon: #17110d;
	--codex-hematite: #b5412c;
	/* Darker red for filled buttons so plaster-colored text passes 4.5:1. */
	--codex-hematite-button: #9c3523;
	--codex-hematite-deep: #7d2a1c;
	--codex-ochre: #d9a23a;
	--codex-blue: #3f8fb5;
	--codex-night: #0b0e21;
	--codex-muted: #5e4b39;

	--ak-font-display: 'Bungee', 'Arial Black', system-ui, sans-serif;
	--ak-font-body: 'Alegreya', Georgia, 'Times New Roman', serif;
	--ak-font-size: 1.1875rem;
	--ak-line-height: 1.55;

	--ak-backdrop-color: var(--codex-night);
	--ak-backdrop-position: 34% center;
	--ak-scrim: linear-gradient(90deg, rgb(11 14 33 / 0) 40%, rgb(11 14 33 / 0.35));
	--ak-ink-on-dark: var(--codex-plaster);

	--ak-panel-bg: var(--codex-plaster);
	--ak-panel-ink: var(--codex-carbon);
	--ak-panel-muted: var(--codex-muted);
	--ak-panel-border: var(--codex-carbon);
	--ak-panel-shadow: 0 1.25rem 2.5rem rgb(0 0 0 / 0.45);

	--ak-accent: var(--codex-hematite-button);
	--ak-accent-ink: var(--codex-plaster);
	--ak-button-bg: transparent;
	--ak-button-bg-hover: var(--codex-plaster-deep);
	--ak-button-border: var(--codex-carbon);

	--ak-choice-bg: var(--codex-plaster-deep);
	--ak-choice-bg-hover: #f2cf7e;
	--ak-choice-border: var(--codex-carbon);
	--ak-key-bg: var(--codex-carbon);
	--ak-key-ink: var(--codex-plaster);

	--ak-bar-bg: rgb(23 17 13 / 0.82);
	--ak-meter-cell: rgb(239 227 196 / 0.22);
	--ak-meter-fill: var(--codex-ochre);
	--ak-meter-critical: #ff6a4d;
	--ak-gain: #86bf9a;
	--ak-loss: #ff8a70;
	--ak-timer-fill: var(--codex-hematite);
	--ak-focus: #1f6c94;
	--ak-focus-on-dark: #8cc8de;

	--ak-radius: 1.25rem;
	--ak-radius-small: 0.9rem;
}

/* Pages: a carbon contour with a red rule inside, like a painted codex page. */

.ak-root .ak-title,
.ak-root .ak-questions,
.ak-root .ak-story,
.ak-root .ak-panel {
	border: 3px solid var(--codex-carbon);
	box-shadow:
		inset 0 0 0 7px var(--codex-plaster),
		inset 0 0 0 11px var(--codex-hematite),
		var(--ak-panel-shadow);
}

.ak-root .ak-story {
	padding: clamp(1.6rem, 3vw, 2.4rem);
}

.ak-root .ak-title__heading,
.ak-root .ak-story__heading,
.ak-root .ak-questions__heading,
.ak-root .ak-panel__heading {
	font-weight: 400;
	letter-spacing: 0.01em;
	color: var(--codex-hematite-deep);
}

.ak-root .ak-story__heading {
	font-size: clamp(1.15rem, 2.4vw, 1.45rem);
	line-height: 1.25;
}

.ak-root .ak-title__heading {
	font-size: clamp(2rem, 6vw, 3rem);
}

.ak-root .ak-button,
.ak-root .ak-switch__label,
.ak-root .ak-outcome__message,
.ak-root .ak-timer {
	font-weight: 400;
}

.ak-root .ak-button {
	border-width: 2px;
	font-size: 0.95rem;
}

.ak-root .ak-button--primary {
	border-color: var(--codex-carbon);
}

.ak-root .ak-field__input {
	border-color: var(--codex-carbon);
	background: #fff8e6;
}

.ak-root .ak-switch__label {
	font-size: 0.9rem;
}

/* Choices: cartouches with bar-and-dot numerals */

.ak-root .ak-choice {
	border-width: 2px;
	font-size: 1.0625rem;
	line-height: 1.35;
}

.ak-root .ak-choice:disabled {
	opacity: 1;
	border-style: dashed;
	background: transparent;
	color: var(--codex-muted);
}

.ak-root .ak-choice__lock {
	color: var(--codex-hematite-deep);
}

.ak-root .ak-choice__key {
	--dot: radial-gradient(circle, var(--codex-plaster) 0 3px, transparent 3.5px);
	--bar: linear-gradient(var(--codex-plaster), var(--codex-plaster));
	width: 2.4rem;
	height: 2.4rem;
	border-radius: 0.7rem;
	color: transparent;
	background-color: var(--codex-carbon);
	background-repeat: no-repeat;
}

.ak-root .ak-choice:disabled .ak-choice__key {
	background-color: var(--codex-muted);
}

/* One to four: dots in a row. Five: a bar. Six to nine: a bar with dots above. */
.ak-root .ak-choice[data-key='1'] .ak-choice__key { background-image: var(--dot); background-size: 8px 8px; background-position: center; }
.ak-root .ak-choice[data-key='2'] .ak-choice__key { background-image: var(--dot), var(--dot); background-size: 8px 8px; background-position: 36% 50%, 64% 50%; }
.ak-root .ak-choice[data-key='3'] .ak-choice__key { background-image: var(--dot), var(--dot), var(--dot); background-size: 8px 8px; background-position: 22% 50%, 50% 50%, 78% 50%; }
.ak-root .ak-choice[data-key='4'] .ak-choice__key { background-image: var(--dot), var(--dot), var(--dot), var(--dot); background-size: 8px 8px; background-position: 12% 50%, 37% 50%, 63% 50%, 88% 50%; }
.ak-root .ak-choice[data-key='5'] .ak-choice__key { background-image: var(--bar); background-size: 70% 5px; background-position: center; }
.ak-root .ak-choice[data-key='6'] .ak-choice__key { background-image: var(--bar), var(--dot); background-size: 70% 5px, 8px 8px; background-position: 50% 66%, 50% 30%; }
.ak-root .ak-choice[data-key='7'] .ak-choice__key { background-image: var(--bar), var(--dot), var(--dot); background-size: 70% 5px, 8px 8px, 8px 8px; background-position: 50% 66%, 36% 30%, 64% 30%; }
.ak-root .ak-choice[data-key='8'] .ak-choice__key { background-image: var(--bar), var(--dot), var(--dot), var(--dot); background-size: 70% 5px, 8px 8px, 8px 8px, 8px 8px; background-position: 50% 66%, 22% 30%, 50% 30%, 78% 30%; }
.ak-root .ak-choice[data-key='9'] .ak-choice__key { background-image: var(--bar), var(--dot), var(--dot), var(--dot), var(--dot); background-size: 70% 5px, 8px 8px, 8px 8px, 8px 8px, 8px 8px; background-position: 50% 66%, 12% 30%, 37% 30%, 63% 30%, 88% 30%; }

/* Status bar: carbon strip with a red rule underneath */

.ak-root .ak-bar {
	border-bottom: 4px solid var(--codex-hematite);
	box-shadow: 0 2px 0 var(--codex-carbon);
}

.ak-root .ak-hud {
	font-family: var(--ak-font-display);
	font-size: 0.8rem;
	letter-spacing: 0.02em;
}

.ak-root .ak-meter__name {
	font-weight: 400;
}

.ak-root .ak-meter__cell {
	width: 0.55rem;
	height: 1.1rem;
	border-radius: 3px;
}

.ak-root .ak-item {
	border-color: rgb(239 227 196 / 0.4);
	background: rgb(239 227 196 / 0.08);
}

.ak-root .ak-icon-button {
	border-color: rgb(239 227 196 / 0.4);
}

.ak-root .ak-outcome {
	border-top: 3px solid var(--codex-hematite);
}

.ak-root .ak-outcome--defeat .ak-outcome__message {
	color: var(--codex-hematite-deep);
}

.ak-root .ak-panel::backdrop {
	background: rgb(11 14 33 / 0.75);
}

@media (max-width: 48rem) {
	.ak-root {
		--ak-font-size: 1.0625rem;
	}

	.ak-root .ak-story {
		gap: 1rem;
		padding: 1.4rem 1.4rem 1.6rem;
	}
}
