/**
 * responsive.css — every @media rule in the system: small-screen layout
 * adjustments for the room page and the editor, and the one global
 * accessibility override that applies everywhere regardless of viewport.
 */

/* Anyone who's asked their OS for reduced motion gets it — every
   transition/animation left in the system (button/link state changes, a
   popup's fade-in, the sweep bar filling) collapses to effectively
   instant instead of being removed outright, so state changes are still
   visible, just not animated. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Room page — small screens ──
   The sidebar (six sections deep — Primary actions, View, Inspection
   Mode, Secondary actions, Legend & Stats, Inspector) switches from a
   docked side panel to a bottom sheet, same content, just re-anchored to
   the bottom of the viewport. Unlike the old single-purpose inspector,
   this sheet now holds every control the room page has, so it defaults
   COLLAPSED to a small handle (see .sheet-handle / setSheetOpen() in
   room.js) rather than staying permanently open — the floor plan stays
   the dominant thing on screen until the checker actually pulls the
   sheet up, and selecting a device or arming Inspection Mode opens it
   automatically so nothing relocated here becomes harder to reach. */
@media (max-width: 700px) {
  .app { padding: var(--space-4) var(--space-3) var(--space-8); }

  .header-inner { align-items: flex-start; }

  .sidebar-primary { flex-direction: row; }
  .sidebar-block-btn { width: auto; }
  .mode-group, .filter-row { flex: 1 1 100%; }
  .quick-btn, .filter-btn, .toolbar-btn, .site-toggle, .sidebar-block-btn { flex: 1 1 auto; min-height: 40px; }
  .zoom-hint { display: none; }

  .legend { gap: var(--space-3) var(--space-4); margin-top: var(--space-3); }

  .popup { padding: var(--space-4); }
  .status-btn { min-height: 44px; }

  .workstation { flex-direction: column; }
  .floor-pane { width: 100%; padding-right: 0; }
  .room-viewport { height: 45vh; }

  /* The desktop app-shell's left-border divider doesn't apply once the
     sidebar stops sitting beside the floor plan — it becomes a bottom
     sheet instead, so the divider moves to its top edge, and the
     shadow (already part of the base .floating-panel-style elevation)
     does the rest of the "floating above the page" work. Collapsed by
     default (max-height just enough for the handle) — .sheet-open (see
     setSheetOpen() in room.js) is what actually reveals the six sections
     underneath. */
  .inspector-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    flex: none;
    max-height: 72px;
    overflow: hidden;
    border-left: none;
    border-top: var(--border-divider);
    border-radius: var(--radius-panel) var(--radius-panel) 0 0;
    box-shadow: var(--shadow-elevated);
    z-index: 400;
    transition: max-height var(--transition);
  }

  .inspector-panel.sheet-open {
    max-height: 45vh;
  }

  .sheet-handle {
    display: block;
    width: 100%;
    margin-bottom: var(--space-2);
  }
}

/* ── Editor page — small screens ──
   The editor now shares room.html's own .workstation/.floor-pane/
   .inspector-panel classes (see editor.html/editor.css), so the 700px
   block above already stacks it the same way: canvas first, full-width
   sidebar below. The one thing that needs overriding here is
   .inspector-panel's collapsed-bottom-sheet treatment — that assumes a
   .sheet-handle toggle button the editor doesn't have, so its whole Room/
   Tools/Properties/View/Legend/Help sidebar would otherwise shrink to an
   unreachable 72px sliver with no way to reopen it. Reverted back to plain
   static in-flow content instead: the sidebar just stacks below the canvas
   at full width and scrolls with the page. */
@media (max-width: 700px) {
  body.editor-page .inspector-panel {
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
    border-top: var(--border-divider);
    border-left: none;
    border-radius: 0;
    box-shadow: none;
  }
  body.editor-page .editor-canvas-viewport { height: 45vh; }
}
