/* Base type. Tokens live only in base/variables.css. */
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  font-weight: var(--font-normal);
  letter-spacing: var(--tracking-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings: one weight (600), calm sizes, page h1 grows from 1024 */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-emphasis);
}

h1 {
  font-size: var(--text-2xl);
  letter-spacing: var(--tracking-tighter);
}

h2 {
  font-size: var(--text-lg);
}

h3 {
  font-size: var(--text-base);
}

h4, h5, h6 {
  font-size: var(--text-sm);
}

@media (min-width: 1024px) {
  h1 {
    font-size: var(--text-3xl);
  }
}

/* Code and mono elements */
code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-feature-settings: 'liga' 0;
}

code {
  padding: 0.1em 0.35em;
  background: var(--color-surface-raised);
  border-radius: var(--radius-xs);
  color: var(--color-text-emphasis);
}

kbd {
  padding: 0 0.35em;
  font-size: var(--text-xs);
  color: var(--color-text-emphasis);
  background: var(--color-surface);
  border: 1px solid var(--color-border-control);
  border-radius: var(--radius-xs);
}

pre {
  padding: var(--spacing-lg);
  font-size: var(--text-sm);
  background: var(--color-background-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow-x: auto;
  tab-size: 2;
}

pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

/* Links. Running-text links (unclassed links in a paragraph) are underlined:
 * the accent is under 3:1 against body text, so colour alone cannot mark them
 * (WCAG 1.4.1). Components style their own classed links. */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

p a:not([class]) {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Small text */
small, .text-small {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

/* Muted text */
.text-muted {
  color: var(--color-text-muted);
}

.text-subtle {
  color: var(--color-text-subtle);
}

/* Emphasis */
strong, b, .text-strong {
  font-weight: var(--font-semibold);
}

em, i {
  font-style: italic;
}

/* Mono text utility */
.font-mono {
  font-family: var(--font-mono);
}

/* Counts, times and durations */
.tabular {
  font-variant-numeric: tabular-nums;
}

/* Selection styling */
::selection {
  background: var(--color-primary-surface);
  color: var(--color-text-emphasis);
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
