/* ==========================================================================
   desktop.css — the night side. Gray workstation windows sit on top of this.
   ========================================================================== */

#desktop { position: fixed; inset: 0; overflow: hidden; }

/* --------------------------------------------------------------------- boot */
#boot {
  position: fixed; inset: 0; z-index: 900;
  background: #000; color: var(--amber);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  padding: 6vh 6vw; overflow: hidden;
  cursor: pointer;
  text-shadow: 0 0 6px rgba(255,155,63,.45);
}
#boot.done { opacity: 0; pointer-events: none; transition: opacity .35s ease .1s; }
#boot-log { margin: 0; white-space: pre-wrap; }
#boot-log .ok  { color: var(--teal); }
#boot-log .hdr { color: var(--bone); }
#boot-skip {
  position: absolute; right: 6vw; bottom: 5vh;
  color: var(--amber-dim); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
}

/* ---------------------------------------------------------------- wallpaper */
#wallpaper {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(70% 34% at 46% 112%, rgba(255,146,58,.40), rgba(255,146,58,0) 66%),
    radial-gradient(150% 62% at 50% 116%, rgba(255,120,50,.24), rgba(255,120,50,0) 64%),
    radial-gradient(95% 55% at 12% -12%, rgba(120,152,190,.11), transparent 66%),
    linear-gradient(180deg, #080910 0%, #0e1118 44%, #17151a 72%, #271b17 100%);
}
#poles { position: absolute; inset: 0; width: 100%; height: 100%; }
#poles line { stroke: rgba(214,220,232,.17); stroke-width: 2; fill: none; }
#poles .wire { stroke: rgba(214,220,232,.12); stroke-width: 1.2; fill: none; }

/* --------------------------------------------------------------- menu column
   NeXT had no menu bar. Menus stood in a column at the top-left and stayed
   open; submenus flew out to the right and stayed too.                        */
#menu { position: absolute; left: 10px; top: 10px; z-index: 60; width: 150px; user-select: none; }
#menu .m-title {
  background: var(--gray); color: var(--ink);
  font-weight: 700; font-size: 12px; text-align: center; letter-spacing: .04em;
  padding: 3px 0;
  border: 1px solid var(--ink);
  box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--lo);
}
#menu .m-item {
  display: flex; align-items: center;
  width: 100%; text-align: left;
  font-family: var(--ui); font-size: 12px;
  padding: 4px 7px;
  background: var(--gray); color: var(--ink);
  border: 1px solid var(--ink); border-top: 0;
  box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--lo);
  cursor: pointer;
}
#menu .m-item:hover { background: var(--gray-lt); }
#menu .m-item:active, #menu .m-item.open { background: var(--ink); color: var(--paper); }
#menu .m-item .sub { margin-left: auto; font-size: 10px; }
#menu .m-group { position: relative; }
#menu .m-fly {
  position: absolute; left: 100%; top: 0; width: 168px; z-index: 61;
  display: none;
}
#menu .m-group.open .m-fly { display: block; }
#menu .m-fly .m-item { border-top: 1px solid var(--ink); }
#menu .m-fly .m-item + .m-item { border-top: 0; }

/* ---------------------------------------------------------------------- dock */
#dock {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  z-index: 60;
  display: flex; flex-direction: column;
  border: 1px solid var(--ink); border-right: 0;
  box-shadow: inset 1px 1px 0 var(--hi);
  background: var(--gray);
}
#dock .d-app {
  position: relative;
  width: 54px; height: 54px; padding: 0;
  display: grid; place-items: center;
  background: var(--gray);
  border: 1px solid var(--lo); border-top-color: var(--hi); border-left-color: var(--hi);
  cursor: pointer;
}
#dock .d-app:hover { background: var(--gray-lt); }
#dock .d-app:active { border-color: var(--hi) var(--lo) var(--lo) var(--hi); background: var(--gray-dk); }
#dock .d-app svg { width: 30px; height: 30px; }
#dock .d-app.running::after {
  content: ""; position: absolute; left: 4px; bottom: 4px;
  width: 5px; height: 5px; background: var(--ink); border-radius: 50%;
}
#dock .d-app .badge {
  position: absolute; right: 3px; top: 3px;
  min-width: 14px; height: 14px; padding: 0 3px;
  font: 700 10px/14px var(--ui); color: var(--paper);
  background: #a03414; border: 1px solid #000;
}
#dock .d-app .tip {
  position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  padding: 3px 7px; font-size: 11px; white-space: nowrap;
  background: var(--gray); border: 1px solid var(--ink);
  box-shadow: inset 1px 1px 0 var(--hi), 2px 2px 0 rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .1s;
}
#dock .d-app:hover .tip { opacity: 1; }

/* -------------------------------------------------------------------- status */
#status {
  position: absolute; left: 10px; bottom: 10px; z-index: 60;
  display: flex; align-items: stretch; gap: 8px;
  font-family: var(--mono); font-size: 11px;
}
#clock {
  padding: 4px 9px; color: var(--bone);
  background: rgba(0,0,0,.5); border: 1px solid rgba(232,228,218,.28);
  letter-spacing: .08em;
}
#observer-light {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  color: var(--amber);
  background: rgba(0,0,0,.5); border: 1px solid rgba(255,155,63,.4);
  cursor: pointer;
}
#observer-light:hover { background: rgba(255,155,63,.14); }
#observer-light i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--amber);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .25 } 50% { opacity: 1 } }
@media (prefers-reduced-motion: reduce) { #observer-light i { animation: none } }

/* --------------------------------------------------------------- screensaver */
/* The screen saver is a canvas the engine in js/saver.js paints into, at
   whatever size it is given — full screen on the desktop, 188x122 in the
   Preferences preview. One implementation, two sizes, no picture of a
   picture. */
.sv-screen {
  position: fixed; inset: 0; z-index: 880;
  background: #000; cursor: none;
  display: flex; align-items: center; justify-content: center;
  animation: sv-in .8s ease both;
}
@keyframes sv-in { from { opacity: 0 } to { opacity: 1 } }
.sv-canvas { width: 100%; height: 100%; display: block; }
.sv-hint {
  position: absolute; left: 0; right: 0; bottom: 16px;
  text-align: center; font-family: var(--mono); font-size: 10px;
  letter-spacing: .18em; color: rgba(232,228,218,.18);
  text-transform: uppercase;
}
.saver-text .s2 { margin-bottom: 26px; }
.saver-text .s3 { font-size: 12px; color: var(--amber-dim); letter-spacing: .22em; }
.saver-text .s3 b { color: var(--amber); }

/* ------------------------------------------------------------------ overlays */
#grain {
  position: absolute; inset: -40px; z-index: 1; pointer-events: none;
  opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: shift .9s steps(3) infinite;
}
@keyframes shift {
  0%   { transform: translate(0,0) }
  33%  { transform: translate(-14px,9px) }
  66%  { transform: translate(11px,-7px) }
  100% { transform: translate(0,0) }
}
#scanlines {
  position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: .2;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.5) 0 1px, transparent 1px 3px);
}
body.no-fx #grain, body.no-fx #scanlines { display: none; }
@media (prefers-reduced-motion: reduce) { #grain { animation: none } }

.noscript { color: var(--bone); padding: 12vh 8vw; font-size: 16px; max-width: 46ch; }
.noscript a { color: var(--amber); }

/* --------------------------------------------------------------------- small
   screens: the desktop metaphor stops working, so windows stack instead.     */
@media (max-width: 860px), (max-height: 520px) {
  #menu { left: 0; top: 0; width: 100%; display: flex; overflow-x: auto; }
  #menu .m-title { flex: 0 0 auto; padding: 6px 10px; }
  #menu .m-item { width: auto; flex: 0 0 auto; border-top: 1px solid var(--ink); border-left: 0; padding: 6px 10px; }
  #menu .m-group { flex: 0 0 auto; }
  #menu .m-fly { left: 0; top: 100%; }
  #dock {
    top: auto; bottom: 0; right: 0; left: 0; transform: none;
    flex-direction: row; justify-content: center; overflow-x: auto;
    border-right: 1px solid var(--ink); border-left: 0;
  }
  #dock .d-app { flex: 0 0 52px; height: 50px; }
  #dock .d-app .tip { display: none; }
  #status { left: 8px; bottom: 58px; }
  .win {
    position: absolute !important;
    left: 6px !important; right: 6px !important;
    top: 40px !important;
    width: auto !important;
    height: calc(100vh - 118px) !important;
    box-shadow: 0 0 0 1px rgba(0,0,0,.6);
  }
  .win.stack-hidden { display: none; }
  .win-resize { display: none; }
  .browser { flex-direction: column; }
  .browser .col { flex: 0 0 auto; max-height: 33%; border-right: 0; border-bottom: 1px solid var(--lo); }
  .browser .col.hide-sm { display: none; }
}
