/* --------------------------------------------------------------------------
   Reset + page-wide defaults.
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
}

body,
h1, h2, h3, p, figure, dl, dd, ul, li {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

/* Views set their own display, so `hidden` needs the last word. */
[hidden] {
  display: none !important;
}

/* Applied for a single frame to move something without animating it. */
.no-transition {
  transition: none !important;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur-slow) var(--ease),
              color var(--dur-slow) var(--ease);
}

img,
svg {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

kbd {
  font-family: inherit;
  font-size: 0.85em;
  line-height: 1;
  padding: 0.24em 0.42em;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background-color: var(--bg-elev);
  white-space: nowrap;
}

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

/* One focus treatment for the whole app. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: var(--sp-4);
  z-index: 20;
  padding: var(--sp-2) var(--sp-4);
  background-color: var(--bg-elev);
  color: var(--text);
  text-decoration: none;
  transform: translateY(calc(-100% - var(--sp-5)));
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Motion is decoration here — never information. Strip all of it on request.
   The exceptions live next to the things they apply to, in components.css: the
   caret sliding between characters, a character taking on its colour as it is
   typed, and the chart readout sliding between seconds. None of them plays on
   its own — each one is a direct answer to a keypress or to the pointer — so
   they are feedback, not decoration. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
