/* Copyright 2026, Niklas Hauser
 * SPDX-License-Identifier: MPL-2.0
 * The address space map and the details card of map-view.js, on top of ../shared/theme.css and
 * register-view.css, which has the access colours. */

.map-frame {
  position: relative; min-height: 320px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
}
.map-canvas { position: absolute; left: 0; top: 0; touch-action: none; cursor: grab; }
.map-canvas.dragging { cursor: grabbing; }
.map-canvas:focus-visible { outline-offset: -2px; }
.map-overview { position: absolute; right: 0; top: 0; border-left: 1px solid var(--rule); cursor: pointer; touch-action: none; }
.map-tip {
  position: absolute; z-index: 2; pointer-events: none; display: grid; gap: 1px; max-width: 360px;
  padding: 5px 8px; border-radius: 5px; background: var(--ink); color: var(--surface); font-size: 12px;
}
.map-tip strong { font: 500 12px var(--font-mono); overflow-wrap: anywhere; }
.map-tip span { opacity: 0.8; font-family: var(--font-mono); font-size: 11.5px; }

/* The details card floats over the map */
.map-card {
  position: absolute; z-index: 3; right: 68px; bottom: 12px; width: min(330px, calc(100% - 92px));
  max-height: calc(100% - 24px); overflow: auto;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 8px;
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.14);
}
.details { display: grid; gap: 8px; }
.details .card-head { display: flex; align-items: center; justify-content: space-between; }
.details .kind { font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.details .card-close {
  width: 24px; height: 24px; border: 0; border-radius: 4px; background: transparent; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.details .card-close:hover { background: var(--hover); color: var(--ink); }
.details .card-name { margin: 0; font: 600 14px var(--font-mono); overflow-wrap: anywhere; }
.details dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12.5px; }
.details dl div { display: contents; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.details dd.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.details .card-desc { margin: 0; color: var(--muted); font-size: 13px; }
.details .card-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* The key of the map colours */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--muted); font-size: 12.5px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.key { width: 14px; height: 10px; border: 1px solid; border-radius: 2px; }
.key-rw { background: var(--reg-rw); border-color: var(--reg-rw-line); }
.key-ro { background: var(--reg-ro); border-color: var(--reg-ro-line); }
.key-wo { background: var(--reg-wo); border-color: var(--reg-wo-line); }
.key-free {
  border-color: var(--rule-strong);
  background: repeating-linear-gradient(135deg, var(--hatch) 0 1px, var(--periph) 1px 4px);
}

/* A register in the card shows its bit fields, 16 bits per row need the room */
.map-card:has(.register-view) { width: min(440px, calc(100% - 92px)); }
.details .register-view figcaption { display: none; }
