/* The one file both public surfaces read: the landing (site/landing/) links
   it as /tokens.css and the docs shell (internal/docsgen/templates/page.html)
   links the same URL, so the faces, the palette and the type ladder are
   declared once. scripts/build-site.sh copies it to public/ beside the
   fonts. scripts/contrast-check.sh parses the two theme blocks below by
   their exact opening lines; keep those lines as they are.

   Two voices (docs/design/site-premium.md, Typography): the mono face is the
   machine talking, transcripts, config, state words, flags, metadata; the
   serif is us, headlines and prose. Dark is the default and light is the
   choice: the inline script in each page's head sets data-theme from
   storage before any CSS applies, and with no script the :root block,
   dark, is what renders. */

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}

/* Source Serif 4, variable: weight 400 to 600 and the optical-size axis,
   which the browser drives from the rendered size (font-optical-sizing is
   auto by default), so headlines get the display cut and body copy the
   text cut from one file. Latin subset only; the unicode-range is the one
   the foundry's own CSS ships. */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/source-serif-4-latin-normal.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: 'Source Serif 4';
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/source-serif-4-latin-italic.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;
}

:root {
  --jq-font-prose: 'Source Serif 4', Charter, 'Iowan Old Style', Georgia, serif;
  --jq-font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* The ladder, from a 1.125rem body. h1 is the landing's display size;
     the docs h1 sits one step down because it opens a chapter, not the
     site. Mono runs one step under the body so the two faces meet at the
     x-height, and 0.92em when set inline inside serif prose. */
  --jq-text-body: 1.125rem;
  --jq-leading-body: 1.6;
  --jq-text-lede: 1.375rem;
  --jq-leading-lede: 1.45;
  --jq-text-h1: clamp(2.5rem, 5.5vw, 3.75rem);
  --jq-text-h1-docs: 2.25rem;
  --jq-text-h2: 1.75rem;
  --jq-text-h3: 1.25rem;
  --jq-leading-heading: 1.15;
  --jq-text-caption: 0.9375rem;
  --jq-text-mono: 0.9375rem;
  --jq-text-mono-sm: 0.8125rem;
  --jq-leading-mono: 1.5;
  --jq-measure: 62ch;

  /* Graphite, the default. --jq-muted #9AA0A6 measures 7.11:1 on --jq-bg;
     each state measures 4.92-4.97:1 as text on the same ground, which also
     clears the 3:1 a badge's own fill needs. See scripts/contrast-check.sh. */
  --jq-bg: #101214;
  --jq-fg: #E8EAED;
  --jq-muted: #9AA0A6;
  --jq-rule: rgba(232, 234, 237, 0.15);

  /* State colors, the Nagios exit-code vocabulary: OK, WARNING, CRITICAL,
     UNKNOWN, PENDING. A state is never carried by color alone; it is the
     color and the word, set in the mono face. These five are the only
     chroma on either surface. */
  --jq-state-ok: #259563;
  --jq-state-warning: #B57515;
  --jq-state-critical: #EF3E58;
  --jq-state-unknown: #916AEE;
  --jq-state-pending: #75849B;

  /* The board's two square tones (docs/design/site-premium.md, The board).
     internal/brand renders the OG image from the same values and
     scripts/brand-sync-check.sh holds the two to each other. */
  --jq-square-light: #1C2025;
  --jq-square-dark: #16191D;

  color-scheme: dark;
}

/* Paper. --jq-muted #5C6166 measures 5.99:1 on --jq-bg; the states relit
   for paper measure 5.6:1 and up. */
:root[data-theme="light"] {
  --jq-bg: #FAFAF8;
  --jq-fg: #17181A;
  --jq-muted: #5C6166;
  --jq-rule: rgba(23, 24, 26, 0.15);
  --jq-state-ok: #14764F;
  --jq-state-warning: #8A5A00;
  --jq-state-critical: #C8102C;
  --jq-state-unknown: #6D3FD6;
  --jq-state-pending: #5A6675;
  --jq-square-light: #F2F1EC;
  --jq-square-dark: #E6E4DD;

  color-scheme: light;
}

/* The board (docs/design/site-premium.md, The board), the one component
   both surfaces draw: sixty-four squares in two tones one step off the
   ground, a piece on each occupied square, a larger one for a host and
   a smaller one for a service. The cell's group carries the object's
   state as a class, in the engine's own words: ok, warning, critical,
   unknown, pending for a service, up, down, unreachable, unknown for a
   host, and the piece takes that state's color, the same five values
   the dashboard and the transcript use. A soft state is the same color
   at partial opacity, because a soft state is the same problem before
   it is confirmed; unreachable is the unknown color hatched;
   acknowledged draws the rook mark on the piece in the ground color.
   The fragment itself comes from internal/brand (BoardSVG). */
.board .sq {
  fill: var(--jq-square-light);
}

.board .sq.dark {
  fill: var(--jq-square-dark);
}

.board .piece {
  fill: var(--jq-state-pending);
  fill-opacity: 1;
  transition: fill 240ms ease, fill-opacity 240ms ease;
}

.board .cell.ok .piece,
.board .cell.up .piece {
  fill: var(--jq-state-ok);
}

.board .cell.warning .piece {
  fill: var(--jq-state-warning);
}

.board .cell.critical .piece,
.board .cell.down .piece {
  fill: var(--jq-state-critical);
}

.board .cell.unknown .piece {
  fill: var(--jq-state-unknown);
}

.board .cell.soft-1 .piece {
  fill-opacity: 0.45;
}

.board .cell.soft-2 .piece {
  fill-opacity: 0.65;
}

.board .cell.unreachable .piece {
  fill: url(#board-hatch);
  fill-opacity: 1;
}

.board .hatch {
  fill: var(--jq-state-unknown);
}

.board .ack {
  fill: var(--jq-bg);
  display: none;
}

.board .cell.acked .ack {
  display: block;
}
