/*
 * Base (issue #43): minimal reset + element defaults on the token system —
 * typography (system font stack), links with visible focus, form controls,
 * table normalization. Visual treatments that are a choice (not a default)
 * are opt-in classes in components.css.
 */

/*
 * The faces, self-hosted (issue #298, doctrine R17 and R18). Literata for
 * reading, Public Sans for headings, IBM Plex Mono for what is raw — all
 * SIL OFL 1.1, vendored under app/assets/fonts with their licence files,
 * served by this relay and never by a third party (AGENTS.md hard rule 8).
 *
 * Chosen on a board, not by taste: docs/design-board-pass1.html narrowed
 * three directions to one, pass1b's matrix put four serifs on our own
 * screens, and pass1c settled the last two at the sizes our voice lives
 * at — 16px prose and 13.6px hints. Literata was drawn for long screen
 * reading, which is what the hints, the posture notes and "what crossed,
 * and what was not learned" actually are.
 *
 * `font-display: swap`: the text is readable in the fallback before the
 * face arrives, because a relay that shows nothing while a font loads has
 * traded a decision's speed for its looks (bible Part VIII).
 */
@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/literata-400-255a4e81.woff2") format("woff2");
}

@font-face {
  font-family: "Literata";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/literata-400-italic-cdb914a2.woff2") format("woff2");
}

@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/literata-600-46fe6789.woff2") format("woff2");
}

@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/public-sans-600-8a6d95c1.woff2") format("woff2");
}

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


/* Keep the scrollbar's space reserved whether or not there is one to
   show. A page that grows past the window when a fold opens would
   otherwise lose ~15 px of viewport at that moment, and everything
   centred on it — which is every screen — would slide half of that
   sideways under the pointer. */
html {
  scrollbar-gutter: stable;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading);
  color: var(--ink);
  background: var(--paper);
}

/* Headings in the civic sans, the body in the serif: the pairing pass 1
   settled (R17). A heading is a label on a document, not a sentence in
   it, so it changes voice rather than size alone. */
h1,
h2,
h3,
h4 {
  font-family: var(--font-headings);
  font-weight: var(--weight-headings);
}

h1 {
  font-size: var(--text-xl);
  margin: var(--space-2) 0 var(--space-4);
}

h2 {
  font-size: var(--text-lg);
  margin: var(--space-6) 0 var(--space-2);
}

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

/* Keyboard focus stays visible everywhere (WCAG 2.4.7); pointer users are
   unaffected thanks to :focus-visible. */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

summary {
  cursor: pointer;
}

/* What is raw stays monospaced (doctrine §5): keys, endpoints, digests,
   protocol words. The reader should be able to tell a value they must
   copy exactly from a sentence about it. */
code,
pre,
samp,
kbd {
  font-family: var(--font-mono);
}

code {
  /* A site key, a digest or an endpoint is one unbroken token, and beside
     a 17rem margin there is no longer room to let it set its own width.
     It breaks where it must rather than deciding the column's width. */
  overflow-wrap: anywhere;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-1);
  font-size: 0.9em;
}

.hint {
  color: var(--muted);
}

/* Form controls */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  font: inherit;
  color: inherit;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  min-width: 18rem;
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: var(--focus-ring);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* Tables: normalization only — the bordered treatment is .table */

table {
  border-collapse: collapse;
  font: inherit;
}

th {
  text-align: left;
}

/* Description lists (detail screens) */

dl {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: var(--space-2) var(--space-4);
  margin: var(--space-4) 0;
}

dt {
  color: var(--muted);
  font-weight: var(--weight-semibold);
}

dd {
  margin: 0;
}
