/* Bear-inspired, text-first layout with a system-matched dark palette. */
:root {
  color-scheme: light dark;
  --background: #fff;
  --text: #242a2d;
  --muted: #67747a;
  --link: #376b8c;
  --rule: #e1e5e7;
  --code-background: #f3f5f6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0b252e;
    --text: #e4e9eb;
    --muted: #b7c6cb;
    --link: #9bbdd2;
    --rule: #28424b;
    --code-background: #15343e;
  }
}

html {
  background: var(--background);
}

body#blog,
body#post {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

header,
main,
footer {
  box-sizing: border-box;
  width: min(100% - 2.5rem, 44rem);
  margin-inline: auto;
}

header {
  padding: 1.4rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.95rem;
}

main {
  padding: 1.2rem 0 2.7rem;
}

footer {
  padding: 1.2rem 0 2rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

article {
  max-width: 68ch;
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.35;
  text-wrap: pretty;
}

h1 {
  margin: 0 0 1.15rem;
  font-size: clamp(1.8rem, 5vw, 2.15rem);
  letter-spacing: -0.025em;
}

h2 {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.4rem;
}

h3 {
  margin: 1.3rem 0 0.65rem;
  font-size: 1.12rem;
}

p,
ul,
ol {
  margin: 0 0 1rem;
}

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

li {
  margin: 0.15rem 0;
}

li::marker {
  color: var(--muted);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

blockquote {
  margin: 1.4rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

blockquote > :last-child {
  margin-bottom: 0;
}

hr {
  margin: 1.8rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

img {
  max-width: 100%;
  height: auto;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

code {
  padding: 0.1em 0.3em;
  background: var(--code-background);
}

pre {
  overflow-x: auto;
  padding: 0.9rem 1rem;
  background: var(--code-background);
  line-height: 1.55;
}

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

::selection {
  background: #426779;
  color: #fff;
}
