body {
	display: grid;
	grid-template:
		"window route" auto
		"window page" minmax(0, 1fr)
		/ min(60vw, 80dvh)
		minmax(0, 1fr); /* 80dvh matches the train scene's 4:5 aspect ratio. */
	height: 100dvh;
	overflow: hidden;
}

.window {
	grid-area: window;
	position: relative;
	height: 100%;
	max-width: 60vw;
	overflow: hidden;
	mask-image: linear-gradient(to right, #000 93%, transparent);

	.background {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	.passenger {
		position: absolute;
		bottom: -20%;
	}

	.person {
		display: block;
		width: 100%;
		height: 100%;
		animation: floating 5s ease-in-out infinite;
	}

	.legs-crossed {
		width: 50%;
		left: -5%;
	}

	.couple-chatting {
		height: 70%;
		right: -10%;

		.person {
			width: auto;
			animation-delay: 0.6s;
		}
	}
}

.train-video {
	position: absolute;
	inset: 0;
}

.train-toggle {
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
	padding: 2px 8px;
	border: 1px solid var(--pal3);
	border-radius: 3px;
	background: var(--pal1);
	color: var(--pal4);
	font: inherit;
	font-size: 0.75rem;
	cursor: pointer;
}

[hidden] {
	display: none !important;
}

.window.is-paused .person {
	animation-play-state: paused;
}

[data-tooltip]:is(:hover, :focus-visible)::after {
	content: attr(data-tooltip);
	position: absolute;
	left: 50%;
	bottom: 100%;
	translate: -50% -4px;
	padding: 2px 8px;
	background-color: var(--pal1);
	color: var(--pal4);
	font-size: 0.8rem;
	white-space: nowrap;
	pointer-events: none;
}

.page {
	grid-area: page;
	overflow: auto;
	padding-inline: 1em;
	overflow-wrap: anywhere;

	&:focus-visible {
		outline: 2px solid var(--pal3);
		outline-offset: -2px;
	}

	article img {
		max-width: 100%;
		height: auto;
	}
}

.route {
	grid-area: route;
	margin-inline: 1rem;
	display: flex;
	flex-wrap: wrap;
	gap: 2px 10px;
	padding-block: 8px;
	background-color: var(--pal1);
	border-bottom: 2px dashed var(--pal2);
	font-size: 0.85rem;

	* {
		height: min-content;
		padding: 0;
		margin: 0;
	}
}

.intro {
	padding-top: 16px;
}

h2 {
	margin-top: 1.3rem;
	padding: 5px 12px;
	background-color: var(--pal2);
	border-left: 7px solid var(--pal3);
	font-size: clamp(1.15rem, 2vw, 1.5rem);
}

:not(pre) > code,
pre {
	background-color: var(--pal2);
}

:not(pre) > code {
	padding: 0 4px;
}

pre {
	overflow-x: auto;
	padding: 8px 12px;
}

ul {
	padding-left: 1.3rem;
}

.projects li {
	margin-bottom: 0.9rem;
}

.projects p,
blockquote p {
	margin: 0;
}

blockquote {
	margin: 0.9rem 0;
	padding-left: 14px;
	border-left: 4px solid var(--pal2);
}

cite {
	color: var(--pal3);
	font-size: 0.85rem;
}

.buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 3px;
	margin: 0.5rem 0;

	img {
		display: block;
		image-rendering: pixelated;
	}
}

#contact code {
	user-select: all;
}

footer {
	margin-top: 2.5rem;

	hr {
		border: 0;
		border-top: 2px dashed var(--pal2);
	}
}

.mug-line {
	display: flex;
	align-items: center;
	gap: 8px;

	img {
		height: 40px;
	}
}

@keyframes floating {
	50% {
		transform: translateY(-20px);
	}
}

@media (max-width: 820px), (orientation: portrait) and (max-width: 1100px), (max-height: 500px) and (orientation: landscape) {
	body {
		grid-template:
			"window" 30dvh
			"route" auto
			"page" minmax(0, 1fr)
			/ minmax(0, 1fr);
	}

	.window {
		max-width: none;
		mask-image: linear-gradient(to bottom, #000 88%, transparent);

		.background {
			object-position: 50% 42%;
		}

		.passenger {
			display: none;
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	.window .person {
		animation: none;
	}
}
