/*
 * The style of metacore, on the HTML elements themselves: a page is a
 * document first, as on the early web, drawn with the precision of an
 * instrument. Tailwind removes the look of every element, and this file
 * gives each one the look of the identity, so plain HTML is already right.
 *
 * The rules of the style:
 *   - Corners are square, lines are one pixel, and nothing casts a shadow.
 *   - A link is underlined and petrol. Petrol marks what a person can act on.
 *   - A label is in Geist Mono, uppercase and small: a table header, a term,
 *     a legend, a heading of the third level.
 *   - A state of the page comes from its markup, such as `aria-current` or
 *     `:user-invalid`, not from a class.
 *   - Nothing moves. A change shows at once.
 *
 * This file holds the elements of a document: text, links, lists, facts and
 * tables. controls.css holds what a person operates, and overlays.css what
 * opens over the page. All three stay plain CSS in one layer, with no
 * Tailwind syntax: brand/index.html links this file as it is.
 */

@layer base {
  :root {
    color-scheme: light;
    accent-color: var(--ink);
    scrollbar-gutter: stable;
  }

  body {
    background: var(--white);
    color: var(--body);
    font: 400 0.875rem/1.5 var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  ::selection {
    background: var(--accent);
    color: var(--white);
  }

  /* The focus of the keyboard is always visible, and always the same. */
  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  /* Headings: two levels of title, then labels. */

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

  h1 {
    font-size: 1.75rem;
    line-height: 1.15;
    letter-spacing: -0.03em;
  }

  h2 {
    font-size: 1.25rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
  }

  /*
   * The voice of a label. `.label` is the one class of this file: it gives
   * the voice to a label that is none of these elements.
   */
  h3,
  h4,
  h5,
  h6,
  th,
  dt,
  legend,
  caption,
  .label {
    color: var(--stone);
    font: 500 0.6875rem/1.45 var(--mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  /* Text. */

  /*
   * A paragraph keeps a measure that reads, about 80 letters a line, however
   * wide the page around it is.
   */
  p {
    max-width: 72ch;
    text-wrap: pretty;
  }

  a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
  }

  a:hover {
    text-decoration-thickness: 2px;
  }

  /*
   * Where the person is, in a navigation: the link is an ink block, as a
   * selected line on a text screen. The shadow widens the block without
   * moving the links beside it.
   */
  nav a[aria-current="page"] {
    background: var(--ink);
    box-shadow: 0 0 0 0.3em var(--ink);
    color: var(--white);
    text-decoration: none;
  }

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

  small {
    color: var(--stone);
    font-size: 0.8125rem;
  }

  code,
  kbd,
  samp,
  pre {
    font-family: var(--mono);
    font-size: 0.8125rem;
  }

  kbd {
    border: 1px solid var(--stone);
    color: var(--ink);
    padding: 0 0.35em;
  }

  pre {
    background: var(--paper);
    border: 1px solid var(--line);
    color: var(--ink);
    overflow-x: auto;
    padding: 0.75rem 1rem;
  }

  hr {
    border-top: 1px solid var(--ink);
  }

  /* A message that a person must read: a failure, or the news that a thing is done. */
  [role="alert"],
  [role="status"] {
    border-left: 2px solid var(--failed);
    color: var(--ink);
    padding-left: 0.75rem;
  }

  [role="status"] {
    border-left-color: var(--live);
  }

  /* Lists. The bullet is a square, as the core of the symbol. */

  ul {
    list-style: square;
    padding-inline-start: 1.25rem;
  }

  ol {
    list-style: decimal;
    padding-inline-start: 1.75rem;
  }

  ::marker {
    color: var(--stone);
  }

  /* A list of terms is a sheet of facts: the term, then its value. */

  dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.375rem 1.5rem;
    align-items: baseline;
  }

  dd {
    color: var(--ink);
  }

  /* Tables: the whole grid shows, and the figures line up. */

  table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
  }

  caption {
    padding-bottom: 0.5rem;
    text-align: left;
  }

  th,
  td {
    border: 1px solid var(--line);
    padding: 0.4375rem 0.625rem;
    text-align: left;
    vertical-align: baseline;
  }

  th {
    background: var(--paper);
    white-space: nowrap;
  }

  thead th {
    border-bottom-color: var(--ink);
  }

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

  tbody tr:hover > td {
    background: var(--paper);
  }
}
