/* ==========================================================================
   G WORLD — reset, typography and element defaults
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor links land below the sticky header instead of under it. */
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: var(--leading);
  color: var(--text);
  background-color: var(--surface-2);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- headings */

h1,
h2,
h3,
h4 {
  line-height: var(--leading-tight);
  text-wrap: balance;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--step-4);
}
h2 {
  font-size: var(--step-3);
}
h3 {
  font-size: var(--step-2);
}
h4 {
  font-size: var(--step-1);
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
figure,
blockquote,
table,
pre {
  margin-block-end: var(--space-4);
}

/* --------------------------------------------------------------- paragraphs */

p {
  text-wrap: pretty;
}

.lede {
  font-size: var(--step-1);
  color: var(--text-muted);
  max-width: var(--measure);
}

.muted {
  color: var(--text-muted);
}

.subtle {
  color: var(--text-subtle);
  font-size: var(--step--1);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ------------------------------------------------------------------- links */

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

/* ------------------------------------------------------------------- lists */

ul,
ol {
  padding-inline-start: 1.35em;
}

li + li {
  margin-block-start: var(--space-1);
}

.list-plain {
  list-style: none;
  padding: 0;
}

/* ---------------------------------------------------------------- media --- */

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  /* Placeholder background so a slow image does not read as a hole in the card. */
  background-color: var(--surface-3);
}

/* ------------------------------------------------------------------ quotes */

blockquote {
  border-inline-start: 3px solid var(--border-strong);
  padding-inline-start: var(--space-4);
  color: var(--text-muted);
}

/* ------------------------------------------------------------------- code */

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background-color: var(--surface-3);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.35em;
}

pre {
  background-color: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
}

/* ------------------------------------------------------------------ tables */

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

caption {
  text-align: start;
  color: var(--text-muted);
  padding-block-end: var(--space-2);
}

/* ------------------------------------------------------------------- forms */

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

/* --------------------------------------------------------------- focus --- */

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

/* Safari/older engines only support the legacy selector. */
:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------- utility -- */

.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;
  inset-inline-start: var(--space-4);
  inset-block-start: -4rem;
  z-index: calc(var(--z-header) + 1);
  background-color: var(--brand-600);
  color: var(--text-on-brand);
  padding: var(--space-2) var(--space-4);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transition: inset-block-start var(--transition-fast);
}

.skip-link:focus {
  inset-block-start: 0;
}

[hidden] {
  display: none !important;
}

hr {
  border: 0;
  border-block-start: 1px solid var(--border);
  margin-block: var(--space-6);
}

::selection {
  background-color: var(--brand-100);
  color: var(--text);
}
