Skip to content

A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.

6.7 KB
Raw Blame
/* Hero mockup: the desk, the fake window and the resting dock. */

.desk {
  position: relative;
  height: clamp(460px, 56vw, 640px);
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / 0.07) 1px, transparent 0) 0 0 / 22px 22px,
    radial-gradient(circle 420px at 80% 22%, rgb(249 124 3 / 0.3), rgb(249 124 3 / 0)),
    radial-gradient(circle 360px at 14% 72%, rgb(120 90 255 / 0.26), rgb(120 90 255 / 0)),
    linear-gradient(180deg, #0b1a2a, #0f3550 58%, #16607e);
}

/* Wallpaper slideshow: the photos sit over the gradient above and under the scene. */
.desk-wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.desk-wallpaper-layer {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  opacity: 0;
  transition: opacity 1.1s ease;
}

.desk-wallpaper-layer.is-active {
  opacity: 1;
}

/* The set runs from bright fields to night skies; this scrim keeps the white menu bar
   and the glass dock legible over the lightest of them. */
.desk-wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 0%, rgb(6 14 24 / 0), rgb(6 14 24 / 0.35)),
    linear-gradient(180deg, rgb(6 14 24 / 0.42), rgb(6 14 24 / 0.16) 42%, rgb(6 14 24 / 0.46));
}

@media (prefers-reduced-motion: reduce) {
  .desk-wallpaper-layer {
    transition: none;
  }
}

.window {
  margin-top: 56px;
  overflow: hidden;
  border: 1px solid #2a2e30;
  border-radius: 18px;
  corner-shape: squircle;
  background: #0f1214;
  color: #f2f1ec;
  text-align: left;
  box-shadow: 0 60px 140px rgb(0 0 0 / 0.55);
}

.menu-bar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 4;
  display: flex;
  height: 28px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 0.75rem;
  color: #fff;
  background: rgb(0 0 0 / 0.28);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid rgb(255 255 255 / 0.06);
}

.note {
  width: min(560px, 100%);
  height: 100%;
  overflow: hidden;
  border-radius: 14px;
  corner-shape: squircle;
  background: rgb(255 253 247 / 0.97);
  color: #1d1d1f;
  box-shadow: 0 30px 60px rgb(0 0 0 / 0.38);
}

.genie-canvas {
  filter: drop-shadow(0 22px 30px rgb(0 0 0 / 0.42));
}

.traffic {
  display: flex;
  gap: 8px;
}

.traffic > * {
  display: grid;
  place-items: center;
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 0.5px rgb(0 0 0 / 0.16);
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  color: rgb(0 0 0 / 0.55);
}

.traffic button {
  cursor: pointer;
}

/* The glyphs appear only on hover, as in macOS. */
.traffic .glyph {
  opacity: 0;
  transition: opacity 0.12s;
}

.traffic:hover .glyph {
  opacity: 1;
}

.dock {
  position: relative;
  display: flex;
  align-items: flex-end;
  width: max-content;
  /* Auto margins centre the row when it fits and let it scroll from the start
     when it does not; `justify-center` would clip the first icons. */
  margin: 0 auto;
  padding: 0 8px 8px;
  /* The glass keeps its resting height, so magnified icons grow out of it:
     68px of content plus the 8px padding and 2px border of the original. */
  height: 78px;
  list-style: none;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 40px;
  corner-shape: squircle;
  background: rgb(255 255 255 / 0.14);
  box-shadow:
    0 10px 36px rgb(0 0 0 / 0.35),
    inset 0 1px 0 rgb(255 255 255 / 0.3);
  backdrop-filter: blur(24px) saturate(180%);
}

/* Specular edge: a gradient border that fades out towards the middle. */
.dock::before {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  corner-shape: inherit;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    rgb(255 255 255 / 0.7),
    rgb(255 255 255 / 0.06) 38%,
    rgb(255 255 255 / 0.06) 62%,
    rgb(255 255 255 / 0.45)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* The dock is wider than a phone: it scrolls, but a visible scrollbar would sit under the glass. */
.dock-scroll {
  /* Room for magnified icons and tooltips above the glass: the container scrolls,
     so without this headroom their overflow would be clipped. */
  padding-top: 88px;
  scrollbar-width: none;
}

.dock-scroll::-webkit-scrollbar {
  display: none;
}

.dock-item {
  position: relative;
  flex: none;
  width: 52px;
  height: 52px;
  margin: 0 3px;
}

.dock-item img {
  filter: drop-shadow(0 2px 4px rgb(0 0 0 / 0.4));
}

/* Minimized-window slot: `--slot` goes from 0 to 1 as the genie lands, so the dock
   makes room for it exactly when the window arrives. */
.dock-item[data-dock-thumb] {
  width: calc(52px * var(--slot, 0));
  height: calc(52px * var(--slot, 0));
  margin-inline: calc(3px * var(--slot, 0));
  opacity: var(--slot, 0);
}

.dock-thumb {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.dock-thumb canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid rgb(255 255 255 / 0.6);
  border-radius: 50%;
  corner-shape: squircle;
  box-shadow: 0 3px 8px rgb(0 0 0 / 0.4);
}

.dock-thumb:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
}

.dock-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translate(-50%, 4px);
  padding: 5px 11px;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 8px;
  corner-shape: squircle;
  background: rgb(20 22 24 / 0.78);
  backdrop-filter: blur(12px);
  font-size: 0.8125rem;
  color: #fff;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.12s,
    transform 0.12s;
}

.dock-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  rotate: 45deg;
  background: inherit;
  border: solid rgb(255 255 255 / 0.12);
  border-width: 0 1px 1px 0;
}

.dock-item:hover .dock-tip,
.dock-item:focus-within .dock-tip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.dock-dot {
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.85);
  transform: translateX(-50%);
}

/* An app that opens pops its dot in, as in macOS. */
.dock-dot.is-new {
  animation: dock-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dock-pop {
  from {
    scale: 0.3;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dock-dot.is-new {
    animation: none;
  }
}

.dock-sep {
  width: 1px;
  height: 68%;
  align-self: center;
  margin: 0 5px 8px;
  background: rgb(255 255 255 / 0.35);
}