@import url("./window-manager.css");
@import url("./window-content.css");
@import url("./shortcuts.css");
@import url("./file-viewers.css");
@import url("./wallpaper.css");
@import url("./display-controls.css");
@import url("./install-app.css");
@import url("./name-dialog.css");
@import url("./drive-items.css");
@import url("./file-manager.css");
@import url("./drive-lifecycle-recovery.css");
@import url("./file-manager-items.css");
@import url("./file-manager-overlay.css");
@import url("./file-manager-search.css");
@import url("./file-manager-polish.css");
@import url("../workspace/workspace-mode.css");

:root {
  /* Published by the OS launcher (v1.js) as the bottom bar's reserved height;
     0px until it mounts. The desktop surface is inset by this so nothing paints
     under the bar. */
  --os-inset-bottom: 0px;
  --desktop-surface: #ffffff;
  --desktop-surface-strong: #faf8f2;
  --desktop-window-bg: #fbfaf6;
  --desktop-window-titlebar-bg: #f7f4ee;
  --desktop-window-content-bg: #fbfaf6;
  --desktop-text: #17191a;
  --desktop-muted: #616966;
  --desktop-border: rgba(20, 23, 25, 0.16);
  --desktop-shadow: 0 24px 70px rgba(39, 42, 40, 0.2);
  --desktop-focus: #17191a;
  --desktop-wallpaper-text: #f7faf9;
  --desktop-wallpaper-muted: rgba(247, 250, 249, 0.78);
  --desktop-wallpaper-shadow: 0 1px 2px rgba(0, 0, 0, 0.96), 0 4px 14px rgba(0, 0, 0, 0.82);
}

:root[data-alyssiun-atmosphere="neo"] {
  --desktop-surface: #11141a;
  --desktop-surface-strong: #151821;
  --desktop-window-bg: #07080b;
  --desktop-window-titlebar-bg: #11141a;
  --desktop-window-content-bg: #080a0d;
  --desktop-text: #f4f4f6;
  --desktop-muted: #8b8b97;
  --desktop-border: rgba(255, 255, 255, 0.09);
  --desktop-shadow: 0 40px 90px -50px rgba(0, 0, 0, 0.9);
  --desktop-focus: #f4f4f6;
}

* { box-sizing: border-box; }

html, body { width: 100%; min-height: 100%; margin: 0; }

body {
  overflow-x: hidden;
  background: #060608;
  color: var(--desktop-text);
  font-family: "Avenir Next", Inter, Aptos, "Segoe UI", system-ui, sans-serif;
}

:root[data-alyssiun-atmosphere="lux"] body { background: #ecebe4; }

:root[data-alyssiun-atmosphere="neo"] body {
  background: radial-gradient(1100px 680px at 50% -240px, #15151d 0%, rgba(6, 6, 8, 0) 60%), #060608;
}

/* No local appearance snapshot yet (new device): boot as NEO/dark. Cached LUX
   still applies before first paint through the inline boot script. */
:root[data-alyssiun-boot="pending"] body { background: #060608; }
:root[data-alyssiun-boot="pending"] .desktop-shell,
:root[data-alyssiun-boot="pending"] #alyssiun-os-launcher-host { visibility: hidden; }
:root[data-alyssiun-boot="pending"] body::after {
  content: "A L Y S S I U N";
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.4em;
}

button, input { font: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body[data-experience="desktop"] {
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 0;
  overflow: hidden;
}

.simple-shell {
  display: grid;
  width: min(760px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  align-content: center;
  gap: 22px;
}

.simple-wordmark { margin: 0; font-size: 0.78rem; font-weight: 750; letter-spacing: 0.2em; }

.simple-panel {
  padding: 36px;
  border: 1px solid var(--desktop-border);
  border-radius: 18px;
  background: var(--desktop-surface-strong);
  box-shadow: var(--desktop-shadow);
}

.simple-panel h1 { margin: 0 0 16px; font-size: clamp(2rem, 7vw, 4.8rem); }
.simple-panel p { margin: 0; color: var(--desktop-muted); line-height: 1.7; }

.desktop-shell {
  position: relative;
  width: 100%;
  /* The bottom bar's top edge is the hard floor: the surface, its wallpaper,
     icons, and every chrome element inside stop here. The bar sits in the strip
     below, not over this container. */
  height: calc(100% - var(--os-inset-bottom, 0px));
  min-width: 0;
  overflow: hidden;
  isolation: isolate;
  color: var(--desktop-text);
}

.desktop-wallpaper {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 72% 16%, rgba(255, 255, 255, 0.7), transparent 32%),
    linear-gradient(145deg, #e8e4dd, #d7d8d4);
}

:root[data-alyssiun-atmosphere="neo"] .desktop-wallpaper {
  background:
    radial-gradient(circle at 72% 16%, rgba(255, 255, 255, 0.06), transparent 32%),
    linear-gradient(145deg, #25292c, #171a1c);
}

.desktop-app-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--desktop-border);
  border-radius: 13px;
  background: var(--desktop-surface-strong);
  box-shadow: 0 9px 22px rgba(26, 29, 28, 0.14);
  color: var(--desktop-text);
}

.desktop-app-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.window-identity .desktop-app-icon svg { width: 17px; height: 17px; }

.desktop-window-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

.desktop-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  left: clamp(108px, 18vw, 260px);
  top: clamp(28px, 10vh, 110px);
  z-index: var(--window-order);
  width: min(620px, calc(100vw - 140px));
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--desktop-border);
  border-radius: 18px;
  background: var(--desktop-window-bg);
  box-shadow: var(--desktop-shadow);
  color: var(--desktop-text);
  pointer-events: auto;
}

.window-titlebar {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 15px;
  border-bottom: 1px solid var(--desktop-border);
  background: var(--desktop-window-titlebar-bg);
}

.window-identity,
.window-controls { display: flex; align-items: center; gap: 9px; }
.window-identity .desktop-app-icon { width: 28px; height: 28px; border-radius: 9px; }
.window-identity strong { font-size: 0.82rem; }

.window-control {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.window-external svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.window-control:hover:not(:disabled),
.window-control:focus-visible { background: rgba(127, 127, 127, 0.14); }
.window-control:disabled { cursor: default; opacity: 0.42; }
.window-content {
  padding: 38px;
  background: var(--desktop-window-content-bg);
  color: var(--desktop-muted);
}
.window-content.window-content-folder {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}
.window-launch { display: inline-flex; margin-top: 14px; color: var(--desktop-text); font-weight: 700; }
.window-signin-required { margin: auto 0; }
.desktop-window.is-maximized {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.desktop-window.is-maximized .window-titlebar {
  min-height: calc(52px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}
.desktop-window.is-maximized .window-content { flex: 1; height: auto; min-height: 0; }

.desktop-shortcut:focus-visible,
.window-control:focus-visible,
.window-launch:focus-visible { outline: 2px solid var(--desktop-focus); outline-offset: 3px; }

@media (max-width: 640px) {
  .desktop-window { left: 12px; top: 16px; width: calc(100vw - 24px); min-height: 280px; }
  .window-content:not(.window-content-embed):not(.window-content-folder) { padding: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
