/* Mystery95 — Pebblet OS, on the web.
   Colours are lifted from desktop/theme.tres, which is the game's real style guide.
   If a value here disagrees with the theme, the theme is right. */

@font-face {
	font-family: "Caveat";
	src: url("assets/fonts/Caveat-VariableFont_wght.ttf") format("truetype");
	font-weight: 400 700;
	font-display: swap;
}

:root {
	--teal: #008080;
	--teal-deep: #006666;
	--face: #c2c2c2;
	--face-window: #bfbfbf;
	--face-hover: #d4d4d4;
	--face-pressed: #ababab;
	--navy: #000080;
	--navy-banner: #0a246b;
	--inactive: #808080;
	--border: #474747;
	--ink: #101010;
	--ink-soft: #3c3c3c;
	--white: #ffffff;
	--success: #16803a;
	--failure: #9b1c1c;
	--crt: #0d1210;
	--crt-text: #b7c9ba;

	--bevel-out: inset -1px -1px 0 0 #6f6f6f, inset 1px 1px 0 0 #f2f2f2;
	--bevel-in: inset 1px 1px 0 0 #6f6f6f, inset -1px -1px 0 0 #f2f2f2;

	--ui: "Segoe UI", system-ui, "DejaVu Sans", sans-serif;
	--mono: "Cascadia Mono", "DejaVu Sans Mono", ui-monospace, monospace;
}

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

body {
	margin: 0;
	padding: 0 0 3.5rem;
	background: var(--teal);
	color: var(--ink);
	font-family: var(--ui);
	font-size: 17px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--navy); text-underline-offset: 2px; }
a:hover { color: var(--navy-banner); }

code {
	font-family: var(--mono);
	font-size: 0.92em;
	background: #d8d8d8;
	border: 1px solid #a9a9a9;
	padding: 0 0.25em;
}

:focus-visible {
	outline: 2px dotted var(--ink);
	outline-offset: 2px;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	background: var(--face);
	padding: 0.5rem 1rem;
	z-index: 100;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ------------------------------------------------------------------ layout */

.desktop {
	max-width: 62rem;
	margin: 0 auto;
	padding: clamp(1rem, 4vw, 3rem) clamp(0.75rem, 3vw, 2rem) 4rem;
	display: flex;
	flex-direction: column;
	gap: clamp(1.75rem, 4vw, 3rem);
}

/* -------------------------------------------------------------------- hero */

.hero {
	text-align: center;
	color: var(--white);
	padding: clamp(1rem, 5vw, 3rem) 0 clamp(0.5rem, 2vw, 1.5rem);
}

.hero-mark {
	width: 4.5rem;
	height: 4.5rem;
	margin: 0 auto 1.25rem;
	background: var(--face);
	box-shadow: var(--bevel-out);
	border: 1px solid var(--border);
	display: grid;
	place-items: center;
	position: relative;
}
.hero-mark::before {
	content: "";
	position: absolute;
	inset: 0.55rem;
	background: var(--crt);
	border: 1px solid #5c5c5c;
}
.hero-mark-glyph {
	position: relative;
	font-family: var(--mono);
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--crt-text);
	letter-spacing: 0.05em;
}

.hero-title {
	font-size: clamp(2.75rem, 9vw, 5rem);
	line-height: 1;
	margin: 0 0 1rem;
	letter-spacing: -0.02em;
	text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}
.hero-title-95 { color: #ffd75e; }

.hero-tagline {
	font-size: clamp(1.1rem, 3vw, 1.4rem);
	font-weight: 600;
	margin: 0 0 0.35rem;
}
.hero-line {
	font-size: clamp(1rem, 2.6vw, 1.2rem);
	margin: 0 auto 2rem;
	max-width: 34rem;
	color: #d8ecec;
}
.hero-line em { font-style: italic; color: #ffd75e; }

.hero-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	justify-content: center;
	margin: 0 0 1.75rem;
}

.hero-status {
	font-size: 0.9rem;
	color: #cfe6e6;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin: 0;
}

.led {
	width: 0.5rem;
	height: 0.5rem;
	background: #4ade80;
	border-radius: 50%;
	box-shadow: 0 0 6px #4ade80;
	flex: none;
}
.led-red { background: #ef4444; box-shadow: 0 0 6px #ef4444; border-radius: 0; }

/* ----------------------------------------------------------------- buttons */

.btn {
	display: inline-block;
	font: inherit;
	font-size: 1rem;
	line-height: 1.2;
	padding: 0.6rem 1.4rem;
	background: var(--face);
	color: var(--ink);
	border: 1px solid var(--border);
	box-shadow: var(--bevel-out);
	text-decoration: none;
	cursor: pointer;
}
.btn:hover { background: var(--face-hover); color: var(--ink); }
.btn:active { background: var(--face-pressed); box-shadow: var(--bevel-in); }
.btn:disabled { color: var(--inactive); cursor: default; }
.btn:disabled:hover { background: var(--face); }

.btn-primary {
	font-weight: 700;
	outline: 1px solid var(--navy);
	outline-offset: 1px;
}

/* ----------------------------------------------------------------- windows */

.win {
	background: var(--face-window);
	border: 1px solid var(--border);
	box-shadow: var(--bevel-out), 4px 4px 0 rgba(0, 0, 0, 0.2);
	scroll-margin-top: 1rem;
}

.win-bar {
	background: var(--navy);
	color: var(--white);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.3rem 0.35rem 0.3rem 0.6rem;
	margin: 2px;
}

.win-title {
	font-size: 0.95rem;
	font-weight: 700;
	margin: 0;
	line-height: 1.4;
}

.win-btns {
	display: flex;
	gap: 2px;
	flex: none;
}
.win-btns i {
	width: 1.1rem;
	height: 1.1rem;
	background: var(--face);
	box-shadow: var(--bevel-out);
	color: var(--ink);
	font-style: normal;
	font-size: 0.6rem;
	display: grid;
	place-items: center;
	line-height: 1;
}

.win-body { padding: clamp(1rem, 3vw, 1.75rem); }

.pull {
	font-size: 1.15rem;
	font-weight: 600;
	border-left: 4px solid var(--navy);
	padding-left: 1rem;
	margin: 1.5rem 0;
}

/* -------------------------------------------------------------------- loop */

.loop {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
	margin: 1.5rem 0 0;
	padding: 0;
	font-family: var(--mono);
	font-size: 0.82rem;
}
.loop li {
	background: var(--face);
	border: 1px solid var(--border);
	box-shadow: var(--bevel-out);
	padding: 0.35rem 0.7rem;
}
.loop li:not(:last-child)::after {
	content: "→";
	margin-left: 0.7rem;
	color: var(--ink-soft);
}
.loop .loop-end {
	background: var(--success);
	color: var(--white);
	border-color: #0d5526;
}

/* ------------------------------------------------------------- answerphone */

.answerphone {
	margin: 1.5rem 0;
	background: var(--crt);
	border: 1px solid #000;
	box-shadow: var(--bevel-in);
	padding: 1rem 1.25rem 1.25rem;
	color: var(--crt-text);
	font-family: var(--mono);
}
.answerphone figcaption {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.75rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #7e9a86;
	border-bottom: 1px solid #2a352e;
	padding-bottom: 0.6rem;
	margin-bottom: 0.9rem;
}
.answerphone figcaption b { color: var(--crt-text); }
.answerphone blockquote {
	margin: 0;
	font-size: 0.92rem;
	line-height: 1.7;
}
.answerphone blockquote p:last-child { margin-bottom: 0; }

.hand {
	font-family: "Caveat", cursive;
	font-size: 1.5em;
	font-weight: 600;
	line-height: 1;
	color: #1e3a8a;
	white-space: nowrap;
}

/* -------------------------------------------------------------- clue chain */

.clue-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: clamp(1rem, 3vw, 2rem);
	margin: 1.75rem 0;
}

.clue {
	margin: 0;
	flex: 1 1 14rem;
	max-width: 18rem;
	text-align: center;
}
.clue img {
	width: 100%;
	height: auto;
	display: block;
	border: 1px solid var(--border);
	box-shadow: var(--bevel-out);
	background: var(--white);
	padding: 6px;
}
.clue figcaption {
	font-size: 0.82rem;
	color: var(--ink-soft);
	margin-top: 0.6rem;
}

.clue-arrow {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.15rem;
	font-family: var(--mono);
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--navy);
	flex: none;
}

.lockbox {
	background: var(--face);
	border: 1px solid var(--border);
	box-shadow: var(--bevel-out);
	padding: 1.5rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	align-items: center;
}
.lockbox-label {
	font-family: var(--mono);
	font-size: 0.85rem;
}
.lockbox-dots {
	background: var(--white);
	border: 1px solid var(--border);
	box-shadow: var(--bevel-in);
	width: 100%;
	padding: 0.35rem 0.5rem;
	font-family: var(--mono);
	letter-spacing: 0.15em;
	text-align: left;
	color: var(--ink);
}

/* ----------------------------------------------------------------- cracker */

.cracker { margin: 1.5rem 0; }

.cracker-panel {
	background: var(--face);
	border: 1px solid var(--border);
	box-shadow: var(--bevel-out);
	padding: 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	align-items: flex-start;
}

.cracker-fields {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	width: 100%;
}
.cracker-fields label {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	font-size: 0.85rem;
	font-weight: 600;
	flex: 1 1 8rem;
}
.cracker-fields input {
	font: inherit;
	font-family: var(--mono);
	font-size: 0.95rem;
	padding: 0.4rem 0.5rem;
	background: var(--white);
	border: 1px solid var(--border);
	box-shadow: var(--bevel-in);
	color: var(--ink);
	min-width: 0;
}
.cracker-fields input:disabled { background: #dcdcdc; color: var(--inactive); }

.cracker-readout { width: 100%; }

.bar {
	height: 1.5rem;
	background: var(--white);
	border: 1px solid #707070;
	box-shadow: var(--bevel-in);
	padding: 2px;
	overflow: hidden;
}
.bar-fill {
	height: 100%;
	width: 0;
	background: var(--navy);
	transition: width 0.06s linear;
}
.bar-fill.is-success { background: var(--success); }
.bar-fill.is-failure { background: var(--failure); }

.cracker-guess {
	font-family: var(--mono);
	font-size: 0.9rem;
	color: var(--ink-soft);
	margin: 0.5rem 0 0.15rem;
	min-height: 1.4em;
	word-break: break-all;
}
.cracker-status {
	font-size: 0.9rem;
	font-weight: 600;
	margin: 0;
	min-height: 1.5em;
}
.cracker-status.is-success { color: var(--success); }
.cracker-status.is-failure { color: var(--failure); }

.rule {
	background: #d3d3d3;
	border-left: 4px solid var(--navy);
	padding: 0.9rem 1.1rem;
	font-size: 0.95rem;
	margin: 1.5rem 0 0;
}

/* ----------------------------------------------------------------- gallery */

.gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
	gap: 1.25rem;
	margin-top: 1.5rem;
}
.gallery figure { margin: 0; }

.shot {
	display: block;
	width: 100%;
	padding: 0;
	border: 1px solid var(--border);
	box-shadow: var(--bevel-out);
	background: var(--face);
	cursor: zoom-in;
}
.shot img {
	display: block;
	width: 100%;
	height: auto;
	image-rendering: pixelated;
}
.shot:hover { box-shadow: var(--bevel-out), 0 0 0 2px var(--navy); }

.gallery figcaption {
	font-size: 0.85rem;
	color: var(--ink-soft);
	margin-top: 0.5rem;
}

/* -------------------------------------------------------------- principles */

.principles {
	margin: 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
	gap: 1.25rem;
}
.principles > div {
	background: var(--face);
	border: 1px solid var(--border);
	box-shadow: var(--bevel-out);
	padding: 1rem 1.1rem;
}
.principles dt {
	font-weight: 700;
	margin-bottom: 0.4rem;
}
.principles dd {
	margin: 0;
	font-size: 0.95rem;
	color: var(--ink-soft);
}

/* --------------------------------------------------------------- fineprint */

.fineprint {
	font-size: 0.85rem;
	color: var(--ink-soft);
	border-top: 1px solid #a5a5a5;
	padding-top: 1rem;
}

/* ----------------------------------------------------------------- taskbar */

.taskbar {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	height: 3rem;
	background: var(--face);
	border-top: 1px solid #f2f2f2;
	box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.15);
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.3rem 0.4rem;
	z-index: 50;
}

.start {
	font: inherit;
	font-weight: 700;
	font-size: 0.95rem;
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.35rem 0.9rem;
	background: var(--face);
	border: 1px solid var(--border);
	box-shadow: var(--bevel-out);
	cursor: pointer;
	flex: none;
}
.start:hover { background: var(--face-hover); }
.start[aria-expanded="true"] { box-shadow: var(--bevel-in); background: var(--face-pressed); }

.start-flag {
	width: 1rem;
	height: 1rem;
	background: #4a63b8;
	border: 1px solid #2b3a72;
	position: relative;
}
.start-flag::before,
.start-flag::after {
	content: "";
	position: absolute;
	background: var(--white);
}
.start-flag::before { left: 0; right: 0; top: 45%; height: 2px; }
.start-flag::after { top: 0; bottom: 0; left: 45%; width: 2px; }

.start-menu {
	position: absolute;
	bottom: calc(100% + 0.3rem);
	left: 0.4rem;
	min-width: 15rem;
	margin: 0;
	padding: 0.25rem;
	list-style: none;
	background: var(--face);
	border: 1px solid var(--border);
	box-shadow: var(--bevel-out), 4px 4px 0 rgba(0, 0, 0, 0.25);
}
.start-menu[hidden] { display: none; }
.start-menu a {
	display: block;
	padding: 0.5rem 0.75rem;
	color: var(--ink);
	text-decoration: none;
	font-size: 0.95rem;
}
.start-menu a:hover,
.start-menu a:focus-visible {
	background: var(--navy);
	color: var(--white);
	outline: none;
}
.start-menu .sep {
	border-top: 1px solid #9a9a9a;
	margin-top: 0.25rem;
	padding-top: 0.25rem;
}

.tasks {
	display: flex;
	gap: 0.3rem;
	list-style: none;
	margin: 0;
	padding: 0;
	overflow: hidden;
	flex: 1;
}
.tasks a {
	display: block;
	padding: 0.35rem 0.9rem;
	background: var(--face);
	border: 1px solid var(--border);
	box-shadow: var(--bevel-out);
	color: var(--ink);
	text-decoration: none;
	font-size: 0.85rem;
	white-space: nowrap;
}
.tasks a:hover { background: var(--face-hover); }
.tasks a:active { box-shadow: var(--bevel-in); }

.clock {
	flex: none;
	margin-left: auto;
	padding: 0.35rem 0.75rem;
	font-size: 0.85rem;
	font-variant-numeric: tabular-nums;
	background: var(--face);
	box-shadow: var(--bevel-in);
	border: 1px solid #a5a5a5;
}

@media (max-width: 46rem) {
	.tasks { display: none; }
}

/* ---------------------------------------------------------------- lightbox */

.lightbox {
	border: 1px solid var(--border);
	box-shadow: var(--bevel-out);
	background: var(--face);
	padding: 0.75rem;
	max-width: min(96vw, 76rem);
	max-height: 92vh;
}
.lightbox::backdrop { background: rgba(0, 0, 0, 0.7); }
.lightbox img {
	display: block;
	max-width: 100%;
	max-height: 80vh;
	height: auto;
	image-rendering: pixelated;
	border: 1px solid var(--border);
	box-shadow: var(--bevel-in);
}
#lightbox-close { margin-top: 0.75rem; }

/* ------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
	html { scroll-behavior: auto; }
}

@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}
