/* ==========================================================================
   Retro desktop shell — a mid-90s beige tower + CRT, rendered in 2.5D.
   The screen surface itself is never 3D-transformed so pointer math for
   window dragging stays exact.
   ========================================================================== */

:root {
	--beige-1: #efe9da;
	--beige-2: #ddd5c1;
	--beige-3: #c9c0a8;
	--beige-4: #a89d83;
	--beige-5: #7e755f;
	--beige-6: #57503f;

	--face: #c3c7cb;
	--face-lt: #dfe3e6;
	--face-hi: #ffffff;
	--face-sh: #878b8f;
	--face-dk: #000000;

	--title-a: #000082;
	--title-b: #1084d0;
	--title-ia: #7b7b7b;
	--title-ib: #b4b4b4;

	--teal: #008080;
	--selection: #000082;

	--ui-font: Tahoma, "Segoe UI", Verdana, Geneva, sans-serif;
	--mono-font: "Lucida Console", "Cascadia Mono", "DejaVu Sans Mono", monospace;

	--taskbar-h: 34px;
}

* { box-sizing: border-box; }

/* several components set display explicitly, which would otherwise win */
[hidden] { display: none !important; }

html, body {
	height: 100%;
}

body {
	margin: 0;
	background: #14161c;
	font-family: var(--ui-font);
	color: #111;
	overflow: hidden;
}

/* ---------- the room ------------------------------------------------------ */

.scene {
	position: relative;
	height: 100%;
	display: grid;
	place-items: center;
	padding: 2vh 2vw;
	background:
		radial-gradient(120% 80% at 50% 12%, #2f3440 0%, #1b1f27 48%, #101319 100%);
	overflow: hidden;
}

/* warm CRT bloom thrown back onto the wall */
.scene::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 38%;
	width: 120vmin;
	height: 90vmin;
	transform: translate(-50%, -50%);
	background: radial-gradient(closest-side, rgba(120, 190, 255, 0.16), transparent 70%);
	pointer-events: none;
}

/* desk plane, receding for a bit of depth */
.scene::after {
	content: "";
	position: absolute;
	inset: auto 0 0 0;
	height: 26vh;
	background:
		linear-gradient(180deg, #4a3a2b 0%, #33271c 40%, #241b13 100%);
	clip-path: polygon(-10% 100%, 110% 100%, 78% 0%, 22% 0%);
	pointer-events: none;
}

.rig {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* ---------- monitor ------------------------------------------------------- */

.monitor {
	position: relative;
	width: min(92vw, 1020px, calc((84vh - 150px) * 4 / 3));
	min-width: 280px;
	padding: 22px 22px 0;
	border-radius: 16px 16px 6px 6px;
	background:
		linear-gradient(160deg, var(--beige-1) 0%, var(--beige-2) 42%, var(--beige-3) 100%);
	/* stepped solid offsets read as an extruded slab rather than a flat shadow */
	box-shadow:
		inset 2px 2px 0 rgba(255, 255, 255, 0.75),
		inset -2px -2px 0 rgba(0, 0, 0, 0.12),
		10px 10px 0 var(--beige-4),
		20px 20px 0 var(--beige-5),
		26px 26px 48px rgba(0, 0, 0, 0.55);
}

.monitor__bezel {
	position: relative;
	padding: 14px;
	border-radius: 10px;
	background: linear-gradient(160deg, var(--beige-3), var(--beige-2));
	box-shadow:
		inset 2px 2px 4px rgba(0, 0, 0, 0.45),
		inset -2px -2px 0 rgba(255, 255, 255, 0.5);
}

/* ---------- screen -------------------------------------------------------- */

.screen {
	position: relative;
	aspect-ratio: 4 / 3;
	border-radius: 14px / 10px;
	background: #05070a;
	overflow: hidden;
	box-shadow:
		inset 0 0 14px rgba(0, 0, 0, 0.95),
		inset 0 0 60px rgba(0, 0, 0, 0.7);
}

.layer {
	position: absolute;
	inset: 0;
}

.layer[hidden] { display: none; }

/* glass: scanlines, curvature vignette, glare */
.crt {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 60;
	border-radius: inherit;
	background:
		linear-gradient(120deg, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0.04) 22%, transparent 46%),
		repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px),
		radial-gradient(130% 120% at 50% 50%, transparent 58%, rgba(0, 0, 0, 0.55) 100%);
	mix-blend-mode: multiply;
	opacity: 0.85;
}

.crt::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(150, 220, 255, 0.05);
	animation: flicker 5.5s steps(2, end) infinite;
}

@keyframes flicker {
	0%, 96%, 100% { opacity: 0.35; }
	97% { opacity: 0.9; }
	98% { opacity: 0.2; }
}

/* ---------- monitor chin + case ------------------------------------------- */

.monitor__chin {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 16px 14px;
}

.badge {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 3px 10px;
	border-radius: 3px;
	background: #f3efe3;
	box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.2);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.14em;
	color: #4a4436;
	text-transform: uppercase;
}

/* the cow-spot nod */
.badge__cow {
	width: 18px;
	height: 12px;
	border-radius: 2px;
	background:
		radial-gradient(closest-side, #221f1a 96%, transparent) 2px 2px / 7px 6px no-repeat,
		radial-gradient(closest-side, #221f1a 96%, transparent) 11px 6px / 6px 5px no-repeat,
		#fff;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.knobs {
	display: flex;
	align-items: center;
	gap: 8px;
}

.knob {
	width: 26px;
	height: 8px;
	border-radius: 2px;
	background: linear-gradient(180deg, var(--beige-1), var(--beige-3));
	box-shadow: inset 1px 1px 0 #fff, 0 1px 2px rgba(0, 0, 0, 0.3);
}

.led {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #1d3b1f;
	box-shadow: inset 0 0 2px #000;
}

body.is-on .led {
	background: #56ff6a;
	box-shadow: 0 0 8px #56ff6a, 0 0 18px rgba(86, 255, 106, 0.55);
}

.case {
	position: relative;
	width: min(96vw, 1120px);
	margin-top: 10px;
	padding: 14px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	border-radius: 6px;
	background: linear-gradient(180deg, var(--beige-1), var(--beige-3));
	box-shadow:
		inset 2px 2px 0 rgba(255, 255, 255, 0.7),
		inset -2px -2px 0 rgba(0, 0, 0, 0.14),
		10px 10px 0 var(--beige-4),
		20px 20px 0 var(--beige-5),
		24px 26px 42px rgba(0, 0, 0, 0.55);
}

.drives {
	display: flex;
	align-items: center;
	gap: 14px;
}

.slot {
	height: 12px;
	border-radius: 2px;
	background: linear-gradient(180deg, #2b2a26, #4d4b44);
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.6);
}

.slot--floppy { width: 92px; }
.slot--cd { width: 130px; }

.vents {
	flex: 1;
	height: 14px;
	border-radius: 2px;
	background: repeating-linear-gradient(90deg, var(--beige-4) 0 3px, transparent 3px 8px);
	opacity: 0.55;
}

.power-btn {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: linear-gradient(160deg, var(--beige-1), var(--beige-3));
	box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 2px rgba(0, 0, 0, 0.35), 0 2px 3px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Boot / POST
   ========================================================================== */

.boot {
	padding: 4% 5%;
	background: #04060a;
	color: #d6d9d2;
	font-family: var(--mono-font);
	font-size: clamp(9px, 1.55vmin, 16px);
	line-height: 1.5;
	z-index: 10;
}

.boot__text {
	margin: 0;
	white-space: pre-wrap;
	text-shadow: 0 0 6px rgba(190, 220, 255, 0.4);
}

.boot__text::after {
	content: "_";
	animation: blink 1s steps(1, end) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.boot__skip {
	position: absolute;
	right: 4%;
	bottom: 4%;
	margin: 0;
	color: #6d7b8d;
	font-size: clamp(8px, 1.3vmin, 13px);
	letter-spacing: 0.08em;
}

/* ---------- splash -------------------------------------------------------- */

.splash {
	display: grid;
	place-content: center;
	gap: 26px;
	justify-items: center;
	background: linear-gradient(170deg, #1f7ec4 0%, #0b4f8a 55%, #062f57 100%);
	color: #fff;
	z-index: 10;
}

.splash__logo {
	font-size: clamp(22px, 5.4vmin, 58px);
	font-weight: 800;
	letter-spacing: 0.06em;
	text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}

.splash__logo span { color: #ffd34d; }

.splash__sub {
	margin: -14px 0 0;
	font-size: clamp(9px, 1.7vmin, 15px);
	letter-spacing: 0.34em;
	text-transform: uppercase;
	opacity: 0.85;
}

.splash__bar {
	width: clamp(140px, 36vmin, 330px);
	height: 16px;
	padding: 2px;
	background: #0a2a48;
	box-shadow: inset 1px 1px 0 #000, inset -1px -1px 0 rgba(255, 255, 255, 0.35);
}

.splash__fill {
	height: 100%;
	width: 0;
	background: repeating-linear-gradient(90deg, #ffd34d 0 10px, transparent 10px 13px);
	transition: width 0.22s linear;
}

/* ==========================================================================
   Desktop
   ========================================================================== */

.desktop {
	z-index: 20;
	background: var(--teal);
	font-size: 12px;
	user-select: none;
}

.desktop__area {
	position: absolute;
	inset: 0 0 var(--taskbar-h) 0;
	overflow: hidden;
}

/* ---------- icons --------------------------------------------------------- */

.icons {
	position: absolute;
	inset: 10px auto 10px 10px;
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	grid-auto-flow: column;
	grid-template-rows: repeat(auto-fill, 88px);
	gap: 4px 10px;
	align-content: start;
}

.icon {
	width: 86px;
	display: grid;
	justify-items: center;
	gap: 5px;
	padding: 5px 3px;
	border: 1px dotted transparent;
	background: none;
	color: #fff;
	font: inherit;
	text-align: center;
	cursor: default;
	text-decoration: none;
}

.icon svg {
	width: 34px;
	height: 34px;
	filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.45));
}

.icon__label {
	padding: 1px 3px;
	line-height: 1.25;
	text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.7);
	word-break: break-word;
}

.icon.is-selected .icon__label {
	background: var(--selection);
	text-shadow: none;
}

.icon.is-selected {
	border-color: rgba(255, 255, 255, 0.85);
}

.icon:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -2px;
}

/* ---------- windows ------------------------------------------------------- */

.win {
	position: absolute;
	display: flex;
	flex-direction: column;
	min-width: 220px;
	min-height: 120px;
	padding: 3px;
	background: var(--face);
	box-shadow:
		inset -1px -1px 0 var(--face-dk),
		inset 1px 1px 0 var(--face-hi),
		inset -2px -2px 0 var(--face-sh),
		inset 2px 2px 0 var(--face-lt),
		2px 2px 6px rgba(0, 0, 0, 0.4);
}

.win[hidden] { display: none; }

.win.is-max {
	inset: 0 !important;
	width: auto !important;
	height: auto !important;
}

.win__bar {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 3px 3px 3px 4px;
	background: linear-gradient(90deg, var(--title-ia), var(--title-ib));
	color: #d8d8d8;
	cursor: default;
}

.win.is-active .win__bar {
	background: linear-gradient(90deg, var(--title-a), var(--title-b));
	color: #fff;
}

.win__bar svg { width: 16px; height: 16px; flex: none; }

.win__title {
	flex: 1;
	font-size: 12px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.win__btns { display: flex; gap: 2px; }

.btn95 {
	display: grid;
	place-items: center;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border: 0;
	background: var(--face);
	box-shadow:
		inset -1px -1px 0 var(--face-dk),
		inset 1px 1px 0 var(--face-hi),
		inset -2px -2px 0 var(--face-sh),
		inset 2px 2px 0 var(--face-lt);
	color: #000;
	font: 700 11px/1 var(--ui-font);
	cursor: pointer;
}

.btn95:active,
.btn95[aria-expanded="true"] {
	box-shadow:
		inset 1px 1px 0 var(--face-dk),
		inset -1px -1px 0 var(--face-hi),
		inset 2px 2px 0 var(--face-sh),
		inset -2px -2px 0 var(--face-lt);
	padding: 1px 3px 0 5px;
}

.btn95:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

.win__menu {
	display: flex;
	gap: 14px;
	padding: 2px 6px;
	font-size: 12px;
	color: #000;
}

.win__menu span { cursor: default; }
.win__menu span::first-letter { text-decoration: underline; }

.win__body {
	flex: 1;
	margin: 2px;
	padding: 14px 16px;
	background: #fff;
	box-shadow:
		inset 1px 1px 0 var(--face-sh),
		inset -1px -1px 0 var(--face-hi),
		inset 2px 2px 0 var(--face-dk),
		inset -2px -2px 0 var(--face-lt);
	overflow: auto;
	user-select: text;
	font-size: 13px;
	line-height: 1.55;
	color: #101010;
}

.win__body--plain {
	background: var(--face);
	box-shadow: none;
	padding: 10px;
}

.win__status {
	display: flex;
	gap: 4px;
	margin: 0 2px 1px;
	font-size: 11px;
	color: #222;
}

.win__status span {
	padding: 2px 6px;
	box-shadow: inset 1px 1px 0 var(--face-sh), inset -1px -1px 0 var(--face-hi);
}

.win__status span:first-child { flex: 1; }

/* ---------- content typography ------------------------------------------- */

.win__body h2 {
	margin: 0 0 4px;
	font-size: 17px;
	letter-spacing: 0.01em;
}

.win__body h3 {
	margin: 18px 0 4px;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.09em;
	color: #000082;
}

.win__body p { margin: 0 0 10px; }
.win__body ul { margin: 0 0 10px; padding-left: 20px; }
.win__body li { margin-bottom: 4px; }

.win__body a { color: #0000c8; }
.win__body a:hover { color: #cc523e; }

.lede {
	font-size: 13px;
	color: #333;
}

.kicker {
	margin: 0 0 12px;
	font-size: 11px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #6a6a6a;
}

.toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-bottom: 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid #d5d5d5;
}

a.btn95 {
	min-height: 24px;
	padding: 0 12px;
	color: #000;
	text-decoration: none;
	font-weight: 400;
	font-size: 12px;
}

a.btn95:hover { color: #000; }

.pdf-frame {
	width: 100%;
	height: min(560px, 60vh);
	border: 0;
	background: #7a7a7a;
	box-shadow: inset 0 0 0 1px #9b9b9b;
}

.note {
	margin: 10px 0 0;
	font-size: 11.5px;
	color: #666;
}

/* file-list rows, used by folders */
.files {
	margin: 0;
	padding: 0;
	list-style: none;
}

.files li {
	display: flex;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid #e4e4e4;
	margin: 0;
}

.files li:last-child { border-bottom: 0; }

.files svg { width: 28px; height: 28px; flex: none; margin-top: 2px; }

.files h3 { margin: 0 0 2px; color: #000; text-transform: none; letter-spacing: 0; font-size: 14px; }

.files .meta {
	margin: 0 0 6px;
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #7a7a7a;
}

.files p { margin: 0 0 6px; }

.tags { display: flex; flex-wrap: wrap; gap: 5px; }

.tag {
	padding: 1px 7px;
	background: var(--face);
	box-shadow: inset -1px -1px 0 var(--face-sh), inset 1px 1px 0 var(--face-hi);
	font-size: 11px;
	color: #202020;
}

/* ---------- taskbar ------------------------------------------------------- */

.taskbar {
	position: absolute;
	inset: auto 0 0 0;
	height: var(--taskbar-h);
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 3px 4px;
	background: var(--face);
	box-shadow: inset 0 1px 0 var(--face-hi), inset 0 2px 0 var(--face-lt);
	z-index: 40;
}

.start {
	display: flex;
	align-items: center;
	gap: 5px;
	height: 26px;
	padding: 0 8px 0 5px;
	font-weight: 700;
	font-size: 12.5px;
}

.start svg { width: 18px; height: 18px; }

.tasks {
	flex: 1;
	display: flex;
	gap: 3px;
	overflow: hidden;
	margin-left: 4px;
}

.task {
	display: flex;
	align-items: center;
	gap: 5px;
	height: 26px;
	min-width: 0;
	max-width: 168px;
	padding: 0 9px;
	font-size: 12px;
	font-weight: 400;
	justify-content: flex-start;
}

.task span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.task svg { width: 15px; height: 15px; flex: none; }

.task.is-active {
	box-shadow:
		inset 1px 1px 0 var(--face-dk),
		inset -1px -1px 0 var(--face-hi),
		inset 2px 2px 0 var(--face-sh),
		inset -2px -2px 0 var(--face-lt);
	background-image: repeating-conic-gradient(var(--face-lt) 0% 25%, var(--face) 0% 50%);
	background-size: 4px 4px;
	font-weight: 700;
}

.tray {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 26px;
	padding: 0 10px;
	box-shadow: inset 1px 1px 0 var(--face-sh), inset -1px -1px 0 var(--face-hi);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

/* ---------- start menu ---------------------------------------------------- */

.startmenu {
	position: absolute;
	left: 4px;
	bottom: calc(var(--taskbar-h) + 2px);
	z-index: 50;
	display: flex;
	width: 236px;
	padding: 3px;
	background: var(--face);
	box-shadow:
		inset -1px -1px 0 var(--face-dk),
		inset 1px 1px 0 var(--face-hi),
		inset -2px -2px 0 var(--face-sh),
		inset 2px 2px 0 var(--face-lt),
		3px 3px 8px rgba(0, 0, 0, 0.45);
}

.startmenu[hidden] { display: none; }

.startmenu__rail {
	width: 26px;
	flex: none;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	overflow: hidden;
	background: linear-gradient(180deg, #000082, #1084d0);
	color: #fff;
}

.startmenu__rail b {
	display: block;
	transform: rotate(180deg);
	writing-mode: vertical-rl;
	padding: 10px 4px;
	font-size: 15px;
	letter-spacing: 0.08em;
	line-height: 1;
}

.startmenu__rail b i { font-style: normal; color: #ffd34d; }

.startmenu ul {
	flex: 1;
	margin: 0;
	padding: 2px;
	list-style: none;
}

.startmenu li + li.sep {
	margin: 3px 2px;
	border-top: 1px solid var(--face-sh);
	border-bottom: 1px solid var(--face-hi);
	height: 0;
	padding: 0;
}

.startmenu button,
.startmenu a {
	display: flex;
	align-items: center;
	gap: 9px;
	width: 100%;
	padding: 6px 8px;
	border: 0;
	background: none;
	color: #000;
	font: 13px/1.2 var(--ui-font);
	text-align: left;
	text-decoration: none;
	cursor: default;
}

.startmenu svg { width: 22px; height: 22px; flex: none; }

.startmenu button:hover,
.startmenu a:hover,
.startmenu button:focus-visible,
.startmenu a:focus-visible {
	background: var(--selection);
	color: #fff;
	outline: none;
}

/* ==========================================================================
   Responsive + motion + no-JS
   ========================================================================== */

/* On small screens windows fill the desktop, so dragging is unnecessary. */
body.is-compact .icons {
	grid-template-rows: repeat(auto-fill, 74px);
	inset: 6px auto 6px 6px;
}

body.is-compact .icon { width: 72px; font-size: 11px; }
body.is-compact .icon svg { width: 28px; height: 28px; }
body.is-compact .win__bar { cursor: default; }

/*
 * Start menu is nearly as tall as the CRT desktop on phones. Without a
 * height cap its top (and the blue Isquick rail) gets clipped by
 * .screen { overflow: hidden; border-radius: … }.
 */
body.is-compact .startmenu {
	left: 4px;
	width: min(236px, calc(100% - 10px));
	max-height: calc(100% - var(--taskbar-h) - 14px);
	overflow: hidden;
}

body.is-compact .startmenu ul {
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
}

body.is-compact .startmenu button,
body.is-compact .startmenu a {
	gap: 7px;
	padding: 4px 7px;
	font-size: 12px;
}

body.is-compact .startmenu svg { width: 18px; height: 18px; }

body.is-compact .startmenu__rail { width: 22px; }

body.is-compact .startmenu__rail b {
	padding: 8px 2px;
	font-size: 12px;
	letter-spacing: 0.06em;
}

@media (max-width: 720px) {
	.case { padding: 10px 12px; }
	.slot--cd { display: none; }
	.monitor { padding: 12px 12px 0; border-radius: 12px 12px 4px 4px; }
	.monitor__bezel { padding: 8px; }
	.monitor__chin { padding: 8px 10px 10px; }
	.badge { font-size: 9px; padding: 2px 7px; }
}

@media (prefers-reduced-motion: reduce) {
	.crt::after { animation: none; }
	.boot__text::after { animation: none; }
	.splash__fill { transition: none; }
}

.noscript {
	position: relative;
	z-index: 100;
	max-width: 640px;
	margin: 8vh auto;
	padding: 28px 32px;
	background: #fff;
	font-size: 15px;
	line-height: 1.6;
}

.noscript a { color: #cc523e; }

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}
