@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url(fonts/atkinson-hyperlegible-next.woff2) format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  src: url(fonts/atkinson-hyperlegible-mono.woff2) format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* Each colour is light-dark(light, dark). The page follows the system setting
   until the visitor picks a theme, which sets data-theme on <html>. */
:root {
  color-scheme: light dark;
  --paper: light-dark(#fcfcfd, #10151f);
  --ink: light-dark(#18202f, #e5e9f0);
  --muted: light-dark(#5b6678, #98a3b5);
  --line: light-dark(#e2e6ed, #253045);
  --edge: light-dark(#878fa0, #5f6b82); /* borders of controls: 3:1 against the paper */
  --raise: light-dark(#f1f3f7, #182030);
  --ogf: light-dark(#2457d6, #86a8ff);
  --ogf-tint: light-dark(#e8eefc, #1a2747);
  --on-ogf: light-dark(#ffffff, #0c1220);
  --ocf: light-dark(#9a5b00, #f0b45e);
  --ocf-tint: light-dark(#fbefdc, #33260f);
  --on-ocf: light-dark(#ffffff, #1d1405);
  --mark: light-dark(#ffe9a3, #5a4710);
  --warn: light-dark(#b42318, #ff9b8f);
  --warn-tint: light-dark(#fdecea, #3a1a17);

  --sans: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --page: 104rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --finder-h: 0px; /* height of the sticky search bar, set by app.js */
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
  /* keep permalinked rows clear of the sticky search bar and table header */
  scroll-padding-top: calc(var(--finder-h) + 3.5rem);
}

body { margin: 0; }

a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: currentColor; }
.external::after { content: "\2197"; display: inline-block; margin-left: 0.15em; font-size: 0.85em; color: var(--muted); text-decoration: none; }

code, kbd { font-family: var(--mono); font-size: 0.9375em; font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--ogf); outline-offset: 2px; border-radius: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip { position: absolute; left: var(--gutter); top: -3rem; padding: 0.5rem 0.75rem; background: var(--ink); color: var(--paper); z-index: 10; }
.skip:focus { top: 0.75rem; }

::highlight(match) { background-color: var(--mark); color: var(--ink); }

/* Layout. Narrow screens: one column. JavaScript puts the panel under the row it describes,
   or above the table for a lookup without a row, and hides it when it has nothing to say. */

.page {
  max-width: var(--page);
  margin-inline: auto;
  padding: clamp(2rem, 5vw, 4rem) var(--gutter) 4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem 3rem;
}
/* One grid item for everything but the panel, so the search bar can stick all the way down */
.content { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 1.25rem; min-width: 0; }
main, .decoder { min-width: 0; }

@media (max-width: 79.99rem) {
  html:not(.js) .decoder { display: none; }
}

/* Wide screens: the panel sits beside the table and stays in view while it scrolls. */

@media (min-width: 80rem) {
  .page { grid-template-columns: minmax(0, 1fr) 23rem; }
  .decoder {
    position: sticky;
    top: 1.25rem;
    align-self: start;
    max-height: calc(100dvh - 2.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  /* there is more below: fade the bottom edge */
  .decoder.has-more { mask-image: linear-gradient(to bottom, #000 calc(100% - 3rem), transparent); }
}
@media (min-width: 80rem) and (max-width: 89.99rem) {
  .page { grid-template-columns: minmax(0, 1fr) 21rem; column-gap: 2rem; }
}

/* Heading, version, links and theme */

h1 {
  margin: 0 0 0.875rem;
  font-size: clamp(2.125rem, 1.5rem + 2.4vw, 3rem);
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.intro-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; }
.links { flex: 1 1 13.5rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.375rem 1.25rem; margin: 0; }
.links a { font-weight: 600; }
.version { padding: 0.0625rem 0.5rem; border-radius: 4px; background: var(--ink); color: var(--paper); font-weight: 700; }
.downloads { color: var(--muted); }
.downloads a { color: var(--ink); }

.theme { flex: none; align-self: start; display: flex; gap: 2px; margin: 0; padding: 2px; border: 1px solid var(--line); border-radius: 999px; }
.theme label { position: relative; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 999px; color: var(--muted); cursor: pointer; }
.theme input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.theme svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.theme label:hover { color: var(--ink); background: var(--raise); }
.theme label:has(input:checked) { background: var(--ink); color: var(--paper); }
.theme label:has(input:focus-visible) { outline: 2px solid var(--ogf); outline-offset: 2px; }

/* Search bar: Commands | Events, the search box and, on phones, the filter button.
   It sticks to the top of the window while the table scrolls. */

.finder { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: stretch; }
@media (min-width: 48rem) {
  .finder { position: sticky; top: 0; z-index: 3; padding-block: 0.75rem; margin-block: -0.75rem; background: var(--paper); }
  .finder .filters-toggle { display: none; }
}

.switch { display: flex; margin: 0; padding: 0; border: 0; }
.switch label { position: relative; display: flex; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch label > span, .filters-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1.5px solid var(--edge);
  font-weight: 650;
  white-space: nowrap;
}
.switch label:first-of-type > span { border-radius: 6px 0 0 6px; }
.switch label:last-of-type > span { border-radius: 0 6px 6px 0; margin-left: -1.5px; }
.switch .n, .filters-toggle .n { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.switch label:hover > span { background: var(--raise); }
.switch input:checked + span { position: relative; background: var(--ink); border-color: var(--ink); color: var(--paper); }
.switch input:checked + span .n { color: inherit; opacity: 0.75; }
.switch input:focus-visible + span { outline: 2px solid var(--ogf); outline-offset: 2px; }

.filters-toggle { font: 650 1rem var(--sans); color: var(--ink); background: transparent; border-radius: 6px; cursor: pointer; }
.filters-toggle:hover, .filters-toggle[aria-expanded="true"] { background: var(--raise); }

.search { position: relative; flex: 1 1 20rem; max-width: 40rem; }
.search input {
  width: 100%;
  font: 400 1.0625rem var(--sans);
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--edge);
  border-radius: 6px;
  padding: 0.75rem 3rem 0.75rem 0.875rem;
  appearance: none;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--ogf); box-shadow: 0 0 0 3px var(--ogf-tint); }
.search kbd {
  position: absolute; right: 0.75rem; top: 50%; translate: 0 -50%;
  padding: 0 0.4rem; border: 1px solid var(--line); border-radius: 4px;
  font-size: 0.8125rem; color: var(--muted);
}
.search input:focus + kbd, .search input:not(:placeholder-shown) + kbd { display: none; }

@media (max-width: 47.99rem) {
  /* three views and the Filters button on one row: the counts are above the table anyway */
  .switch .n { display: none; }
  .switch label > span, .filters-toggle { padding: 0 0.75rem; font-size: 0.9375rem; }
  .filters-toggle { margin-left: auto; }
  .search { order: 1; flex-basis: 100%; }
}

/* Under the search box, for a lookup: how the search was read */

.search-hint { margin-top: -0.375rem; font-size: 0.875rem; color: var(--muted); }
.search-hint p { margin: 0; }
.search-hint strong { color: var(--ink); font-weight: 600; }
.search-hint kbd { padding: 0 0.3rem; border: 1px solid var(--line); border-radius: 4px; font-size: 0.8125rem; }
/* "Also error code 0x0C, Command Disallowed": a link to the other reading */
.search-hint button {
  font: inherit; font-weight: 600; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 0.18em;
}
.search-hint button:hover { text-decoration-color: currentColor; }

/* Filters: a group (radio buttons drawn as chips) and the release that added it */

.filters { display: grid; gap: 0.75rem; }
.filter {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  align-items: start;
  margin: 0; padding: 0; border: 0;
  min-width: 0;
}
.filter legend { float: left; padding: 0.4rem 0 0; font-size: 0.875rem; font-weight: 700; color: var(--muted); }
.chip-list { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chips label > span {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
}
.chips .n { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.chips label:hover > span { background: var(--raise); }
.chips label.is-zero > span { border-color: var(--line); color: var(--muted); }
.chips input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chips input:checked + span .n { color: inherit; opacity: 0.75; }
.chips input:focus-visible + span { outline: 2px solid var(--ogf); outline-offset: 2px; }

.release-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.release select {
  font: 600 0.9375rem var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  min-width: 12rem;
}
.check { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.9375rem; font-weight: 600; cursor: pointer; }
.check input { width: 1.0625rem; height: 1.0625rem; margin: 0; accent-color: var(--ink); cursor: inherit; }
.check:has(input:disabled) { color: var(--muted); cursor: default; }

.filters.is-bypassed .filter { opacity: 0.45; }
.filters-note { margin: 0; font-size: 0.875rem; color: var(--muted); }

@media (max-width: 47.99rem) {
  /* on phones the filters fold away behind the Filters button */
  .js .content:not(.filters-open) .filters { display: none; }
  .filter { grid-template-columns: minmax(0, 1fr); }
  .filter legend { padding: 0 0 0.375rem; }
}

.count { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; margin: 0 0 0.5rem; font-size: 0.875rem; color: var(--muted); }
.count button {
  font: 600 0.875rem var(--sans); color: var(--ink); background: none; border: 0; padding: 0;
  text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 0.18em; cursor: pointer;
}
.count button:hover { text-decoration-color: currentColor; }

/* The table. Fixed column widths: it never grows wider than its column, and the columns
   don't move as rows are filtered. */

.listing { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 0.9375rem; }
.listing thead th {
  position: sticky; top: var(--finder-h); z-index: 2;
  background: var(--paper);
  box-shadow: inset 0 -1.5px 0 var(--ink); /* a border wouldn't stick with the cell */
  padding: 0.625rem 0.625rem 0.5rem;
  text-align: left;
  vertical-align: bottom;
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
}
.listing thead th.c-code { color: var(--ogf); }
.listing thead th.c-sub { color: var(--ocf); }
.th-sub { display: block; font-size: 0.75rem; }
.th-sub .ogf { color: var(--ogf); }
.th-sub .ocf { margin-left: 0.375rem; color: var(--ocf); }
.listing th button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.25rem;
}
.listing th button::after { content: ""; width: 0.6em; height: 0.6em; opacity: 0.6; background: currentColor; clip-path: polygon(50% 0, 100% 40%, 0 40%, 0 60%, 100% 60%, 50% 100%); }
.listing th[aria-sort="ascending"] button::after { opacity: 1; clip-path: polygon(50% 15%, 100% 75%, 0 75%); }
.listing th[aria-sort="descending"] button::after { opacity: 1; clip-path: polygon(0 25%, 100% 25%, 50% 85%); }

.listing tbody tr { border-bottom: 1px solid var(--line); }
.js .listing tbody tr[id] { cursor: pointer; }
.listing tbody tr[id]:hover { background: var(--raise); }
.listing tbody tr.is-selected { background: var(--ogf-tint); box-shadow: inset 3px 0 0 var(--ogf); }
.listing tbody tr.is-selected:has(+ .detail-row) { border-bottom-color: transparent; }
.listing tbody th, .listing td { padding: 0.5rem 0.625rem; text-align: left; vertical-align: baseline; }
.listing tbody th { font-weight: 400; }

.c-name { width: 31%; }
.c-op { width: 7rem; }
.c-code { width: 4.75rem; }
.c-sub { width: 5.75rem; }
.c-since { width: 5.5rem; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.c-spec { width: 7rem; }
.c-op, .c-code, .c-sub, .c-spec { white-space: nowrap; }
.c-sum { line-height: 1.45; text-wrap: pretty; }

.name { font: 600 0.875rem var(--mono); text-decoration: none; overflow-wrap: anywhere; }
.name:hover { text-decoration: underline; }
.c-op .opcode, .c-code code { font-weight: 600; }
.c-op .fields { display: block; margin-top: 0.125rem; font-size: 0.8125rem; }
.c-op .fields code { font-size: 1em; }
.c-op .ogf, .c-code code { color: var(--ogf); }
.c-op .ocf, .c-sub code { color: var(--ocf); }
.c-op .ocf { margin-left: 0.375rem; }
.field-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.tag {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0 0.375rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 600 0.75rem/1.5 var(--sans);
  color: var(--muted);
  vertical-align: 0.1em;
  white-space: nowrap;
}
.formerly { display: block; margin-top: 0.125rem; font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }

.c-spec a { font: 0.875rem var(--mono); }

/* Error codes: names are words, not identifiers; codes aren't OGFs or event codes */
#errors .name { font: 600 0.9375rem var(--sans); }
#errors thead th.c-code, #errors .c-code code { color: inherit; }

/* The details of the selected row, opened under it on narrow screens */
.listing tr.detail-row { background: var(--paper); box-shadow: inset 3px 0 0 var(--ogf); }
.listing tr.detail-row > td { padding: 0.25rem 1rem 1.25rem 1.25rem; }

/* Without JavaScript both tables show, one after the other, under these headings */
.table-title { margin: 2.5rem 0 0.5rem; font-size: 1.25rem; }
.js .table-title { display: none; }

.empty { padding: 3rem 0; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 1rem; }
.empty-actions, .switches { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.empty button {
  font: 600 0.875rem var(--sans);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
}
.empty button:hover { background: var(--raise); }
.empty button.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* The panel: what it shows, then the opcode bits or event packet, then the details */

.decoder-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 2rem; margin-bottom: 0.5rem; }
.decoder-label { margin: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.decoder-help { margin: 0 0 1rem; color: var(--muted); }

.close, .copy {
  display: inline-grid; place-items: center; flex: none;
  padding: 0; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.close { width: 2rem; height: 2rem; border: 1px solid var(--line); color: var(--ink); }
.copy { width: 1.75rem; height: 1.75rem; border-radius: 4px; }
.close svg, .copy svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.close:hover, .copy:hover { color: var(--ink); background: var(--raise); }
html:not(.js) .copy { display: none; }

/* Opcode decoder: the 16 opcode bits split into the 6-bit OGF and 10-bit OCF */

.decoder-opcode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.375rem;
  margin: 0 0 0.75rem;
}
.decoder-opcode > code { font-size: 2rem; font-weight: 650; letter-spacing: 0.01em; }
.decoder-bytes { display: inline-flex; align-items: center; gap: 0.375rem; margin-left: auto; color: var(--muted); font-size: 0.875rem; }
.decoder-bytes code { color: var(--ink); font-size: 1rem; }

.bits {
  display: grid;
  grid-template-columns: auto 6fr 10fr auto;
  align-items: center;
  gap: 0.5rem;
}
.bit-index { font: 0.75rem var(--mono); color: var(--muted); }
.bits-ogf, .bits-ocf { display: grid; gap: 2px; }
.bits-ogf { grid-template-columns: repeat(6, 1fr); --c: var(--ogf); --tint: var(--ogf-tint); --on: var(--on-ogf); }
.bits-ocf { grid-template-columns: repeat(10, 1fr); --c: var(--ocf); --tint: var(--ocf-tint); --on: var(--on-ocf); }

.bit {
  display: grid;
  place-items: center;
  height: 2.5rem;
  background: var(--tint);
  color: var(--c);
  font: 600 1rem var(--mono);
  transition: background-color 120ms, color 120ms;
}
.bit.on { background: var(--c); color: var(--on); }
.bits-ogf .bit:first-child, .bits-ocf .bit:first-child { border-radius: 4px 0 0 4px; }
.bits-ogf .bit:last-child, .bits-ocf .bit:last-child { border-radius: 0 4px 4px 0; }

.field { grid-row: 2; display: flex; flex-wrap: wrap; gap: 0 0.375rem; align-items: baseline; align-self: start; min-width: 0; margin: 0; font-size: 0.875rem; }
.field-ogf { grid-column: 2; }
.field-ocf { grid-column: 3; }
.field-label { font-weight: 700; }
.field code { font-size: 0.9375rem; font-weight: 600; }
.field-note { flex-basis: 100%; color: var(--muted); }
.field-ogf .field-label, .field-ogf code { color: var(--ogf); }
.field-ocf .field-label, .field-ocf code { color: var(--ocf); }

/* A packet: H4 indicator, opcode or event code, length, subevent (LE events), parameters.
   Cells without a value from the search are dashed. */
.packet {
  display: grid;
  grid-template-columns: repeat(var(--cells, 4), minmax(0, 1fr)) minmax(0, 2fr);
  gap: 2px;
}
[data-command-packet] { margin-top: 1rem; }
.packet span {
  display: block; height: 2.5rem; padding-inline: 0.25rem; border-radius: 4px;
  font: 600 1rem/2.5rem var(--mono); text-align: center;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background: var(--raise); color: var(--muted);
}
.packet .packet-code { background: var(--ogf); color: var(--on-ogf); }
.packet .packet-sub { background: var(--ocf); color: var(--on-ocf); }
.packet .packet-op { background: var(--ink); color: var(--paper); }
.packet .is-given { color: var(--ink); }
.packet .is-unknown { background: transparent; outline: 1.5px dashed var(--line); outline-offset: -1.5px; }
.packet .is-bad { background: var(--warn-tint); color: var(--warn); }
.packet small { padding-top: 0.25rem; font: 0.75rem var(--sans); color: var(--muted); text-align: center; }

.decoder-result { margin-top: 1rem; padding-top: 0.875rem; border-top: 1px solid var(--line); }
.decoder-result p { margin: 0; }
.decoder-result p + p { margin-top: 0.25rem; color: var(--muted); }
.decoder-result .warn { color: var(--warn); }
.decoder-name-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.25rem; }
.decoder-name { font: 650 1rem var(--mono); overflow-wrap: anywhere; }
.decoder-name.is-words { font-family: var(--sans); }

/* Details: parameters and return parameters with their sizes (and values, from a packet),
   and the events a command generates or the commands that generate an event */

.details { margin-top: 0.75rem; font-size: 0.875rem; }
.details-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0; color: var(--muted); }
.details-meta a { color: var(--ink); font-weight: 600; }
.details h3 { margin: 1.125rem 0 0.25rem; font-size: 0.875rem; font-weight: 700; }
.params { margin: 0; }
.params div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 1rem;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
}
.params div:last-child { border-bottom: 0; }
.params dt code, .links-list code { font-size: 0.8125rem; font-weight: 600; overflow-wrap: anywhere; }
.params dd { margin: 0; max-width: 11rem; color: var(--muted); text-align: right; }
.params dd.value { grid-column: 1 / -1; max-width: none; margin-top: 0.125rem; color: var(--ink); text-align: left; font: 600 0.8125rem var(--mono); overflow-wrap: anywhere; }
.params dd.value::before { content: "= "; color: var(--muted); font-weight: 400; }
.params dd.value.is-failure { color: var(--warn); }
.params dd.value .rest { color: var(--muted); font: 400 0.8125rem var(--sans); }
.details .note { margin: 0.375rem 0 0; color: var(--muted); }
.none { margin: 0; color: var(--muted); }
.links-list { display: grid; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.links-list a { text-decoration: none; }
.links-list a:hover code { text-decoration: underline; }
.links-list .tag { margin-left: 0.375rem; }

/* Narrow screens: the panel above the table (a lookup without a row) or under a row */
main > .decoder { max-width: 40rem; margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.decoder.is-inline .result-row { display: none; }
.decoder.is-inline .decoder-result { padding-top: 0; border-top: 0; }
.decoder.is-inline .decoder-result:not(:has(p:not(.result-row))) { display: none; }
@media (min-width: 48rem) {
  .decoder.is-inline {
    display: grid;
    grid-template-columns: minmax(0, 23rem) minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "top top" "head details" "result details";
    gap: 0 2.5rem;
  }
  .decoder.is-inline .decoder-top { grid-area: top; }
  .decoder.is-inline [data-head] { grid-area: head; }
  .decoder.is-inline .decoder-result { grid-area: result; }
  .decoder.is-inline .details { grid-area: details; margin-top: 0; }
}

/* "Copied" */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 20;
  margin: 0; padding: 0.5rem 1rem; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-size: 0.875rem; font-weight: 600;
  translate: -50% 0.5rem; opacity: 0; pointer-events: none;
  transition: opacity 150ms, translate 150ms;
}
.toast.is-shown { opacity: 1; translate: -50% 0; }

/* Phones: each row becomes a small block */

@media (max-width: 47.99rem) {
  .listing thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .listing, .listing tbody { display: block; }
  .listing tbody tr[id] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name spec" "op since" "sum sum";
    gap: 0.25rem 1rem;
    padding: 0.875rem 0;
  }
  .listing tbody th, .listing td { width: auto; padding: 0; }
  .listing tbody tr.is-selected { padding-inline: 0.75rem; }
  .listing tr.detail-row { display: block; }
  .listing tr.detail-row > td { display: block; padding: 0.25rem 0.75rem 1.25rem; }
  .c-name { grid-area: name; }
  .c-op { grid-area: op; }
  .c-op { white-space: normal; }
  .c-op code { white-space: nowrap; }
  .c-op .fields { display: inline; margin: 0 0 0 0.75rem; }
  .c-op .ocf { margin-left: 0.75rem; }
  .field-name { position: static; width: auto; height: auto; overflow: visible; clip-path: none; margin-right: 0.25rem; font: 700 0.8125rem var(--sans); }
  .c-sum { grid-area: sum; }
  .c-spec { grid-area: spec; text-align: right; }
  .c-spec a { display: inline-block; padding-block: 0.25rem; margin-block: -0.25rem; }
  .c-since { grid-area: since; text-align: right; }
  .c-since::before { content: "since "; color: var(--muted); }
  #events tbody tr[id] { grid-template-columns: auto auto 1fr auto; grid-template-areas: "name name name spec" "code sub . since" "sum sum sum sum"; }
  #errors tbody tr[id] { grid-template-areas: "name spec" "code code" "sum sum"; }
  .c-code { grid-area: code; }
  .c-sub { grid-area: sub; }
  .c-sub:not(:empty)::before { content: "subevent "; font-size: 0.8125rem; font-weight: 700; color: var(--ocf); }
}

/* Touch screens: bigger targets */

@media (pointer: coarse) {
  .close { width: 2.75rem; height: 2.75rem; }
  .theme label { width: 2.25rem; height: 2.25rem; }
  .search kbd { display: none; }
  .copy { width: 2.5rem; height: 2.5rem; }
  .chips label > span { padding-block: 0.5rem; }
  .release select { padding-block: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bit, .toast { transition: none; }
}
