:root {
  color-scheme: light dark;
  --muted: color-mix(in srgb, CanvasText 65%, Canvas);
}

body {
  margin: 0;
  background: Canvas;
  color: CanvasText;
  font: 18px/1.6 system-ui, sans-serif;
}

main {
  max-inline-size: 50rem;
  margin-inline: auto;
  padding-block: 3rem;
  padding-inline: 1rem;
}

h1 {
  margin-block: 0 1.5rem;
  font-size: 2rem;
}

h2 {
  margin-block: 2.5rem 0.5rem;
  font-size: 1.25rem;
}

code {
  font-family: ui-monospace, monospace;
}

a {
  color: inherit;
}

.test {
  padding-block: 1rem;
  padding-inline: 1.25rem;
  /* Colored by the result (.yes, .no or .error), see below */
  border: 2px solid var(--state, transparent);
  border-radius: 0.5rem;
  background: color-mix(in srgb, CanvasText 6%, Canvas);
}

/*
 * Without JavaScript, the result (test.ech.michai.li) is shown in an iframe,
 * which can't resize itself, so it's sized for the longest result.
 */
.test iframe {
  display: block;
  inline-size: 100%;
  block-size: 6rem;
  border: 0;
}

@media (max-width: 32rem) {
  .test iframe {
    block-size: 11.5rem;
  }
}

@media (max-width: 22rem) {
  .test iframe {
    block-size: 13.5rem;
  }
}

/* The test result HTML in the iframe or opened directly */
body.framed {
  /* Lets the iframe show the box behind it */
  background: transparent;
  overflow: hidden;
}

body.standalone {
  max-inline-size: 40rem;
  margin-inline: auto;
  padding-block: 3rem;
  padding-inline: 1rem;
}

#result {
  margin: 0;
  color: var(--state, var(--muted));
  font-size: 1.25rem;
  font-weight: 600;
}

#details {
  margin-block: 0.25rem 0;
  color: var(--muted);
  /* Long cipher suite names on narrow screens */
  overflow-wrap: anywhere;
}
#details > code {
  display: block;
}

/*
 * The result's color, set on the box (by test.js) or the result itself
 * (test.html), for the box's border & the result
 */
.yes {
  --state: light-dark(#1a7f37, #4ac26b);
}

.no {
  --state: light-dark(#b35900, #f0a040);
}

.error {
  --state: light-dark(#c62828, #ef6b6b);
}

.small {
  margin-block-start: 2.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}
