/* window.css — the floating panel every page of ours puts a form in.
   Shared like bar.css, so the three surfaces cannot drift apart. */

/* Fixed, so it floats over the page rather than pushing it about — which is
   what the accordions did, moving the line you were reading every time one
   opened. Resizing is the browser's own grip: `resize` needs `overflow` set to
   anything but visible, which is also what keeps a long form inside the frame. */
#win {
  position: fixed; z-index: 40;
  top: 5rem; left: 50%; transform: translateX(-50%);
  width: min(46rem, calc(100vw - 2rem));
  /* Tall enough for what is in it and no taller: a fixed height made a short
     panel roomy and a long one scroll for no reason. `auto` up to a cap, so it
     only ever scrolls when the content genuinely will not fit the screen — and
     the moment you drag the corner, that inline height wins over both. */
  height: auto;
  min-width: 18rem; min-height: 8rem;
  max-width: 100vw; max-height: calc(100vh - 7rem);
  resize: both; overflow: hidden;
  display: flex; flex-direction: column;
  /* Raised, like the bar: it sits ON the page, so it takes the same colour the
     bar does rather than the page's own. The shadow lifts it; the colour says
     which layer it belongs to. */
  background: var(--raised); color: CanvasText;
  border: 1px solid var(--btn-edge); border-radius: .5rem;
  box-shadow: 0 .6rem 2rem #0004;
}
/* Dragged by the bar, so the grab area is obvious and a text selection inside
   the form never moves the window. */
/* Its own title bar keeps a rule: this one IS two surfaces meeting inside a
   single small box, where a tone change alone is too quiet to read as a grab
   handle. Different problem from the page bar, different answer. */
#win-bar {
  flex: 0 0 auto; display: flex; align-items: baseline; gap: .6rem;
  padding: .45rem .7rem; cursor: move; user-select: none;
  border-bottom: 1px solid var(--btn-edge); border-radius: .5rem .5rem 0 0;
  background: var(--surface);
}
#win-title { flex: 1 1 auto; font-weight: 600; color: var(--heading); }
/* 24x24 is the 2.5.8 minimum; at .1rem of vertical padding this came out
   21.6px tall, which is a small target for the one control that dismisses the
   thing covering your page. Same glyph, same place, bigger hit area. */
#win-close {
  font: inherit; line-height: 1; cursor: pointer;
  min-width: 24px; min-height: 24px; padding: .2rem .5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: none; color: var(--link);
}
/* The window scrolls, never the page — same rule the rest of the app follows. */
#win-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: .2rem 1rem 1rem; }
#win-body > * { margin-top: .6rem; }
#win-body pre { overflow-x: auto; background: #0001; padding: .6rem; border-radius: .3rem;
  font-size: .9rem; }
/* Dragging with the pointer over the frame would otherwise select text inside it. */
body.dragging { user-select: none; }
