/* Copyright 2026, Niklas Hauser
 * SPDX-License-Identifier: MPL-2.0
 * The register view of register-view.js and the access colours that the map view uses too,
 * on top of ../shared/theme.css. */

:root {
  --periph: #F1F4F2;
  --reg-rw: #D3E8DF;
  --reg-rw-line: #2F7A64;
  --reg-ro: #DCE4EF;
  --reg-ro-line: #4A6A90;
  --reg-wo: #F2E6CF;
  --reg-wo-line: #946524;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --periph: #111916;
    --reg-rw: #1C3A31;
    --reg-rw-line: #5FC0A0;
    --reg-ro: #1D2837;
    --reg-ro-line: #8FB1D9;
    --reg-wo: #35291A;
    --reg-wo-line: #D8A85A;
  }
}
:root[data-theme="dark"] {
  --periph: #111916;
  --reg-rw: #1C3A31;
  --reg-rw-line: #5FC0A0;
  --reg-ro: #1D2837;
  --reg-ro-line: #8FB1D9;
  --reg-wo: #35291A;
  --reg-wo-line: #D8A85A;
}

.register-view { margin: 0; display: grid; gap: 8px; font-size: 12px; }
.register-view figcaption { font: 12px var(--font-mono); color: var(--muted); }
.register-view figcaption b { font-weight: 600; font-size: 13px; color: var(--ink); }

.reg-row { display: grid; grid-template-columns: repeat(var(--bits), minmax(22px, 1fr)); gap: 0 1px; }
.bit-num, .bit-val { grid-row: 1; text-align: center; font: 10px/16px var(--font-mono); color: var(--faint); font-variant-numeric: tabular-nums; }
.bit-val { grid-row: 3; font-size: 11px; color: var(--muted); }
.bit-val.set { color: var(--ink); font-weight: 600; }
.reg-cell {
  grid-row: 2; min-height: 40px; min-width: 0; padding: 3px 2px; border: 1px solid; border-radius: 3px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; overflow: hidden;
}
.reg-cell b { font: 600 11px var(--font-mono); white-space: nowrap; }
.reg-cell small { font: 9.5px var(--font-mono); color: var(--muted); white-space: nowrap; }
.reg-cell.vertical { writing-mode: vertical-rl; transform: rotate(180deg); min-height: 64px; }
.f-rw { background: var(--reg-rw); border-color: var(--reg-rw-line); }
.f-ro { background: var(--reg-ro); border-color: var(--reg-ro-line); }
.f-wo { background: var(--reg-wo); border-color: var(--reg-wo-line); }
.reg-cell.reserved {
  border-color: var(--rule-strong);
  background: repeating-linear-gradient(135deg, var(--hatch) 0 1px, var(--periph) 1px 6px);
}

.reg-fields { border-collapse: collapse; font-size: 12px; }
.reg-fields th {
  text-align: left; font-weight: 500; font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); padding: 4px 10px 4px 0; border-bottom: 1px solid var(--rule-strong);
}
.reg-fields td { padding: 3px 10px 3px 0; border-bottom: 1px solid var(--rule); vertical-align: top; color: var(--muted); }
.reg-fields td.num { font-family: var(--font-mono); color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
