/* Rules shared by every page: the lesson site and the real-life example sites.
   Each page's own stylesheet sets the tokens used here (--font, --text, --bg,
   --surface, --focus, --radius and --accent-text). */

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

@media (min-width: 640px) {
  body {
    font-size: 1.0625rem;
  }
}

h1,
h2,
h3 {
  line-height: 1.2;
}

a {
  color: var(--accent-text);
}

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

/* Scripts hide and show parts of a page with the hidden attribute. It must win
   over any display rule a component sets. */
[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.skip-link:focus {
  top: 12px;
}

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

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
