*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Geometry and colours below are measured from a real Windows 7 desktop
   captured at 1024x768, so the layout matches it pixel for pixel there and
   keeps its proportions elsewhere. */
:root {
  --taskbar-height: 45px;
  --icon-cell: 76px;
  --icon-art: 48px;
  --icon-pitch: 107px;
  --ui-font: "Segoe UI", "Selawik", "Open Sans", Tahoma, sans-serif;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--ui-font);
  background: #0a3f70;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}

button {
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  cursor: default;
}

.desktop {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: url("assets/wallpaper.jpg") center / cover no-repeat #0a3f70;
}

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

/* Icons fill a column before starting the next one, the way the shell lays them
   out, so the files virus.exe drops land beside the ones already there. */
.icon-grid {
  position: absolute;
  top: 6px;
  left: 4px;
  display: grid;
  grid-template-rows: repeat(4, var(--icon-pitch));
  grid-auto-flow: column;
  grid-auto-columns: var(--icon-cell);
  column-gap: 22px;
  justify-items: center;
}

.icon {
  width: var(--icon-cell);
  height: max-content;
  padding: 3px 1px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 3px;
  text-align: center;
}

.icon-art {
  display: grid;
  place-items: center;
  width: var(--icon-art);
  height: var(--icon-art);
}

.icon-art img {
  max-width: 100%;
  max-height: 100%;
  filter: drop-shadow(0 1px 2px rgba(0, 20, 45, 0.45));
}

.icon-label {
  padding: 0 2px;
  color: #fff;
  font-size: 12px;
  line-height: 1.25;
  text-shadow:
    0 0 3px rgba(0, 12, 30, 0.95),
    0 1px 2px rgba(0, 12, 30, 0.9),
    0 0 6px rgba(0, 12, 30, 0.55);
  overflow-wrap: break-word;
}

.icon:hover {
  border-color: rgba(174, 214, 255, 0.55);
  background: linear-gradient(
    180deg,
    rgba(146, 202, 249, 0.3),
    rgba(103, 176, 239, 0.4)
  );
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.icon.is-selected {
  border-color: rgba(174, 214, 255, 0.75);
  background: linear-gradient(
    180deg,
    rgba(124, 190, 245, 0.5),
    rgba(76, 158, 232, 0.58)
  );
}

/* Centred on the wallpaper logo: the offset keeps the icon art - not the
   whole cell, label included - on the middle of the screen. */
.icon--virus {
  position: absolute;
  left: 49.4%;
  top: 51%;
  transform: translate(-50%, calc(-50% + 11px));
}

.icon--dropped {
  animation: icon-dropped 420ms ease-out backwards;
}

@keyframes icon-dropped {
  from {
    opacity: 0;
  }
}

/* ---------- Shell state: view sizes, renaming, deleting ---------- */

body[data-icons="large"] {
  --icon-cell: 108px;
  --icon-art: 76px;
  --icon-pitch: 140px;
}

body[data-icons="classic"] {
  --icon-cell: 66px;
  --icon-art: 32px;
  --icon-pitch: 80px;
}

body.no-icons .icon {
  visibility: hidden;
}

/* Refresh: the shell redraws the icons, and for a frame they are not there. */
.icon-grid.is-refreshing .icon {
  animation: icon-refresh 180ms steps(2);
}

@keyframes icon-refresh {
  50% {
    opacity: 0;
  }
}

.icon.is-vanishing {
  opacity: 0;
  transition: opacity 140ms linear;
}

.icon.is-shortcut .icon-art {
  position: relative;
}

/* The arrow Windows stamps on the bottom-left corner of a shortcut. */
.icon.is-shortcut .icon-art::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 15px;
  height: 15px;
  filter: drop-shadow(0 1px 1px rgba(0, 20, 45, 0.35));
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15'%3E%3Crect x='.5' y='.5' width='14' height='14' fill='%23fbfbfb' stroke='%23949494'/%3E%3Cpath d='M4.3 10.7 L9.7 5.3' stroke='%23262626' stroke-width='1.7' stroke-linecap='round'/%3E%3Cpath d='M11.3 3.7 L11.3 8.3 L6.7 3.7 Z' fill='%23262626'/%3E%3C/svg%3E")
    no-repeat center / 100% 100%;
}

.icon-rename {
  width: 100%;
  padding: 1px 3px;
  font-family: inherit;
  font-size: 12px;
  color: #000;
  background: #fff;
  box-shadow: 0 0 0 1px #4a90c8;
}

/* ---------- Taskbar ---------- */

.taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  height: var(--taskbar-height);
  display: flex;
  align-items: stretch;
  border-top: 1px solid rgb(150, 189, 214);
  background-image:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.07) 0%,
      rgba(255, 255, 255, 0) 45%,
      rgba(0, 14, 34, 0.05) 100%
    ),
    linear-gradient(
      90deg,
      rgb(74, 166, 215) 0%,
      rgb(72, 164, 214) 12%,
      rgb(65, 159, 213) 19%,
      rgb(60, 154, 210) 27%,
      rgb(56, 147, 206) 37%,
      rgb(51, 139, 204) 46%,
      rgb(47, 133, 203) 56%,
      rgb(43, 124, 198) 66%,
      rgb(31, 85, 145) 90%,
      rgb(32, 80, 136) 100%
    );
  box-shadow: 0 -1px 0 rgba(20, 45, 65, 0.5);
}

.start {
  width: 52px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.start img {
  width: 40px;
  height: 40px;
}

.start:hover img {
  filter: drop-shadow(0 0 5px rgba(170, 230, 255, 0.9)) brightness(1.1);
}

.pinned {
  display: flex;
  align-items: center;
  padding: 3px 0 3px 11px;
}

.pinned button {
  width: 64px;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 3px;
  border: 1px solid transparent;
}

.pinned img {
  height: 32px;
  width: auto;
}

.pinned button:hover {
  border-color: rgba(196, 232, 255, 0.65);
  background: linear-gradient(
    180deg,
    rgba(219, 243, 255, 0.4),
    rgba(147, 205, 247, 0.22) 52%,
    rgba(181, 226, 253, 0.32)
  );
  box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.26);
}

.tray {
  margin-left: auto;
  display: flex;
  align-items: stretch;
}

.tray-btn {
  width: 26px;
  display: grid;
  place-items: center;
  border-radius: 3px;
}

.tray-btn svg {
  filter: drop-shadow(0 1px 1px rgba(0, 20, 45, 0.5));
}

.tray-btn--chevron svg {
  width: 10px;
  height: 7px;
}

.tray-btn--flag svg {
  width: 17px;
  height: 18px;
}

.tray-btn--network svg {
  width: 17px;
  height: 13px;
}

.tray-btn--volume svg {
  width: 15px;
  height: 17px;
}

.tray-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.clock {
  min-width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #fff;
  font-size: 12px;
  line-height: 1.15;
  text-shadow: 0 1px 1px rgba(0, 20, 45, 0.6);
  border-radius: 3px;
}

.clock:hover {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.show-desktop {
  width: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: inset 1px 0 0 rgba(0, 22, 48, 0.24);
}

.show-desktop:hover {
  background: linear-gradient(
    180deg,
    rgba(219, 243, 255, 0.32),
    rgba(155, 210, 247, 0.18)
  );
}

@media (max-width: 620px) {
  :root {
    --icon-cell: 68px;
    --icon-art: 40px;
    --icon-pitch: 92px;
  }

  .icon-label {
    font-size: 11px;
  }

  .clock {
    min-width: 74px;
    font-size: 11px;
  }
}
