/* Base: how plain HTML looks before any component styles. Tokens only. */

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--c-text);
  background-color: var(--c-page);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 500; /* STIX Two Text looks heavy any bolder */
  color: var(--c-heading);
  line-height: var(--lh-heading);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
h5 { font-size: var(--fs-lead); }
h6 { font-size: var(--fs-body); }

small { font-size: var(--fs-small); }

a {
  color: var(--c-action);
  text-underline-offset: 0.2em;
}

/* Read by screen readers, not shown (a chart's numbers, a date said in full). */
.visually-hidden {
  position: absolute;
  width: var(--border-1);
  height: var(--border-1);
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A button that opens a record (open_button(), src/forms.php) looks like a link; its form sits in the text. */
.link-button {
  padding: 0;
  color: var(--c-action);
  text-align: start;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.open {
  display: inline;
}

/* iPhone Safari: never below 16px, or it zooms into the field on focus. */
input,
select,
textarea {
  font-size: var(--fs-body);
}

/* Chrome, Edge and Safari: a field the browser fills in itself (a saved email and password) gets the browser's own pale
   blue background and text colour, which no background-color can override (newer Chrome also ignores the old trick of
   delaying the change). So a white inner shadow is painted over it, wide enough to cover the field, and our text colour
   is kept. With focus the ring is added after it (field.css adds the red ring for a field in error, and leaves the
   code boxes see-through). */
input:-webkit-autofill,
input:-webkit-autofill:hover,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--c-text);
  box-shadow: inset 0 0 0 var(--field-h) var(--c-page);
}

input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--c-text);
  box-shadow: inset 0 0 0 var(--field-h) var(--c-page), var(--focus-ring);
}

/* Visible keyboard focus on everything clickable (mouse clicks do not show it): Bootstrap's soft ring.
   The transparent outline still shows in Windows high-contrast mode, which hides box-shadows. */
:focus-visible {
  outline: var(--border-1) solid transparent;
  box-shadow: var(--focus-ring);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
