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

:root {
  color-scheme: light dark;
  --bg: #f5f2eb;
  --fg: #2c2c2c;
  --accent: #0366d6;
  --border: #d8d4cb;
  --code-bg: #efebe4;
  --blockquote-border: #0366d6;
  --table-stripe: #f0ece5;
  --gray: #5c5c5c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0d;
    --fg: #e0e0e0;
    --accent: #79b8ff;
    --border: #333;
    --code-bg: #1a1a1a;
    --blockquote-border: #79b8ff;
    --table-stripe: #141414;
    --gray: #aaa;
  }
}

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  padding: 2rem 1rem;
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  margin: 1.5rem 0 0.5rem;
}

h1 { font-size: 2rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p, ul, ol, pre, blockquote, table, dl, figure {
  margin: 0.75rem 0;
}

hr {
  margin: 0.5rem 0;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover { text-decoration-thickness: 2px; }

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

ul, ol { padding-left: 2rem; }
li { margin: 0.25rem 0; }

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", Menlo, Courier, monospace;
  font-size: 0.875rem;
  line-height: 1.45;
  tab-size: 4;
}

code {
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", Menlo, Courier, monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
}

kbd {
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", Menlo, Courier, monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.2em 0.4em;
  box-shadow: 0 1px 0 var(--border);
}

blockquote {
  border-left: 4px solid var(--blockquote-border);
  padding: 0.5rem 1rem;
  color: var(--gray);
}

blockquote p { margin: 0.5rem 0; }

hr {
  border: none;
  border-top: 1px solid var(--border);
}

table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

th { font-weight: 600; }
tr:nth-child(even) { background: var(--table-stripe); }

img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

video {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

dl dt { font-weight: 600; margin-top: 0.5rem; }
dl dd { margin-left: 1.5rem; }

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

footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--gray);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.footer-links a {
  color: var(--gray);
  text-decoration: none;
  display: flex;
  align-items: center;
  line-height: 0;
}

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