/* The /ui pages' one stylesheet (pkg/ui). CSP allows no inline style. Each
   color scheme names its own colors, each pair at least 4.5:1. */
:root { color-scheme: light dark; --fg: #111827; --bg: #ffffff; --link: #1d4ed8; --muted: #4b5563; --line: #d1d5db; --bad: #b91c1c; --ok: #15803d; --warn: #b45309; }
@media (prefers-color-scheme: dark) {
  :root { --fg: #e5e7eb; --bg: #111827; --link: #93c5fd; --muted: #9ca3af; --line: #4b5563; --bad: #fca5a5; --ok: #86efac; --warn: #fcd34d; }
}
body { font: 15px/1.5 system-ui, sans-serif; max-width: 62rem; margin: 1rem auto; padding: 0 1rem; color: var(--fg); background: var(--bg); }
a { color: var(--link); }
/* The header: the brand and the running release's version, small and
   muted, and the vocabularies' button at the other end. */
header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin: .5rem 0 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
header a.brand { font-weight: 700; color: var(--fg); text-decoration: none; }
header .version, header .version a { font-size: 13px; color: var(--muted); }
header button { padding: .25rem 1rem; }
h1 { font-size: 1.4rem; margin: .5rem 0; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .4rem; }
h4 { font-size: .95rem; margin: 1rem 0 .3rem; }
#ui-error:empty { display: none; }
#ui-error { color: var(--bad); border-left: 4px solid var(--bad); padding-left: .6rem; margin: 0 0 1rem; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, pre:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
code, pre, .mono { font-family: ui-monospace, monospace; }
p code { overflow-wrap: anywhere; }
.hint { color: var(--muted); font-weight: 400; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
footer { margin-top: 2.5rem; color: var(--muted); font-size: 13px; }

/* Forms. */
form { display: grid; gap: .75rem; padding: 1rem; border: 1px solid var(--line); border-radius: 6px; }
label, legend { font-weight: 600; }
fieldset { border: 0; padding: 0; margin: 0; }
fieldset label, label.check { font-weight: 400; margin-right: 1rem; display: inline-block; }
input[type=text] { font: inherit; padding: .3rem .5rem; width: 100%; max-width: 22rem; box-sizing: border-box; display: block; }
input#from-vin { font-family: ui-monospace, monospace; }
input[aria-invalid=true], select[aria-invalid=true] { border: 2px solid var(--bad); }
input[readonly] { background: transparent; border-style: dashed; }
.error { color: var(--bad); margin: .2rem 0 0; }
button { font: inherit; padding: .35rem 1.2rem; justify-self: start; }
select { font: inherit; padding: .25rem; }
form p.hint { margin: 0; }
.vin-row { display: flex; gap: .5rem; align-items: stretch; flex-wrap: wrap; }
.vin-row input#from-vin { flex: 1; min-width: 12rem; }
form details.options { margin: 0; }
form details.options[open] > summary { margin-bottom: .5rem; }
form details.options > div, form details.options > fieldset { margin-bottom: .5rem; }

/* The page's controls (page.html): a box, its tabs along the top, each a
   link, the current one joined to the form below it. */
.controls { border: 1px solid var(--line); border-radius: 8px; margin: 1rem 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 0 .25rem; padding: .5rem .75rem 0; border-bottom: 1px solid var(--line); }
.tabs a { padding: .45rem .9rem; margin-bottom: -1px; text-decoration: none; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; }
.tabs a:hover { text-decoration: underline; }
.tabs a[aria-current=page] { color: var(--fg); font-weight: 600; border-color: var(--line); background: var(--bg); }
.controls form { border: 0; }
.controls > .error { margin: 1rem 1rem 0; }
.controls .try { margin: 0 1rem; }
/* The examples, side by side as the line allows. */
ul.examples { list-style: none; padding: 0; margin: .25rem 1rem 1rem; display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; }
a.example { display: inline-block; font-family: ui-monospace, monospace; padding: .2rem .6rem; border: 1px solid var(--line); border-radius: 4px; }

/* The dialogs, popovers behind their buttons: the answer's JSON, and the
   vocabularies, whose button is in the header. */
dialog[popover] { box-sizing: border-box; width: min(56rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: 8px; color: var(--fg); background: var(--bg); overflow: auto; box-shadow: 0 8px 32px rgb(0 0 0 / .4); }
dialog[popover]::backdrop { background: rgb(0 0 0 / .45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dialog-head h2 { margin: 0; }

/* The answer (page.html's result, decode.html). */
#result { margin-top: 1.5rem; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; vertical-align: top; padding: .25rem .75rem .25rem 0; border-bottom: 1px solid var(--line); }
table.kv th { width: 40%; font-weight: 600; }
/* A table that scrolls sideways (.wide, .scroll) breaks no word. The two
   that do not, a decode's elements and the install commands, must fit
   the page: their cells may break anywhere, else an element's long name
   beside its value, or a command's line, pushes the page sideways. */
table.kv td, table.install th, table.install td { overflow-wrap: anywhere; }
td ul { margin: 0; padding-left: 1.1rem; }
pre { margin: 0; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 4px; overflow-x: auto; font-size: 13px; }
pre.wrap { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 16rem; overflow-y: auto; }
.copyable { display: flex; gap: .5rem; align-items: flex-start; margin: .25rem 0; }
.copyable > pre { flex: 1; min-width: 0; }
button.copy { font-size: 13px; padding: .3rem .8rem; flex: none; }
mark { font-weight: 700; }
details { border: 1px solid var(--line); border-radius: 6px; padding: .25rem .75rem; margin: .5rem 0; }
summary { cursor: pointer; font-weight: 600; padding: .25rem 0; }
details table { margin-bottom: .5rem; }
ul.codes { margin: .25rem 0; padding-left: 1.1rem; }
.codes-clean { color: var(--ok); }
p.summary { font-size: 1.2rem; font-weight: 600; margin: .25rem 0; }
p.status { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.chip { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-weight: 600; font-size: 13px; }
.chip-ok { color: var(--ok); border: 1px solid var(--ok); }
details.dev { margin-top: 2rem; }
.codes-flagged { color: var(--bad); }
.null { color: var(--muted); font-style: italic; }
.wide { overflow-x: auto; }
.wide table { font-size: 13px; }
@media (max-width: 40rem) {
  table.kv th { width: auto; }
  table.install, table.install tbody, table.install tr, table.install th, table.install td { display: block; }
  table.install thead { display: none; }
  table.install th { border: 0; padding-top: .75rem; }
}

/* The vocabularies (vocab.html). */
/* The catalog scrolls sideways on a narrow screen rather than breaking
   words; a drift example may break anywhere. */
.scroll { overflow-x: auto; margin: .5rem 0 1rem; }
table.catalog th[scope=row] { white-space: nowrap; }
table.catalog details { border: 0; padding: 0; margin: 0; }
table.catalog summary { font-weight: 400; padding: 0; }
table.catalog .row-details summary { color: var(--link); cursor: pointer; }
table.catalog details ul { margin: .25rem 0 0; padding-left: 1.1rem; overflow-wrap: anywhere; }
table.catalog dl { margin: .25rem 0 0; display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; }
table.catalog dt { font-weight: 600; }
table.catalog dd { margin: 0; overflow-wrap: anywhere; }
table.catalog .actions { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; }
table.catalog .actions a { display: inline-block; min-height: 24px; padding: .2rem 0; }
table.catalog .actions button { min-height: 24px; min-width: 24px; }
form.inline { display: inline; padding: 0; border: 0; }
form.inline button { font-size: 13px; padding: .15rem .6rem; }
.load, .offer { display: grid; gap: .25rem; margin: .75rem 0; }
.load p, .offer p { margin: 0; }
.refusal { border-left: 4px solid var(--bad); padding-left: .6rem; margin: .5rem 0; }
.refusal form { border: 0; padding: .25rem 0; }
/* Files dragged over the page: they load when dropped. */
.dropzone { border: 2px dashed var(--line); border-radius: 6px; padding: 1rem; }
section#browser.dropping #browser-files { outline: 2px dashed var(--link); outline-offset: 4px; }
section#browser.dropping .dropzone { border-color: var(--link); }
details.more { margin: .75rem 0; }
form.filter { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; border: 0; padding: 0; margin: .5rem 0; }
form.filter label { flex-basis: 100%; }

/* map (map.go). The heights and widths are map.go's geometry, which draws
   the lines from them: a column's heading 32px, a vocabulary's 26px, a
   card 72px, 10px between any two; columns 26% wide, 11% apart, a model
   10% in under its make. A card's box fills it, the name wrapping to two
   lines; while the card is under the pointer or focused, its box grows to
   show a longer name whole, over the cards below, which never move. What
   the card's lines draw (.rel) is read with its name, and shown when the
   columns stack (below). */
.map-key { list-style: none; padding: 0; margin: .5rem 0; display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; font-size: 13px; color: var(--muted); }
.map-key li { display: flex; align-items: center; gap: .4rem; }
.key-line { display: inline-block; width: 2rem; border-top: 2px solid var(--muted); }
.key-line.derived { border-top-style: dashed; }
.key-line.decoded { border-top-style: dotted; }
.key-line.under { width: 1rem; height: .5rem; border-top: 0; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); }
.key-card { display: inline-block; width: 1rem; height: .9rem; border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 3px; }
.map { position: relative; min-width: 40rem; margin: 1rem 0; }
.map-edges { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.map-edges path { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.map-edges path.derived { stroke-dasharray: 6 4; }
.map-edges path.decoded { stroke-dasharray: 2 3; }
.map-edges path.under { stroke: var(--line); }
.map-cols { position: relative; display: grid; grid-template-columns: 26% 26% 26%; column-gap: 11%; }
.map-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.map-head { height: 32px; line-height: 32px; margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.map-group { height: 26px; line-height: 26px; margin: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map .node { position: relative; display: block; height: 72px; color: var(--fg); text-decoration: none; }
.map .node.under { margin-left: 10%; }
.map .node .box, .map-empty { box-sizing: border-box; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); display: flex; flex-direction: column; justify-content: center; }
.map .node .box { position: absolute; top: 0; left: 0; right: 0; min-height: 100%; }
.map-empty { height: 72px; margin: 0; overflow: hidden; border-style: dashed; color: var(--muted); font-size: 13px; }
.map .node.unchecked .box { border-left: 4px solid var(--warn); }
.map .node .name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-weight: 600; line-height: 20px; }
.map .node .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; line-height: 16px; color: var(--muted); }
.map .node .rel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.map .node:is(:hover, :focus-visible) { z-index: 1; }
.map .node:is(:hover, :focus-visible) .name { display: block; }
.map .node:is(:hover, :focus-visible) .meta { white-space: normal; overflow-wrap: anywhere; }
.map a.node:focus-visible { outline: 0; }
.map a.node:focus-visible .box { outline: 2px solid currentColor; outline-offset: 2px; }
.map a.node:hover .box, .map a.node:focus-visible .box { border-color: var(--link); }
.map a.node:hover .name { text-decoration: underline; }
/* map.js lights the route through a card and quiets the rest: a quiet
   card's name takes the muted color, still 4.5:1, never an opacity. */
.map.lighting .node:not(.lit) .name { color: var(--muted); }
.map.lighting .map-edges path:not(.lit) { opacity: .25; }
.map .node.lit .box { border-color: var(--link); box-shadow: 0 0 0 1px var(--link); }
.map-edges path.lit { stroke: var(--link); stroke-width: 2.5; }
/* A window too narrow for the columns side by side (the map's 40rem and
   the page's padding) stacks them: from, the spine, then the targets. The
   lines, drawn for the columns side by side, hide with their key, and
   each card shows what they drew as a line of its own. */
@media (max-width: 42rem) {
  .map-key .key-lines, .map-edges { display: none; }
  .map { min-width: 0; }
  .map-cols { display: flex; flex-direction: column; gap: 1rem; }
  .map .node, .map-empty { height: auto; }
  .map .node .box { position: static; }
  .map .node .name { display: block; }
  .map .node .meta { white-space: normal; overflow-wrap: anywhere; }
  .map .node .rel { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; font-size: 13px; line-height: 18px; }
}
