/* The three parts of a token, as JWT debuggers colour them, are the accent colours. */
:root {
  --header: #e0662c;
  --payload: #8b65f0;
  --signature: #14904d;

  --bg: #f5f5f5;
  --fg: #191919;
  --muted: #666666;
  --faint: #a3a3a3;
  --frame: #ededed;
  --frame-border: #e3e3e3;
  --panel: #ffffff;
  --border: #ebebeb;
  --surface: #f7f7f7;
  --track: #e8e8e8;
  --pill: #ffffff;
  --pill-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.03);
  --good-bg: #e8f6ee;
  --good-fg: #0d6a38;
  --warn-bg: #fdf0e1;
  --warn-fg: #8c4507;
  --bad-bg: #fdeceb;
  --bad-fg: #b3261e;
  --changed-bg: #f0ebfe;
  --changed-fg: #5a3dc2;
  --logo-bg: transparent;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --header: #ef7d45;
    --payload: #a58bff;
    --signature: #7fca84;

    --bg: #111111;
    --fg: #f5f5f5;
    --muted: #a3a3a3;
    --faint: #5e5e5e;
    --frame: #1b1b1b;
    --frame-border: #282828;
    --panel: #141414;
    --border: #262626;
    --surface: #1c1c1c;
    --track: #1f1f1f;
    --pill: #333333;
    --pill-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --good-bg: #0f2418;
    --good-fg: #74d394;
    --warn-bg: #2a1c0c;
    --warn-fg: #f0a463;
    --bad-bg: #2c1213;
    --bad-fg: #ff8b82;
    --changed-bg: #211a3b;
    --changed-fg: #bca8ff;
    --logo-bg: #f1f1f4;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --header: #ef7d45;
  --payload: #a58bff;
  --signature: #7fca84;

  --bg: #111111;
  --fg: #f5f5f5;
  --muted: #a3a3a3;
  --faint: #5e5e5e;
  --frame: #1b1b1b;
  --frame-border: #282828;
  --panel: #141414;
  --border: #262626;
  --surface: #1c1c1c;
  --track: #1f1f1f;
  --pill: #333333;
  --pill-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --good-bg: #0f2418;
  --good-fg: #74d394;
  --warn-bg: #2a1c0c;
  --warn-fg: #f0a463;
  --bad-bg: #2c1213;
  --bad-fg: #ff8b82;
  --changed-bg: #211a3b;
  --changed-fg: #bca8ff;
  --logo-bg: #f1f1f4;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

/* A thin bar in the colours of a token's header, payload and signature. */
body::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--header) 0 33.3%, var(--payload) 33.3% 66.6%, var(--signature) 66.6%);
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: currentColor;
}

code {
  font: 0.86em/1 "Roboto Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15em 0.4em;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

header.site,
footer.site,
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}

header.site .brand {
  font: 500 1.1em "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand .header {
  color: var(--header);
}

.brand .payload {
  color: var(--payload);
}

.brand .signature {
  color: var(--signature);
}

.brand .dot {
  color: var(--faint);
}

header.site nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

header.site nav a {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95em;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 10px;
}

header.site nav a:hover {
  color: var(--fg);
}

header.site nav a[aria-current] {
  color: var(--fg);
  background: var(--track);
}

footer.site {
  color: var(--muted);
  font-size: 0.88em;
  padding-top: 8px;
  padding-bottom: 40px;
  margin-top: 40px;
}

h1 {
  font-size: clamp(1.9em, 4vw, 2.6em);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 40px 0 10px;
}

h2 {
  font-size: 1em;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

h3 {
  font-size: 0.95em;
  font-weight: 600;
  margin: 24px 0 8px;
}

.lead {
  font-size: 1.12em;
  line-height: 1.55;
}

.meta,
.meta a {
  color: var(--muted);
}

.why {
  color: var(--muted);
  font-size: 0.92em;
}

p.why {
  border-left: 2px solid var(--payload);
  padding-left: 12px;
}

/* The front page: what the project is for, before the results. */
.hero {
  padding: 24px 0 8px;
}

.hero h1 {
  font-size: clamp(2.1em, 5vw, 3.2em);
  max-width: 20ch;
  margin-top: 32px;
}

.hero .lead {
  max-width: 68ch;
  color: var(--fg);
}

.run-head {
  max-width: 90ch;
  margin-top: 48px;
}

.hero + .run-head {
  border-top: 1px solid var(--frame-border);
  padding-top: 8px;
}

.run-head > h2 {
  font-size: 1.6em;
  letter-spacing: -0.02em;
  margin: 32px 0 4px;
}

.run-head p {
  margin: 8px 0;
}

/* The legend: the four verdicts, coloured like the cells. */
p.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 0.88em;
}

p.legend > span:not(.hint) {
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

p.legend .hint {
  color: var(--muted);
  margin-left: 4px;
}

/* Tabs: a pill track that stays at the top while a long table scrolls by. */
nav.tabs {
  position: sticky;
  top: 10px;
  z-index: 5;
  margin: 28px 0 12px;
}

.tabs-track {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px;
  background: var(--track);
  border: 1px solid var(--frame-border);
  border-radius: 999px;
  box-shadow: 0 6px 20px -10px rgba(0, 0, 0, 0.25);
}

.tabs-track::-webkit-scrollbar {
  display: none;
}

.tabs-track a {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9em;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.tabs-track a:hover {
  color: var(--fg);
}

.tabs-track a.active {
  color: var(--fg);
  background: var(--pill);
  box-shadow: var(--pill-shadow);
}

.tabs-track a:focus-visible {
  outline: 2px solid var(--payload);
  outline-offset: -2px;
}

.tabs-track .sep {
  flex: none;
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--frame-border);
}

.badge {
  min-width: 1.6em;
  padding: 0 0.45em;
  border-radius: 999px;
  background: var(--payload);
  color: #ffffff;
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.6;
  text-align: center;
}

.filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 16px;
}

.filter input {
  width: min(100%, 340px);
  padding: 8px 14px;
  border: 1px solid var(--frame-border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  font-size: 0.92em;
}

.filter input:focus {
  outline: 2px solid var(--payload);
  outline-offset: 1px;
}

.filter-count {
  color: var(--muted);
  font-size: 0.9em;
}

/* Each section is a frame with a title strip around a lighter panel. */
.panel {
  background: var(--frame);
  border: 1px solid var(--frame-border);
  border-radius: 16px;
  padding: 4px;
  margin: 0 0 20px;
  scroll-margin-top: 72px;
}

.js .panels > .panel:not(.active) {
  display: none;
}

.panel.standalone {
  margin-top: 40px;
}

.panel > h2 {
  padding: 8px 14px 10px;
}

.panel-body {
  background: var(--panel);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.panel-body > :first-child {
  margin-top: 0;
}

.panel-body > :last-child {
  margin-bottom: 0;
}

.panel-body > p {
  max-width: 82ch;
}

/* The overview: one card for each check. */
.checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.panel-body > h3:first-of-type {
  margin-top: 20px;
}

a.check {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

a.check:hover {
  border-color: var(--faint);
  box-shadow: 0 4px 14px -8px rgba(0, 0, 0, 0.25);
}

.check-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.check-head span {
  color: var(--muted);
  font-size: 0.85em;
}

.question {
  color: var(--muted);
  font-size: 0.9em;
  flex: 1;
}

.bar {
  display: flex;
  gap: 2px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  min-width: 4px;
}

.bar .good {
  background: var(--good-fg);
}

.bar .warn {
  background: var(--warn-fg);
}

.bar .bad {
  background: var(--bad-fg);
}

.bar .na {
  background: var(--faint);
  opacity: 0.6;
}

ul.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.85em;
}

.good-text {
  color: var(--good-fg);
}

.warn-text {
  color: var(--warn-fg);
}

.bad-text {
  color: var(--bad-fg);
}

.na-text {
  color: var(--muted);
}

/* What each column of a table tests. */
dl.variants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin: 16px 0 20px;
}

dl.variants > div {
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 10px;
}

dl.variants dt {
  font-weight: 600;
  margin-bottom: 2px;
}

dl.variants dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.92em;
}

dl.variants dd strong {
  color: var(--fg);
  font-weight: 600;
}

/* The question a check answers, then its explanation behind a closed summary. */
p.ask {
  font-size: 1.05em;
  font-weight: 500;
  margin-bottom: 12px;
}

p.verdict {
  font-size: 1.05em;
  line-height: 1.55;
  max-width: 82ch;
  margin-bottom: 20px;
}

.panel details {
  margin: 0 0 14px;
}

.panel details summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--muted);
  width: fit-content;
}

.panel details summary:hover {
  color: var(--fg);
}

.panel details[open] summary {
  margin-bottom: 10px;
}

.explain-body {
  padding: 4px 0 6px 14px;
  border-left: 2px solid var(--border);
}

.explain-body > p {
  max-width: 82ch;
}

.explain-body h4 {
  margin: 22px 0 6px;
  font-size: 1em;
}

.table {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.table.tall {
  max-height: 560px;
  overflow-y: auto;
}

.table.tall thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9em;
}

th,
td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

thead th {
  background: var(--surface);
  color: var(--muted);
  font-size: 0.92em;
  font-weight: 600;
}

tbody tr:hover > * {
  box-shadow: inset 0 0 0 999px rgba(127, 127, 127, 0.05);
}

tbody th {
  font-weight: 500;
  position: sticky;
  left: 0;
  background: var(--panel);
}

tbody th a {
  text-decoration: none;
}

tbody th a:hover {
  text-decoration: underline;
}

/* Language logos, with a light backdrop in dark mode so dark logos stay visible. */
img.logo {
  display: inline-block;
  vertical-align: -3px;
  margin-right: 7px;
  padding: 1px;
  border-radius: 4px;
  background: var(--logo-bg);
  box-sizing: content-box;
}

.language > h2 img.logo {
  vertical-align: -4px;
  margin-right: 10px;
  padding: 2px;
}

th .version {
  display: block;
  color: var(--muted);
  font-size: 0.85em;
  font-weight: 400;
}

td.wrap {
  white-space: normal;
  min-width: 24ch;
}

.good {
  background: var(--good-bg);
  color: var(--good-fg);
}

.warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
}

.bad {
  background: var(--bad-bg);
  color: var(--bad-fg);
}

.na {
  color: var(--faint);
}

.changed {
  background: var(--changed-bg);
  color: var(--changed-fg);
}

td.warn,
td.bad {
  white-space: normal;
  min-width: 14ch;
}

/* A cell with details gets a corner mark, like a note in a spreadsheet. */
td.has-tip {
  cursor: pointer;
  background-image: linear-gradient(225deg, currentColor 0 5px, transparent 5px);
  background-repeat: no-repeat;
  background-position: top right;
  background-size: 10px 10px;
}

td.has-tip:not(.good):not(.warn):not(.bad) {
  background-image: linear-gradient(225deg, var(--faint) 0 5px, transparent 5px);
}

td.has-tip:focus-visible {
  outline: 2px solid var(--payload);
  outline-offset: -2px;
}

.tip {
  position: absolute;
  z-index: 20;
  max-width: min(440px, calc(100vw - 16px));
  padding: 10px 12px;
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--frame-border);
  border-radius: 10px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.35);
  font-size: 0.85em;
}

.tip strong {
  display: block;
  margin-bottom: 4px;
}

.tip p {
  margin: 0 0 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.tip p:last-child {
  margin-bottom: 0;
}

/* The libraries page. */
.run-head + .filter {
  margin-top: 24px;
}

.language {
  margin: 28px 0 0;
}

.language > h2 {
  font-size: 1.2em;
  margin-bottom: 12px;
}

.language .count {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8em;
}

.libraries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.library {
  background: var(--panel);
  border: 1px solid var(--frame-border);
  border-radius: 14px;
  padding: 16px 18px;
}

.library h3 {
  font-size: 1.05em;
  margin: 0;
}

.library h3 a {
  text-decoration: none;
}

.library h3 a:hover {
  text-decoration: underline;
}

.library .version {
  color: var(--muted);
  font: 400 0.82em "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-left: 6px;
}

.library .package {
  color: var(--muted);
  font-size: 0.88em;
  margin: 2px 0 12px;
}

.library .package a {
  color: var(--muted);
}

/* Where a library did not do what the RFCs require. */
ul.findings {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9em;
}

ul.findings li + li {
  margin-top: 4px;
}

ul.findings a {
  color: inherit;
}

@media (max-width: 640px) {
  h1 {
    margin-top: 24px;
  }

  /* On a phone the library column scrolls with the results instead of covering them. */
  tbody th {
    position: static;
    white-space: normal;
    overflow-wrap: break-word;
    min-width: 10ch;
    max-width: 17ch;
  }

  th .version {
    display: none;
  }

  .panel-body {
    padding: 14px;
  }

  .libraries {
    grid-template-columns: 1fr;
  }
}

@media print {
  body::before,
  nav.tabs,
  .filter {
    display: none;
  }

  .js .panels > .panel:not(.active) {
    display: block;
  }
}

.nowrap {
  white-space: nowrap;
}
