/* ============================================================
   02 — RESET
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;

  /* Reserves the scrollbar's width whether or not it is showing.

     The loader locks scrolling with `overflow: hidden`, which takes
     the scrollbar away; without this, the bar reappears at the
     moment the loader leaves and shifts the entire page sideways by
     its width. Measured here at 15px — small, but it lands exactly
     when the visitor first looks at the page. */
  scrollbar-gutter: stable;
}

/* Horizontal overflow is clipped, not scrolled — the marquee
   rows extend past the viewport by design. `clip` (not `hidden`)
   keeps position:sticky working in the Showcase section. */
html,
body {
  overflow-x: clip;
}

body {
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
  border-style: none;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* Anchor scrolling clears the fixed nav */
:where(:has(:target)) {
  scroll-behavior: smooth;
}

:target {
  scroll-margin-block-start: 6rem;
}

/* ------------------------------------------------------------
   FOCUS

   Only for keyboard users — :focus-visible rather than :focus, so
   clicking a button does not leave a ring behind it. The offset
   keeps the ring clear of the element's own border on the pill
   buttons and cards.
   ------------------------------------------------------------ */

:focus-visible {
  outline: 2px solid var(--c-border-strong);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ------------------------------------------------------------
   SKIP LINK

   Hidden until focused. The page runs to ~18,000px with a fixed
   nav, so without this a keyboard user tabs through the whole
   header before reaching anything.
   ------------------------------------------------------------ */

.skip-link {
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: 50%;
  translate: -50% -150%;
  z-index: var(--z-top);

  padding: 0.75rem 1.5rem;
  background-color: var(--c-surface-light);
  color: var(--c-text-invert);
  border-radius: 0 0 var(--r-tile) var(--r-tile);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);

  transition: translate var(--dur-fast) var(--ease);
}

.skip-link:focus-visible {
  translate: -50% 0;
}

/* ------------------------------------------------------------
   REDUCED MOTION

   A global backstop. Individual modules also bail out in JS, but
   this covers any CSS transition or animation added later without
   remembering to guard it.
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
