/* Tokens, layout and page of the reviewed mock-up. The ecosystem header has its own file. */
:root {
  /* Layout: the ecosystem header, sub bar and footer stay as today. One comparison panel (from, to) leads to one result table, grouped by table, with a sticky header. */
  color-scheme: light;

  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --bg: #ffffff;
  --fg: #212529;
  --muted: #5c636a;
  --border: #dee2e6;
  --rule: #e5e5e5;
  --surface: #f8f9fa;
  --primary: #1b6ec2;
  --primary-edge: #1861ac;
  --link: #0366d6;
  --focus: #1b6ec2;

  --nav-bg: #222222;
  --nav-edge: #080808;
  --subnav-bg: #f8f8f8;
  --subnav-edge: #e7e7e7;

  --add-bg: #d1e7dd;
  --add-fg: #0a3622;
  --del-bg: #f8d7da;
  --del-fg: #58151c;
  --old-bg: #fdecee;
  --new-bg: #e3f3e8;
  --err-bg: #f8d7da;
  --err-edge: #f1aeb5;
  --err-fg: #58151c;
  --ok-bg: #e7f1ec;
  --ok-edge: #b7d7c6;
  --ok-fg: #0a3622;
  --info-bg: #eef4fb;
  --info-edge: #c5d9ef;
  --info-fg: #163a63;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 16px; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
h1, h2, p, ol, ul, dl { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 0.9em; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.container {
  width: 100%;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 768px) { .container { max-width: 750px; } }
@media (min-width: 992px) { .container { max-width: 970px; } }
@media (min-width: 1200px) { .container { max-width: 1170px; } }

/* The result table needs the whole screen. Only the header keeps the container width of api.monitor.se. */
.full-width {
  width: 100%;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 768px) { .full-width { padding-inline: 2rem; } }

/* Page */
.page { padding-block: 1.5rem 3rem; display: flex; flex-direction: column; gap: 1.5rem; }
h1 { font-size: 1.875rem; line-height: 1.2; font-weight: 500; }
.lead { color: var(--fg); }
.page > * { min-width: 0; }

/* Comparison panel */
.compare {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.25rem;
  border: 1px solid var(--border); border-radius: 0.5rem; padding: 1rem 1.25rem; background: var(--surface);
}
.pick { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.pick label { font-size: 0.875rem; font-weight: 600; }
.sel {
  appearance: auto; min-width: 10rem; padding: 0.375rem 0.75rem; background: var(--bg); color: var(--fg);
  border: 1px solid #ced4da; border-radius: 0.25rem;
}
.sel:disabled { background: var(--border); color: var(--muted); }
.sel:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 0.2rem rgba(27, 110, 194, 0.25); outline: none; }
.arrow { padding-bottom: 0.4rem; color: var(--muted); font-size: 1.25rem; line-height: 1.5; }
.asof { margin-left: auto; font-size: 0.875rem; color: var(--muted); text-align: right; }
.asof strong { color: var(--fg); font-weight: 600; }

/* Notes */
.note { border: 1px solid var(--info-edge); background: var(--info-bg); color: var(--info-fg); border-radius: 0.5rem; padding: 0.875rem 1.125rem; max-width: 65ch; }
.note.ok { border-color: var(--ok-edge); background: var(--ok-bg); color: var(--ok-fg); }
.note.err { border-color: var(--err-edge); background: var(--err-bg); color: var(--err-fg); }
.btn {
  display: inline-block; cursor: pointer; padding: 0.375rem 0.75rem; border-radius: 0.25rem; border: 1px solid transparent;
  background: var(--primary); border-color: var(--primary-edge); color: #fff; margin-top: 0.75rem;
}
.btn:hover { background: var(--primary-edge); }

/* Result */
.res { display: flex; flex-direction: column; gap: 1rem; }
.res-head { display: flex; flex-direction: column; gap: 0.25rem; }
.res-head h2 { font-size: 1.5rem; line-height: 1.25; font-weight: 500; }
.res-head h2 .mono { font-size: 0.85em; font-weight: 500; background: var(--surface); border: 1px solid var(--border); border-radius: 0.25rem; padding: 0 0.375rem; }
.tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.chip {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.375rem;
  background: var(--bg); border: 1px solid #ced4da; border-radius: 2rem; padding: 0.125rem 0.75rem; font-size: 0.875rem;
}
.chip:hover:not(:disabled) { background: var(--surface); }
.chip .n { font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary-edge); color: #fff; }
.chip[aria-pressed="true"] .n { color: #fff; }
.chip:disabled { color: var(--muted); border-style: dashed; cursor: default; }
.tools-r { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.inp { padding: 0.25rem 0.75rem; border: 1px solid #ced4da; border-radius: 0.25rem; min-width: 14rem; background: var(--bg); color: var(--fg); }
.inp:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 0.2rem rgba(27, 110, 194, 0.25); outline: none; }
.link { appearance: none; background: none; border: 0; padding: 0.125rem 0; cursor: pointer; color: var(--link); font-size: 0.9375rem; }
.link:hover { text-decoration: underline; }

/* The gutter is the width of the chevron and its gap in .tg. Badges sit in it, and names and diffs start after it. */
.changes { --gutter: 1.375rem; width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: 0.5rem; overflow: clip; }
.changes tbody + tbody > tr:first-child > * { border-top: 1px solid var(--border); }
.changes th[scope="row"], .changes td { text-align: left; font-weight: 400; padding: 0.5rem 1rem; vertical-align: top; }
.tr-table { background: var(--surface); }
.tr-table th[scope="row"] { font-weight: 600; }
.gutter-row { display: grid; grid-template-columns: var(--gutter) minmax(0, 1fr); align-items: start; }
/* The "+ " or "- " prefix and the line padding hang in the gutter, so the column name starts where the table name starts. */
.tr-col .diff { margin-left: calc(var(--gutter) - 2ch - 0.375rem); }
.nm { font-family: var(--mono); font-size: 0.9em; overflow-wrap: break-word; }
.tr-table .nm { font-weight: 600; }
.tg {
  appearance: none; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem; text-align: left; max-width: 100%;
}
.tg .nm { min-width: 0; }
.tg svg { width: 0.875rem; height: 0.875rem; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.12s; }
.tg[aria-expanded="false"] svg { transform: rotate(-90deg); }
@media (prefers-reduced-motion: reduce) { .tg svg { transition: none; } }

.bd { display: inline-block; width: 1.125rem; text-align: center; font-size: 0.8125rem; font-weight: 600; line-height: 1.4; padding-block: 0.125rem; border-radius: 0.25rem; cursor: default; }
.bd-add { background: var(--add-bg); color: var(--add-fg); }
.bd-del { background: var(--del-bg); color: var(--del-fg); }

.diff { font-family: var(--mono); font-size: 0.875rem; overflow-x: auto; }
/* max-width 0 keeps a long diff line from widening the table, so the line scrolls in its cell and not the page. */
.changes td.dc { width: 100%; max-width: 0; }
/* width 1% shrinks the count column to its text, so the table name column gets the rest. */
.changes td.cnt { width: 1%; white-space: nowrap; text-align: right; }
.dl { white-space: pre; padding: 0 0.375rem; }
.dl-del { background: var(--old-bg); }
.dl-add { background: var(--new-bg); }
.def { font-family: var(--mono); font-size: 0.875rem; color: var(--muted); }
.foot-note { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; font-size: 0.875rem; color: var(--muted); }
.none { padding: 1.5rem 1rem; color: var(--muted); }

.site-foot { border-top: 1px solid var(--rule); color: var(--muted); line-height: 60px; }

@media (max-width: 40rem) {
  h1 { font-size: 1.625rem; }
  .asof { margin-left: 0; text-align: left; flex: 1 1 100%; }
  .arrow { display: none; }
  .sel { min-width: 0; width: 100%; }
  .pick { flex: 1 1 8rem; }
  .inp { min-width: 0; width: 100%; }
  .tools-r { width: 100%; }
  .changes, .changes tbody { display: block; }
  .changes tr { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.25rem 0.75rem; padding: 0.625rem 1rem; align-items: start; }
  .changes th[scope="row"], .changes td { display: block; padding: 0; }
  .changes td.dc { grid-column: 1 / -1; min-width: 0; width: auto; max-width: none; }
  .tr-table th[scope="row"] { grid-column: 1 / -1; }
  .changes td.cnt { grid-column: 1 / -1; width: auto; padding-left: var(--gutter); text-align: left; }
  .changes tbody + tbody > tr:first-child { border-top: 1px solid var(--border); }
  .changes tbody + tbody > tr:first-child > * { border-top: 0; }
}

/* Without script every row is shown and the tools stay hidden; the toggles are only shown when the script runs. */
html:not(.js) .tg svg { display: none; }
html:not(.js) .tg { cursor: default; }
html:not(.js) .tr-table .tg .nm { padding-left: var(--gutter); }
noscript .btn, .compare .btn { margin-top: 0; }
