/* One stylesheet, no framework, no webfont. The page should cost nothing to
   load and look the same in ten years. */

:root {
  --bg: #07090d;
  --panel: #0c1016;
  --edge: #1a222e;
  --ink: #c3ccd8;
  --ink-dim: #6c7a8b;
  --ink-faint: #46525f;
  --accent: #4a86b4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  font: 14px/1.55 ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
        "Liberation Mono", monospace;
  -webkit-font-smoothing: antialiased;
  padding: 0 1rem 4rem;
}

main {
  max-width: 800px;
  margin: 0 auto;
}

header {
  padding: 2.5rem 0 1.25rem;
}

h1 {
  margin: 0;
  font-weight: 400;
}

.wordmark {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  color: var(--ink-faint);
}

/* The strapline carries the page, so it gets the size the wordmark gave up. */
.tagline {
  display: block;
  margin: 0.5rem 0 0;
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.tagline a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--ink-faint);
  padding-bottom: 1px;
}

.tagline a:hover {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 560px) {
  .tagline { font-size: 1.1rem; }
}

/* ---- the grid ---- */

.stage {
  position: relative;
  width: 100%;
  max-width: 768px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  background: #05070a;
}

#grid {
  display: block;
  width: 100%;
  height: 100%;
  /* The canvas is rendered at 1:1 and upscaled with nearest-neighbour, so
     the browser must not smooth it either. */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* A hairline rather than a border: the world is a torus, so a hard frame
   would imply an edge that does not exist. */
.stage-edge {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--edge);
}

/* ---- ticker ---- */

.ticker {
  margin: 1rem auto 0;
  max-width: 768px;
  min-height: 8.4rem;
}

.ticker ol {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.76rem;
  line-height: 1.2rem;
  color: var(--ink-dim);
}

.ticker li {
  display: flex;
  gap: 0.55rem;
  align-items: baseline;
  white-space: nowrap;
  overflow: hidden;
  animation: arrive 220ms ease-out;
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ticker li { animation: none; }
}

.t-time { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.t-asn  { color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.t-port { color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.t-pat  { color: var(--ink-faint); }
.t-swatch {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  align-self: center;
}
.t-novel { color: var(--accent); }

/* ---- readout ---- */

.readout {
  margin: 1.5rem auto 0;
  max-width: 768px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  border-top: 1px solid var(--edge);
  padding-top: 0.9rem;
}

.readout dl {
  margin: 0;
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.readout dt {
  color: var(--ink-faint);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.readout dd {
  margin: 0.1rem 0 0;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.conn {
  margin: 0;
  font-size: 0.7rem;
  color: var(--ink-faint);
}

.conn[data-state="live"]::before    { content: "● "; color: #3f8f6a; }
.conn[data-state="joining"]::before { content: "● "; color: #b08a3a; }
.conn[data-state="lost"]::before    { content: "● "; color: #9a4a3a; }

/* ---- legend ---- */

.legend {
  margin: 1.25rem auto 0;
  max-width: 768px;
}

.legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  font-size: 0.7rem;
  color: var(--ink-faint);
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend .sw {
  width: 7px;
  height: 7px;
  border-radius: 1px;
}

/* ---- league tables ---- */

/* Countries and networks are the same object with different labels, so they
   get one rule set rather than two that drift apart. */
.census-note {
  margin: 0 0 0.9rem;
  font-size: 0.72rem;
  color: var(--ink-faint);
  line-height: 1.6;
  max-width: 56ch;
}

.league {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.76rem;
  columns: 2;
  column-gap: 2.5rem;
}

.league li {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.16rem 0;
  break-inside: avoid;
  color: var(--ink-dim);
}

.league .k-rank {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  flex: 0 0 1.4rem;
  text-align: right;
}

/* Flags are emoji, so they pick up the system colour font and ignore the
   monospace stack. Fixed width keeps the names aligned regardless. */
.league .k-flag {
  flex: 0 0 1.3rem;
  font-size: 0.95rem;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.league .k-as {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.league .k-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.league .k-n {
  margin-left: auto;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
  padding-left: 0.5rem;
}

@media (max-width: 560px) {
  .league { columns: 1; }
}

/* ---- countries ---- */

.countries {
  margin: 2.5rem auto 0;
  max-width: 768px;
}

.countries h2 {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

/* ---- prose ---- */

.prose {
  margin: 3.5rem auto 0;
  max-width: 34rem;
  color: var(--ink-dim);
  font-size: 0.83rem;
  line-height: 1.8;
}

/* Not centred and not evenly spaced. Headings sit closer to the paragraph they
   introduce than to the one they follow, which is how printed text has always
   worked and how a template never does. */
.prose h2 {
  margin: 2.75rem 0 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 600;
}

.prose h2:first-child { margin-top: 0; }

.prose h3 {
  margin: 1.6rem 0 0.3rem;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0;
  text-transform: none;
}

.prose p { margin: 0 0 0.95rem; }

.prose strong { color: var(--ink); font-weight: 600; }
.prose em { font-style: italic; color: var(--ink); }

.prose a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink-faint);
}

.prose a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.prose .quiet { color: var(--ink-faint); font-size: 0.78rem; }

/* The four rules, set as a definition list because that is what they are. */
.rules {
  margin: 0.9rem 0 0;
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.5rem 1.4rem;
}

.rules dt {
  color: var(--ink);
  font-size: 0.76rem;
  padding-top: 0.12rem;
}

.rules dd {
  margin: 0;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--edge);
}

.rules dd:last-child { border-bottom: 0; }

@media (max-width: 560px) {
  .rules { grid-template-columns: 1fr; gap: 0.15rem; }
  .rules dt { margin-top: 0.7rem; }
  .rules dd { padding-bottom: 0.7rem; }
}

/* ---- visitor counter ---- */

/* A hit counter, because every site had one. Deliberately the only thing on
   the page that is not trying to be tasteful. */
.counter {
  margin: 4rem auto 0;
  max-width: 768px;
  padding-top: 1.5rem;
  border-top: 1px solid var(--edge);
  text-align: center;
}

.counter-line {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-dim);
  letter-spacing: 0.02em;
}

.counter-digits {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  vertical-align: -0.1em;
  white-space: nowrap;
}

.counter-note {
  margin: 0.5rem 0 0;
  font-size: 0.66rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

@media (max-width: 560px) {
  body { padding: 0 0.75rem 3rem; }
  .readout dl { gap: 1.1rem; }
  .ticker ol { font-size: 0.7rem; }
}
