/* ═══════════════════════════════════════════════════════
   FAUX OS V2.1 - Desktop Kernel (Window Manager)
   ═══════════════════════════════════════════════════════ */

/* ── Desktop: only visible in desktop mode ── */
.kernel { display: none; }

body.mode--desktop .kernel {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  z-index: var(--z-content);
}

/* ═══════════════════════════════════════════════════════
   MENUBAR
   ═══════════════════════════════════════════════════════ */
.menubar {
  height: 38px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 0 var(--sp-4);
  gap: var(--sp-4);
  background: var(--c-black);
  border-bottom: 2px solid var(--border-strong);
  z-index: var(--z-menubar);
  font-size: var(--fs-xs);
  user-select: none;
  position: relative;

  /* Accent underline */
  &::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--accent);
    opacity: 0.3;
  }
}

.menubar__brand {
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: var(--tracking-pixel);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.menubar__brand .star-mark {
  font-size: 8px;
  opacity: 0.5;
}

.menubar__center {
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.menubar__hint {
  opacity: 0.4;
  font-size: var(--fs-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px var(--sp-2);
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
}

.menubar__right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  justify-content: flex-end;
}

.menubar__clock {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.menubar__legal-link {
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 0;
  opacity: 0.5;
  transition: opacity var(--dur-fast), color var(--dur-fast);

  &:hover {
    opacity: 1;
    color: var(--ink-muted);
  }
}

.menubar__sep {
  color: var(--ink-faint);
  opacity: 0.25;
  font-size: 10px;
  user-select: none;
}

/* ═══════════════════════════════════════════════════════
   WORKSPACE
   ═══════════════════════════════════════════════════════ */
.workspace {
  flex: 1;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
}

/* ═══════════════════════════════════════════════════════
   DESKTOP FOLDERS - top-left, clean, with accent marks
   ═══════════════════════════════════════════════════════ */
.desktop-folders {
  position: absolute;
  top: var(--sp-8);
  left: var(--sp-8);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: var(--z-content);
}

.desktop-folder {
  width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: var(--sp-2) var(--sp-2);
  background: transparent;
  border: none;
  border-radius: var(--r-lg);
  transition: background var(--dur-fast) var(--ease-smooth);
  cursor: pointer;
  user-select: none;

  &:hover {
    background: rgba(255, 255, 255, 0.04);
  }

  &:active {
    transform: scale(0.95);
  }
}

.desktop-folder__icon {
  font-size: 32px;
  line-height: 1;
  opacity: 0.65;
  filter: grayscale(1) brightness(1.6);
  transition: filter var(--dur-fast), opacity var(--dur-fast);

  .desktop-folder:hover & {
    opacity: 0.9;
  }
}

.desktop-folder__label {
  font-size: 11px;
  color: var(--ink-muted);
  text-align: center;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════
   WINDOW
   ═══════════════════════════════════════════════════════ */
.window {
  position: absolute;
  display: none;
  flex-direction: column;
  min-width: 360px;
  min-height: 220px;
  background: var(--glass);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-win);
  overflow: hidden;
  transition: box-shadow var(--dur-normal) var(--ease-smooth);

  &.is-active {
    display: flex;
    box-shadow: var(--shadow-win);
  }

  &.is-dragging {
    opacity: 0.9;
    transition: none;
  }

  &.is-focused {
    box-shadow: var(--shadow-win), 0 0 0 1px rgba(232, 93, 48, 0.1);
  }
}

.window__titlebar {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-3);
  background: var(--c-charcoal);
  border-bottom: 2px solid var(--border-strong);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  position: relative;

  /* Accent mark */
  &::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 14px;
    background: var(--accent);
    opacity: 0.35;
    border-radius: 0 2px 2px 0;
  }

  &:active { cursor: grabbing; }
}

.window__title {
  font-family: var(--font-pixel);
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-pixel);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: var(--sp-2);
}

.window__controls {
  display: flex;
  gap: var(--sp-1);
}

.window__btn-maximize,
.window__btn-close {
  width: 32px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  font-size: var(--fs-sm);
  transition: all var(--dur-fast);
  cursor: pointer;
  color: var(--ink);

  &:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-strong);
  }
}

.window__btn-close:hover {
  background: var(--accent);
  color: var(--c-white);
  border-color: var(--accent);
}

/* Maximized */
.window.is-maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0;
  border: none;
}

.window__body {
  flex: 1;
  overflow: auto;
  padding: var(--sp-4);
}

/* ── Dynamic spawned windows (file viewer etc.) ── */
.window--closing {
  animation: winClose 0.18s ease-in forwards;
  pointer-events: none;
}

@keyframes winClose {
  to { opacity: 0; transform: scale(0.95); }
}

/* File viewer body inside spawned windows */
.file-viewer {
  padding: var(--sp-3);
  height: 100%;
  overflow: auto;
}

/* ═══════════════════════════════════════════════════════
   DOCK
   ═══════════════════════════════════════════════════════ */
.dock {
  position: absolute;
  bottom: var(--sp-3);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: rgba(8, 8, 8, 0.9);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: var(--z-dock);
  max-width: 95vw;
  flex-wrap: wrap;
  justify-content: center;
}

.dock__item {
  width: 66px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  transition: transform var(--dur-fast) var(--ease-spring),
              background var(--dur-fast);
  cursor: pointer;
}

.dock__glyph {
  font-family: var(--font-pixel);
  font-size: 14px;
  transition: filter var(--dur-fast);
}

.dock__label {
  font-size: 8px;
  color: var(--ink-muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
