*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.5;
}

/* Form controls inherit the body font. Element selectors keep this below the class-based
   typography rule, so .btn-primary still gets the pixel font. */
button,
input,
select,
textarea {
  font: inherit;
}

/* Typography rule: the pixel font is reserved for headers, badges, section titles and
   primary buttons. This is the only rule that may reference --font-pixel
   (enforced by tests/unit/typography.test.js). */
h1,
h2,
h3,
.app-title,
.section-title,
.badge,
.btn-primary {
  font-family: var(--font-pixel);
}

h1,
h2,
h3 {
  margin: 0 0 var(--space-3);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.02em;
}

h1 {
  font-size: var(--text-2xl);
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

p {
  margin: 0 0 var(--space-4);
}

a {
  color: var(--color-info);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--color-primary);
}

img,
svg {
  display: block;
  max-width: 100%;
}

.pixel-icon {
  image-rendering: pixelated;
  flex-shrink: 0;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

[tabindex='-1']:focus {
  outline: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@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;
  }
}
