html:has(> .websitePage) {
	/* IMPORTANT this fixes jittery painting behaviour */
	background-color: #555;
	background-image: linear-gradient(#222, #888);
	background-attachment: fixed;
}

body.websitePage {
	--background: #555;
	--max-width: 750px;
	--main-margin: auto;
	--dark-text: #fff;
	--panel: var(--window-frame);
	--panel-text: var(--window-text);
	
	--charcoal:  "Charcoal", Tahoma, Verdana, "DejaVu Sans", sans-serif;
	--geneva: Geneva, "Trebuchet MS", Tahoma, Verdana, sans-serif;
	--window-frame: #dddddc;
	--window-text: #000;
	--window-gray: #888;
	--window-white: #fff;
	
	--bar-size: 20px;
	--resize-offset: 3px;
	--window-margin: 60px;
	
	display: block;
	overflow-x: hidden;
	letter-spacing: 0;
	margin-top: 0;
	
	background-color: transparent;
	background-image:  url("/images/projects/websites/boxes.png");
	background-repeat: no-repeat;
	background-position: top 270px center;
	background-size: 1202px;
}

.websitePage #panel .menu, .websitePage #panel .subsection, .websitePage #panel nav a {
	box-shadow: 
		inset 0px 2px 0px var(--window-white), 
		inset -1px -2px 0px var(--window-gray), 
		inset 1px 0px 0px var(--window-gray), 
		0 -2px 0px var(--window-text);
}

.noselect {
	user-select: none;
	-moz-user-select: none;
	-webkit-user-select: none;
}

.window {
	position: relative;
	margin: 0 0 30px;
	width: calc(100% - var(--window-margin));
}

.window .panel {
	border: 2px solid var(--window-text);
	box-shadow: 
		2px 2px 0 var(--window-text), 
		inset 2px 2px 0 var(--window-white), 
		inset -2px -2px 0 var(--window-gray);
	padding: 5px 6px 6px;
	box-sizing: border-box;
	background-color: var(--window-frame);
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	contain: layout paint;
}

.window.left:not([data-detached]) {
	margin-left: var(--window-margin);
}

.window[data-detached] {
	min-width: auto;
	max-width: auto;
	position: absolute;
	box-sizing: border-box;
}

.window[data-closed], .window[data-placeholder] { visibility: hidden; }
.window.collapsed { padding-bottom: 0; }

.window .blurb {
	position: absolute;
	bottom: 14%;
	right: -80px;
	width: 44%;
	letter-spacing: -0.01em;
	line-height: 1.25em;
	font-size: var(--small-text-size);
	text-align: right;
}

.window.left .blurb {
	right: -20px;
}

.window .panel:not([style]) + .blurb span, .window[data-detached] .blurb span {
	background: var(--background);
}

.window .blurb b {
	padding-right: 5px;
}

.window .bar {
	display: flex;
	height: var(--bar-size);
	margin: 0 0 6px;
	align-items: stretch;
	image-rendering: crisp-edges;
	image-rendering: pixelated;
	color: var(--window-text);
	font-smooth: never;
	-webkit-font-smoothing: none;
	-moz-osx-font-smoothing: none;
}

.window .bar .stripes { 
	flex-grow: 1; 
	background-image: url(/images/projects/websites/stripes.png);
	background-size: auto 19px;
	margin: 0 5px 0px;
	cursor: default;
	display: flex;
	justify-content: center;
	align-items: flex-end;
	image-rendering: crisp-edges;
	image-rendering: pixelated;
}

.window .bar .stripes p { 
	margin: 0 0 0px;
	padding: 0px 5px 1px;
	line-height: 1.1em;
	font-size: 17px;
	letter-spacing: -0.01em;
	font-family: var(--charcoal);
	border-top: 2px solid var(--window-frame);
	background-color: var(--window-frame);
}

.window .bar button, .window .resize {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	border: none;
	height: inherit;
	width: var(--bar-size);
	background-size: cover;
	outline: none;
	image-rendering: pixelated;
}

.window .resize { 
	background-image: url(/images/projects/websites/resize.png);
	height: var(--bar-size); 
	position: absolute;
	right: var(--resize-offset);
	bottom: var(--resize-offset);
	box-shadow: -2px -2px 0 var(--window-white), -4px -4px 0 var(--window-text);
}

.window .bar button:active { filter: brightness(0.8); }
.window .bar .quit { background-image: url(/images/projects/websites/quit.png); }
.window .bar .collapse { background-image: url(/images/projects/websites/collapse.png); }

.window .frame {
	padding: 0;
	border: 2px solid var(--window-text);
	box-shadow: 2px 2px 0 var(--window-white), -2px -2px 0 var(--window-gray);
	position: relative;
	flex-grow: 1;
	flex-shrink: 1;
	overflow: hidden;
	letter-spacing: 0;
	height: 300px;
}

.window .frame iframe {
	display: block;
	border: none;
	width: 200%;
	height: 200%;
	transform: scale(0.5);
	transform-origin: top left;
}

.window .frame.imgFrame {
	overflow: scroll;
}

.window .frame > img {
	width: 100%;
	display: block;
}

.window.collapsed .bar { 
	margin-bottom: 0 !important; 
}

.window.collapsed .frame, .window.collapsed .resize, .window.collapsed .blurb { 
	display: none; 
}

.window.collapsed .panel {
	height: auto;
}

.window.unfocused {
	--window-gray: var(--window-frame);
	--window-white: var(--window-frame);
	--window-text: #444;
}

.window.unfocused .bar .stripes p {
	opacity: 0.9;
}

.window.unfocused .bar button, 
.window.unfocused .bar .stripes,
.window.unfocused .resize {
	background-image: none;
	background-color: var(--window-frame);
}

.window.unfocused .frame {
	pointer-events: none;
}

#drag, #drag.dragResize:before, #drag.dragResize:after { 
	border: 2px dashed black;
	border-image-source: url("/images/projects/websites/drag_border.png");
	border-image-slice: 8;
	border-image-repeat: round;
	border-image-width: 2px;
	position: absolute;
	z-index: 1000;
	cursor: default;
	display: flex;
	justify-content: center;
	overflow: hidden;
}

#drag.dragResize, #drag.dragResize:before, #drag.dragResize:after {
	border-image-slice: 3;
	border-image-width: 1px;
	box-sizing: border-box;
}

#drag.dragResize:before {
	content: "";
	width: var(--bar-size);
	height: var(--bar-size);
	right: calc(var(--resize-offset) + 2px);
	bottom: calc(var(--resize-offset) + 3px);
	border-image-slice: 4 0 0 4;
}

#drag.dragResize:after {	
	content: "";
	position: static;
	width: calc(100% - 15px);
	height: calc(100% - 37px);
	margin: 30px 0 0;
	display: block;
	clip-path: polygon(
		0 0, 100% 0, 
		100% calc(100% - var(--bar-size)), 
		calc(100% - var(--bar-size)) calc(100% - var(--bar-size)), 
		calc(100% - var(--bar-size)) 100%, 0 100%
	);
}

.websitePage p.more {
	font-family: var(--sans);
	font-size: var(--medium-text-size);
	letter-spacing: -0.01em;
	max-width: 500px;
	text-align: center;
	text-wrap: balance;
	line-height: 1.1em;
	margin: 20px auto 0;
	font-weight: bold;
}

.websitePage footer {
	position: relative;
}

.desktop {
	position: absolute;
	top: -70px;
	right: 0;
	display: flex;
	justify-content: flex-end;
	flex-direction: column;
	gap: 20px;
	padding: 10px 12px 0;
}

.folder {
	color: inherit;
	margin: 0 10px;
	text-align: center;
	cursor: default;
}

.folder .label {
	background: var(--window-white);
	color: var(--window-text);
	font-family: var(--geneva);
	padding: 0 2px;
	font-size: 10px;
	font-smooth: never;
	-webkit-font-smoothing: none;
	-moz-osx-font-smoothing: none;
}

.folder .icon {
	height: 50px;
	width: 50px;
	display: block;
	margin: 0 auto 6px;
	image-rendering: crisp-edges;
	image-rendering: pixelated;
}

.folder:hover { text-decoration: none; }

@media screen and (max-width: 1250px) {	
	body.websitePage {
		margin-top: var(--panel-gap);
		background-size: 1000px;
		background-position: top 350px center;
	}
		
	.websitePage footer p {
		margin: 0 auto 0;
		text-align: center;
	}
	
	.desktop {
		margin: 30px 0 0;
		flex-direction: row;
		top: 0px;
	}
	
	.window .frame.scale > img {
		height: 100%;
		object-fit: cover;
	}
}

@media screen and (max-width: 650px) {	
	body.websitePage {
		--window-margin: 0;
		
		background-image: none;
	}
	
	.window .blurb, .window.left .blurb {
		right: -20px;
		width: 84%;
	}
}

@font-face {
  font-family: "Charcoal";
  font-style: normal;
  font-weight: 700;
  src: url("/fonts/charcoal.woff2") format("woff2");
}
