/* The SmaLLM page : black, white, red, and red rain behind it.

   Built like the tiny page: flat fills and whole pixels. What differs is the
   accent, the rain behind everything, and the cells of notes against
   llama.cpp where tiny has its terminal. */

/* --- webfont ----------------------------------------------- *
   The file /css/site.css serves, by the same URL, so every page on
   the site shares one cache entry for it.
   ============================================================ */
@font-face {
  font-family: "Paper Mono";
  src: url("/fonts/paper-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  size-adjust: 103.1353%;   /* 0.606 em advance up to 0.625: see /css/site.css */
}

/* --- tokens ------------------------------------------------ */
:root {
  /* Dark already: keeps a phone browser's automatic dark mode from recoloring
     the page (see /css/site.css). */
  color-scheme: dark;

  --bg:     #000000;
  --fg:     #ffffff;
  --fg-2:   #8c8c8c;   /* the repo link, one step off white */
  --line:   #1c1c1c;   /* the bar's hairline, barely off black */
  --line-2: #2e2e2e;   /* the install box, which needs an edge that shows */
  /* A shade off the page, so a box reads as a panel and not as a hole. */
  --panel:  #0a0a0a;

  /* Two reds, one for each job, the way tiny has two greens. As a fill this
     one carries white text at 5.20:1; as text on black it would be 4.04:1,
     short of what small text needs. */
  --red:    #d42121;
  /* Hover. Lighter, but only as far as white text allows: 4.72:1. */
  --red-hi: #e02424;
  /* Red as ink on black: 5.94:1, and 5.60:1 on the panels. The mark in the
     bar, the figures SmaLLM wins, and what it wins by. */
  --red-ink: #ff3b3b;
  /* The other engines' bars: there, but not competing with the red ones. */
  --bar-2:  #3a3a3a;

  --mono: "Paper Mono", ui-monospace, "SF Mono", SFMono-Regular,
          "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

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

body {
  margin: 0;
  /* A column at least as tall as the window, as on the Crucible page, so
     the footer sits at the bottom of a tall window rather than partway up
     it with rain under it. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/25px var(--mono);
  -webkit-font-smoothing: antialiased;
}

/* --- rain -------------------------------------------------- */
/* Fixed behind everything, and drawn by js/rain.js. As tall as the largest
   the window gets (lvh), so a phone's toolbars coming and going do not
   resize it, which would start the rain over. */
.rain {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100vh; height: 100lvh;
  display: block;
  pointer-events: none;
}
/* Everything else above it. */
.bar, .hero, .specs, .foot { position: relative; z-index: 1; }

/* Words that sit on the rain rather than on a panel get a shadow of the page's
   black around each letter, so the rain passes behind them instead of
   through them. */
.hero__title, .hero__line, .cmd__label, .cmd__note, .cmd__sizes, .specs__src {
  text-shadow: 0 0 6px #000, 0 0 2px #000, 0 0 1px #000;
}

/* --- top bar ----------------------------------------------- */
/* The same 40px bar as Crucible's and tiny's: three items on one vertical
   center, nothing wraps, and the repo link truncates rather than growing the
   bar. Black, so the rain falls behind it rather than through its words. */
.bar {
  display: flex; align-items: center; flex-wrap: nowrap;
  gap: 12px; height: 40px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
/* The padding gives the arrow a target bigger than the mark; the path strokes
   in currentColor so the hover moves it with the text. */
.bar__back {
  display: inline-flex; align-items: center;
  color: var(--fg-2);
  text-decoration: none;
  padding: 5px 2px; flex: none;
  transition: color .15s;
}
.bar__back svg {
  width: 14px; height: 14px; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.bar__back:hover { color: var(--red-ink); }
.bar__back:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.bar__name {
  font: 500 15px/15px var(--mono);
  color: var(--fg);
  text-decoration: none;
  letter-spacing: 0; flex: none;
}
/* The mark is markup rather than ::before so its tilde can be lifted. */
.bar__mark { color: var(--red-ink); }
/* Paper Mono sets its tilde at hyphen height, under the middle of the slash
   beside it, so "~/" reads as a tilde that has slipped. Lifted 0.09375 em, as
   on every page of the site. */
.tilde { position: relative; top: -0.09375em; }
.bar__name:hover { color: var(--red-ink); }
.bar__repo {
  font: 400 12px/15px var(--mono);
  color: var(--fg-2);
  text-decoration: none;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar__repo:hover { color: var(--fg); text-decoration: underline; }

/* --- hero -------------------------------------------------- */
/* As tall as what is in it, so the notes under it start on the first screen. */
.hero {
  display: flex; flex-direction: column; align-items: center;
  gap: 36px;
  padding: 48px 28px 16px;
}
.hero__head { display: flex; flex-direction: column; align-items: center; gap: 20px; }
/* Bottom aligned: the mark stands on the title's baseline, which is 11px up
   from the foot of its line box (the room for descenders "SmaLLM" has none
   of), so the mark's bottom margin takes that back. */
.hero__unit { display: flex; align-items: flex-end; gap: 20px; }
/* Two bars no taller than the title: the white one to the top of its
   capitals (59px at 80), the red one about half that. Whole pixels at every
   step, so the edges stay sharp. */
.mark { display: flex; align-items: flex-end; gap: 4px; margin-bottom: 11px; }
.mark__tall, .mark__short { display: block; width: 14px; }
.mark__tall { height: 59px; background: var(--fg); }
.mark__short { height: 29px; background: var(--red); }

/* 80px, and 64 and 48 at the steps below, are multiples of 8, so at the
   face's 0.625 em every column is a whole pixel (50px here). Whole
   letter-spacing keeps the advance whole, since tracking adds to it. */
.hero__title {
  margin: 0;
  font: 500 80px/80px var(--mono);
  letter-spacing: -2px;
  color: var(--fg);
}
/* 19.2px for 12px columns. A step off white: it is said under the title, not
   beside it. */
.hero__line {
  margin: 0;
  font: 400 19.2px/28px var(--mono);
  color: var(--fg-2);
  text-align: center;
}

/* --- button ------------------------------------------------ */
/* White on the red: 5.20:1, where black would be 4.04:1. Flat fill, square
   corners, no border. */
.btn {
  display: inline-block;
  border: 0;
  background: var(--red);
  color: #ffffff;
  font: 500 15px/15px var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  padding: 17px 30px;
  transition: background-color .15s;
}
.btn:hover { background: var(--red-hi); }
.btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

/* --- install line ------------------------------------------ */
/* The button and the command are one offer, so they share a column of their
   own and the hero's gap stays between that column and the title above it.
   Full width, so the box below measures itself against the hero rather than
   against its own command, which is wider than a phone. */
.get { display: flex; flex-direction: column; align-items: center; gap: 20px; width: 100%; }

/* Wide enough that the whole command shows: the longest is 82 characters
   at 8px (see .cmd__text), 656px, plus the padding and the button.
   Narrower than that it scrolls rather than wraps, since a wrapped shell
   command reads as two commands. */
.cmd { width: 100%; max-width: 900px; }

/* The marks stand outside the box, in a column of their own, so the boxes
   keep one left edge whether that column holds one mark or two. */
.cmd__row { display: flex; align-items: center; gap: 14px; }
.cmd__row + .cmd__row { margin-top: 10px; }
.cmd__os {
  flex: none;
  /* Packed against the box: the Windows row carries one mark where the row
     above it carries two. */
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  width: 52px;
  color: var(--fg-2);
}
.cmd__os svg { width: 18px; height: 18px; display: block; fill: currentColor; }
.cmd__label {
  margin: 0 0 8px;
  font: 400 13px/16px var(--mono);
  color: var(--fg-2);
  text-align: center;
}
.cmd__box {
  flex: 1; min-width: 0;
  display: flex; align-items: stretch;
  border: 1px solid var(--line-2);
  background: var(--panel);
}
.cmd__text {
  flex: 1; min-width: 0;
  overflow-x: auto;
  white-space: pre;
  padding: 14px 16px;
  /* 12.8, not 13: at the face's 0.625 em that is 8px a character, every
     column on a whole pixel. */
  font: 400 12.8px/20px var(--mono);
  color: var(--fg);
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
/* White until it is used, then the red fill, the same pairing the download
   button uses. */
.cmd__copy {
  flex: none;
  border: 0; border-left: 1px solid var(--line-2);
  background: transparent;
  color: var(--fg);
  font: 500 12px/20px var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 14px 18px;
  cursor: pointer;
  transition: background-color .15s, color .15s;
  /* "Copy" and what replaces it are different lengths; a fixed width keeps
     the box from twitching when the label swaps. 116 holds the longest,
     "SELECT IT", at 113.5. */
  min-width: 116px;
}
.cmd__copy:hover,
.cmd__copy.is-said { background: var(--red); color: #ffffff; }
.cmd__copy:focus-visible { outline: 2px solid var(--fg); outline-offset: -2px; }
/* Holds its line whether or not it has anything to say, so confirming the
   copy does not shift the page under the pointer. */
.cmd__note {
  margin: 8px 0 0; min-height: 16px;
  font: 400 12px/16px var(--mono);
  color: var(--fg-2);
  text-align: center;
}
/* The binary sizes, in the row the status line keeps empty: pulled up over it
   rather than given a row of their own, so nothing moves for them. They step
   aside while the status line is saying "copied". */
.cmd__sizes {
  margin: -16px 0 0;
  font: 400 12px/16px var(--mono);
  color: var(--fg-2);
  text-align: center;
  text-wrap: balance;
}
.cmd__note:not(:empty) + .cmd__sizes { visibility: hidden; }

/* --- against llama.cpp and Ollama ---------------------------- */
/* Size and memory in one group of cells, then speed in a column for each
   kind of hardware. As wide as the showcases on the other project pages
   (Crucible's tour, tiny's terminal): 1440px less 28 each side. */
.specs {
  width: 100%; max-width: 1440px;
  margin: 0 auto;
  padding: 40px 28px 64px;
}
.specs__title {
  margin: 0 0 20px;
  font: 500 19.2px/24px var(--mono);
  color: var(--fg);
}
/* The groups' names, and over each column of speeds the hardware's, all in
   white. */
.specs__group, .plat__name {
  margin: 0 0 12px;
  font: 500 12.8px/16px var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg);
}
.specs__grid + .specs__group { margin-top: 40px; }
/* Speed's name has the model after it, and room under it so it reads as the
   group's name over the columns'. */
.specs__group--speed { margin-bottom: 20px; }
/* The model after Speed and the hardware after each column's name, in gray.
   Kept whole: where a line is too long, the parentheses go to a line of
   their own rather than breaking inside "i7-14700K". The longest is 280px,
   inside the narrowest place it has to fit (292px, a phone 320 wide). */
.specs__with, .plat__hw { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--fg-2); white-space: nowrap; }
.specs__title, .specs__group, .plat__name {
  text-shadow: 0 0 6px #000, 0 0 2px #000, 0 0 1px #000;
}

/* Every cell is the same size: three across (two and one at the steps
   below), and in each, room for two lines of description and three of fine
   print whether they use it or not. Every description fits two lines and
   every fine print three in the narrowest cell any step allows (252px
   inside), so the cells and their parts line up across both groups. */
.specs__grid, .plats, .plat__notes {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  gap: 12px;
}
.specs__grid, .plats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* The columns stand on their cells. Below about 1055px the longest name line
   takes two lines in its column, and standing the columns on their feet
   keeps the cells level all the same. */
.plats { align-items: end; }
.plat { min-width: 0; }

.note {
  display: flex; flex-direction: column;
  border: 1px solid var(--line-2);
  background: var(--panel);
  padding: 16px 18px 14px;
}
.note__top { display: grid; gap: 2px; }
.note__title {
  margin: 0;
  font: 500 12.8px/16px var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg);
}
/* What SmaLLM wins by, in its red, the largest thing in the cell. 25.6px
   for 16px columns. */
.note__gain {
  margin: 0;
  font: 500 25.6px/32px var(--mono);
  color: var(--red-ink);
}
/* Two lines kept whether the description fills them or not (the longest
   need 31 characters a line). */
.note__what {
  margin: 6px 0 14px;
  min-height: 38px;
  font: 400 13px/19px var(--mono);
  color: var(--fg-2);
}

.note__rows { margin: 0; display: grid; gap: 10px; }
/* The name, and beside it the figure with its bar under it. The name's
   column is ten of the name's own characters ("llama.cpp" is nine), so the
   figures start at the same place. */
.note__row {
  display: grid;
  grid-template-columns: 10ch minmax(0, 1fr);
  align-items: baseline;
  gap: 0 10px;
  font: 400 13px/20px var(--mono);
}
.note__row dt { color: var(--fg-2); }
/* 19.2px for 12px columns. */
.note__row dd {
  margin: 0;
  display: grid; gap: 4px;
  font: 400 19.2px/24px var(--mono);
}
.note__val { color: var(--fg-2); white-space: nowrap; }
.note__bar { display: block; height: 8px; }
.note__bar > span {
  display: block; height: 100%;
  /* A sliver at least, so a figure a hundredth of the other still has a bar. */
  width: max(3px, var(--w));
  background: var(--bar-2);
}
/* SmaLLM's row: the red one. */
.note__row.is-win dt { color: var(--fg); }
.note__row.is-win .note__val { color: var(--red-ink); font-weight: 600; }
.note__row.is-win .note__bar > span { background: var(--red); }
/* Not measured: the words, smaller, and the bar's room kept, so the cell
   keeps its height. */
.note__row.is-none .note__val { font-size: 13px; }

/* Three lines kept, with the space above them (14 + 3 x 17). */
.note__fine {
  margin: 0;
  padding-top: 14px;
  min-height: 65px;
  font: 400 11.2px/17px var(--mono);
  color: var(--fg-2);
}

.specs__src {
  margin-top: 14px; margin-bottom: 0;
  font: 400 12px/16px var(--mono);
  color: var(--fg-2);
}
.specs__src a { color: var(--fg-2); }
.specs__src a:hover { color: var(--fg); }

/* --- foot -------------------------------------------------- */
.foot {
  margin-top: auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px 20px;
  padding: 20px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  font: 400 12px/16px var(--mono);
  color: var(--fg-2);
}
.foot a { color: var(--fg-2); text-decoration: none; }
.foot a:hover { color: var(--fg); text-decoration: underline; }

/* --- responsive steps -------------------------------------- *
   Whole pixels per step, the same way the main site handles its scale.
   ============================================================ */
/* Three cells across hold the widest figure, "27,362 tok/s" (144px), beside
   its name, and every description in two lines, down to a window of about
   965px. Two across do the same down to about 665. */
@media (max-width: 980px) {
  .specs__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Each kind of hardware a row of its own, its two cells side by side. */
  .plats { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .plat__notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .hero__unit { gap: 16px; }
  .hero__title { font-size: 64px; line-height: 64px; }
  /* The capitals are 48px at this step. */
  .mark { gap: 3px; margin-bottom: 9px; }
  .mark__tall, .mark__short { width: 11px; }
  .mark__tall { height: 48px; }
  .mark__short { height: 24px; }
}

@media (max-width: 680px) {
  .specs__grid, .plat__notes { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .get { gap: 16px; }
  .cmd__label { font-size: 12px; }
  .cmd__row { gap: 10px; }
  .cmd__os { width: 40px; gap: 8px; }
  .cmd__os svg { width: 16px; height: 16px; }
  /* 11.2 for 7px columns, the phone's step down from 12.8's 8. */
  .cmd__text { font-size: 11.2px; padding: 12px 12px; }
  .cmd__copy { font-size: 11px; padding: 12px 12px; min-width: 96px; }   /* "SELECT IT" is 95.9 */
  /* 7.2px columns, which keep the sizes to two lines on a 360px phone. */
  .cmd__sizes { font-size: 11.52px; }
  .bar { padding: 0 14px; }
  .hero { gap: 28px; padding: 36px 20px 16px; }
  .hero__head { gap: 14px; }
  .hero__unit { gap: 12px; }
  .hero__title { font-size: 48px; line-height: 48px; letter-spacing: -1px; }
  /* The capitals are 35px at this step. */
  .mark { gap: 3px; margin-bottom: 7px; }
  .mark__tall, .mark__short { width: 8px; }
  .mark__tall { height: 35px; }
  .mark__short { height: 17px; }
  .hero__line { font-size: 16px; line-height: 24px; }
  .specs { padding: 28px 14px 48px; }
  .specs__grid, .plat__notes { gap: 10px; }
  .specs__src { font-size: 11.52px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .bar__back, .cmd__copy { transition: none; }
}
