/* Luminum website — plain, readable, no framework.
 *
 * Two typefaces only: the system sans for prose, Fira Code for everything that
 * belongs to the device rather than the page — the wordmark, the nav, code,
 * table headings. That is the whole visual idea: the chrome is set in the same
 * font the screenshots are drawn in, so the page and the terminal agree.
 *
 * No web serif. Georgia is absent on Linux and fontconfig quietly substitutes
 * something spindly at body size, which is why the old stack looked broken on
 * half the visitors' machines. system-ui always resolves to a face the machine
 * hints well. */

:root {
  /* The device's own palette, lifted from the screenshots so the page and the
     terminal agree on more than the font. These are the literal values Rich
     drew with — grep the SVGs before changing one. */
  --term-bg: #1e1e1e;
  --term-panel: #272727;
  --term-fg: #c5c8c6;
  --term-dim: #8a8d8b;
  --term-teal: #6fb3b0; /* the tty badge, lightened to read on --term-bg */

  /* Ink and paper. Text colours are a ramp: headings darkest, body next,
     muted for anything that is a label rather than a sentence. Nothing that
     carries meaning is lighter than --muted. */
  --ink: #11161d;
  --text: #2c343d;
  --muted: #5f6b78;
  --faint: #8c97a3;

  --bg: #ffffff;
  --panel: #f2f5f7;
  --panel-hover: #e6ebee;
  --rule: #e4e8ec;
  --rule-firm: #c8d0d8;

  /* The same tty teal, darkened instead, because #398280 as drawn is only
     4:1 on white. --accent-wash and --select are it at two dilutions, and
     --on-accent is what survives on top of it. */
  --link: #2f6d6b;
  --link-hover: #1f4b4a;
  --accent-wash: #dff0ed;
  --select: #cfe8e6;
  --on-dark: #ffffff;

  /* The call to action is the terminal's yellow — the shade Rich draws the
     window buttons and the menu's own prompt in. Dark text on it, not white:
     10:1, and it reads as a highlighted key rather than another link. */
  --cta: #febc2e;
  --cta-hover: #ffcf5c;
  --on-cta: #1e1e1e;

  --code-bg: #eef3f3;
  --code-ink: #1f4b4a;

  /* Translucent, so the page scrolling under the sticky header shows through
     the blur. Shadows are --ink at two strengths. */
  --header-bg: rgba(255, 255, 255, 0.9);
  --shadow-near: rgba(17, 22, 29, 0.12);
  --shadow-far: rgba(17, 22, 29, 0.5);

  --sans: system-ui, -apple-system, "Segoe UI", Cantarell, "Noto Sans",
    "DejaVu Sans", Arial, sans-serif;
  --mono: "Fira Code UI", ui-monospace, "SFMono-Regular", "DejaVu Sans Mono",
    Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
}

::selection {
  background: var(--select);
  color: var(--ink);
}

/* padding-inline, not the padding shorthand: .wrap outranks the bare element
   selectors below it, so a shorthand here silently zeroes whatever top and
   bottom padding main/header/footer ask for. */
.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding-inline: 1.5rem;
}

/* Header and navigation */

header.site {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--rule);
  background: var(--header-bg);
  backdrop-filter: saturate(1.4) blur(8px);
}

header.site .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: bold;
  letter-spacing: 0.16em;
  text-decoration: none;
  color: var(--ink);
}

/* The download button rides next to the wordmark on every page. */
.button {
  display: inline-block;
  background: var(--cta);
  color: var(--on-cta);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border-radius: 5px;
}

.button:hover {
  background: var(--cta-hover);
  color: var(--on-cta);
}

/* What the button fetches, said quietly beside it rather than on it. Two
   short lines rather than one long one, so the header still fits the nav. */
.download {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.release {
  font-family: var(--mono);
  font-size: 0.66rem;
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: var(--muted);
}

nav.site {
  display: flex;
  gap: 1.5rem;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

nav.site a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

nav.site a:hover { color: var(--ink); }

nav.site a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--link);
}

/* Text */

main { padding-block: 3rem 4.5rem; }

h1, h2, h3 {
  color: var(--ink);
  font-weight: 600;
}

h1 {
  font-size: clamp(1.95rem, 1.5rem + 1.6vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.021em;
  font-weight: 700;
  margin: 0 0 1rem;
}

/* Anchor targets sit under a sticky header, so they need room reserved above
   them or the jump lands with the title hidden. */
h2, h3 { scroll-margin-top: 5.5rem; }

h2 {
  font-size: 1.4rem;
  line-height: 1.3;
  letter-spacing: -0.012em;
  margin: 3.4rem 0 0.9rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
}

/* The rule divides sections from each other; the first one follows the lead
   or a figure, which already sets it apart. */
main > h2:first-of-type {
  border-top: none;
  padding-top: 0;
}

h3 {
  font-size: 1.08rem;
  margin: 2.1rem 0 0.5rem;
}

p, ul, ol { margin: 0 0 1.15rem; }
li { margin-bottom: 0.45rem; }

/* A list item with several blocks in it is wrapped in <p> by Markdown; a
   one-line item is not. Keep the two spaced the same. */
li > p { margin-bottom: 0.5rem; }
li > p:last-child { margin-bottom: 0; }

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

a:hover { color: var(--link-hover); }

/* The lead is the first thing read, so it is darker than the body, not
   lighter — grey-on-white reads as disabled text. Size, measure and the rule
   are what set it apart.

   A rule and an indent rather than a filled panel: the rule gives the same
   "this is set apart" without drawing a container. Same
   vocabulary as the aside below, one weight up and without the fill, so the
   two read as a family rather than as the same thing. */
.lead {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--ink);
  max-width: 38rem;
  margin: 0 0 2.5rem;
  padding-left: 1.35rem;
  border-left: 3px solid var(--link);
}

/* A blockquote in the Markdown is an aside — the "mind this" panel. */
blockquote {
  background: var(--panel);
  border-left: 3px solid var(--link);
  border-radius: 0 5px 5px 0;
  padding: 0.9rem 1.15rem;
  margin: 1.8rem 0;
  font-size: 0.97rem;
}

blockquote > p:last-child { margin-bottom: 0; }

/* Code */

code, pre, .mono { font-family: var(--mono); }

/* Inline code stays light. A page of prose is mostly inline code in the
   reference, and dark chips in running text read as a checkerboard. */
code {
  background: var(--code-bg);
  border-radius: 3px;
  padding: 0.12em 0.34em;
  font-size: 0.85em;
  color: var(--code-ink);
}

/* `Ctrl+A`{: .mono } — a key name rather than code, so no box. */
code.mono {
  background: none;
  padding: 0;
  font-size: 0.92em;
  color: inherit;
}

/* Blocks, though, are the terminal's own colours — a recipe on this page and
   a recipe on the device look like the same thing, which is the point. */
pre {
  background: var(--term-bg);
  color: var(--term-fg);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.55;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* Screenshots
 *
 * The shots are SVG, inlined into the page by build.py, and they need Fira Code
 * specifically: Rich placed every glyph at an x derived from its advance width,
 * so in any other font the box-drawing borders stop joining up and the menu
 * clock turns to soup. Hence the font is served here rather than assumed.
 *
 * No local() in the src, on purpose. A visitor with the full Fira Code
 * installed would get its ligatures, and the shots would then show a single
 * arrow glyph where the device's console draws a literal `->`. The subset in
 * fonts/ has the ligatures removed, so everyone sees the same thing.
 *
 * font-display: block because the fallback here is not a different typeface,
 * it is a broken grid; better a beat of nothing than a flash of that. */

@font-face {
  font-family: "Fira Code";
  src: url("fonts/FiraCode-Regular.subset.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Fira Code";
  src: url("fonts/FiraCode-Bold.subset.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

/* The same two files under a second family name, for the page chrome rather
   than the shots. Only font-display differs: blank nav links for up to three
   seconds is a worse trade than a beat of the fallback mono, and a shot cannot
   fall back at all. Same URLs, so it is still one download each. */

@font-face {
  font-family: "Fira Code UI";
  src: url("fonts/FiraCode-Regular.subset.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fira Code UI";
  src: url("fonts/FiraCode-Bold.subset.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

figure {
  margin: 2.25rem 0;
}

figure svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
  border-radius: 8px;
  background: var(--term-bg);
  box-shadow: 0 1px 2px var(--shadow-near),
    0 14px 30px -18px var(--shadow-far);
}

figcaption {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 0.7rem;
}

/* The catalogue — generated from the recipe files by catalogue() in build.py,
   so every selector below has to be matched there rather than in the prose. */

.app-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin: 2rem 0 0.5rem;
}

.app-index a {
  font-family: var(--mono);
  font-size: 0.76rem;
  text-decoration: none;
  color: var(--muted);
  background: var(--panel);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
}

.app-index a:hover {
  color: var(--ink);
  background: var(--panel-hover);
}

.app {
  border-top: 1px solid var(--rule);
  padding-top: 1.6rem;
  margin-top: 2.4rem;
  scroll-margin-top: 5.5rem;
}

/* The section already draws the divider, and .app-title is an h2, which draws
   one of its own — without these two resets every entry gets both. */
.app-title {
  font-size: 1.4rem;
  line-height: 1.3;
  letter-spacing: -0.012em;
  margin: 0 0 0.5rem;
  padding-top: 0;
  border-top: none;
}

.app-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.9rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.app-meta .age,
.app-meta .tag {
  border-radius: 3px;
  padding: 0.2rem 0.45rem;
}

.app-meta .age {
  background: var(--accent-wash);
  color: var(--link-hover);
  font-weight: 700;
}

.app-meta .tag {
  background: var(--panel);
  color: var(--muted);
}

.app-meta .tag::before { content: "#"; opacity: 0.5; }

.app-copy > :last-child { margin-bottom: 0; }

/* Dark, with the summary bar in the shade Rich draws window chrome in, so an
   unfolded recipe looks like the terminal it came from. */
.recipe {
  margin-top: 1.1rem;
  border-radius: 6px;
  background: var(--term-panel);
  overflow: hidden;
}

.recipe > summary {
  cursor: pointer;
  padding: 0.55rem 0.9rem;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--term-dim);
  list-style: none;
}

.recipe > summary::-webkit-details-marker { display: none; }

/* The disclosure triangle is drawn here rather than left to the browser: the
   native marker sits outside the padding and cannot be coloured. */
.recipe > summary::before {
  content: "▸";
  display: inline-block;
  width: 1em;
  color: var(--term-teal);
}

.recipe[open] > summary::before { content: "▾"; }

.recipe > summary:hover { color: var(--term-fg); }

.recipe > summary code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.recipe pre {
  margin: 0;
  border-radius: 0;
}

/* Tables */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  margin: 1.6rem 0;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.8rem;
}

th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }

th {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule-firm);
}

td { border-bottom: 1px solid var(--rule); }

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

td:first-child {
  white-space: nowrap;
  font-weight: 600;
  color: var(--ink);
}

/* Lists
 *
 * Every numbered list on the site is a sequence of instructions, so the steps
 * need no class of their own in the Markdown — the counter is drawn here. */

main ol {
  list-style: none;
  counter-reset: step;
  padding-left: 0;
}

main ol > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.6rem;
  margin-bottom: 0.9rem;
}

main ol > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1em;
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
}

main ul {
  list-style: none;
  padding-left: 0.2rem;
}

main ul > li {
  position: relative;
  padding-left: 1.1rem;
}

main ul > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--rule-firm);
}

/* Footer */

footer.site {
  background: var(--term-bg);
  padding: 2.25rem 0 3rem;
  font-size: 0.85rem;
  color: var(--term-dim);
}

footer.site p {
  margin: 0 0 1rem;
  max-width: 34rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
}

footer.site a {
  color: var(--term-teal);
  text-decoration: none;
}

footer.site a:hover {
  color: var(--on-dark);
  text-decoration: underline;
}

@media (max-width: 34rem) {
  body { font-size: 16.5px; }
  .wrap { padding-inline: 1.15rem; }
  main { padding-block: 3rem 3.5rem; }
  .lead { padding-left: 1rem; }
  header.site .wrap { padding-bottom: 0.75rem; }
  /* Pinned right, caption first, so the button sits at the screen edge. */
  .download {
    margin-left: auto;
    flex-direction: row-reverse;
  }
  .release { text-align: right; }
  .release-kind { display: none; }
  nav.site {
    margin-left: 0;
    gap: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
