/* ── Keep every Telerik window inside the visible area ─────────────────────────────────────────────────
   Linked from App.razor AFTER the platform skin (ST/REV/REL/Custom). BUMP ?v= THERE ON EVERY CHANGE.

   Every window declares a fixed pixel Width (250px - 1200px) and most have no height at all, while the
   skins only cap height with fixed values (.demo-window / .find-window 900px, .sheet-window and
   .duplicatesheetwindow 600px, .image-window nothing). On a laptop at 100%, or inside a host frame
   that has its own left panel, a window came out bigger than the screen: centred windows lost their
   bottom (and their title bar off the top), wide ones ran off the right edge, and nothing scrolled.

   vw / vh are the frame's own viewport when we are embedded, so these caps follow the frame, not the
   host page. max-width / max-height also win over the inline width Telerik writes from Width="...",
   so none of the window declarations have to change. */

/* Cap the window itself. (0,2,0) beats the skins' single-class rules; maximized windows are left alone. */
.k-window:not(.k-window-maximized) {
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
}

/* The window is a flex column: keep the title bar (and its close button) full height, and let the
   content area shrink and scroll in both directions instead of pushing the window past the cap. */
.k-window-titlebar {
    flex-shrink: 0;
}

.k-window-content {
    min-height: 0;
    overflow: auto;
}

/* The skins' fixed height caps, kept on screens tall enough for them and reduced to the viewport on
   smaller ones - min() so large monitors see exactly the old sizes. Same specificity as the rule above
   and later in the file, so these win over it. */
.k-window.demo-window:not(.k-window-maximized),
.k-window.find-window:not(.k-window-maximized) {
    max-height: min(900px, calc(100vh - 16px));
}

.k-window.sheet-window:not(.k-window-maximized) {
    max-height: min(600px, calc(100vh - 16px));
}

/* The skins set this one with !important, so it needs !important too. Redacted Preview is excluded:
   DisplayFileNew.razor already gives it its own viewport-aware cap, min(700px, 92vh). */
.k-window.duplicatesheetwindow:not(.redactedpreviewwindow):not(.k-window-maximized) {
    max-height: min(600px, calc(100vh - 16px)) !important;
}
