@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;
}

/* --- Spiral --- */

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

/* --- Info (standalone overlay) --- */

#info-section {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	padding: 5% 10%;
	text-align: center;
	font-size: 1.5rem;
	line-height: 1.8;
	z-index: 2;
	pointer-events: none;
}

#info-section .highlight-text {
	pointer-events: auto;
}

.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-minimize {
	position: absolute;
	top: 4px;
	right: 4px;
	z-index: 53;
	width: 20px;
	height: 20px;
	border: none;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.1);
	color: #888;
	font-family: 'IBM Plex Mono', monospace;
	font-size: 12px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

#terminal-minimize:hover {
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
}

#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;
	height: 100vh;
	overflow: hidden;
}

.image-slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

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

#touch-terminal {
	position: fixed;
	bottom: 5%;
	left: 5%;
	right: 5%;
	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;
}

.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-footer {
	padding: 6px 12px;
	text-align: center;
	font-size: 11px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.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;
}

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

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

/* --- Mobile --- */

@media (max-width: 640px) {
	#info-section {
		padding: 5%;
	}

	#terminal-toggle {
		bottom: 16px;
		right: 16px;
	}
}
