/* Base element styling and resets */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  margin-top: 2em;
  margin-bottom: 0.6em;
  scroll-margin-top: calc(var(--topnav-height) + 16px);
}

h1 { font-size: var(--fs-4xl); margin-top: 0; }
h2 { font-size: var(--fs-2xl); border-bottom: 1px solid var(--border-color); padding-bottom: 0.4em; }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { margin: 0 0 1em 0; color: var(--text-secondary); }

a {
  color: var(--accent-600);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

ul, ol {
  color: var(--text-secondary);
  padding-left: 1.4em;
}
li { margin-bottom: 0.4em; }

strong { color: var(--text-primary); font-weight: 600; }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-code);
  color: var(--accent-700);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
}

[data-theme="dark"] code { color: var(--accent-400); }

pre {
  font-family: var(--font-mono);
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1em 1.2em;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  position: relative;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: var(--fs-sm);
}

th, td {
  text-align: left;
  padding: 0.6em 0.8em;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

th {
  background: var(--bg-table-head);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

td.col-name, td.col-type {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--accent-700);
  white-space: nowrap;
}
[data-theme="dark"] td.col-name, [data-theme="dark"] td.col-type { color: var(--accent-400); }

hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2em 0;
}

blockquote {
  border-left: 3px solid var(--border-strong);
  margin: 1em 0;
  padding: 0.2em 1em;
  color: var(--text-muted);
}

img { max-width: 100%; }

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