/* Red Hat Mono, self-hosted (SIL Open Font License 1.1: fonts/OFL.txt). The build puts this
   in front of shared.css in both stylesheets. */
@font-face {
  font-family: "Red Hat Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/red-hat-mono-latin-ext-400.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Red Hat Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/red-hat-mono-latin-400.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Red Hat Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/red-hat-mono-latin-ext-500.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Red Hat Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/red-hat-mono-latin-500.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Red Hat Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/red-hat-mono-latin-ext-700.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Red Hat Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/red-hat-mono-latin-700.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Shared by the search page and the record pages: theme tokens, base elements, the header,
   the key/value list and the full record view. Copied from design/prototype/shared.css, which
   stays as the reference; this is the one the site is built from. */
:root {
  --bg: #fbfbfc; /* paper */
  --fg: #17191e; /* ink */
  --dim: #666b74; /* secondary text, keys in the preview */
  --faint: #a2a7af; /* rules of thumb: separators, placeholders */
  --rule: #e2e4e8;
  --accent: #1f55a8; /* prompt, matched characters, links */
  --ok: #2d7a4c;
  --warn: #9a6400;
  --bad: #b3261e;
  --sel-bg: var(--fg); /* selection is reverse video */
  --sel-fg: var(--bg);
  --mono: "Red Hat Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs: 14px;
  --fs-prompt: 22px;
  --fs-small: 12px;
  --lh: 1.55;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131417;
    --fg: #e4e4e1;
    --dim: #92969e;
    --faint: #5b5f67;
    --rule: #2a2d33;
    --accent: #8db3ef;
    --ok: #7fc39a;
    --warn: #dfb15a;
    --bad: #ef8a80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131417;
  --fg: #e4e4e1;
  --dim: #92969e;
  --faint: #5b5f67;
  --rule: #2a2d33;
  --accent: #8db3ef;
  --ok: #7fc39a;
  --warn: #dfb15a;
  --bad: #ef8a80;
  color-scheme: dark;
}

body {
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--fs) / var(--lh) var(--mono);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
* {
  box-sizing: border-box;
}
a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.btn {
  color: var(--accent);
  white-space: nowrap;
}
.btn::before {
  content: "[";
  color: var(--faint);
}
.btn::after {
  content: "]";
  color: var(--faint);
}
.btn:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
kbd {
  font: inherit;
}
[hidden] {
  display: none;
}

/* Text for screen readers only (live regions). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* header */
.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2ch;
  padding-block: 14px 4px;
}
.mark {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}
.top nav {
  display: flex;
  gap: 2ch;
}

/* status colours */
.st-active {
  color: var(--ok);
}
.st-lapsed {
  color: var(--warn);
}
.st-retired {
  color: var(--bad);
}

/* key/value list */
.kv {
  display: grid;
  grid-template-columns: 12ch minmax(0, 1fr);
  column-gap: 1.5ch;
  row-gap: 2px;
  margin: 0;
}
.kv dt {
  color: var(--dim);
}
.kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.kv .none {
  color: var(--faint);
}

/* full record view */
.record {
  overflow-y: auto;
  padding-block: 18px 24px;
}
.record .inner {
  max-width: 92ch;
  display: grid;
  gap: 18px;
}
.record h1 {
  font: inherit;
  font-size: var(--fs-prompt);
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.record .name {
  font-weight: 500;
}
.record .kv {
  grid-template-columns: 14ch minmax(0, 1fr);
}
.record .src {
  color: var(--dim);
}

@media (max-width: 640px) {
  :root {
    --fs: 15px;
    --fs-prompt: 19px;
  }
  .kv,
  .record .kv {
    grid-template-columns: 10ch minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    /* biome-ignore lint/complexity/noImportantStyles: reduced motion must win over any rule */
    scroll-behavior: auto !important;
  }
}

/* The search page: one screen, like a terminal window. Prompt, a counter line, then the
   result list with a live preview beside it (as in a fuzzy finder), and a key bar at the
   foot. From design/prototype/page.css, without the prototype's in-page record view. */
html,
body {
  height: 100%;
}

.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  padding-inline: 16px;
  max-width: 1320px;
  margin-inline: auto;
}

/* prompt */
.top h1 {
  font: inherit;
  margin: 0;
}
.prompt {
  display: flex;
  align-items: baseline;
  gap: 1ch;
  padding-block: 18px 2px;
  font-size: var(--fs-prompt);
}
.prompt .caret {
  color: var(--accent);
  font-weight: 700;
  user-select: none;
}
#q {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-weight: 500;
  color: var(--fg);
  background: transparent;
  border: 0;
  outline: 0;
  padding: 0;
  caret-color: var(--accent);
  caret-shape: block;
}
#q::placeholder {
  color: var(--faint);
  font-weight: 400;
}
#q::selection {
  background: var(--accent);
  color: var(--bg);
}
.info {
  min-height: calc(var(--fs) * var(--lh));
  padding-block: 0 10px;
  padding-left: calc(var(--fs-prompt) * 0.62 + 1ch);
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.info .ok {
  color: var(--ok);
}
.info .bad {
  color: var(--bad);
}
.info .warn {
  color: var(--warn);
}
.info .btn {
  margin-left: 1ch;
}

/* main area */
main {
  min-height: 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.72fr);
}
main.single {
  grid-template-columns: minmax(0, 1fr);
}
/* The usage text and the about page scroll inside the main area, not the page. */
#doc {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.list {
  min-height: 0;
  overflow-y: auto;
  padding-block: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.row {
  display: grid;
  grid-template-columns: 2ch 21ch minmax(0, 1fr) 3ch 8ch;
  column-gap: 1ch;
  padding-inline: 0.5ch;
  cursor: default;
  white-space: nowrap;
  /* Rows below the fold are not laid out until they scroll into view: 50 rows cost 25-35 ms of
     layout per keystroke at 4x on a phone otherwise. The height is the placeholder until then. */
  content-visibility: auto;
  contain-intrinsic-size: auto calc(var(--fs) * var(--lh));
}
.row > span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .ptr {
  color: var(--accent);
  font-weight: 700;
}
.row .lei {
  color: var(--dim);
}
.row .cc {
  color: var(--dim);
}
.row .aka {
  color: var(--dim);
}
/* The reading a lookup at GLEIF found the entity by: isin, bic, reg.no. */
.row .via {
  margin-right: 0.3ch;
  padding-inline: 0.6ch;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: var(--fs-small);
}
.row mark {
  background: none;
  color: var(--accent);
  font-weight: 700;
}
.row[aria-selected="true"] {
  background: var(--sel-bg);
  color: var(--sel-fg);
}
.row[aria-selected="true"] > span,
.row[aria-selected="true"] .aka {
  color: var(--sel-fg);
}
.row[aria-selected="true"] mark {
  color: var(--sel-fg);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.row[aria-selected="true"] .ptr {
  color: var(--sel-fg);
}
.row:not([aria-selected="true"]):hover {
  background: color-mix(in srgb, var(--fg) 6%, transparent);
}

/* preview, a bordered pane with its title set into the top border */
.preview {
  min-height: 0;
  overflow-y: auto;
  padding: 18px 0 12px 2ch;
  border-left: 1px solid var(--rule);
}
.pane {
  position: relative;
  border: 1px solid var(--rule);
  padding: 14px 1.5ch 12px;
}
.pane > .label {
  position: absolute;
  top: -0.8em;
  left: 1ch;
  padding-inline: 1ch;
  background: var(--bg);
  color: var(--dim);
}
.pane .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2ch;
  margin-top: 12px;
}
.pane .note {
  margin: 0 0 4px;
  color: var(--dim);
}

/* usage text and man page share one column width */
.doc {
  padding-block: 16px 24px;
  max-width: 76ch;
}
.doc h2 {
  font: inherit;
  font-weight: 700;
  margin: 18px 0 2px;
}
.doc p,
.doc dl {
  margin: 0 0 8px 7ch;
}
.doc p.lead {
  margin-left: 0;
}
.doc .examples {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 3ch;
  row-gap: 2px;
  margin-left: 7ch;
}
.doc .examples button {
  text-align: left;
  color: var(--accent);
}
.doc .examples span {
  color: var(--dim);
}
.man-head {
  display: flex;
  justify-content: space-between;
  gap: 2ch;
  color: var(--dim);
}
.man-head span:nth-child(2) {
  text-align: center;
}
.man-head.foot {
  margin-top: 18px;
}
.doc .keys {
  display: grid;
  grid-template-columns: 14ch minmax(0, 1fr);
  margin-left: 7ch;
  row-gap: 2px;
}
.doc .keys dd {
  margin: 0;
}

/* key bar, reverse-video keys as in nano */
.keys-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 3ch;
  flex-wrap: wrap;
  padding-block: 8px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--rule);
  font-size: var(--fs-small);
  color: var(--dim);
}
.keys-bar ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5ch 2.5ch;
  margin: 0;
  padding: 0;
  list-style: none;
}
.keys-bar kbd {
  background: var(--fg);
  color: var(--bg);
  padding-inline: 0.6ch;
  margin-right: 0.8ch;
  font-weight: 500;
}
.keys-bar .meta {
  white-space: nowrap;
}

.copied {
  color: var(--ok);
}

@media (max-width: 900px) {
  main {
    grid-template-columns: minmax(0, 1fr);
  }
  .preview {
    display: none;
  }
}
@media (max-width: 640px) {
  /* The message and the retry button of a failed lookup are longer than the line. */
  .info {
    white-space: normal;
  }
  .row {
    grid-template-columns: 2ch minmax(0, 1fr) auto;
    grid-template-areas: "p n c" "p l s";
    padding-block: 6px;
    white-space: normal;
    border-bottom: 1px solid var(--rule);
    contain-intrinsic-size: auto 62px;
  }
  .row .ptr {
    grid-area: p;
  }
  .row .nm {
    grid-area: n;
    white-space: normal;
  }
  .row .cc {
    grid-area: c;
    text-align: right;
  }
  .row .lei {
    grid-area: l;
    font-size: var(--fs-small);
  }
  .row .st {
    grid-area: s;
    font-size: var(--fs-small);
    text-align: right;
  }
  .doc p,
  .doc dl,
  .doc .examples,
  .doc .keys {
    margin-left: 2ch;
  }
  .man-head span:nth-child(2) {
    display: none;
  }
}
@media (hover: none) and (pointer: coarse) {
  .keys-bar ul {
    display: none;
  }
}
