/* BioStudio AI — Windows desktop polish.
   Scoped to the classic Windows marker (`theme-windows`) so OS-style shells
   (macOS, BioStudioAI 1–5, Nebula/Pulse/Vector/Lumen) keep their own chrome. */

html.os-windows #os.theme-windows {
  --win-bg: #f3f3f3;
  --win-body-bg: #f9f9fb;
  --win-border: rgba(0, 0, 0, 0.08);
  --win-border-focus: rgba(0, 0, 0, 0.14);
  --titlebar-bg: #f3f3f3;
  --win-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --win-shadow-focus: 0 16px 40px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --taskbar-bg: rgba(243, 243, 243, 0.94);
  --flyout-bg: rgba(243, 243, 243, 0.96);
}

html.os-windows #os.theme-windows.dark {
  --win-bg: #202020;
  --win-body-bg: #1c1c1c;
  --win-border: rgba(255, 255, 255, 0.08);
  --win-border-focus: rgba(255, 255, 255, 0.14);
  --titlebar-bg: #2c2c2c;
  --win-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --win-shadow-focus: 0 16px 40px rgba(0, 0, 0, 0.55);
  --taskbar-bg: rgba(32, 32, 32, 0.94);
  --flyout-bg: rgba(44, 44, 44, 0.96);
}

html.os-windows #os.theme-windows .window {
  background: var(--win-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 8px;
}

html.os-windows #os.theme-windows .window-titlebar {
  background: var(--titlebar-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html.os-windows #os.theme-windows .taskbar {
  background: var(--taskbar-bg);
  backdrop-filter: blur(min(20px, var(--bs-max-blur, 20px))) saturate(1.15);
  -webkit-backdrop-filter: blur(min(20px, var(--bs-max-blur, 20px))) saturate(1.15);
}

html.os-windows #os.theme-windows .start-menu {
  background: var(--start-mica), var(--flyout-bg);
  backdrop-filter: blur(min(48px, var(--bs-max-blur, 48px))) saturate(1.45);
  -webkit-backdrop-filter: blur(min(48px, var(--bs-max-blur, 48px))) saturate(1.45);
  max-height: min(76vh, calc(100dvh - var(--taskbar-h) - 24px));
}

html.os-windows #os.theme-windows .toast,
html.os-windows body.theme-windows .user-flyout {
  backdrop-filter: blur(min(18px, var(--bs-max-blur, 18px)));
  -webkit-backdrop-filter: blur(min(18px, var(--bs-max-blur, 18px)));
}

/* Common Windows laptop heights (1080p @ 125–150%).
   Gate --shell-scale with the Windows theme marker so BioStudioAI / macOS
   shells on a Windows host are not forced into Win11 compact chrome. */
@media (max-height: 820px) {
  html.os-windows:not(.shell-mobile):has(#os.theme-windows) {
    --shell-scale: 0.88;
  }
  html.os-windows #os.theme-windows .start-menu {
    --start-pad-x: 16px;
  }
  html.os-windows #os.theme-windows .start-grid,
  html.os-windows #os.theme-windows .start-cat-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-height: 700px) {
  html.os-windows:not(.shell-mobile):has(#os.theme-windows) {
    --shell-scale: 0.82;
  }
}

@media (max-width: 1100px) {
  html.os-windows #os.theme-windows .start-grid,
  html.os-windows #os.theme-windows .start-cat-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 820px) {
  html.os-windows #os.theme-windows .start-menu {
    width: min(100vw - 12px, 652px);
    left: 50%;
    bottom: calc(var(--taskbar-h) + 8px);
  }
  html.os-windows #os.theme-windows .start-grid,
  html.os-windows #os.theme-windows .start-cat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  html.os-windows #os.theme-windows .toast {
    width: min(340px, calc(100vw - 24px));
  }
}

html.os-windows #os.theme-windows .win-btn {
  min-width: var(--window-control-w);
}

html.os-windows #os.theme-windows .window-body {
  overscroll-behavior: contain;
}

/* Firefox doesn't paint the WebKit scrollbar thumb the same way. */
@-moz-document url-prefix() {
  html.os-windows #os.theme-windows .window-body,
  html.os-windows #os.theme-windows .start-categorized,
  html.os-windows #os.theme-windows .start-all,
  html.os-windows #os.theme-windows .start-home,
  html.os-windows #os.theme-windows .start-results {
    scrollbar-width: thin;
  }
}
