/* sam parsons — site stylesheet
   keep this small. one file. */

:root {
  --fg: #1a1a1a;
  --bg: #fafafa;
  --muted: #666;
  --accent: #0044aa;
  --accent-visited: #663399;
  --rule: #ddd;
  --code-bg: #eee;
  --max-width: 860px;
  /* translucent center panel so the checkerboard shows faintly through */
  --panel-bg: rgba(250, 250, 250, 0.83);
  /* checkerboard framing the page on wide screens */
  --check-a: #3a3a3a;
  --check-b: #222222;
  --check-size: 80px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #d8d8d8;
    --bg: #181818;
    --muted: #888;
    --accent: #0099ff;
    --accent-visited: #c79cff;
    --rule: #333;
    --code-bg: #262626;
    --panel-bg: rgba(24, 24, 24, 0.80);
  }
  img, svg, video { filter: brightness(0.92); }
}

/* on mobile the checkerboard shows through the whole panel (no gutters),
   so make the panel more opaque for readability */
@media (max-width: 600px) {
  :root { --panel-bg: rgba(250, 250, 250, 0.94); }
}
@media (max-width: 600px) and (prefers-color-scheme: dark) {
  :root { --panel-bg: rgba(24, 24, 24, 0.93); }
}

* { box-sizing: border-box; }

html {
  font-size: 17px;
  /* a background on the root stops the body's translucent background from
     being propagated across the whole canvas (so the gutters stay solid) */
  background-color: var(--check-a);
}

/* dark grey checkerboard painted on a fixed layer behind everything.
   position:fixed stays put on scroll on mobile too, unlike
   background-attachment:fixed. the translucent body reveals it. */
html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--check-a);
  background-image:
    linear-gradient(45deg, var(--check-b) 25%, transparent 25%, transparent 75%, var(--check-b) 75%),
    linear-gradient(45deg, var(--check-b) 25%, transparent 25%, transparent 75%, var(--check-b) 75%);
  background-size: var(--check-size) var(--check-size);
  background-position: 0 0, calc(var(--check-size) / 2) calc(var(--check-size) / 2);
}

body {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--fg);
  background: var(--panel-bg);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 3rem 4rem;
  min-height: 100vh;
}

/* header / nav */
header.site {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.6rem;
  margin-bottom: 2rem;
}
header.site h1 {
  font-size: 2.5rem;
  font-weight: normal;
  margin: 0 0 0.2rem;
  font-family: monospace;
}
header.site h1 a {
  color: var(--fg);
  text-decoration: none;
}
header.site nav {
  font-size: 0.9rem;
}
header.site nav a {
  margin-right: 0.8rem;
}

/* links */
a { color: var(--accent); text-decoration: underline; }
a:visited { color: var(--accent-visited); }

/* typography */
h1, h2, h3, h4 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.25;
}
h1 { font-size: 1.6rem; margin-top: 0; }
h2 { font-size: 1.25rem; margin-top: 2em; border-bottom: 1px solid var(--rule); padding-bottom: 0.2em; }
h3 { font-size: 1.05rem; margin-top: 1.5em; }

p, ul, ol { margin: 0.8em 0; }
ul, ol { padding-left: 1.5em; }

time {
  font-family: monospace;
  color: var(--muted);
  font-size: 0.9rem;
}

code {
  font-family: "DejaVu Sans Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 2px;
}
pre {
  background: var(--code-bg);
  padding: 0.8em 1em;
  overflow-x: auto;
  border-radius: 3px;
  font-size: 0.85rem;
  line-height: 1.4;
}
pre code { background: none; padding: 0; }

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

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

/* figures */
figure {
  margin: 1.5em 0;
  text-align: center;
}
figure img, figure svg, figure video {
  max-width: 100%;
  height: auto;
}
figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4em;
  font-style: italic;
}

/* the chronological feed (home + category pages) */
ul.feed {
  list-style: none;
  padding: 0;
}
ul.feed li {
  margin-bottom: 1.2em;
  padding-bottom: 1.2em;
  border-bottom: 1px dotted var(--rule);
}
ul.feed li:last-child { border-bottom: none; }
ul.feed .meta {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.2em;
}
ul.feed .meta .tag {
  display: inline-block;
  padding: 0 0.4em;
  margin-left: 0.3em;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-size: 0.8rem;
}
ul.feed h3 {
  margin: 0.1em 0 0.3em;
  font-size: 1.05rem;
}
ul.feed p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* update banner inside a project page */
aside.updates {
  margin: 1.5em 0;
  font-size: 0.95rem;
}
aside.updates h2 {
  font-size: 0.85rem;
  font-weight: normal;
  margin: 0 0 0.3em;
  border: none;
  padding: 0;
  font-family: monospace;
  text-transform: lowercase;
  letter-spacing: 0.03em;
  color: var(--accent);
}
aside.updates ul {
  margin: 0;
  padding-left: 1.2em;
}
aside.updates li { margin: 0.2em 0; }

/* "this is an update to..." banner inside an update post */
aside.updates-parent {
  font-size: 0.9rem;
  color: var(--muted);
  border: 1px dashed var(--rule);
  padding: 0.5em 1em;
  margin: 0 0 1.5em;
}

/* footer */
footer.site {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--muted);
}

/* fixed site wordmark, pinned to the bottom-right corner; ignores scroll.
   sits in the dark checkerboard gutter on wide screens. */
body::after {
  content: "slparsons.net";
  position: fixed;
  right: 0.9rem;
  bottom: 0.6rem;
  font-family: monospace;
  font-size: 1.53rem;
  letter-spacing: 0.03em;
  color: #b0b0b0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 10;
}

/* KaTeX sanity — keep display math from overflowing on mobile */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.2em 0;
}
