/* Open Source Investor.
   The register comes off his reference picture (a 1-bit micro computer screen): one pixel mono, two
   inks on black, and a double stroke frame as the only container. The STRUCTURE is a site: a
   masthead, tabs, panels with headings, labelled rows and real buttons. The first build printed the
   content as a BASIC listing with line numbers, which read as source code rather than as a page, and
   let the raster window cut two lines of text in half. Both are gone. */

@font-face {
  font-family: "Departure Mono";
  src: url("/font/DepartureMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ink: measured off his picture, a black ground and one silver. Every value below is over 4.5:1
     on the ground it is painted on, and the three steps are the hierarchy. */
  --bg: #000000;
  --paper: #f0f0f0;   /* 18.1:1  headings, values, the active tab */
  --ink: #cfcfcf;     /* 13.4:1  body copy */
  --muted: #9c9c9c;   /* 7.4:1   labels, notes, disabled controls */
  --rule: #3a3a3a;    /* lines only, never text */
  --rule-lit: #6a6a6a;

  /* type: 16 is the floor, because nothing on one of his sites goes under it */
  --t-display: 44px;
  --t-h2: 24px;
  --t-value: 20px;
  --t-body: 18px;
  --t-label: 16px;

  /* spacing */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;

  --pad-body: 24px;   /* the panel body inset; every full width rule is pulled out by it */
  --page: 1440px;
  --gut: 48px;

  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Departure Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;
  font-size: var(--t-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--paper); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 10;
  background: var(--paper); color: var(--bg);
  padding: var(--s3) var(--s5);
  font-size: var(--t-body);
}
.skip:focus { left: 0; }

.page {
  max-width: calc(var(--page) + var(--gut) * 2);
  margin: 0 auto;
  padding: var(--s7) var(--gut);
}

/* ---- masthead ------------------------------------------------------------ */

.masthead {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 48ch);
  gap: var(--s5) var(--s7);
  align-items: end;
  padding-bottom: var(--s5);
}
.masthead::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--rule);
}

.masthead-id { display: flex; align-items: baseline; gap: var(--s4); flex-wrap: wrap; }

.wordmark {
  margin: 0;
  font-size: var(--t-display);
  line-height: 1.1;
  font-weight: 400;
  color: var(--paper);
}

.ticker {
  margin: 0;
  font-size: var(--t-h2);
  line-height: 1.1;
  color: var(--muted);
}

.premise { margin: 0; color: var(--ink); }

/* ---- tabs ---------------------------------------------------------------- */

.tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--s2);
  margin: var(--s5) 0 var(--s6);
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: var(--s3) var(--s4);
  border: 2px solid var(--rule);
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: var(--t-label);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.12s linear, border-color 0.12s linear, background-color 0.12s linear;
}
.tab:hover { color: var(--paper); border-color: var(--rule-lit); }
.tab:active { transform: translateY(1px); }
.tab[aria-current="page"] {
  color: var(--bg);
  background: var(--paper);
  border-color: var(--paper);
}

/* ---- panels: the double stroke of his window ----------------------------- */

.panel {
  border: 3px solid var(--rule-lit);
  padding: 3px;
  margin-bottom: var(--s5);
}

.panel-h {
  margin: 0;
  padding: var(--s4) var(--pad-body);
  font-size: var(--t-h2);
  line-height: 1.25;
  font-weight: 400;
  color: var(--paper);
  border-bottom: 2px solid var(--rule);
}

.panel-body { padding: var(--pad-body); }
.panel-body > :first-child { margin-top: 0; }
.panel-body > :last-child { margin-bottom: 0; }

.panel-note {
  position: relative;
  margin: var(--s4) calc(var(--pad-body) * -1) 0;
  padding: var(--s4) var(--pad-body) 0;
  color: var(--muted);
  font-size: var(--t-label);
}
.panel-note::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: var(--rule);
}

.note { margin: var(--s4) 0 0; color: var(--muted); font-size: var(--t-label); }

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s5);
  align-items: start;
}
.cols-wide { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }

/* ---- labelled rows: the one way a value is printed on this site ---------- */

.rows { margin: 0; }
.rows > div {
  position: relative;
  display: grid;
  grid-template-columns: minmax(14ch, auto) minmax(0, 1fr);
  column-gap: var(--s5);
  padding: var(--s3) var(--pad-body);
  margin: 0 calc(var(--pad-body) * -1);
}
.rows > div::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--rule);
}
.rows > div:last-child::after { display: none; }
.rows dt,
.rows dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.rows dt { color: var(--muted); font-size: var(--t-label); }
.rows dd { color: var(--ink); }
.rows dd.value { color: var(--paper); font-size: var(--t-value); }

/* ---- the split, 70 / 20 / 10 --------------------------------------------- */

.split { margin: 0; }
.split-row {
  position: relative;
  display: grid;
  grid-template-columns: 6ch minmax(16ch, 20ch) minmax(0, 1fr);
  gap: var(--s5);
  align-items: baseline;
  padding: var(--s4) var(--pad-body);
  margin: 0 calc(var(--pad-body) * -1);
}
.split-row::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--rule);
}
.split-row:last-of-type::after { display: none; }
.split-pc { color: var(--paper); font-size: var(--t-value); text-align: right; }
.split-name { color: var(--paper); }
.split-what { color: var(--ink); }

/* ---- the raster window: his one object ----------------------------------- */

.plate {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 3px solid var(--rule-lit);
  padding: 3px;
  background: var(--bg);
}
.plate-in { position: relative; height: 100%; border: 2px solid var(--rule); overflow: hidden; }
.plate-img,
.plate-cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.plate-img { object-fit: contain; opacity: 0.4; }

.plate-cap {
  margin: var(--s3) 0 0;
  color: var(--muted);
  font-size: var(--t-label);
  min-height: 24px;
}
.plate-cap b { font-weight: 400; color: var(--ink); }

/* the scan, the one thing on this site that moves */
.scan {
  margin: var(--s2) 0 0;
  color: var(--muted);
  font-size: var(--t-label);
  overflow-wrap: anywhere;
  min-height: 48px;
}
.scan b { font-weight: 400; color: var(--ink); }

/* ---- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 var(--s5);
  border: 2px solid var(--ink);
  background: var(--bg);
  color: var(--paper);
  font: inherit;
  font-size: var(--t-label);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.12s linear, background-color 0.12s linear, border-color 0.12s linear;
}
.btn:hover { background: var(--paper); color: var(--bg); border-color: var(--paper); }
.btn:active { transform: translateY(2px); }
.btn[aria-disabled="true"],
.btn:disabled {
  color: var(--muted);
  border-color: var(--rule);
  background: var(--bg);
  cursor: default;
  pointer-events: none;
}

.links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s3);
  margin-top: var(--s3);
}

.mintrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22ch;
  gap: var(--s3);
  align-items: stretch;
}

.mint {
  margin: 0;
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: var(--s3) var(--s5);
  border: 2px solid var(--rule);
  color: var(--paper);
  overflow-wrap: anywhere;
  min-width: 0;
  user-select: all;
}
.mint.none { color: var(--muted); }

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

.tbl { width: 100%; border-collapse: collapse; }
.tbl { margin: 0 calc(var(--pad-body) * -1); width: calc(100% + var(--pad-body) * 2); }
.tbl th,
.tbl td {
  text-align: left;
  font-weight: 400;
  padding: var(--s3) var(--s4);
  vertical-align: top;
}
.tbl th:first-child, .tbl td:first-child { padding-left: var(--pad-body); }
.tbl th:last-child, .tbl td:last-child { padding-right: var(--pad-body); }
.tbl th {
  color: var(--muted);
  font-size: var(--t-label);
  border-bottom: 2px solid var(--rule-lit);
}
.tbl td { border-bottom: 2px solid var(--rule); color: var(--ink); }
.tbl .num { text-align: right; white-space: nowrap; color: var(--paper); }
.tbl th.num { color: var(--muted); }
.tbl tr.pick td { color: var(--paper); }
.tbl tbody tr:hover td { color: var(--paper); }
.tbl button.rowpick {
  background: none; border: 0; color: inherit; font: inherit;
  padding: 0; cursor: pointer; text-align: left;
}
.tbl button.rowpick:hover { color: var(--paper); text-decoration: underline; text-underline-offset: 4px; }
.tbl .state { color: var(--muted); font-size: var(--t-label); white-space: nowrap; }

/* a horizontal scroller only, and it never swallows the page scroll */
.scroll { overflow-x: auto; overscroll-behavior-x: contain; }

/* ---- forms --------------------------------------------------------------- */

.form { display: grid; grid-template-columns: minmax(0, 1fr) 22ch; gap: var(--s3); align-items: stretch; }
.form .lab { grid-column: 1 / -1; color: var(--muted); font-size: var(--t-label); margin: 0 0 var(--s1); }

.field {
  background: var(--bg);
  border: 2px solid var(--rule);
  color: var(--paper);
  font: inherit;
  padding: var(--s3) var(--s4);
  min-height: 56px;
  min-width: 0;
}
.field::placeholder { color: var(--muted); }
.field:focus { border-color: var(--paper); outline: none; }

.said { margin: var(--s4) 0 0; color: var(--ink); }
.said:empty { display: none; }

/* ---- steps --------------------------------------------------------------- */

.steps { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); }
.step { margin: 0; }
.step h3 {
  margin: 0 0 var(--s2);
  font-size: var(--t-value);
  line-height: 1.3;
  font-weight: 400;
  color: var(--paper);
}
.step p { margin: 0; color: var(--ink); max-width: 56ch; }
.step .n { color: var(--muted); }

/* ---- the live region ----------------------------------------------------- */

.say {
  position: fixed;
  left: 50%;
  bottom: var(--s5);
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--bg);
  padding: var(--s3) var(--s5);
  font-size: var(--t-label);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s linear;
}
.say.on { opacity: 1; }

/* ---- focus --------------------------------------------------------------- */

a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--paper);
  outline-offset: 3px;
}
main:focus { outline: none; }

/* ---- widths -------------------------------------------------------------- */

@media (max-width: 1700px) {
  :root { --page: 1280px; }
}

@media (max-width: 1400px) {
  :root { --page: 1120px; --gut: 40px; }
}

@media (max-width: 1100px) {
  :root { --gut: 32px; --t-display: 38px; }
  .masthead { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .cols, .cols-wide { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  :root { --gut: 20px; --t-display: 32px; --t-h2: 22px; }
  .page { padding: var(--s6) var(--gut); }
  .tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mintrow, .form { grid-template-columns: minmax(0, 1fr); }
  .rows > div { grid-template-columns: minmax(11ch, auto) minmax(0, 1fr); }
  .split-row { grid-template-columns: 5ch minmax(0, 1fr); gap: var(--s2) var(--s4); }
  .split-what { grid-column: 2; }
}

@media (max-width: 520px) {
  :root { --gut: 16px; --pad-body: 22px; --t-display: 28px; --t-h2: 20px; --t-value: 18px; --t-body: 16px; }
  .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .links { grid-template-columns: minmax(0, 1fr); }

  .rows > div { grid-template-columns: minmax(0, 1fr); row-gap: var(--s1); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- the tables on a narrow screen ---------------------------------------
   Five or six columns of a repository name, two star deltas, a licence and a
   state cannot fit a phone. Each row prints as two lines instead, which is
   what every other value on this page does: the name on the first line, the
   rest on the second, separated by a middle dot. The roles keep it a table
   for a screen reader. */
@media (max-width: 820px) {
  .tbl { margin: 0; width: 100%; }
  .tbl, .tbl thead, .tbl tbody, .tbl tr, .tbl td { display: block; width: auto; }
  .tbl thead { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
  .tbl tr { border-bottom: 2px solid var(--rule); padding: var(--s3) var(--pad-body); margin: 0 calc(var(--pad-body) * -1); }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { display: inline; border: 0; padding: 0; text-align: left; }
  .tbl td.name { display: block; color: var(--paper); padding-bottom: var(--s1); }
  .tbl td.date { color: var(--muted); display: block; font-size: var(--t-label); }
  .tbl td.num { text-align: left; }
  .tbl td.line2 ~ td::before { content: " · "; color: var(--muted); }
  .tbl td.num[data-u]::after { content: " " attr(data-u); color: var(--muted); font-size: var(--t-label); }
  .scroll { overflow-x: visible; }
}
