/* =====================================================================
   mac primitives: window bars, desktop things (QuickTime windows, real
   icons, stickies), the display, the footer dock.
   ===================================================================== */

/* ---------- Traffic lights / window bars ---------- */
.win-bar, .notes-bar, .plan-bar {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px;
  font: 600 13px/1 var(--font-sf); color: #6e6e73;
}
.win-bar > i, .notes-bar > i, .plan-bar > i, .qt-bar > i, .msgs-tl > i, .term-bar > i {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  background: var(--tl-red);
  box-shadow: inset 0 0 0 .5px rgba(0,0,0,.2);
}
.win-bar > i:nth-child(2), .notes-bar > i:nth-child(2), .plan-bar > i:nth-child(2), .qt-bar > i:nth-child(2), .msgs-tl > i:nth-child(2), .term-bar > i:nth-child(2) { background: var(--tl-yellow); }
.win-bar > i:nth-child(3), .notes-bar > i:nth-child(3), .plan-bar > i:nth-child(3), .qt-bar > i:nth-child(3), .msgs-tl > i:nth-child(3), .term-bar > i:nth-child(3) { background: var(--tl-green); }
.win-bar > span, .notes-bar > span, .plan-bar > span {
  position: absolute; left: 0; right: 0; text-align: center; pointer-events: none;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.win { background: #fff; border-radius: 12px; box-shadow: var(--shadow-win); overflow: hidden; }
.win .win-bar { background: #f6f6f6; border-bottom: .5px solid rgba(0,0,0,.1); }

/* ---------- Desktop ---------- */
.desk { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.desk-item {
  position: absolute; left: var(--x); top: var(--y);
  transform: translate(calc(var(--dx, 0px) + var(--mx, 0px)), calc(var(--dy, 0px) + var(--my, 0px))) rotate(var(--r, 0deg));
  pointer-events: auto;
  cursor: grab;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  opacity: 0;
  animation: pop-in .9s var(--ease-spring) forwards;
  animation-delay: var(--in, .35s);
  will-change: transform;
}
.desk-item.dragging { cursor: grabbing; z-index: 20; }
@keyframes pop-in { from { opacity: 0; scale: .7; } to { opacity: 1; scale: 1; } }
.desk-item > * { pointer-events: none; }
.desk-label {
  font: 500 12px/1.2 var(--font-sf); color: #444; letter-spacing: 0;
  padding: 2px 6px; border-radius: 4px;
  white-space: nowrap;
}
.desk-item.picked .desk-label { background: #0a64d6; color: #fff; }

.icon-item img { filter: drop-shadow(0 6px 8px rgba(0,0,0,.18)); }
.icon-item.picked img { filter: drop-shadow(0 6px 8px rgba(0,0,0,.18)) brightness(.85); }

/* QuickTime-style video windows (HeyClicky) */
.qt { width: var(--w); }
.qt-win {
  width: 100%;
  padding: 0 7px 7px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ededed, #e2e2e2);
  box-shadow: 0 0 0 .5px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.8), 0 22px 44px -18px rgba(0,0,0,.4);
  transition: box-shadow .3s;
}
.desk-item.dragging .qt-win { box-shadow: 0 0 0 .5px rgba(0,0,0,.22), 0 40px 70px -20px rgba(0,0,0,.45); }
.qt-bar { position: relative; display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 2px; }
.qt-bar > i { width: 10px; height: 10px; }
.qt-x { position: absolute; right: 2px; width: 11px; height: 11px; color: #9a9a9a; }
.qt-media { position: relative; border-radius: 6px; overflow: hidden; background: #000; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.4); }
.qt-media video { width: 100%; height: auto; display: block; }
.qt-live { aspect-ratio: 1.75; background: var(--wp) center top/cover; }
.qt-notch { position: absolute; top: 0; left: 50%; width: 34%; height: 9%; transform: translateX(-50%); background: #000; border-radius: 0 0 6px 6px; }
.island-host--mini { left: 50%; top: 0; width: 0; height: 0; font-size: 7.4px; }
.island-host--mini .island { --w-closed: 12.4em; --h-closed: 2.1em; }

.kao { font: 400 21px/1 var(--font-mono); color: #8a8a8a; cursor: grab; white-space: pre; }

.sticky {
  width: 188px; padding: 15px 15px 19px;
  font: 500 14px/1.45 var(--font-sf); color: #5b4a12;
  background: linear-gradient(180deg, #fff4ad, #ffe86b);
  border-radius: 2px 2px 14px 2px;
  box-shadow: 0 1px 1px rgba(0,0,0,.06), 0 14px 26px -12px rgba(120, 90, 0, .45);
}
.sticky b { color: #3d300a; }

.keycap {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 52px; height: 52px; margin: 0 3px;
  font: 500 9.5px/1.15 var(--font-sf); color: #8a8a90; text-align: center;
  background: linear-gradient(180deg, #ffffff, #f2f2f5);
  border-radius: 10px;
  box-shadow: 0 0 0 .5px rgba(0,0,0,.16), 0 3px 0 #d8d8de, 0 8px 18px -8px rgba(0,0,0,.3), inset 0 1px 0 #fff;
  animation: key 4s var(--ease-out) infinite;
}
.keycap b { font-size: 19px; color: var(--ink-2); font-weight: 500; }
.keycap--wide { width: 66px; }
.keycap:nth-child(2) { animation-delay: .1s; }
@keyframes key { 0%, 86%, 100% { transform: none; box-shadow: 0 0 0 .5px rgba(0,0,0,.16), 0 3px 0 #d8d8de, 0 8px 18px -8px rgba(0,0,0,.3), inset 0 1px 0 #fff; } 90%, 95% { transform: translateY(3px); box-shadow: 0 0 0 .5px rgba(0,0,0,.16), 0 0 0 #d8d8de, 0 4px 10px -6px rgba(0,0,0,.3), inset 0 1px 0 #fff, 0 0 0 4px rgba(var(--electric-rgb), .18); } }
.pixel { display: block; line-height: 0; filter: drop-shadow(0 6px 8px rgba(0,0,0,.15)); }
.pixel svg { image-rendering: pixelated; shape-rendering: crispEdges; }

/* iMessage bubbles (marquee) */
.imsg {
  position: relative; display: inline-block;
  padding: 9px 15px;
  font: 400 16px/1.3 var(--font-sf); letter-spacing: -0.01em;
  border-radius: 19px;
  white-space: nowrap;
}
.imsg--me { color: #fff; background: #0a84ff; }
.imsg--swaey { color: var(--ink); background: #e9e9eb; }

/* ---------- The display (screen only) ---------- */
.display-stage {
  position: relative;
  perspective: 2400px;
  perspective-origin: 50% 0%;
  display: grid; justify-items: center;
}
.display {
  --dw: min(1300px, 94vw, calc((100svh - 215px) * 1.5));
  --rx: 26deg; --sc: .84; --ty: 0px; --on: 0;
  position: relative;
  width: var(--dw);
  transform: translateY(var(--ty)) rotateX(var(--rx)) scale(var(--sc));
  transform-origin: 50% 100%;
  will-change: transform;
}
.display-bezel {
  position: relative;
  padding: 1.15% 1.15% 1.35%;
  border-radius: 2.1% / 3.2%;
  background: #000;
  box-shadow:
    0 0 0 1.5px #3a3b40,
    0 0 0 2.5px #121315,
    0 50px 120px -40px rgba(10, 20, 60, .45),
    0 30px 60px -30px rgba(0, 0, 0, .35);
}
.display-bezel::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 70;
  background: linear-gradient(118deg, rgba(255,255,255,.07) 0%, rgba(255,255,255,0) 28%, rgba(255,255,255,0) 72%, rgba(255,255,255,.03) 100%);
}
.display-shadow {
  width: 80%; height: 40px; margin-top: 8px;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 20, 60, .22), transparent 70%);
  filter: blur(8px);
}

/* ---------- Footer dock (real icons) ---------- */
.dock {
  position: relative; z-index: 5;
  display: flex; align-items: flex-end; gap: 6px;
  width: max-content; margin: 0 auto;
  padding: 7px 8px;
  border-radius: 22px;
  background: rgba(255,255,255,.5);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 0 0 .5px rgba(255,255,255,.9), 0 0 0 .5px rgba(0,0,0,.14), 0 20px 40px -18px rgba(0,0,0,.35);
}
.dock-item {
  --s: 1;
  position: relative;
  width: calc(56px * var(--s)); height: calc(56px * var(--s));
  transition: width .18s var(--ease-out), height .18s var(--ease-out);
  display: block;
}
.dock-item img { width: 100%; height: 100%; filter: drop-shadow(0 2px 3px rgba(0,0,0,.18)); }
.dock-item::before {
  content: attr(data-label);
  position: absolute; left: 50%; bottom: calc(100% + 12px); transform: translateX(-50%) translateY(4px);
  padding: 4px 10px; border-radius: 7px;
  font: 500 13px/1.3 var(--font-sf); white-space: nowrap; color: var(--ink);
  background: rgba(236,236,240,.95);
  box-shadow: 0 0 0 .5px rgba(0,0,0,.15), 0 6px 16px -6px rgba(0,0,0,.3);
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .2s;
}
.dock-item:hover::before, .dock-item:focus-visible::before { opacity: 1; transform: translateX(-50%); }
.dock-item:active img { filter: brightness(.75); }
.dock-item.running::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: rgba(0,0,0,.6); }
.dock-sep { width: 1px; align-self: stretch; margin: 6px 3px; background: rgba(0,0,0,.16); }
.dk-ico { position: absolute; inset: 8%; border-radius: 23%; display: grid; place-items: center; box-shadow: 0 2px 5px rgba(0,0,0,.2); }
.dk-ico svg { width: 46%; height: 46%; }
.dk-x { background: #000; color: #fff; }
@media (max-width: 640px) {
  .dock { gap: 3px; padding: 6px 7px; border-radius: 18px; }
  .dock-item { width: 38px; height: 38px; }
  .dock-sep, .dock-item[data-label="x"], .dock-item[data-label="apps"] { display: none; }
}
