/* ============================================================
   DmytroOS — desktop shell: wallpaper, menu bar, dock,
   windows, spotlight, notifications, boot
   ============================================================ */

/* ---------- desktop / wallpaper ---------- */

#desktop {
  position: fixed;
  inset: 0;
  background-image: var(--wallpaper-img), var(--wallpaper);
  background-size: cover;
  background-position: center;
}

/* ---------- boot ---------- */

#boot {
  position: fixed;
  inset: 0;
  z-index: var(--z-boot);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 56px;
  background: #000;
  color: #fff;
  transition: opacity .45s ease;
}
#boot.is-fading { opacity: 0; pointer-events: none; }
.boot-logo { width: 190px; height: auto; }
.boot-bar {
  width: 220px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .22);
  overflow: hidden;
}
.boot-bar i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 3px;
  background: #fff;
  transition: width .25s ease;
}

/* verbose CRT boot (Apple menu → Restart in Verbose Mode) */
#boot.is-verbose {
  justify-content: flex-start;
  align-items: flex-start;
  gap: 0;
  padding: 0;
  background: #04060a;
  overflow: hidden;
}
#boot.is-verbose::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, .28) 3px);
  animation: bv-flicker 3s steps(40) infinite;
}
.bv { width: 100%; height: 100%; padding: 6vh 6vw; overflow: hidden; }
.bv-log {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(11px, 2.4vw, 15px);
  line-height: 1.75;
  color: #7cfc9a;
  text-shadow: 0 0 6px rgba(80, 255, 140, .45);
  white-space: pre-wrap;
  word-break: break-word;
}
.bv-log b { font-weight: 700; }
.bv-ok { color: #34d399; }
.bv-info { color: #fbbf24; }
.bv-live { color: #ff5d8f; }
.bv-cursor { display: inline-block; margin-left: 1px; animation: term-blink 1s steps(1) infinite; }
@keyframes bv-flicker { 0%, 100% { opacity: .55; } 8% { opacity: .62; } 50% { opacity: .4; } }

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

#menubar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-menubar);
  display: flex;
  align-items: center;
  height: var(--menubar-h);
  padding: 0 10px;
  font-size: var(--fs-body);
  color: var(--bar-text);
  background: var(--bar-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: 0 .5px 0 var(--separator);
}
.mb-left, .mb-right { display: flex; align-items: center; gap: 2px; }
.mb-right { margin-left: auto; }
.mb-item {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  border-radius: 5px;
  white-space: nowrap;
  color: inherit;
}
.mb-item:hover, .mb-item.is-open { background: var(--ctl-bg-hover); }
.mb-item svg { width: 15px; height: 15px; display: block; }
.mb-portrait {
  width: 18px;
  height: 18px;
  display: block;
  border-radius: 5px;
  background: #000;
  object-fit: cover;
  object-position: center;
}
/* light theme: invert the chip (dark stencil on a light chip) to match the bar's dark glyphs */
:root[data-theme="light"] .mb-portrait { filter: invert(1); }
.mb-appname { font-weight: 700; }
#mb-clock { font-variant-numeric: tabular-nums; padding: 0 10px 0 6px; white-space: nowrap; }

/* ---------- dropdown menus ---------- */

.dropdown {
  position: absolute;
  z-index: var(--z-dropdown);
  min-width: 230px;
  padding: 5px;
  border-radius: 9px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--glass-border);
  box-shadow: 0 14px 44px rgba(0, 0, 0, .3);
  transform-origin: top left;
  animation: menu-pop .12s var(--ease-out);
}
@keyframes menu-pop {
  from { opacity: 0; transform: scale(.97) translateY(-3px); }
  to   { opacity: 1; transform: none; }
}
.dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  padding: 4px 10px;
  border-radius: 5px;
  text-align: left;
  color: var(--text-1);
  white-space: nowrap;
}
.dd-item:hover { background: var(--accent); color: #fff; }
.dd-item:hover .dd-hint { color: rgba(255, 255, 255, .75); }
.dd-item .dd-check { width: 14px; display: inline-block; }
.dd-hint { font-size: var(--fs-sm); color: var(--text-3); }
.dd-sep { height: 1px; margin: 5px 10px; background: var(--separator); }

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

#desktop-icons-left {
  position: absolute;
  top: calc(var(--menubar-h) + 18px);
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#desktop-icons {
  position: absolute;
  top: calc(var(--menubar-h) + 18px);
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dt-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 92px;
  padding: 6px 2px;
  border-radius: 8px;
}
.dt-icon:hover { background: rgba(255, 255, 255, .14); }
.dt-icon svg, .dt-icon img { width: 52px; height: 52px; }
.dt-icon span {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .55);
  text-align: center;
}

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

#window-layer { position: absolute; inset: 0; pointer-events: none; }

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 200px;
  border-radius: var(--r-window);
  background: var(--win-bg);
  box-shadow: var(--win-shadow-inactive);
  overflow: hidden;
  pointer-events: auto;
}
.window.is-active { box-shadow: var(--win-shadow); }
.window.is-opening { animation: win-open .22s var(--ease-out); }
@keyframes win-open {
  from { opacity: 0; transform: scale(.94) translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.window.is-closing {
  opacity: 0;
  transform: scale(.96);
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
}
.window.is-minimizing {
  transition: transform .32s var(--ease-out), opacity .32s ease;
  opacity: 0;
  pointer-events: none;
}
.window.is-restoring { animation: win-open .25s var(--ease-out); }
.window.is-zooming { transition: left .25s var(--ease-out), top .25s var(--ease-out), width .25s var(--ease-out), height .25s var(--ease-out); }

.win-titlebar {
  display: flex;
  align-items: center;
  flex: 0 0 var(--titlebar-h);
  padding: 0 12px;
  background: var(--win-chrome);
  box-shadow: 0 .5px 0 var(--separator);
  touch-action: none;
  cursor: default;
}
.traffic { display: flex; gap: 8px; }
.tl {
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 50%;
  border: .5px solid rgba(0, 0, 0, .15);
  position: relative;
}
.tl-close { background: var(--tl-close); }
.tl-min   { background: var(--tl-min); }
.tl-zoom  { background: var(--tl-zoom); }
.window:not(.is-active) .tl { background: rgba(128, 128, 134, .4); }
.tl svg {
  position: absolute;
  inset: 1px;
  width: 8px;
  height: 8px;
  opacity: 0;
  stroke: rgba(0, 0, 0, .55);
  stroke-width: 1.6;
}
.traffic:hover .tl svg { opacity: 1; }
.win-title {
  flex: 1;
  text-align: center;
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.window.is-active .win-title { color: var(--text-1); }
.win-titlebar .traffic-ghost { width: 52px; flex: 0 0 auto; } /* balances traffic lights so title centers */

.win-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- dock ---------- */

#dock-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: var(--z-dock);
  display: flex;
  justify-content: center;
  pointer-events: none;
}
#dock {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: calc(var(--dock-size) + 14px); /* fixed: magnified icons pop out above the glass */
  padding: 7px 10px;
  border-radius: var(--r-dock);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--glass-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .25);
  pointer-events: auto;
}
.dock-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  width: var(--dock-size);
  height: var(--dock-size);
  /* magnification grows width/height (reflows neighbors apart), not transform */
  transition: width .1s ease-out, height .1s ease-out;
}
.dock-item img, .dock-item svg {
  width: 100%;
  height: 100%;
  border-radius: var(--r-icon);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .22);
}
.dock-item svg { box-shadow: none; }
.dock-item .dock-dot {
  position: absolute;
  bottom: -6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--bar-text);
  opacity: 0;
}
.dock-item.is-running .dock-dot { opacity: .85; }
.dock-item.is-bouncing { animation: dock-bounce .5s var(--ease-out) 2; }
@keyframes dock-bounce {
  0%, 100% { translate: 0 0; }
  40% { translate: 0 -16px; }
}
.dock-sep {
  width: 1px;
  align-self: stretch;
  margin: 4px 3px;
  background: var(--separator);
}
.dock-label {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-1);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--glass-border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}
.dock-item:hover .dock-label { opacity: 1; }

/* ---------- spotlight ---------- */

#spotlight {
  position: fixed;
  inset: 0;
  z-index: var(--z-spotlight);
  display: flex;
  justify-content: center;
  padding-top: 16vh;
  background: rgba(0, 0, 0, .18);
}
.sp-panel {
  width: min(620px, calc(100vw - 32px));
  align-self: flex-start;
  border-radius: var(--r-panel);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--glass-border);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
  overflow: hidden;
  animation: menu-pop .14s var(--ease-out);
}
.sp-input-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.sp-input-row svg { width: 20px; height: 20px; flex: 0 0 auto; color: var(--text-2); }
#sp-input {
  flex: 1;
  border: 0;
  background: none;
  font-family: var(--font-sys);
  font-size: 20px;
  color: var(--text-1);
}
#sp-input::placeholder { color: var(--text-3); }
#sp-results { max-height: 46vh; overflow-y: auto; border-top: 1px solid var(--separator); padding: 6px; }
#sp-results:empty { display: none; }
.sp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  text-align: left;
  color: var(--text-1);
}
.sp-row img, .sp-row svg { width: 30px; height: 30px; border-radius: 22.5%; flex: 0 0 auto; }
.sp-row.is-selected { background: var(--accent); color: #fff; }
.sp-row.is-selected .sp-sub { color: rgba(255, 255, 255, .75); }
.sp-name { font-weight: 600; }
.sp-sub { font-size: var(--fs-sm); color: var(--text-3); margin-left: auto; white-space: nowrap; }

/* ---------- notifications ---------- */

#notif-root {
  position: fixed;
  top: calc(var(--menubar-h) + 10px);
  right: 12px;
  z-index: var(--z-notif);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}
.notif {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--glass-border);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .28);
  color: var(--text-1);
  pointer-events: auto;
  cursor: pointer;
  transform: translateX(calc(100% + 24px));
  transition: transform .35s var(--ease-spring), opacity .25s ease;
}
.notif.is-in { transform: none; }
.notif.is-out { opacity: 0; transform: translateX(calc(100% + 24px)); }
.notif img, .notif svg { width: 36px; height: 36px; border-radius: 22.5%; flex: 0 0 auto; }
.notif img.is-round { border-radius: 50%; object-fit: cover; }
.notif-title { font-weight: 700; font-size: var(--fs-body); }
.notif-body { font-size: var(--fs-sm); color: var(--text-2); }

/* Hide the desktop icons only below the desktop/iOS mode line (899px) — match the
   breakpoint JS uses in boot.js/main.js. The whole #desktop is already display:none in
   iOS mode, so this is just belt-and-braces; the point is that whenever the desktop IS
   shown (≥900px) its icons show too — no dead band where the desktop is up but iconless. */
@media (max-width: 899px) {
  #desktop-icons, #desktop-icons-left { display: none; }
}
