/*
 * site_right_rail.css
 *
 * Fixes for the shared right rail (static/js/nav.js builds it and injects its own styles).
 * Kept in a stylesheet so it can carry a ?v= tag: nav.js has none, and production keeps
 * static files for a year, so changes to nav.js would not reach returning visitors.
 * base.html loads this file on every page.
 */

/* A rail button's hover label ("Calendar", "Contacts") opens to the left of the button. While a
   right-side card is open that spot is behind the card, so only the label's edge showed
   (owner, 2026-11-08). Hide the labels while a card is open; the open card names itself. */
body.rsh-tools-panel-open #right-side-panel-host .rsh-tab::after {
    display: none !important;
}

/* The rail's panels (Page info, AI, Analytics, Contacts, Calendar, Summary) and the right side card
   scroll on their own. A scroll that reaches a panel's top or bottom must stay in the panel: passed
   on to the page, a Mac trackpad made the whole page bounce away while the panel stayed put
   (owner, 2026-11-12). Same rule as the shared left menu (site_left_nav.css). */
[id^="right-side-panel-host-panel-"],
#right-side-card-summary-wrapper {
    overscroll-behavior: contain;
}


/* A fixed rail sits beside the right-side card, 0.5rem from it, never over it (owner, 2026-11-18).
   nav.js sets the gap to 1rem on :root; setting it here on body wins for everything inside the page.
   --rsh-open-shell-w is worked out again so it uses the same gap. */
body {
    --rsh-panel-gap: 0.5rem;
    --rsh-open-shell-w: calc(var(--rsh-rail-w) + var(--rsh-panel-w) + var(--rsh-panel-gap));
}


/* Between 993px and 1097px nav.js shows the rail's icons at rest, fixed over the window's right edge, but
   takes the right card out of the page row, so nothing kept room for the rail: it covered the right edge
   of the page, e.g. New Negotiation's Next button (owner, 2026-11-21). The page column is the element
   just before #right-side-card on every layout (#site-card-center in base.html, the main column in
   esign_base.html), so it keeps the rail's width plus 1rem free while the rail shows, with or without an
   open panel (no jump when Contacts opens). The market pages did this for themselves first (0aa5cb857).
   At 992px and less the rail is hidden until opened and then opens over the page like a drawer; from
   1098px the right card keeps the room itself.
   "html" is there on purpose: nav.js adds `body.rsh-rail-visible #site-card-center { margin-right: 0 !important }`
   after this file, with the same weight, so without it nav.js won on base.html pages. */
@media (min-width: 993px) and (max-width: 1097.98px) {
    html body:is([data-right-rail-state="rail"], [data-right-rail-state="panel"]) :has(+ #right-side-card) {
        margin-right: calc(var(--rsh-rail-w, 56px) + 1rem) !important;
    }
}


/* Dark theme: the holder of the rail's open panel (Contacts, AI, ...) is painted white by nav.js,
   which showed as a frame around the panel. It paints nothing; each panel has its own colour
   (owner, 2026-11-18). */
[data-theme="dark"] #right-side-panel-host .rsh-panels,
[data-bs-theme="dark"] #right-side-panel-host .rsh-panels {
    background-color: transparent !important;
}
