@font-face {
	font-family: 'IBM Plex Mono';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url(fonts/plex-mono-400-latin.woff2) format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: 'IBM Plex Mono';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url(fonts/plex-mono-400-latin-ext.woff2) format('woff2');
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: 'IBM Plex Mono';
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url(fonts/plex-mono-500-latin.woff2) format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: 'IBM Plex Mono';
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url(fonts/plex-mono-500-latin-ext.woff2) format('woff2');
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	background: #fff;
	color: #000;
	font-family: 'IBM Plex Mono', monospace;
	overflow-x: hidden;
}

/* --- Spiral --- */

canvas {
	display: block;
	width: 100vw;
	height: 100vh;
	opacity: .5;
	mix-blend-mode: overlay;
	z-index: 5;
	position: fixed;
	top: 0;
	left: 0;
}

/* --- Highlight text (about page) --- */

.highlight-text {
	background: rgba(255, 255, 255, 0.85);
	display: inline;
	padding: 0.1em 0.3em;
	box-decoration-break: clone;
	-webkit-box-decoration-break: clone;
}

/* --- Terminal toggle --- */

#terminal-toggle {
	position: fixed;
	bottom: 5rem;
	right: 5rem;
	z-index: 100;
	border: none;
	background: transparent;
	color: #000;
	font-size: 6rem;
	cursor: pointer;
	opacity: 0.5;
	transition: opacity 0.15s;
	padding: 0;
	line-height: 1;
	mix-blend-mode: overlay;
}

#terminal-toggle:hover {
	opacity: 1;
}

#terminal-toggle.hidden {
	display: none;
}

/* --- Floating terminal panel --- */

#terminal-panel {
	position: fixed;
	z-index: 50;
	display: flex;
	flex-direction: column;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #000;
	mix-blend-mode: hard-light;
	box-shadow: 0 1rem 5rem rgba(0, 0, 0, 0.85);
}

#terminal-panel.hidden {
	display: none;
}

#terminal-dragbar {
	position: absolute;
	top: 0;
	left: 12px;
	right: 12px;
	height: 8px;
	z-index: 52;
	cursor: grab;
}

#terminal-dragbar:active {
	cursor: grabbing;
}

#terminal-controls {
	position: absolute;
	top: 1rem;
	right: 1rem;
	z-index: 53;
	display: flex;
	gap: .5rem;
}

#terminal-controls a,
#terminal-controls button {
	width: 2rem;
	height: 2rem;
	background: rgba(255, 255, 255, 0.08);
	color: #888;
	font-family: 'IBM Plex Mono', monospace;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	padding: 0;
	border: none;
}

#terminal-controls a:hover,
#terminal-controls button:hover {
	font-weight: bold;
}

#terminal-body {
	flex: 1;
	min-height: 0;
	overflow: hidden;
	position: relative;
}

#terminal-frame {
	width: 100%;
	height: 100%;
	border: none;
	border-radius: 4px;
	background: #000;
	display: block;
	pointer-events: none;
}

#terminal-kbd-hint {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 15rem;
	color: rgba(0, 0, 0, 0.8);
	pointer-events: none;
	mix-blend-mode: hard-light;
	z-index: 55;
	animation: kbd-fade 5s ease-out forwards;
}

#terminal-kbd-hint.hidden {
	display: none;
}

@keyframes kbd-fade {
	0% {
		opacity: 0;
		transform: translate(-50%, -50%) scale(0.7);
	}

	15% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1);
	}

	100% {
		opacity: 0;
		transform: translate(-50%, -50%) scale(1);
	}
}

/* --- Resize handles --- */

.resize-handle {
	position: absolute;
	z-index: 51;
}

.resize-n {
	top: -3px;
	left: 8px;
	right: 8px;
	height: 6px;
	cursor: n-resize;
}

.resize-s {
	bottom: -3px;
	left: 8px;
	right: 8px;
	height: 6px;
	cursor: s-resize;
}

.resize-e {
	right: -3px;
	top: 8px;
	bottom: 8px;
	width: 6px;
	cursor: e-resize;
}

.resize-w {
	left: -3px;
	top: 8px;
	bottom: 8px;
	width: 6px;
	cursor: w-resize;
}

.resize-ne {
	top: -3px;
	right: -3px;
	width: 12px;
	height: 12px;
	cursor: ne-resize;
}

.resize-nw {
	top: -3px;
	left: -3px;
	width: 12px;
	height: 12px;
	cursor: nw-resize;
}

.resize-se {
	bottom: -3px;
	right: -3px;
	width: 12px;
	height: 12px;
	cursor: se-resize;
}

.resize-sw {
	bottom: -3px;
	left: -3px;
	width: 12px;
	height: 12px;
	cursor: sw-resize;
}

/* --- Drag/resize overlay --- */

#terminal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 49;
}

#terminal-overlay.hidden {
	display: none;
}

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

#image-gallery {
	position: relative;
	z-index: 0;
}

.image-slide {
	width: 100vw;
}

.image-slide img {
	width: 100%;
	display: block;
}

.video-slide {
	position: relative;
	height: 56.25vw;
	overflow: hidden;
}

.video-slide iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: none;
	display: block;
	pointer-events: none;
}

/* --- Touch terminal (mobile/tablet replacement) --- */

#touch-terminal {
	position: fixed;
	top: 50svh;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 90%;
	max-width: 600px;
	max-height: 60vh;
	z-index: 50;
	background: white;
	border-radius: 4px;
	font-family: 'IBM Plex Mono', monospace;
	font-size: 13px;
	mix-blend-mode: hard-light;
	color: black;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

#touch-terminal.tt-no-blend {
	mix-blend-mode: normal;
	isolation: isolate;
}

.tt-tabs {
	display: flex;
	gap: 1px;
	background: rgba(0, 0, 0, 0.03);
	padding: 8px 12px 0;
}

.tt-tab {
	padding: 4px 10px;
	color: #666;
	font-size: 11px;
}

.tt-tab-active {
	color: black;
	border-bottom: 1px solid #000;
}

.tt-content {
	padding: 12px;
	margin: 0;
	font-family: inherit;
	font-size: inherit;
	line-height: 1.6;
	overflow-y: auto;
	flex: 1;
	min-height: 0;
	white-space: pre-wrap;
	word-break: break-all;
}

.tt-about-img {
	width: 100%;
	display: block;
	margin-bottom: 8px;
	mix-blend-mode: normal;
}

.tt-content a {
	color: inherit;
}

.tt-title {
	color: black;
	font-weight: 500;
	letter-spacing: 0.15em;
}

.tt-section {
	color: #b8860b;
}

.tt-bright {
	color: #000;
	font-weight: 500;
}

.tt-dim {
	color: #666;
}

.tt-green {
	color: #5a8a5a;
}

.tt-yellow {
	color: #b8860b;
}

/* --- About page --- */

.about-page {
	background: #fff;
	display: flex;
	flex-direction: column;
	height: 100vh;
	overflow: hidden;
}

#about-main {
	flex: 1;
	display: grid;
	grid-template-columns: 1fr 2fr;
	overflow: hidden;
}

#home-link {
	display: flex;
	align-items: center;
	justify-content: right;
}

#home-link canvas {
	display: block;
	width: 140px;
	height: 140px;
	position: static;
	opacity: 0.5;
	mix-blend-mode: normal;
	transition: opacity 0.15s;
}

#home-link canvas:hover {
	opacity: 1;
}

#about {
	overflow-y: auto;
	padding: 10rem;
	font-size: 0.95rem;
	line-height: 1.75;
}

#about section {
	margin-bottom: 4rem;
}

#about h2 {
	font-size: 1.1rem;
	font-weight: 400;
	margin-bottom: 1.2rem;
	letter-spacing: 0.02em;
}

#about p {
	margin-bottom: 1rem;
}

#about p:last-child {
	margin-bottom: 0;
}

#about a {
	color: #000;
}

#about a:hover {
	opacity: 0.6;
}

#about .diagram {
	font-family: ui-monospace, 'Cascadia Mono', 'Consolas', monospace;
	font-size: 0.8rem;
	line-height: 1.4;
	overflow-x: auto;
	scrollbar-width: none;
	margin: 1.5rem 0;
	color: #444;
}

#about .diagram::-webkit-scrollbar {
	display: none;
}

#demo-install, #demo-install-es {
	display: block;
	width: 100%;
	margin-bottom: 4rem;
}

#lang-toggle {
	margin-bottom: 3rem;
	font-size: 0.85rem;
	letter-spacing: 0.04em;
}

#lang-toggle a {
	color: #999;
	text-decoration: none;
}

#lang-toggle a.active {
	color: #000;
}

#lang-toggle a:hover {
	color: #000;
}

/* --- About page mobile --- */

@media (max-width: 640px) {
	#about-main {
		display: block;
		overflow-y: auto;
	}

	#about {
		overflow-y: visible;
		padding: 6vh 1.2rem;
	}

	#about .diagram {
		font-size: 0.7rem;
	}

	#home-link {
		display: block;
		padding: 4vh 0;
	}

	#home-link canvas {
		width: 100%;
		height: 100%;
	}

}

/* --- Mobile landscape --- */

@media (orientation: landscape) and (max-height: 500px) {
	#touch-terminal {
		top: 5%;
		max-height: 80vh;
	}
}

/* --- Touch devices --- */

@media (pointer: coarse) {
	canvas {
		pointer-events: none;
	}
}

/* --- Mobile --- */

@media (max-width: 640px) {
	#terminal-toggle {
		bottom: 16px;
		right: 16px;
	}
}
