@import url("./window-manager.css");
@import url("./shortcuts.css");
@import url("./wallpaper.css");
@import url("./minimized-strip.css");

:root {
  --desktop-surface: rgba(255, 255, 255, 0.78);
  --desktop-surface-strong: rgba(250, 248, 242, 0.94);
  --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;
}

:root[data-alyssiun-atmosphere="neo"] {
  --desktop-surface: rgba(12, 15, 18, 0.82);
  --desktop-surface-strong: rgba(8, 10, 12, 0.94);
  --desktop-text: #f2f4f3;
  --desktop-muted: #aeb6b2;
  --desktop-border: rgba(242, 244, 243, 0.16);
  --desktop-shadow: 0 30px 82px rgba(0, 0, 0, 0.56);
  --desktop-focus: #dce9ff;
}

* { box-sizing: border-box; }

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

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

button, input { font: inherit; }

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%;
  height: 100%;
  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-surface-strong);
  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-surface);
}

.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;
}

.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; color: var(--desktop-muted); }
.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; }

/* Embedded first-party app content fills the window below the titlebar. */
.window-content-embed { flex: 1; min-height: 0; padding: 0; }
.window-app-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--desktop-surface-strong);
}

/* Frames must never swallow pointer events while a window is being dragged
   or resized, or the gesture would die the moment it crosses an iframe. */
html.is-window-interacting .window-app-frame { pointer-events: none; }

.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 { padding: 26px; }
}
