* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

body.is-drawer-open {
  overflow: hidden;
}

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

img {
  height: auto;
}

a {
  color: var(--link-color);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

a:hover {
  color: #174483;
}

:root[data-theme="dark"] a:hover {
  color: #70bce7;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] a:hover {
    color: #70bce7;
  }
}

button,
input,
select {
  font: inherit;
}

button,
select {
  color: inherit;
}

button {
  cursor: pointer;
}

a,
button,
.button {
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--space-4);
  color: var(--heading-color);
  font-family: var(--font-heading);
  line-height: 1.18;
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--header-height) + var(--space-4));
}

h1 {
  font-size: clamp(2rem, 4vw, 3.7rem);
}

h2 {
  margin-top: var(--space-12);
  font-size: clamp(1.55rem, 2.5vw, 2.1rem);
}

h3 {
  margin-top: var(--space-8);
  font-size: 1.25rem;
}

p,
ul,
ol,
dl,
table,
blockquote,
figure,
pre {
  margin: 0 0 var(--space-5);
}

ul,
ol {
  padding-left: 1.35rem;
}

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

hr {
  height: 1px;
  margin: var(--space-8) 0;
  border: 0;
  background: var(--border);
}

code,
kbd {
  border-radius: 0.25rem;
  padding: 0.1em 0.35em;
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 0.9em;
}

pre {
  overflow-x: auto;
  padding: var(--space-5);
  border-radius: var(--radius-md);
  background: var(--code-bg);
  color: var(--code-ink);
  white-space: pre;
}

pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

th,
td,
code,
pre,
a,
button,
select {
  overflow-wrap: anywhere;
}

.button,
.button-secondary,
.icon-button,
.search-field button {
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-muted);
  font-weight: 700;
}

::selection {
  background: var(--accent-soft);
}
