/*
 * Windows XP easter-egg mode for Lyve.
 * Window frame + Luna title-bar gradient follow XP.css v0.2.6
 * (https://botoxparty.github.io/XP.css/, MIT). The control buttons are drawn
 * in CSS instead of XP.css's pixel-art SVGs: the camera continuously scales
 * the lyrics world, and re-rasterizing detailed SVGs every frame is what made
 * playback stutter. Three Luna themes (blue / olive / silver) are supported.
 */

.visualization-mode.winxp-mode {
	background-color: #5aa7e6;
	overflow: hidden;
}

/* Bliss wallpaper on its own layer so the camera can parallax it (see
   script.js animation loop). Oversized so the drift never reveals an edge.
   Gradient stays underneath as a fallback while the image loads. */
.xp-wallpaper {
	display: none;
}

.winxp-mode .xp-wallpaper {
	display: block;
	position: absolute;
	inset: -20%;
	z-index: 0;
	/* Gradient is the load-time fallback, behind the crossfading image layers. */
	background-color: #5aa7e6;
	background-image: linear-gradient(180deg, #1c5fc6 0%, #2f80d8 28%, #5aa7e6 50%, #9ccfee 61%, #d3e8c6 66%, #93bf63 73%, #5a9b39 100%);
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	transform: translateZ(0);
	will-change: transform;
}

/* Two stacked layers: script.js sets the next wallpaper on the inactive layer
   and toggles .is-active so the swap is instant, no crossfade. */
.winxp-mode .xp-wallpaper-layer {
	position: absolute;
	inset: 0;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	opacity: 0;
	will-change: opacity;
}

.winxp-mode .xp-wallpaper-layer.is-active {
	opacity: 1;
}

.winxp-mode #lyrics-world {
	position: relative;
	z-index: 1;
}

/* Darkens the viewport edges over the wallpaper/lyrics, sitting below the
   beat flash so the flash still reads at full brightness. */
.winxp-vignette {
	display: none;
}

.winxp-mode .winxp-vignette {
	display: block;
	position: absolute;
	inset: 0;
	z-index: 50;
	pointer-events: none;
	background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.55) 100%);
}

.winxp-mode .word-element {
	font-weight: normal;
	color: #000;
	text-shadow: none;
	will-change: transform;
}

/* XP.css assumes a content-box layout; pin it so Lyve's global border-box
   reset doesn't squash the chrome. */
.winxp-mode .xp-window,
.winxp-mode .xp-window * {
	box-sizing: content-box;
}

/* ---- Window frame (XP.css .window, active state) ---- */
.winxp-mode .xp-window {
	min-width: 150px;
	max-width: min(82vw, 600px);
	font-size: 11px;
	background: #ece9d8;
	border-top-left-radius: 8px;
	border-top-right-radius: 8px;
	padding: 0 0 3px;
	-webkit-font-smoothing: antialiased;
	font-family: Tahoma, "Trebuchet MS", sans-serif;

	/* Theme = classic Luna blue (overridden by .xp-theme-* below). */
	--xp-tb: linear-gradient(180deg, #0997ff, #0053ee 8%, #0050ee 40%, #06f 88%, #06f 93%, #005bff 95%, #003dd7 96%, #003dd7);
	--xp-border-light: #0831d9;
	--xp-border-dark: #001ea0;
	--xp-btn: linear-gradient(180deg, #6aa8f7 0%, #2f7ae6 45%, #1659cc 55%, #3f8af0 100%);
	--xp-f1: #00138c;
	--xp-f2: #0831d9;
	--xp-f3: #001ea0;
	--xp-f4: #166aee;
	--xp-f5: #003bda;
	--xp-f6: #0855dd;

	box-shadow:
		inset -1px -1px var(--xp-f1),
		inset 1px 1px var(--xp-f2),
		inset -2px -2px var(--xp-f3),
		inset 2px 2px var(--xp-f4),
		inset -3px -3px var(--xp-f5),
		inset 3px 3px var(--xp-f6);
}

.winxp-mode .xp-window.xp-theme-olive {
	--xp-tb: linear-gradient(180deg, #a6c46f, #7d9f3f 8%, #7a9c3c 40%, #86a84f 88%, #86a84f 93%, #789a3a 95%, #5d7c2a 96%, #5d7c2a);
	--xp-border-light: #6d8d3a;
	--xp-border-dark: #4a6824;
	--xp-btn: linear-gradient(180deg, #aed176 0%, #7da53c 45%, #5e8a26 55%, #93c455 100%);
	--xp-f1: #3a5016;
	--xp-f2: #6d8d3a;
	--xp-f3: #4a6824;
	--xp-f4: #88aa50;
	--xp-f5: #59792d;
	--xp-f6: #77973c;
}

.winxp-mode .xp-window.xp-theme-silver {
	--xp-tb: linear-gradient(180deg, #f1f1f6, #c2c4d2 8%, #a7aabd 40%, #bcbecd 88%, #bcbecd 93%, #a7aabd 95%, #83879c 96%, #83879c);
	--xp-border-light: #989cb0;
	--xp-border-dark: #73768a;
	--xp-btn: linear-gradient(180deg, #eceef4 0%, #b3b7c8 45%, #8d92a9 55%, #ccced9 100%);
	--xp-f1: #595c70;
	--xp-f2: #989cb0;
	--xp-f3: #73768a;
	--xp-f4: #c1c3d0;
	--xp-f5: #828598;
	--xp-f6: #b4b6c6;
}

/* ---- Title bar (XP.css .title-bar) ---- */
.winxp-mode .xp-titlebar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	height: 21px;
	padding: 3px;
	font-family: "Trebuchet MS", Tahoma, sans-serif;
	font-size: 13px;
	background: var(--xp-tb);
	border-top: 1px solid var(--xp-border-light);
	border-left: 1px solid var(--xp-border-light);
	border-right: 1px solid var(--xp-border-dark);
	border-top-left-radius: 8px;
	border-top-right-radius: 7px;
	text-shadow: 1px 1px #0f1089;
}

.winxp-mode .xp-window.xp-theme-olive .xp-titlebar {
	text-shadow: 1px 1px #2f4015;
}

.winxp-mode .xp-window.xp-theme-silver .xp-titlebar {
	text-shadow: 1px 1px rgba(70, 73, 92, 0.9);
}

.winxp-mode .xp-title {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	padding-left: 3px;
	margin-right: 12px;
	font-weight: 700;
	color: #fff;
	letter-spacing: 0;
}

/* ---- Title-bar control buttons (CSS-drawn, lightweight) ---- */
.winxp-mode .xp-controls {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
}

.winxp-mode .xp-control {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 16px;
	margin-left: 2px;
	border: 1px solid rgba(255, 255, 255, 0.7);
	border-radius: 3px;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 1px rgba(0, 0, 0, 0.25);
}

.winxp-mode .xp-min,
.winxp-mode .xp-max {
	width: 16px;
	background: var(--xp-btn);
}

.winxp-mode .xp-close {
	width: 22px;
	background: linear-gradient(180deg, #f7ad8f 0%, #e94e25 45%, #d23a12 55%, #f08a63 100%);
}

.winxp-mode .xp-min::before {
	content: "";
	position: absolute;
	bottom: 2px;
	width: 7px;
	height: 2px;
	background: #fff;
}

.winxp-mode .xp-max::before {
	content: "";
	width: 8px;
	height: 7px;
	border: 1px solid #fff;
	border-top-width: 2px;
	border-radius: 1px;
}

.winxp-mode .xp-close::before {
	content: "\2715";
	color: #fff;
	font: 700 11px/1 Tahoma, "Trebuchet MS", sans-serif;
	text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}

/* ---- Notepad menu bar ---- */
.winxp-mode .xp-menubar {
	display: flex;
	gap: 14px;
	padding: 3px 8px 2px;
	font-family: Tahoma, "Trebuchet MS", sans-serif;
	font-size: 11px;
	color: #000;
}

.winxp-mode .xp-menu-item u {
	text-decoration: underline;
}

/* ---- Notepad text area ---- */
.winxp-mode .xp-body {
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 3px;
	padding: 16px 22px;
	min-height: 48px;
	background: #fff;
	border: 1px solid #7f9db9;
}

.winxp-mode .xp-word {
	color: #0a0a0a;
	line-height: 1.05;
	white-space: nowrap;
}
