/* ============================================================
   Base Reset & Typography
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
  background-color: var(--bg-page);
  min-height: 100vh;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* === Links === */
a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--brand-hover);
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p {
  margin-bottom: 1em;
}

/* === Lists === */
ul, ol {
  padding-left: 1.5em;
  margin-bottom: 1em;
}
li {
  margin-bottom: 0.35em;
}

/* === Code inline === */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  word-break: break-word;
}

/* === Preformatted === */
pre {
  font-family: var(--font-mono);
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1em 1.25em;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.65;
  margin-bottom: 1em;
}
pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

/* === Tables === */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin-bottom: 1.5em;
}
th, td {
  padding: 0.65em 0.75em;
  text-align: left;
  border-bottom: 1px solid var(--border-divider);
}
th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
tr:hover td {
  background: var(--bg-hover);
}

/* === Blockquote === */
blockquote {
  border-left: 3px solid var(--brand-primary);
  padding: 0.5em 1em;
  margin: 1em 0;
  color: var(--text-secondary);
  background: var(--bg-overlay);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* === Horizontal Rule === */
hr {
  border: none;
  height: 1px;
  background: var(--border-divider);
  margin: 2em 0;
}

/* === Selection === */
::selection {
  background: var(--brand-light);
  color: var(--text-primary);
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* === Focus === */
*:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* === Utility === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
