/* ============================================================================
 * ValueCharts — mobile editor chrome  (frontend/docs/mobile-editor-layout-spec.md)
 * ============================================================================
 * Loaded by public/draw_io/index.html AFTER vc-editor-skin.css, so it applies
 * INSIDE the editor iframe only — it can never reach the Next.js app.
 *
 * Why this is a separate file and not part of vc-editor-skin.css: that file's
 * rule 1 is "APPEARANCE ONLY … never `display`, never `position`". This file
 * is the opposite by design — it removes draw.io's own chrome below 768px so
 * React can own the surrounding UI. Keeping the two apart means the skin file's
 * invariant still holds when read on its own.
 *
 * Gated by ONE class, `html.vc-mobile-chrome-active`, which means "the flag is
 * on AND this is a phone". vc-early-hook.js sets it at document start and
 * re-sets it whenever the verdict flips, so it already covers rotation.
 *
 * This file used to carry its own `@media (max-width: 767px)` alongside the
 * flag class. That was the third of three separate definitions of the same
 * breakpoint (the others being vc-early-hook.js's `innerWidth < 768` and the
 * app's `useIsMobile()`), written in three different forms, with nothing able
 * to check them against each other. Rotating a large phone to landscape flipped
 * all three at once and put the whole flagged editor back to desktop chrome
 * mid-session, reported live 2026-09-22.
 *
 * So the media query is GONE from here on purpose. Do not reintroduce one: the
 * verdict belongs to `__vcMobileChromeActive()` in vc-early-hook.js, which this
 * file now simply reads. Off the flag, or on a tablet or desktop, the class is
 * absent and this file is inert.
 *
 * The selectors below were derived from a RUNTIME ENUMERATION of every
 * positioned, painted element inside the iframe at 360x740 with the flag on,
 * not from the research spec's inventory — the first pass matched
 * `.geVerticalToolbar` on the assumption that the spec's "both mxWindow
 * panels" named the two that exist, and it left 11,520px² of draw.io chrome
 * on screen. Re-enumerate before trusting this list again; the probe is
 * described in layout spec §14 step 1.
 * ==========================================================================*/

/* ---- draw.io's four sketch toolbars -------------------------------------
   All four are `position:absolute` DIRECT CHILDREN of `.geEditor`, all four
   carry `geToolbarContainer`, and none contains another — so one child
   selector takes exactly these and nothing nested deeper. Enumerated from
   `EditorUi`'s own handles, with what each one actually carries:

     sketchPickerMenuElt   .geVerticalToolbar   Templates, Custom Shapes,
                                                Text, Note, Rectangle,
                                                Ellipse, Line, Arrow,
                                                Freehand, Generate
     sketchMainMenuElt     .geSketchMainMenu    Diagram (hamburger), Delete,
                                                Undo, Redo
     sketchFooterMenuElt   .geFooterToolbar     Pages, Zoom Out, Zoom, Zoom In
     sketchMenubarElt      (no second class)    Save & Exit

   Only the picker and the main menu actually paint today; the footer and the
   menubar are already `display:none` (the menubar by an inline
   `display:none !important` of our own). They are covered anyway so a future
   draw.io state cannot paint one back over the canvas without anybody
   noticing — the cost of covering an already-hidden element is nothing.

   Where the contents go: the picker's shapes became the React tool bar
   (step 3, §7); Delete/Undo/Redo move to the overflow menu (step 5, §8);
   zoom is already a React control (ZoomControl); the hamburger opens a menu
   React replaces wholesale, and Save & Exit is EditorView's own header.

   Hidden, never rotated or transformed — layout spec §3 rule 4: these touch
   targets are ~28px and the picker's overflow chevron is built for a vertical
   layout.

   `!important` because draw.io writes inline cssText onto these elements in
   the "simple" theme (unmini.js:286547); an inline display would otherwise
   beat any selector here. */
html.vc-mobile-chrome-active .geEditor > .geToolbarContainer,
html.vc-desktop-rail-active .geEditor > .geToolbarContainer {
  display: none !important;
}
/* ^ `vc-desktop-rail-active` (2026-09-23): the React tool rail on desktop and
   tablet, behind its own flag (lib/mobileChrome.ts). It takes over the SAME
   four toolbars — the picker's tools are the rail's tiles, and the main menu's
   Diagram/Undo/Redo/Delete are the rail's Menu tile (Undo/Redo/Delete sit at
   the top of that menu). It is the ONLY rule in this file that applies on
   desktop: the canvas, scrollbar and panel rules below stay phone-only. */

/* ---- draw.io's on-demand panels: NO LONGER HIDDEN HERE ----------------
   A blanket `.mxWindow { display: none !important }` lived here and was
   removed 2026-09-22, when the ⋮ became draw.io's own `diagram` menu. Five of
   that menu's entries — Shapes, Format, Layers, Tags, Find/Replace — open
   precisely these panels, so the blanket would have made a third of the menu
   open something invisible: a tap that silently does nothing, which is the
   exact failure draw.io's own disabled sparkles button had.

   The problem the blanket solved was real, though — some of these panels open
   UNPROMPTED and obstructed 11,520px² of a 390px canvas. That is now handled
   in over-ride.js (`vcCloseAutoPanels`), which closes the ones that opened
   themselves and leaves the ones the user asked for. CSS cannot tell those two
   apart, which is why this rule could not stay.

   DO NOT reintroduce a `.mxWindow` hide rule here. If a panel is obstructing,
   the question is who opened it. */


/* ---- the dead-grey band ------------------------------------------------
   draw.io paints the GRID as a background-image on `.geBackgroundPage` and
   nothing at all on the container behind it, which is a flat
   `--workspace-color` (#ececec). So the canvas ends at the page edge in a
   hard line and everything beyond it reads as dead space rather than as
   more canvas.

   On a desktop viewport that band is a margin nobody notices. At 360px it is
   most of the screen: a value-stream map is wide and short, so at any
   readable zoom its page occupies a thin horizontal strip and the rest of a
   740px-tall phone is grey. Measured on a 1169x826 page at 0.65: the page is
   760x537 in a 360x581 viewport — wider than the screen AND shorter than it.
   First impression of the mobile editor was "diagram squeezed into the top,
   grey underneath".

   Fix: match the container to the page and drop the page's edge treatment, so
   the boundary stops being visible. The grid still stops where the page
   stops, but white-to-white with no shadow reads as the grid fading out
   rather than as the canvas ending.

   Why not `graph.pageVisible = false`, which would make draw.io paint the
   grid across the whole container and is the better look: `pageVisible` is
   serialised into the saved XML as the model's `page` attribute, so the next
   autosave would write `page="0"` into the user's file and change how that
   flow opens on DESKTOP too. A view preference must not become a document
   edit. Raised rather than taken — if we want it, it needs the export path
   to exclude it, which is not a mobile-layout change.

   Only white is introduced, and only because it is already the page's own
   colour (§16 forbids NEW colours, not matching an existing one). Dark mode
   keeps draw.io's own panel token, so nothing is invented there either. */
html.vc-mobile-chrome-active .geDiagramContainer {
  background-color: light-dark(#ffffff, var(--ge-dark-panel-color)) !important;
}

html.vc-mobile-chrome-active .geBackgroundPage {
  box-shadow: none !important;
  border-color: transparent !important;
}

/* ---- the permanent horizontal scrollbar --------------------------------
   A desktop-browser default, not something native touch scrolling ever
   shows: the canvas is wider than a phone at any readable zoom (see §12a's
   0.65 floor), so `.geDiagramContainer` always overflows horizontally and
   the browser always painted a track along the bottom edge. On a phone that
   is a permanent grey bar over the drawing surface that nobody can use,
   because the gesture is a swipe.

   SCROLLING IS UNTOUCHED — `overflow` is deliberately not in this rule.
   Hiding the indicator and disabling the behaviour are different changes,
   and the second one would break panning. */
html.vc-mobile-chrome-active .geDiagramContainer {
  scrollbar-width: none; /* Firefox, and Chromium 121+ */
}

html.vc-mobile-chrome-active .geDiagramContainer::-webkit-scrollbar {
  display: none; /* Safari, and Chromium before 121 */
}
