/* Page frame: top bar, persistent map with a step panel beside it (a bottom sheet on phones),
   and a status bar with MGA coordinates. */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--fs-m)/var(--lh) var(--font-sans);
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr var(--status-h);
  overflow: hidden;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: 0 var(--s4);
  border-bottom: var(--line);
  background: var(--paper);
}
.brand { display: flex; align-items: baseline; gap: var(--s3); min-width: 0; }
.brand-name { font-weight: 600; font-size: var(--fs-l); letter-spacing: .01em; }
.brand-sub { color: var(--ink-3); font-size: var(--fs-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: var(--s1); }

.app {
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
  min-height: 0;
}
.map { min-height: 0; background: var(--paper-3); }
.panel {
  display: flex; flex-direction: column; min-height: 0;
  border-left: var(--line);
  background: var(--paper);
}
.step-body { overflow-y: auto; padding: var(--s4) var(--s4) var(--s6); flex: 1; min-height: 0; }
.step-body:focus, .step-body h2:focus { outline: none; }
.sheet-handle { display: none; }

.statusbar {
  display: flex; align-items: center; gap: var(--s2);
  padding: 0 var(--s4);
  border-top: var(--line);
  font-size: var(--fs-xs); color: var(--ink-2);
  white-space: nowrap; overflow: hidden;
}
.statusbar .sep { color: var(--ink-3); }
.status-edition { margin-left: auto; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }

.print-only { display: none; }
/* Before printing, the map takes its printed size so tiles are fetched and placed for the page. */
body.print-prep .app { grid-template-columns: 703px 1fr; }
body.print-prep .map { width: 703px; height: 420px; flex: none; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 2000; background: var(--ink); color: var(--paper); padding: var(--s2) var(--s3); }
.skip:focus { left: var(--s2); top: var(--s2); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Phones: map on top, steps as a bottom sheet that can be expanded. */
@media (max-width: 760px) {
  body { grid-template-rows: var(--topbar-h) 1fr; }
  .brand-sub { display: none; }
  .topbar { padding: 0 var(--s3); }
  .app { grid-template-columns: 1fr; grid-template-rows: 42svh 1fr; }
  .panel { border-left: 0; border-top: var(--line); }
  .sheet-handle {
    display: flex; justify-content: center; align-items: center;
    height: 22px; border: 0; background: var(--paper-2); cursor: pointer; width: 100%;
  }
  .sheet-grip { width: 40px; height: 3px; background: var(--rule-strong); }
  body.sheet-expanded .app { grid-template-rows: 18svh 1fr; }
  .statusbar { display: none; }
  .step-body { padding: var(--s3) var(--s4) var(--s6); }
}
