/* Reset + element defaults. */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--c-text);
  background: var(--c-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
svg.icon { flex-shrink: 0; }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--s-4);
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: var(--lh-heading);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p, ul, ol, dl, blockquote, figure, table { margin: 0 0 var(--s-4); }
p { text-wrap: pretty; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }

strong, b { font-weight: 700; }
small { font-size: var(--fs-small); }
hr { border: 0; border-top: 1px solid var(--c-border); margin: var(--s-8) 0; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

::selection { background: var(--c-yellow); color: var(--c-ink); }

:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Dark sections: a black ring is invisible there (WCAG 2.4.7), so they use yellow (≈ 14:1 on black). */
.prefooter, .site-footer, .course-final, .section--black, .course-hero, .home-hero { --c-focus: var(--c-yellow); }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 1000;
  padding: var(--s-3) var(--s-4);
  background: var(--c-yellow);
  color: var(--c-ink);
  font-weight: 700;
  border-radius: var(--r-sm);
}
.skip-link:focus { top: var(--s-4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Page-to-page navigation crossfades instead of flashing blank (cross-document view transitions; browsers without
   support navigate as before). The header is its own group, so it stays put while the content fades. Only without a
   reduced-motion preference: the rule above doesn't reach the ::view-transition pseudo-elements. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .site-header { view-transition-name: site-header; }
  ::view-transition-group(root) { animation-duration: 200ms; animation-timing-function: var(--ease); }
}
