/* al_document_browser.css

   The browser half's stylesheet for the al_document_browser WebSDK control. Every rule is keyed on
   the class the framework gives the control's div (ActiveLoopDocumentBrowser, the JavaScript class's
   own name), never on a control ID: IDs change every session, and the session-setup instance that
   serves this file never has a live control's ID.

   Bootstrap 5 (the framework's own) does the look and the layout: the body is a flex column filling
   the frame the developer drew, inside its own padding (p-3), the folder path a breadcrumb, the
   listing a list group, the upload view a modal. These rules add only what Bootstrap has no class
   for: the header's grid (the breadcrumb on the left, Add at the top right, the empty-folder text
   under Add, and the text across the whole header in a narrow control), the empty-folder text keeps
   its line breaks, the listing may shrink and scroll inside the frame, a long name can wrap inside
   its row, a thumbnail and the host's folder icon never outgrow their box, the right-click menu sits
   where it was opened, the map view's map keeps a usable height in a short window, and the map's
   credit stays legible on a dark page. The upload view needs no rule here, and the map view only those
   two: Bootstrap's scrollable dialog with its content at full height (h-100) gives each most of the
   window's height, and the frame the uploader or the map fills grows into its body (the classes are
   set in al_document_browser.js). The map's own look is MapLibre's stylesheet, the framework's
   maplibre-gl.css.

   This file ships inside a Xojo String constant (CSS_SOURCE), so it keeps to plain ASCII with no
   tabs and no backslashes. */

/* The header, two columns: the breadcrumb, and a right column as wide as Add or the empty-folder
   text's longest line, whichever is wider, and never wider than half the header. The breadcrumb spans
   both rows, so a breadcrumb that wraps never pushes the text down. The header is a size container,
   so the narrow layout below follows the control's own width (Bootstrap's responsive classes follow
   the window's). */
.ActiveLoopDocumentBrowser .al-document-browser-header {
    container: al-document-browser-header / inline-size;
    grid-template-columns: minmax(0, 1fr) fit-content(50%);
}

.ActiveLoopDocumentBrowser .al-document-browser-crumbs {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.ActiveLoopDocumentBrowser .al-document-browser-add {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
}

.ActiveLoopDocumentBrowser .al-document-browser-notice {
    grid-column: 2;
    grid-row: 2;
    white-space: pre-line;
}

/* A header narrower than 576 px (Bootstrap's sm breakpoint; with the 1rem padding, a control narrower
   than 608 px): the breadcrumb keeps the first row beside Add, and the text goes under them across the
   whole header. */
@container al-document-browser-header (max-width: 575.98px) {
    .ActiveLoopDocumentBrowser .al-document-browser-crumbs {
        grid-row: 1;
    }

    .ActiveLoopDocumentBrowser .al-document-browser-notice {
        grid-column: 1 / -1;
    }
}

.ActiveLoopDocumentBrowser .al-document-browser-list {
    min-height: 0;
}

.ActiveLoopDocumentBrowser .al-document-browser-details {
    min-width: 0;
}

.ActiveLoopDocumentBrowser .al-document-browser-thumbnail canvas {
    max-width: 100%;
    max-height: 100%;
}

/* The host's folder icon (folder_icon) in a folder row's box, fitted inside it the way a thumbnail is:
   its own size when it fits, scaled down when it does not, never outgrowing the box. */
.ActiveLoopDocumentBrowser .al-document-browser-thumbnail img {
    max-width: 100%;
    max-height: 100%;
}

.ActiveLoopDocumentBrowser .al-document-browser-menu {
    position: fixed;
}

/* The map view's frame, which MapLibre draws into: it grows to fill the modal's body (flex-grow-1), and
   never gets shorter than 20rem, so a short window keeps a usable map and the body scrolls instead. */
.ActiveLoopDocumentBrowser .al-document-browser-map-frame {
    min-height: 20rem;
}

/* The map's credit reads dark on its light background whatever the page's theme. MapLibre's stylesheet
   colors only the credit's link (rgba(0, 0, 0, 0.75)) on a half-white background, and the rest of the
   credit takes the page's text color: on a page in Bootstrap's dark theme that is light gray, and "(c)" and
   "contributors" all but vanish (measured in the harness). The credit must be shown clearly. */
.ActiveLoopDocumentBrowser .al-document-browser-map-frame .maplibregl-ctrl-attrib {
    color: rgba(0, 0, 0, 0.75);
}
