/* LatencyLens website: the Ladder system (DESIGN.md) set for reading. */

@font-face {
  font-family: 'Public Sans Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/public-sans-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Public Sans Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/public-sans-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2-variations');
}

:root {
  --spec-ink: #16233f;
  --rail-text: #dce3f0;
  --rail-muted: #a9b8d2;
  --rail-indicator: #7fa6ff;
  --ground: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #f1f3f7;
  --rule: #dde2ea;
  --rule-soft: #edf0f4;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #5f6b7a;
  --accent: #2f6fdf;
  --accent-text: #2459c4;
  --selection: #cfddfb;
  --scroll-thumb: #c3cad6;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0d131f;
    --panel: #141b29;
    --panel-2: #1a2334;
    --rule: #2a3447;
    --rule-soft: #202939;
    --ink: #e6eaf2;
    --ink-2: #a8b2c5;
    --ink-3: #939eb3;
    --accent: #7fa6ff;
    --accent-text: #8fb1ff;
    --selection: #2b4270;
    --scroll-thumb: #3a465e;
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--scroll-thumb) transparent;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font:
    400 15px/1.6 'Public Sans Variable',
    system-ui,
    sans-serif;
  font-variant-numeric: tabular-nums;
  caret-color: var(--accent);
}

::selection {
  background: var(--selection);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-thickness: 2px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 4px;
  z-index: 1;
}
.skip:focus {
  top: 12px;
}

/* The ink bar: the rail of the app, laid across the top. */
.bar {
  background: var(--spec-ink);
  color: var(--rail-text);
}
.bar-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand .mark {
  color: var(--rail-indicator);
}
.bar nav {
  display: flex;
  gap: 4px;
}
.bar nav a {
  position: relative;
  color: var(--rail-text);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 4px;
}
.bar nav a:hover {
  background: #1c2c4d;
}
.bar nav a[aria-current='page'] {
  background: #22345c;
  font-weight: 500;
}
.bar nav a[aria-current='page']::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 2px;
  background: var(--rail-indicator);
}
.bar :focus-visible {
  outline-color: var(--rail-indicator);
}

main {
  padding: 32px 24px 16px;
}

.doc {
  max-width: 880px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 40px 48px 48px;
}
.doc > :first-child {
  margin-top: 0;
}
.doc p,
.doc ul {
  max-width: 68ch;
}

h1,
h2,
h3 {
  color: var(--ink);
  text-wrap: balance;
  scroll-margin-top: 16px;
}
h1 {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
h2 {
  font-size: 19px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 40px 0 10px;
  padding-top: 24px;
  border-top: 1px solid var(--rule-soft);
}
h3 {
  font-size: 16px;
  line-height: 1.4;
  font-weight: 600;
  margin: 28px 0 6px;
}
h2 + h3 {
  margin-top: 16px;
}

p {
  margin: 0 0 14px;
}
.meta {
  color: var(--ink-2);
  font-size: 14px;
  margin-bottom: 24px;
}
.meta em {
  font-style: normal;
}
h1 + .meta {
  margin-top: 0;
}

ul {
  margin: 0 0 16px;
  padding-left: 20px;
}
li {
  margin: 4px 0;
}
li::marker {
  color: var(--ink-3);
}
li > ul {
  margin: 6px 0 4px;
}

strong {
  font-weight: 600;
}

code {
  font-family: 'JetBrains Mono Variable', ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.86em;
  background: var(--panel-2);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: 1px 4px;
  overflow-wrap: anywhere;
}

/* Tables: ruled like the app's stats table; they scroll inside the page on narrow screens. */
.table {
  margin: 8px 0 20px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.5;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 9px 14px;
  border-bottom: 1px solid var(--rule-soft);
}
th {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--panel-2);
  border-bottom-color: var(--rule);
  white-space: nowrap;
}
tbody tr:last-child td {
  border-bottom: 0;
}
td:first-child {
  min-width: 14em;
}

.foot {
  max-width: 880px;
  margin: 0 auto;
  padding: 8px 24px 40px;
  color: var(--ink-2);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 24px;
}
.foot p {
  margin: 0;
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }
  .bar-inner {
    padding: 0 16px;
  }
  .bar nav a {
    padding: 8px 10px;
  }
  main {
    padding: 16px 0 8px;
  }
  .doc {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 28px 16px 32px;
  }
  h1 {
    font-size: 25px;
  }
  .foot {
    padding: 8px 16px 32px;
  }
  td:first-child {
    min-width: 11em;
  }
}

@media (forced-colors: active) {
  .bar nav a[aria-current='page']::after {
    background: Highlight;
  }
}

@media print {
  .bar nav,
  .skip,
  .foot {
    display: none;
  }
  .bar {
    background: none;
    color: #000;
  }
  .brand {
    color: #000;
  }
  .doc {
    border: 0;
    padding: 0;
  }
}
