/* MaverickWX — the Map frame (decision 20, 2026-12-04; docs/plan/map-frame-usability-brief.md § The frame).

   One layout contract around Map's four renderers: Warnings (the server's SVG page), Radar (MapLibre), Satellite
   (one still picture) and Models (the server's pictures). Each view keeps its own drawing code and its own
   stylesheet; this file owns where the shared parts sit and how big they are, so a reader meets one layout in
   every view. It is CSS only: nothing in it needs script, and a view that is whole without script stays whole.

   Loaded by all four views after the site's shared sheets (fonts, tokens, shell, styles), and before each view's
   own sheet. Sizes are declared once, here, as custom properties; a view never redeclares them.

   The slots (desktop: 1024 px and wider, and at least 600 px tall):

     masthead     the site's bar
     .mapframe-bar     the view bar: the view switch, then the view's place control, then one status chip    44 px
     .mapframe-tools   the tool row: the view's title, its product chooser, its tools                       ≤ 56 px
     .mapframe-dock    the panel at the left, collapsible: lists and choices                                360 px
     .mapframe-stage   the map or the picture, which fills what is left
     .mapframe-zoom    top right of the stage, "+" above "−", 40 × 40 px buttons
     .mapframe-key     bottom right of the stage: a "Key" button that opens a card
     .mapframe-time    only on a view that has time (Radar, Models): play, step, scrubber, the frame's time     64 px

   On a phone (below 1024 px wide, or shorter than 600 px) the dock is a bottom sheet opened from the tool row, the
   time bar is 56 px and every control is at least 44 × 44 px.

   Slice 1 builds the view bar and these declarations; the tool row, dock, stage, zoom, Key and time bar are taken
   up view by view in slices 2–5. Never a scientific colour here: the map room's grounds stay the views' own
   (`--sv-room-*` in severe-live.css, `--radar-*` in radar.css), dark in both themes. */

:root {
  --mf-bar-h: 44px;
  --mf-tools-h: 56px;
  --mf-dock-w: 360px;
  --mf-time-h: 64px;
  --mf-zoom: 40px;
}

@media (max-width: 1023.98px), (max-height: 599.98px) {
  :root { --mf-time-h: 56px; --mf-zoom: 44px; }
}

/* ---------------------------------------------------------------------------------------
   The view bar (slice 1): the same top, height, left edge and type in all four views.
   Its content sits on the masthead's edges (`--masthead-width`, `--hub-gutter`, as `body .masthead
   .shell-inner` in shell.css), so the first view's left edge is the logo's. The switch is
   `mapViews()`'s markup, the section row's (`.sectionnav` in shell.css): its look, weight and
   current mark are kept, and only its box is the frame's.
   ------------------------------------------------------------------------------------- */

.mapframe-bar { background: color-mix(in srgb, var(--intro) 68%, var(--surface)); }
.mapframe-bar-inner {
  display: flex; align-items: stretch; gap: var(--sp-3);
  max-width: var(--masthead-width); width: calc(100% - 2 * var(--hub-gutter)); margin-inline: auto;
  min-height: var(--mf-bar-h);
}
.mapframe-bar .mapviews { flex: 0 1 auto; min-width: 0; background: none; border: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
/* `body` makes this as specific as the title strip's `.shell-inner` rules in shell.css (Radar's switch sits inside its
   strip), and this file is later, so the switch's box is the frame's on every layout. */
body .mapframe-bar .mapviews .shell-inner { max-width: none; width: max-content; margin: 0; padding: 0; gap: 0; flex-wrap: nowrap; align-items: stretch; border: 0; }
.mapframe-bar .mapviews a {
  flex: none; min-height: var(--mf-bar-h); padding: 0 var(--sp-3);
  font-size: var(--fs-bulletin); white-space: nowrap;
}
.mapframe-bar .mapviews a:first-child { padding-inline-start: 0; }
.mapframe-bar .mapviews a:first-child[aria-current="page"]::after { left: 0; }
.mapframe-place { display: flex; align-items: center; min-width: 0; }
.mapframe-status { display: flex; align-items: center; margin: 0 0 0 auto; min-width: 0; }

/* ---------------------------------------------------------------------------------------
   The frame's grid: tool row over dock and stage, the time bar at the foot.
   ------------------------------------------------------------------------------------- */

.mapframe {
  display: grid;
  grid-template-columns: var(--mf-dock-w) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "tools tools" "dock stage" "time time";
  min-height: 0;
}
.mapframe-tools {
  grid-area: tools;
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: var(--mf-tools-h); max-height: var(--mf-tools-h);
  padding-inline: var(--gutter);
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.mapframe-tools h1 { margin: 0; font-size: var(--fs-subhead); font-weight: 800; line-height: 1.2; }
.mapframe-dock {
  grid-area: dock;
  width: var(--mf-dock-w); min-width: 0; overflow: auto;
  background: var(--paper); border-right: 1px solid var(--line);
}
.mapframe[data-dock="closed"] { grid-template-columns: 0 minmax(0, 1fr); }
.mapframe[data-dock="closed"] .mapframe-dock { visibility: hidden; }
.mapframe-stage { grid-area: stage; position: relative; min-width: 0; min-height: 0; }
.mapframe-zoom {
  position: absolute; top: var(--sp-3); right: var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-1);
}
.mapframe-zoom > * { width: var(--mf-zoom); height: var(--mf-zoom); }
.mapframe-key { position: absolute; right: var(--sp-3); bottom: var(--sp-3); }
.mapframe-time {
  grid-area: time;
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: var(--mf-time-h);
  padding-inline: var(--gutter);
  background: var(--paper); border-top: 1px solid var(--line);
}

@media (max-width: 1023.98px), (max-height: 599.98px) {
  .mapframe { grid-template-columns: minmax(0, 1fr); grid-template-areas: "tools" "stage" "time"; }
  /* The dock is a bottom sheet: it peeks at no more than 40% of the screen and never covers the selected point. */
  .mapframe-dock {
    position: fixed; inset: auto 0 0 0; z-index: 30;
    width: auto; max-height: 40svh;
    border-right: 0; border-top: 1px solid var(--line);
  }
  .mapframe-dock:not([data-open]) { display: none; }
}
