/* sitecheck web UI
 *
 * One typeface (Archivo, variable weight + width), used at different widths:
 * expanded and heavy for the grade, normal for everything else. The grade
 * letter and its gauge are the only loud things on the page.
 */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("fonts/archivo.woff2") format("woff2-variations"), url("fonts/archivo.woff2") format("woff2");
}

:root {
  --paper: #eef2ef;
  --surface: #f8faf9;
  --ink: #1c2629;
  --muted: #586569;
  --line: #d2dbd7;
  --accent: #2e4bc6;
  --accent-ink: #ffffff;

  --g-a: #23774f;
  --g-b: #5c8a1f;
  --g-c: #b07b0c;
  --g-d: #c1561a;
  --g-f: #b3322b;
  --g-none: #7a8689;

  --s-ok: var(--g-a);
  --s-warn: #9a6a00;
  --s-fail: var(--g-f);
  --s-info: #4b5ea8;

  --radius-s: 4px;
  --radius-m: 10px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12181a;
    --surface: #1a2225;
    --ink: #e4ebe8;
    --muted: #97a4a7;
    --line: #2c383b;
    --accent: #8ea2ff;
    --accent-ink: #10162e;

    --g-a: #4fbf88;
    --g-b: #9ac255;
    --g-c: #e3b043;
    --g-d: #f08a4e;
    --g-f: #f0716a;
    --g-none: #8b9799;

    --s-warn: #e3b043;
    --s-info: #9aaae8;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-stretch: 100%;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

code {
  font-family: inherit;
  font-weight: 600;
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ---- top bar ---------------------------------------------------------- */

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0 0;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 800;
  font-stretch: 118%;
  letter-spacing: -0.01em;
}

.top-link {
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ---- hero + form ------------------------------------------------------ */

.hero {
  padding: 3.5rem 0 1rem;
}

.hero.compact {
  padding-top: 1.75rem;
}

h1 {
  margin: 0 0 0.75rem;
  max-width: 14em;
  font-size: clamp(2.1rem, 6vw, 3.25rem);
  line-height: 1.05;
  font-weight: 780;
  font-stretch: 112%;
  letter-spacing: -0.025em;
}

.lede {
  margin: 0 0 2rem;
  max-width: 36em;
  color: var(--muted);
  font-size: 1.125rem;
}

.check-form label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.field {
  display: flex;
  gap: 0.5rem;
}

.field input {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1rem;
  font: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-m);
}

.field input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.field input:hover {
  border-color: var(--muted);
}

.field button {
  padding: 0.85rem 1.4rem;
  font: inherit;
  font-weight: 700;
  font-stretch: 108%;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-m);
  cursor: pointer;
}

.field button:hover {
  filter: brightness(1.08);
}

@media (max-width: 30rem) {
  .field {
    flex-direction: column;
  }
}

/* ---- explainer -------------------------------------------------------- */

h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 720;
  font-stretch: 106%;
  letter-spacing: -0.01em;
}

.explainer {
  margin-top: 3rem;
}

.explainer dl {
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: minmax(9rem, 13rem) 1fr;
  gap: 0.9rem 1.5rem;
}

.explainer dt {
  font-weight: 650;
}

.explainer dd {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 34rem) {
  .explainer dl {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .explainer dd {
    margin-bottom: 0.8rem;
  }
}

.scale {
  margin: 1.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---- notice ----------------------------------------------------------- */

.notice {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 2px solid var(--g-f);
  border-radius: var(--radius-m);
}

.notice h2 {
  font-size: 1.125rem;
}

.notice p {
  margin: 0;
}

/* ---- report ----------------------------------------------------------- */

.report {
  margin-top: 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 6px solid var(--grade, var(--g-none));
  border-radius: var(--radius-m);
  padding: 1.5rem 1.5rem 0.5rem;
}

.g-a { --grade: var(--g-a); }
.g-b { --grade: var(--g-b); }
.g-c { --grade: var(--g-c); }
.g-d { --grade: var(--g-d); }
.g-f { --grade: var(--g-f); }

.verdict {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding-bottom: 1.5rem;
}

.letter {
  margin: 0;
  flex: none;
  width: 1.1em;
  text-align: center;
  font-size: clamp(4.25rem, 16vw, 7.5rem);
  line-height: 0.85;
  font-weight: 900;
  font-stretch: 125%;
  color: var(--grade, var(--g-none));
  animation: letter-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.verdict-text {
  flex: 1;
  min-width: 0;
}

.verdict-text h2 {
  margin-bottom: 0.15rem;
  overflow-wrap: anywhere;
}

.score {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.cached {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* 20 segments, 5 points each. Filled ones take the grade colour. */
.gauge {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 3px;
  max-width: 22rem;
}

.seg {
  height: 10px;
  border-radius: 2px;
  background: var(--line);
}

.seg.on {
  background: var(--grade, var(--g-none));
  animation: seg-in 240ms ease-out both;
}

.seg:nth-child(1) { animation-delay: 120ms; }
.seg:nth-child(2) { animation-delay: 140ms; }
.seg:nth-child(3) { animation-delay: 160ms; }
.seg:nth-child(4) { animation-delay: 180ms; }
.seg:nth-child(5) { animation-delay: 200ms; }
.seg:nth-child(6) { animation-delay: 220ms; }
.seg:nth-child(7) { animation-delay: 240ms; }
.seg:nth-child(8) { animation-delay: 260ms; }
.seg:nth-child(9) { animation-delay: 280ms; }
.seg:nth-child(10) { animation-delay: 300ms; }
.seg:nth-child(11) { animation-delay: 320ms; }
.seg:nth-child(12) { animation-delay: 340ms; }
.seg:nth-child(13) { animation-delay: 360ms; }
.seg:nth-child(14) { animation-delay: 380ms; }
.seg:nth-child(15) { animation-delay: 400ms; }
.seg:nth-child(16) { animation-delay: 420ms; }
.seg:nth-child(17) { animation-delay: 440ms; }
.seg:nth-child(18) { animation-delay: 460ms; }
.seg:nth-child(19) { animation-delay: 480ms; }
.seg:nth-child(20) { animation-delay: 500ms; }

@keyframes letter-in {
  from { opacity: 0; transform: scale(0.82); }
  to { opacity: 1; transform: none; }
}

@keyframes seg-in {
  from { background: var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  .letter,
  .seg.on {
    animation: none;
  }
}

@media (max-width: 30rem) {
  .verdict {
    align-items: flex-start;
    gap: 1rem;
  }
}

/* ---- check groups ------------------------------------------------------ */

.group {
  padding: 1.25rem 0 1rem;
  border-top: 1px solid var(--line);
}

.group h3 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
}

.blurb {
  margin: 0.1rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.checks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.check {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 13rem) 1fr;
  gap: 0.25rem 1rem;
  padding: 0.55rem 0;
  align-items: baseline;
}

.check + .check {
  border-top: 1px dashed var(--line);
}

.status {
  font-size: 0.875rem;
  font-weight: 700;
}

.status::before {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-right: 0.4em;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 0.05em;
}

.s-ok .status { color: var(--s-ok); }
.s-warn .status { color: var(--s-warn); }
.s-fail .status { color: var(--s-fail); }
.s-info .status { color: var(--s-info); }

.name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.detail {
  color: var(--muted);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

@media (max-width: 36rem) {
  .check {
    grid-template-columns: 5.5rem 1fr;
  }

  .detail {
    grid-column: 2;
  }
}

/* ---- monitored sites --------------------------------------------------- */

.watched {
  margin-top: 3rem;
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  padding: 0.7rem 0.8rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-weight: 600;
  color: var(--muted);
}

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

td.host {
  font-weight: 600;
}

.host-sub {
  display: none;
}

@media (max-width: 36rem) {
  .col-when,
  .col-cert,
  .col-score {
    display: none;
  }

  td.host {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .host-sub {
    display: block;
    font-weight: 400;
    color: var(--muted);
  }

  th,
  td {
    padding: 0.6rem 0.65rem;
  }
}

td.when {
  color: var(--muted);
}

.down {
  color: var(--s-fail);
  font-weight: 600;
}

.chip {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-s);
  font-weight: 900;
  font-stretch: 125%;
  color: #fff;
  background: var(--grade, var(--g-none));
}

@media (prefers-color-scheme: dark) {
  .chip {
    color: var(--paper);
  }
}

/* ---- footer ------------------------------------------------------------ */

.foot {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.foot p {
  margin: 0;
  max-width: 40em;
}
