/*
 * A1 — THE RESULTS TAKE THE FULL CANVAS.
 *
 * Canvas-flow amendment A1 (Phillip, 2026-08-04): "Chat anchor is a floating panel… (supersedes
 * the full-height 'spine'). Conversation is NOT a full-height left column."
 *
 * The page never got the message. `.chat-container` is still a flex row of a `flex:1` chat column
 * and a fixed 32rem sidebar, so on a 1378px screen the cars were crammed into 32rem while more
 * than half the canvas sat white — and the chat anchor, which is supposed to float OVER results,
 * floated over nothing. Every argument for the floating form assumes cars behind the panel.
 *
 * GATED ON THE MOUNT ACTUALLY SUCCEEDING, not on the viewport. `mountChat()` sets
 * `data-otto-canvas="on"` only after the anchor is really on screen, and the error boundary
 * clears it. So if the bundle 404s or Chat throws, the page keeps TODAY's two-column layout with
 * the legacy chat in it, exactly as it degrades now. The layout and the component that justifies
 * it arrive together or not at all — a full-width canvas with no anchor floating over it would be
 * a results page with the conversation deleted.
 *
 * This is a NEW FILE rather than edits to layout.css / sidebar.css / chat.css deliberately: those
 * are shared and Clev is active in this repo. A new file cannot collide, and the whole A1 change
 * is legible in one place instead of as three diffs against rules that predate the amendment.
 */

body[data-otto-canvas="on"] .chat-panel {
    /* The conversation is no longer a column. The anchor is `position: fixed` at every width —
       a floating panel at >=1024px, a bottom sheet below it — so it needs no space in flow.
       What remains inside this element is the LEGACY fallback (welcome turn + input dock), which
       is only ever revealed when the anchor has failed, and at that point this attribute is gone. */
    display: none;
}

body[data-otto-canvas="on"] .sidebar {
    /* Not a sidebar any more; it is the canvas. */
    width: 100%;
    border-left: 0;
}

body[data-otto-canvas="on"] .sidebar-content {
    /*
     * ROOM FOR THE ANCHOR TO FLOAT OVER.
     *
     * The panel floats, so it does not displace content — which means without this the last cards
     * sit UNDERNEATH it and cannot be scrolled clear. "Floats over the results" has to mean the
     * shopper can still reach every result.
     *
     * The reserve is the anchor's FLOOR (40vh) plus its offset (5vh) plus breathing room, not its
     * ceiling: reserving 85vh would leave a permanent hole under a panel that is usually 40%, and
     * the panel scrolls internally rather than growing past its cap.
     */
    padding-bottom: calc(45vh + 1.5rem);
}

@media (min-width: 1024px) {
    body[data-otto-canvas="on"] .sidebar-content {
        /*
         * NO LEFT RESERVE. The first version padded 408px off the left so nothing could ever sit
         * behind the panel — and measured, that cost a whole COLUMN of cars for the full height
         * of the page, to dodge something that occupies one corner at the bottom.
         *
         * The floating form's entire premise is that Otto growing costs the shopper nothing
         * BECAUSE THE CARS ARE STILL THERE, BEHIND HIM. Permanently reserving a strip so nothing
         * is ever behind him concedes exactly what the form was chosen to avoid, and turns the
         * panel back into a column that merely looks like it floats.
         *
         * So cards use the full width and scroll past behind the panel. What must be guaranteed
         * is REACHABILITY, not permanent clearance: the reserve below means the last row can always be
         * scrolled clear of the panel, so no card is permanently unreadable.
         */
        padding-bottom: calc(45vh + 2rem);
    }
}

/*
 * THE CONSENT HOST, once it has been reparented into the canvas by mountChat().
 *
 * #messages-container is not a message list any more — the transcript was retired 2026-08-17. It
 * survives as the host for two things that were never messages and are simply anchored to it:
 * the A2P SMS opt-in card (ui-actions.js — identity, rates, STOP/HELP, Terms, Privacy) and the
 * budget widget (budget-enhanced.js).
 *
 * It keeps `flex: 1` from chat.css, which inside the canvas would make an EMPTY host claim the
 * whole column and push the cards off screen. Here it takes exactly the space its contents need,
 * which is none until something is injected.
 */
body[data-otto-canvas="on"] #messages-container {
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;      /* a consent gate must never be scrolled out of its own container */
    padding: 0;
    gap: 0.75rem;
}

body[data-otto-canvas="on"] #messages-container:empty {
    display: none;          /* no empty gap above the results when nothing is hosted */
}
