/* PANEL-60 Phase 11, Workstream BM — desktop layout +
   navigation (items 220–229). This file layers over
   style.css, which is NOT edited: its preserved WIDTHFIX
   block (html, body { overflow-x: clip } and the 1280px
   main cap) still governs every page.

   SCOPE LAW: every layout-changing rule lives inside a
   min-width media query (desktop-first), so phone/tablet
   chrome (the mobile law, items 202–206) renders exactly
   as before. The only unqueried rules are the hidden-by-
   default overlays BM itself adds (hover card, context
   menu, palette) — display:none until BM's JS opens them,
   so they alter no existing chrome at any width.

   WIDESCREEN (item 223) is opt-in per page: only a page
   carrying .p60bm-wide escapes the 1280px cap, only at
   min-width 1600px, and only for the main element that
   contains it. Design tokens come from WS-BP's
   p60bp_tokens.css when present, always with literal
   fallbacks (var(--p60-gap, 16px)). */

/* ---- BM's own overlays: hidden until opened (all widths) */
.p60bm-hovercard, .p60bm-contextmenu, .p60bm-palette {
  display: none;
  position: fixed;
  z-index: 60;
  max-width: min(92vw, 340px);
}
.p60bm-hovercard.open, .p60bm-contextmenu.open,
.p60bm-palette.open { display: block; }

/* ================================================================
   TABLET-UP — min-width 761px: BM components only
   ================================================================ */
@media (min-width: 761px) {
  .p60bm-crumbs { display: flex; flex-wrap: wrap;
    gap: var(--p60-gap, 16px); margin-bottom: 12px; }
  .p60bm-tabbar { display: flex; flex-wrap: wrap;
    gap: 6px; list-style: none; padding: 0; }
  .p60bm-tabbar li { display: inline-flex; align-items: center;
    gap: 6px; border: 1px solid var(--line, #444);
    border-radius: 8px; padding: 4px 8px; }
  .p60bm-art { max-width: 180px; height: auto; border-radius: 8px; }
  .p60bm-compare { display: grid;
    grid-template-columns: 1fr; gap: var(--p60-gap, 16px); }
}

/* ================================================================
   DESKTOP — min-width 1101px: sidebar + panes
   ================================================================ */
@media (min-width: 1101px) {
  /* 220: collapsed sidebar — icons + labels fold to a rail.
     The class is set on <body> by p60bm.js from the per-user
     state served by /nav/state.json. */
  body.p60bm-sidebar-collapsed .side-nav a,
  body.p60bm-sidebar-collapsed .side-group > summary {
    overflow: hidden; white-space: nowrap;
    text-overflow: ellipsis; }
  body.p60bm-sidebar-collapsed .sidebar,
  body.p60bm-sidebar-collapsed aside.sidebar {
    width: var(--p60-sidebar-collapsed, 64px); }
  /* 222: three panes — list + detail + inspector */
  .p60bm-threepane { display: grid;
    grid-template-columns: minmax(220px, 1fr) 2fr minmax(220px, 1fr);
    gap: var(--p60-gap, 16px); align-items: start; }
  /* 228: split view */
  .p60bm-compare { grid-template-columns: 1fr 1fr; }
  .p60bm-hovercard, .p60bm-contextmenu { max-width: 340px; }
}

/* ================================================================
   WIDESCREEN — min-width 1600px (items 222/223)
   ================================================================ */
@media (min-width: 1600px) {
  /* 223: an opt-in .p60bm-wide page uses the large monitor;
     no narrow centered column. Other pages keep the cap. */
  main:has(.p60bm-wide) { max-width: none; }
  .p60bm-wide { width: 100%; max-width: none; }
  .p60bm-threepane {
    grid-template-columns: minmax(280px, 1fr) 2.4fr minmax(280px, 1fr); }
}
