/*
 * Librarium Militaris: element defaults.
 *
 * What the document looks like before a single component is involved.
 */

@layer base {
  html {
    line-height: var(--leading-normal);
    -webkit-text-size-adjust: 100%;
    tab-size: 4;
  }

  body {
    min-height: 100vh;
    position: relative;
    /* `clip` rather than `hidden`: it stops sideways overflow without turning the
       body into a scroll container, which would break the sticky control bar. */
    overflow-x: clip;
    background-color: var(--color-canvas);
    color: var(--color-ink);
    font-family: var(--font-sans);
    font-size: var(--text-16);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

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

  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar-track {
    background: var(--color-canvas);
    border-left: 1px solid var(--color-border);
  }

  ::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent);
  }

  /* The one place !important earns its keep: a reader who has asked the system
     to stop moving things is not overruled by a component. Inside a layer it
     still wins: an !important declaration in an earlier layer beats a later
     one, which is the reverse of how normal declarations resolve. */
  @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;
    }
  }
}
