/* ==========================================================================
   Base: reset, element defaults, accessibility helpers
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
figure,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

/* Form controls never exceed their container (e.g. the comment form on phones). */
input,
select,
textarea { max-width: 100%; }

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}

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

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* Icon sprite usage: <svg class="icon"><use href="#i-name"></use></svg> */
.icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--sm { width: 0.875rem; height: 0.875rem; }
.icon--lg { width: 1.625rem; height: 1.625rem; stroke-width: 1.6; }

/* Typographic roles */
.u-display {
  font-family: var(--font-display);
  font-weight: 500;
}

.u-mono {
  font-family: var(--font-mono);
}

.u-label {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-ink-3);
}

.u-label--accent { color: var(--color-accent); }

.u-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-ink);
  color: var(--color-paper);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
  color: var(--color-paper);
}

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--page-margin));
  margin-inline: auto;
  padding-inline: var(--page-margin);
}

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

/* The hidden attribute must always win over component display rules. */
[hidden] {
  display: none !important;
}

.u-self-start { align-self: flex-start; }
.icon--accent { color: var(--color-accent); }
.u-label--on-field { color: var(--color-on-field-3); }
