/* Reset, typography, page layout and a few layout utilities. */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--navbar-height) + var(--space-4));
  /* Invisible overlays (tooltips) near the edge must never cause sideways scrolling. */
  overflow-x: clip;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

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

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

button {
  cursor: pointer;
}

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

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); }

p {
  text-wrap: pretty;
}

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

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

mark {
  background: var(--color-highlight);
  color: inherit;
  border-radius: 2px;
  padding: 0 0.1em;
}

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

hr {
  border: 0;
  border-top: var(--border);
}

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

::selection {
  background: var(--color-accent-subtle);
}

/* Page structure */

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -10rem;
  z-index: var(--z-toast);
  padding: var(--space-2) var(--space-4);
  background: var(--color-text);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
}

.skip-link:focus {
  top: var(--space-4);
  color: var(--color-text-inverse);
}

.site-main {
  flex: 1;
  width: 100%;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow { max-width: calc(var(--container-narrow) + 2 * var(--gutter)); }
.container--medium { max-width: calc(var(--container-medium) + 2 * var(--gutter)); }

.page {
  padding-block: var(--space-12) var(--space-16);
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.page-header__title {
  font-size: var(--text-3xl);
}

.page-header__lead {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  max-width: var(--measure);
}

.section + .section {
  margin-top: var(--space-12);
}

.section__title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
}

/* Long-form text (legal pages, decisions) */

.prose {
  max-width: var(--measure);
  line-height: var(--leading-relaxed);
}

.prose > * + * {
  margin-top: var(--space-4);
}

.prose h2 {
  margin-top: var(--space-10);
  font-size: var(--text-xl);
}

.prose h3 {
  margin-top: var(--space-8);
}

.prose ul,
.prose ol {
  padding-left: var(--space-6);
}

.prose li + li {
  margin-top: var(--space-2);
}

/* Layout utilities */

.stack > * + * { margin-top: var(--stack-gap, var(--space-4)); }
.stack--sm { --stack-gap: var(--space-2); }
.stack--lg { --stack-gap: var(--space-8); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-gap, var(--space-3));
}

.cluster--end { justify-content: flex-end; }
.cluster--between { justify-content: space-between; }
.cluster--nowrap { flex-wrap: nowrap; }

.grid-auto {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
}

.text-muted { color: var(--color-text-muted); }
.text-subtle { color: var(--color-text-subtle); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-center { text-align: center; }
.mono { font-family: var(--font-mono); }

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

[hidden] {
  display: none !important;
}
