/* ---- Tokens ---- */

:root {
  --bg: #ffffff;
  --ink: #1a1a1a;
  --soft: #555555;
  --faint: #a3a3a0;
  --hair: #ececea;
  --hover-bg: #f7f7f5;

  --sans: 'Inter', Helvetica, system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;

  --max-width: 640px;
  --space-page-top: 56px;
  --space-section: 48px;
  --space-row: 18px;
}

/* ---- Fonts ---- */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  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: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin-ext.woff2') format('woff2');
  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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/plexmono-400-latin.woff2') format('woff2');
  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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/plexmono-500-latin.woff2') format('woff2');
  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;
}

/* ---- Base ---- */

html {
  color-scheme: light only;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 24px;
  top: 8px;
  z-index: 2;
  background: var(--bg);
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 13px;
}

/* ---- Layout ---- */

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

main {
  padding-top: var(--space-page-top);
  padding-bottom: 72px;
}

h1 {
  margin: 0 0 20px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

h2 {
  margin: var(--space-section) 0 14px;
  font-size: 13px;
  font-weight: 600;
}

h3,
h4,
h5,
h6 {
  margin: 32px 0 10px;
  font-size: 13px;
  font-weight: 600;
}

p,
li {
  color: var(--soft);
  font-size: 15px;
  line-height: 1.7;
}

p {
  max-width: 52ch;
  margin: 0 0 16px;
}

b,
strong {
  font-weight: 600;
  color: var(--ink);
}

img {
  max-width: 100%;
  height: auto;
}

hr {
  border: 0;
  border-top: 1px solid var(--hair);
  margin: var(--space-section) 0;
}

blockquote {
  margin: 0 0 16px;
  padding-left: 16px;
  border-left: 1px solid var(--hair);
}

code {
  font-family: var(--mono);
  font-size: 13px;
}

pre {
  overflow-x: auto;
  padding: 16px 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  font-size: 13px;
  line-height: 1.6;
  color: var(--soft);
}

pre code {
  font-size: 13px;
}

/* ---- Terminal nav ---- */

.nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 24px;
  font-family: var(--mono);
  font-size: 13px;
}

.nav a {
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 3px;
}

.nav a:hover {
  text-decoration: underline;
}

.nav a[aria-current='page'] {
  text-decoration: underline;
}

.nav-links {
  display: flex;
  gap: 18px;
}

/* ---- Text links ---- */

.prose a,
.textlink {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  transition: background-size 220ms ease;
}

@media (hover: hover) {
  .prose a,
  .textlink {
    background-size: 0% 1px;
  }

  .prose a:hover,
  .textlink:hover {
    background-size: 100% 1px;
  }
}

/* ---- Quiet list ---- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--hair);
}

.list li {
  border-top: 1px solid var(--hair);
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 16px;
  padding: var(--space-row) 8px;
  margin: 0 -8px;
  text-decoration: none;
  transition: background-color 150ms ease;
}

.row:hover {
  background: var(--hover-bg);
}

.row-name,
.row-desc,
.row-meta,
.row-year,
.row-body {
  display: block;
}

.row-name {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
}

.row-desc {
  color: var(--soft);
  font-size: 14px;
  line-height: 1.6;
  margin-top: 2px;
}

.row-meta {
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.6;
  margin-top: 4px;
}

.row-year {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  color: var(--faint);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.row-body {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ---- Facts table ---- */

.facts {
  width: 100%;
  border-collapse: collapse;
}

.facts th,
.facts td {
  text-align: left;
  font-weight: 400;
  font-size: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--hair);
  vertical-align: top;
}

.facts tr:last-child th,
.facts tr:last-child td {
  border-bottom: 1px solid var(--hair);
}

.facts th {
  width: 32%;
  color: var(--faint);
  font-weight: 400;
}

.facts td {
  color: var(--ink);
}

/* ---- Meta and empty states ---- */

.meta {
  color: var(--faint);
  font-size: 12.5px;
  margin-bottom: 24px;
}

.empty {
  color: var(--faint);
  font-size: 15px;
}

.closing {
  margin-top: 32px;
  color: var(--soft);
  font-size: 14px;
}

.home-links {
  display: flex;
  gap: 42px;
  margin-top: 32px;
}

.home-links a {
  color: var(--ink);
  font-size: 14px;
}

/* ---- Footer ---- */

footer {
  border-top: 1px solid var(--hair);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

/* ---- Responsive ---- */

@media (max-width: 400px) {
  .nav {
    padding: 24px 20px;
  }

  .nav-links {
    gap: 14px;
  }

  .wrap,
  .footer-inner {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* ---- Forced dark mode defence ---- */

@media (prefers-color-scheme: dark) {
  html,
  body {
    background: var(--bg);
    color: var(--ink);
  }

  .row-name,
  .facts td,
  b,
  strong {
    color: var(--ink);
  }

  p,
  li,
  .row-desc {
    color: var(--soft);
  }
}
