/* Windows XP "Luna" (Normal, Blue). Frames, buttons, taskbar and Start menu are the theme's own
   bitmaps from luna.msstyles (XP SP3), sliced with the SizingMargins of its NormalBlue.ini. */

@font-face { font-family: "XP Tahoma"; src: local("Tahoma"), url(../assets/fonts/wine-tahoma.ttf) format("truetype"); }
@font-face {
  font-family: "XP Tahoma";
  font-weight: bold;
  src: local("Tahoma Bold"), local("Tahoma-Bold"), url(../assets/fonts/wine-tahomabd.ttf) format("truetype");
}

:root {
  --face: #ece9d8;
  --hilite: #316ac5;
  --shadow: #aca899;
  --ui-font: "XP Tahoma", Tahoma, "Segoe UI", Verdana, sans-serif;
  --title-font: "Trebuchet MS", "XP Tahoma", Tahoma, sans-serif;
  --taskbar-h: 30px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #004e98;
  font: 11px var(--ui-font);
  color: #000;
  -webkit-user-select: none;
  user-select: none;
}

/* Wallpaper: Bliss. The blue gradient underneath shows while it loads, as it did on XP. */
#desktop {
  position: fixed;
  inset: 0 0 var(--taskbar-h) 0;
  background:
    url(../assets/wallpaper.jpg) center / cover no-repeat,
    radial-gradient(ellipse at 30% 20%, #2a74d0 0%, #0f5bb6 45%, #004e98 100%);
  overflow: hidden;
}

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

.desk-icon {
  position: absolute;
  width: 76px;
  padding: 2px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #fff;
  text-align: center;
  cursor: default;
  outline: none;
  touch-action: manipulation;
}
.desk-icon img { width: 32px; height: 32px; }
.desk-icon span { padding: 0 2px 1px; line-height: 13px; text-shadow: 1px 1px 1px #000, 0 0 2px rgba(0, 0, 0, 0.6); }
.desk-icon.sel span { background: var(--hilite); text-shadow: none; }
.desk-icon.sel:focus span { outline: 1px dotted #fff; outline-offset: 0; }
.desk-icon.sel img { filter: brightness(0.62) sepia(1) hue-rotate(185deg) saturate(4); }

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

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  padding: 0 4px 4px;
}
.window.hidden { display: none; }
.window .edge { position: absolute; pointer-events: none; }
.window .fl { left: 0; top: 29px; bottom: 4px; width: 4px; background-image: url(../assets/luna/frame-left.png); background-size: 4px 100%; }
.window .fr { right: 0; top: 29px; bottom: 4px; width: 4px; background-image: url(../assets/luna/frame-right.png); background-size: 4px 100%; }
.window .fb {
  left: 0; right: 0; bottom: 0; height: 4px;
  border-style: solid;
  border-width: 0 5px;
  border-image: url(../assets/luna/frame-bottom.png) 0 5 fill stretch;
}
.window.inactive .fl { background-image: url(../assets/luna/frame-left-inactive.png); }
.window.inactive .fr { background-image: url(../assets/luna/frame-right-inactive.png); }
.window.inactive .fb { border-image-source: url(../assets/luna/frame-bottom-inactive.png); }
.window.maximized { padding: 0; }
.window.maximized .edge { display: none; }

/* [Window.Caption] FrameCaption.bmp, SizingMargins 28, 35, 9, 17 (left, right, top, bottom). */
.titlebar {
  flex: none;
  height: 29px;
  margin: 0 -4px;
  padding: 0 5px 0 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  cursor: default;
  touch-action: none;
  position: relative;
}
.titlebar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-style: solid;
  border-width: 9px 35px 17px 28px;
  border-image: url(../assets/luna/caption.png) 9 35 17 28 fill stretch;
}
.inactive > .titlebar::before { border-image-source: url(../assets/luna/caption-inactive.png); }
.maximized > .titlebar { margin: 0; }
.maximized > .titlebar::before { border-image-source: url(../assets/luna/caption-max.png); }
.maximized.inactive > .titlebar::before { border-image-source: url(../assets/luna/caption-max-inactive.png); }
.window { isolation: isolate; }
.titlebar .ticon { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.titlebar .ttext {
  flex: 1;
  padding-top: 1px;
  font: bold 13px var(--title-font);
  letter-spacing: 0.1px;
  text-shadow: 1px 1px #0a1883;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inactive > .titlebar .ttext { color: #d8e4f8; text-shadow: none; }
.tbtns { display: flex; gap: 3px; flex: none; margin-top: 1px; }

/* Caption buttons: 8 states (normal, hot, pressed, disabled; the same for inactive windows). */
.tb {
  width: 21px;
  height: 21px;
  padding: 0;
  border: 0;
  background: url(../assets/luna/btn-min.png) 0 0 / 21px 168px no-repeat;
  cursor: default;
}
.tb.max { background-image: url(../assets/luna/btn-max.png); }
.maximized .tb.max { background-image: url(../assets/luna/btn-restore.png); }
.tb.close { background-image: url(../assets/luna/btn-close.png); }
.tb.help { background-image: url(../assets/luna/btn-help.png); }
.tb:hover { background-position: 0 -21px; }
.tb:active { background-position: 0 -42px; }
.inactive .tb { background-position: 0 -84px; }
.inactive .tb:hover { background-position: 0 -105px; }
.inactive .tb:active { background-position: 0 -126px; }

.wbody {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  background: var(--face);
  min-height: 0;
}

/* ------------------------------------------------------------ menu bar */

.menubar {
  flex: none;
  display: flex;
  height: 20px;
  background: var(--face);
  border-bottom: 1px solid #fff;
  box-shadow: 0 1px var(--shadow);
  position: relative;
  z-index: 2;
}
.menubar .mtop {
  padding: 3px 6px;
  line-height: 13px;
  cursor: default;
}
.menubar .mtop.hot, .menubar .mtop.open { background: var(--hilite); color: #fff; }
.menubar u, .popup u { text-decoration: none; }
.show-keys .menubar u, .show-keys .popup u { text-decoration: underline; }

.popup {
  position: absolute;
  z-index: 50;
  min-width: 150px;
  padding: 2px;
  background: #fff;
  border: 1px solid var(--shadow);
  box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.35);
}
.popup .mi {
  display: flex;
  height: 17px;
  align-items: center;
  padding: 0 10px 0 17px;
  white-space: nowrap;
  cursor: default;
}
.popup .mi .acc { margin-left: auto; padding-left: 24px; }
.popup .mi.hot { background: var(--hilite); color: #fff; }
.popup .mi.disabled { color: var(--shadow); }
.popup .sep { height: 1px; margin: 3px 1px; background: var(--shadow); }

/* ------------------------------------------------------------ window resize grips */

.grip { position: absolute; z-index: 3; touch-action: none; }
.grip.e { top: 8px; right: -3px; width: 6px; bottom: 8px; cursor: ew-resize; }
.grip.s { left: 8px; bottom: -3px; height: 6px; right: 8px; cursor: ns-resize; }
.grip.se { right: -3px; bottom: -3px; width: 12px; height: 12px; cursor: nwse-resize; }
.maximized .grip { display: none; }

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

#taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--taskbar-h);
  display: flex;
  background: url(../assets/luna/taskbar.png) 0 0 / 1px 30px repeat-x;
  z-index: 60;
  isolation: isolate;
}

/* [Start::Button]: the theme's StartButton.bmp (normal, hot, pressed) with explorer.exe's flag. */
#start {
  flex: none;
  width: 99px;
  height: 30px;
  padding: 0;
  border: 0;
  background: url(../assets/luna/start.png) 0 0 no-repeat;
  cursor: default;
  outline: none;
}
#start:hover { background-position: 0 -30px; }
#start:active, #start.open { background-position: 0 -60px; }

#tasks { flex: 1; min-width: 0; display: flex; gap: 2px; padding: 3px 4px 0 10px; overflow: hidden; }
/* [TaskBand::Toolbar.Button]: TaskBandButton.bmp, 6 states. */
.task {
  flex: 0 1 160px;
  min-width: 36px;
  height: 23px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 7px;
  border: 0;
  background: none;
  color: #fff;
  font: 11px var(--ui-font);
  text-align: left;
  cursor: default;
  position: relative;
  outline: none;
}
.task::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-style: solid;
  border-width: 4px;
  border-image: url(../assets/luna/task-normal.png) 4 fill stretch;
}
.task:hover::before { border-image-source: url(../assets/luna/task-hot.png); }
.task.active::before { border-image-source: url(../assets/luna/task-checked.png); }
.task.active:hover::before { border-image-source: url(../assets/luna/task-hotchecked.png); }
.task:active::before { border-image-source: url(../assets/luna/task-pressed.png); }
.task img { width: 16px; height: 16px; flex: none; }
.task span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* [TrayNotifyHoriz::TrayNotify.Background]: TaskbarTray.bmp, SizingMargins 34, 10, 12, 12. */
#tray {
  flex: none;
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px 0 19px;
  color: #fff;
}
#tray::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-style: solid;
  border-width: 12px 10px 12px 34px;
  border-image: url(../assets/luna/tray.png) 12 10 12 34 fill stretch;
}
#tray button { width: 16px; height: 16px; padding: 0; border: 0; background: none; cursor: default; }
#tray button img { display: block; width: 16px; height: 16px; }
#tray button[hidden] { display: none; }
#clock { padding: 0 2px 0 4px; white-space: nowrap; }

/* ------------------------------------------------------------ Start menu */

#startmenu {
  position: fixed;
  left: 0;
  bottom: var(--taskbar-h);
  width: min(380px, 100vw);
  z-index: 70;
  display: flex;
  flex-direction: column;
  filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.35));
}
#startmenu[hidden] { display: none; }

/* [StartPanel.UserPane]: StartUserPanel.bmp, SizingMargins 59, 60, 62, 0. */
.sm-user {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 4px 6px;
  position: relative;
  color: #fff;
}
.sm-user::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-style: solid;
  border-width: 62px 60px 1px 59px;
  border-image: url(../assets/luna/userpanel.png) 62 60 1 59 fill stretch;
}
.sm-pic {
  flex: none;
  width: 55px;
  height: 55px;
  padding: 4px;
  background: url(../assets/luna/usertile.png) 0 0 / 55px 55px;
}
.sm-pic div {
  width: 47px;
  height: 47px;
  border-radius: 3px;
  background: url(../assets/clippy/atlas.png) no-repeat;
}
.sm-user b {
  font: 600 18.5px "Franklin Gothic Medium", "Franklin Gothic", "Trebuchet MS", var(--ui-font);
  text-shadow: 1px 1px 2px #09428b, 2px 2px 2px #09428b;
}

.sm-mid { display: flex; min-height: 0; }
/* [StartPanel.ProgList]: StartPanelMFUBackground.bmp, SizingMargins 2, 153, 3, 0. */
.sm-left {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  padding: 6px 1px 0 3px;
  position: relative;
  color: #373738;
}
.sm-left::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-style: solid;
  border-width: 3px 153px 0 2px;
  border-image: url(../assets/luna/mfu.png) 3 153 0 2 fill stretch;
}
/* [StartPanel.PlacesList]: StartPanelPlacesBackground.bmp, SizingMargins 172, 7, 3, 1. */
.sm-right {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  padding: 6px 4px 6px 4px;
  position: relative;
  color: #0a246a;
}
.sm-right::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-style: solid;
  border-width: 3px 7px 1px 172px;
  border-image: url(../assets/luna/places.png) 3 7 1 172 fill stretch;
}
.sm-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  border-radius: 0;
  cursor: default;
}
.sm-item img { flex: none; }
.sm-item .t { display: flex; flex-direction: column; min-width: 0; line-height: 13px; }
.sm-item .t small { font-size: 11px; color: #8e8e8e; }
.sm-left .sm-item.big { min-height: 38px; }
.sm-left .sm-item.big .t span { font-weight: bold; }
.sm-left .sm-item:hover { background: rgb(48, 112, 208); color: #fff; }
.sm-left .sm-item:hover small { color: #fff; }
.sm-right .sm-item { min-height: 26px; }
.sm-right .sm-item.bold { font-weight: bold; }
.sm-right .sm-item:hover { background: rgb(48, 112, 208); color: #fff; }
.sm-sep { height: 2px; margin: 4px auto; background: url(../assets/luna/sep-programs.png) center / 100% 2px no-repeat; width: 90%; }
.sm-right .sm-sep { background-image: url(../assets/luna/sep-places.png); width: 75%; }
.sm-spacer { flex: 1; min-height: 8px; }
/* [StartPanel.MorePrograms] */
.sm-more {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  height: 30px;
  margin-top: 2px;
  font-weight: bold;
  cursor: default;
}
.sm-more i { width: 16px; height: 24px; background: url(../assets/luna/moreprog-arrow.png); }
.sm-more:hover, .sm-more.open { background: rgb(48, 112, 208); color: #fff; }
.sm-more:hover i, .sm-more.open i { background-image: url(../assets/luna/moreprog-arrow-hot.png); }

/* [StartPanel.Logoff]: StartPanelLogoffBackground.bmp, SizingMargins 49, 47, 0, 38. */
.sm-off {
  height: 40px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  padding: 0 8px 2px;
  position: relative;
  color: #fff;
}
.sm-off::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-style: solid;
  border-width: 1px 47px 38px 49px;
  border-image: url(../assets/luna/logoff.png) 1 47 38 49 fill stretch;
}
.sm-off .sm-item { padding: 2px 4px; }
.sm-off .sm-item i { width: 24px; height: 24px; background: url(../assets/luna/icon-turnoff.png); }
.sm-off .sm-item.logoff i { background-image: url(../assets/luna/icon-logoff.png); }
.sm-off .sm-item:hover { background: none; }
.sm-off .sm-item:hover i { background-image: url(../assets/luna/icon-turnoff-hot.png); }
.sm-off .sm-item.logoff:hover i { background-image: url(../assets/luna/icon-logoff-hot.png); }

/* All Programs: [StartMenu::Toolbar] StartGroupBackground.bmp, SizingMargins 6, 5, 3, 4. */
.flyout {
  position: fixed;
  z-index: 75;
  min-width: 170px;
  padding: 2px 2px 2px 3px;
  color: #000;
  filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.35));
}
.flyout::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-style: solid;
  border-width: 3px 5px 4px 6px;
  border-image: url(../assets/luna/allprog.png) 3 5 4 6 fill stretch;
}
.flyout .fi { display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 22px 0 6px; position: relative; white-space: nowrap; cursor: default; }
.flyout .fi img { width: 16px; height: 16px; }
.flyout .fi.sub::after { content: ""; position: absolute; right: 8px; top: 7px; border: 4px solid transparent; border-left-color: currentColor; border-right: 0; }
.flyout .fi:hover, .flyout .fi.open { background: rgb(22, 101, 203); color: #fff; }

/* ------------------------------------------------------------ Clippit */

#clippy { position: fixed; width: 124px; height: 93px; z-index: 35; touch-action: none; cursor: default; }
#clippy[hidden] { display: none; }
#clippy .sprite { width: 124px; height: 93px; background: url(../assets/clippy/atlas.png) no-repeat; }

/* The word balloon: colours and font from the character file (MS Sans Serif, #ffffe1 on black). */
.balloon {
  position: fixed;
  z-index: 36;
  width: 214px;
  padding: 7px 9px 8px;
  background: #ffffe1;
  color: #000;
  border: 1px solid #000;
  border-radius: 7px;
  font: 11px var(--ui-font);
  line-height: 14px;
  box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.2);
}
.balloon[hidden] { display: none; }
.balloon p { margin: 0 0 6px; }
.balloon p:last-child { margin-bottom: 0; }
.balloon .tail { position: absolute; width: 0; height: 0; border: 9px solid transparent; }
.balloon.below .tail { bottom: 100%; border-bottom-color: #000; border-top: 0; }
.balloon.below .tail::after { content: ""; position: absolute; left: -8px; top: 1px; border: 8px solid transparent; border-bottom-color: #ffffe1; border-top: 0; }
.balloon.above .tail { top: 100%; border-top-color: #000; border-bottom: 0; }
.balloon.above .tail::after { content: ""; position: absolute; left: -8px; bottom: 1px; border: 8px solid transparent; border-top-color: #ffffe1; border-bottom: 0; }
.balloon .opt { display: flex; align-items: flex-start; gap: 6px; padding: 2px 0; cursor: pointer; }
.balloon .opt::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: 2px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #9cc4ff, #1f5ee0 60%, #0a2f8c);
}
.balloon .opt:hover { color: #0000c0; text-decoration: underline; }

/* Turning off: XP greyed the screen behind its Turn Off dialog. */
body.shutdown #desktop, body.shutdown #taskbar { filter: grayscale(1) brightness(0.8); transition: filter 1.2s; }

/* Right-click menus (Clippit's) use the menu look of the Solitaire popups. */
.popup.ctx { position: fixed; z-index: 95; }
.popup.ctx .mi:hover { background: var(--hilite); color: #fff; }
