/*
Theme Name: mijnpagina desktop
Description: Een bureaublad in de browser: pagina's, berichten en snelkoppelingen openen als vensters, met een taakbalk en een startmenu.
Author: Berry van den Bos
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: mijnpagina-desktop
*/

:root {
	--mpd-bg: #0e1217;
	--mpd-panel: #161c24;
	--mpd-raise: #1c2530;
	--mpd-line: #2a3340;
	--mpd-line2: #3a4656;
	--mpd-text: #e6edf3;
	--mpd-muted: #9aa7b4;
	--mpd-accent: #f0b44c;
	--mpd-sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
	--mpd-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
	--mpd-bar-h: 52px;
}

html, body { margin: 0; height: 100%; }
html:has(body.mpd) { overflow: hidden; }
body.mpd {
	background: var(--mpd-bg);
	color: var(--mpd-text);
	font: 16px/1.55 var(--mpd-sans);
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
}
.mpd *, .mpd *::before, .mpd *::after { box-sizing: border-box; }
.mpd a { color: var(--mpd-accent); }
.mpd a:hover { color: #ffd28a; }
.mpd :focus-visible { outline: 2px solid var(--mpd-accent); outline-offset: 2px; }

.mpd-screen {
	height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
	height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
	min-height: 480px;
	display: flex;
	flex-direction: column;
}

/* ---------- bureaublad ---------- */

.mpd-desk {
	flex: 1;
	position: relative;
	overflow: hidden;
	background-image: radial-gradient(#1f2833 1px, transparent 1px);
	background-size: 22px 22px;
}

.mpd-icons {
	position: absolute;
	left: 16px;
	top: 16px;
	bottom: 16px;
	display: flex;
	flex-direction: column;
	flex-wrap: wrap;
	align-content: flex-start;
	gap: 6px;
	z-index: 2;
}
.mpd .mpd-icon {
	width: 96px;
	padding: 10px 6px;
	border-radius: 10px;
	color: var(--mpd-text);
	text-decoration: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	text-align: center;
}
.mpd .mpd-icon:hover, .mpd .mpd-icon:focus-visible { background: var(--mpd-raise); color: var(--mpd-text); }
.mpd-icon-tile {
	width: 48px;
	height: 48px;
	border-radius: 12px;
	background: var(--mpd-panel);
	border: 1px solid var(--mpd-line);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--mpd-accent);
}

.mpd-watermark {
	position: absolute;
	right: 28px;
	bottom: 20px;
	margin: 0;
	text-align: right;
	font: 12px/1.6 var(--mpd-mono);
	color: #7d8a98;
}

/* ---------- vensters ---------- */

.mpd-win {
	position: absolute;
	left: 150px;
	top: 40px;
	width: 560px;
	max-width: calc(100% - 32px);
	max-height: calc(100% - 32px);
	display: flex;
	flex-direction: column;
	background: var(--mpd-panel);
	border: 1px solid var(--mpd-line);
	border-radius: 12px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
	overflow: hidden;
	z-index: 10;
}
.mpd-win[hidden] { display: none; }
.mpd-win.is-narrow { width: 460px; }
.mpd-win.is-wide { width: 720px; }
.mpd-win.is-active { border-color: var(--mpd-line2); }
.mpd-win.is-dragging { opacity: .96; }
.mpd-win.is-dragging .mpd-bar { cursor: grabbing; }
.mpd-win.is-max { left: 8px !important; top: 8px !important; width: calc(100% - 16px); height: calc(100% - 16px); max-width: none; max-height: none; }

.mpd-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 8px 8px 14px;
	background: var(--mpd-panel);
	border-bottom: 1px solid var(--mpd-line);
	cursor: grab;
	user-select: none;
	touch-action: none;
}
.mpd-win.is-active .mpd-bar { background: var(--mpd-raise); }
.mpd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mpd-accent); flex: none; }
.mpd-title {
	flex: 1;
	margin: 0;
	font: 500 13px/1.3 var(--mpd-mono);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.mpd-wbtn {
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--mpd-muted);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}
.mpd-wbtn:hover { background: #222c38; color: var(--mpd-text); }

.mpd-body {
	padding: 22px 24px 26px;
	overflow: auto;
	font-size: 15px;
}

/* ---------- inhoud ---------- */

.mpd-body > :first-child { margin-top: 0; }
.mpd-body > :last-child { margin-bottom: 0; }
.mpd-body h1, .mpd-body h2, .mpd-body h3, .mpd-body h4 { line-height: 1.2; margin: 1.4em 0 .5em; }
.mpd-body h1 { font-size: 30px; }
.mpd-body h2 { font-size: 22px; }
.mpd-body h3 { font-size: 18px; }
.mpd-body p, .mpd-body ul, .mpd-body ol { margin: 0 0 1em; }
.mpd-body img, .mpd-body video, .mpd-body iframe { max-width: 100%; height: auto; border-radius: 8px; }
.mpd-body figure { margin: 0 0 1em; }
.mpd-body figcaption { color: var(--mpd-muted); font-size: 13px; }
.mpd-body blockquote { margin: 0 0 1em; padding-left: 14px; border-left: 3px solid var(--mpd-line2); color: var(--mpd-muted); }
.mpd-body code, .mpd-body pre { font-family: var(--mpd-mono); font-size: 13px; background: var(--mpd-bg); border-radius: 6px; }
.mpd-body code { padding: 2px 5px; }
.mpd-body pre { padding: 12px; overflow: auto; border: 1px solid var(--mpd-line); }
.mpd-body hr { border: 0; border-top: 1px solid var(--mpd-line); margin: 1.5em 0; }
.mpd-body .wp-block-button__link, .mpd-btn {
	display: inline-block;
	padding: 10px 16px;
	border: 0;
	border-radius: 8px;
	background: var(--mpd-accent);
	color: #14110a;
	font: 700 15px/1.2 var(--mpd-sans);
	text-decoration: none;
	cursor: pointer;
}
.mpd-body .wp-block-button__link:hover, .mpd-btn:hover { filter: brightness(1.08); color: #14110a; }
.mpd-body .wp-block-gallery { gap: 8px; }

.mpd-hero { font-size: 30px; line-height: 1.15; margin: 0 0 8px; }
.mpd-muted { color: var(--mpd-muted); }
.mpd-date { display: block; font: 12px/1.5 var(--mpd-mono); color: var(--mpd-muted); }
p.mpd-date { margin: 0 0 10px; }

.mpd-postlist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.mpd .mpd-postlist a {
	display: block;
	padding: 12px;
	border-radius: 8px;
	background: var(--mpd-bg);
	border: 1px solid var(--mpd-line);
	color: var(--mpd-text);
	text-decoration: none;
}
.mpd .mpd-postlist a:hover { border-color: var(--mpd-line2); background: #121820; }
.mpd-ptitle { display: block; font-weight: 500; }

/* ---------- formulier ---------- */

.mpd-form p { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; }
.mpd-form label { font-size: 13px; color: var(--mpd-muted); }
.mpd-form .mpd-btn { align-self: flex-start; }
.mpd-form input, .mpd-form textarea, .mpd-input {
	font: inherit;
	font-size: 15px;
	color: var(--mpd-text);
	background: var(--mpd-bg);
	border: 1px solid var(--mpd-line);
	border-radius: 6px;
	padding: 10px 12px;
	width: 100%;
}
.mpd-form input:focus, .mpd-form textarea:focus, .mpd-input:focus { border-color: var(--mpd-accent); outline: none; }
.mpd-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.mpd-notice { padding: 10px 12px; border-radius: 8px; background: #1b2a22; border: 1px solid #2f5a43; }
.mpd-notice.mpd-error { background: #2c1d1d; border-color: #6a3434; }

/* ---------- startmenu ---------- */

.mpd-menu {
	position: absolute;
	left: 12px;
	bottom: 12px;
	width: 300px;
	max-width: calc(100% - 24px);
	max-height: calc(100% - 24px);
	overflow: auto;
	z-index: 9999;
	background: var(--mpd-panel);
	border: 1px solid var(--mpd-line);
	border-radius: 12px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
	padding: 14px;
}
.mpd-menu[hidden] { display: none; }
.mpd-menu-label { display: block; font: 12px/1.5 var(--mpd-mono); color: var(--mpd-muted); margin-bottom: 6px; }
.mpd-input { padding: 9px 10px; font-size: 14px; }
.mpd-menu-list { list-style: none; margin: 10px 0 0; padding: 0; }
.mpd-menu-item {
	width: 100%;
	text-align: left;
	padding: 10px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--mpd-text);
	font: inherit;
	cursor: pointer;
}
.mpd-menu-item:hover { background: #222c38; }
.mpd-nomatch { margin: 8px 0 0; font-size: 13px; }

/* ---------- taakbalk ---------- */

.mpd-taskbar {
	height: var(--mpd-bar-h);
	flex: none;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0 10px;
	background: #0a0d11;
	border-top: 1px solid var(--mpd-line);
}
.mpd-start {
	height: 36px;
	padding: 0 14px;
	border: 0;
	border-radius: 8px;
	background: var(--mpd-accent);
	color: #14110a;
	font: 700 15px/1 var(--mpd-sans);
	cursor: pointer;
	flex: none;
}
.mpd-tasks { flex: 1; display: flex; gap: 6px; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.mpd-task {
	height: 36px;
	padding: 0 12px;
	border: 0;
	border-bottom: 2px solid transparent;
	border-radius: 6px;
	background: var(--mpd-panel);
	color: var(--mpd-text);
	font: 13px/1 var(--mpd-sans);
	cursor: pointer;
	white-space: nowrap;
}
.mpd-task:hover { background: #222c38; }
.mpd-task.is-active { border-bottom-color: var(--mpd-accent); }
.mpd-clock { font: 13px/1 var(--mpd-mono); color: var(--mpd-muted); padding: 0 6px; flex: none; }

/* ---------- telefoon ---------- */

@media (max-width: 700px) {
	.mpd-icons { position: static; flex-direction: row; flex-wrap: wrap; padding: 12px; }
	.mpd .mpd-icon { width: 84px; }
	.mpd-desk { overflow-y: auto; }
	.mpd-win, .mpd-win.is-narrow, .mpd-win.is-wide {
		position: absolute;
		left: 8px !important;
		top: 8px !important;
		width: auto;
		right: 8px;
		bottom: 8px;
		max-width: none;
		max-height: none;
	}
	.mpd-bar { cursor: default; }
	.mpd-watermark { display: none; }
	.mpd-body { padding: 18px; }
}

@media (prefers-reduced-motion: no-preference) {
	.mpd-win { animation: mpd-pop .14s ease-out; }
	@keyframes mpd-pop { from { transform: scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
}
