/* terminal-ish, old school, quiet */

:root {
  --bg: #dcdcd7;
  --fg: #1a1a1a;
  --dim: #5a5a53;
  --line: #a4a49c;
  --link: #0000bb;
  --inset: #e8e8e4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1e1e;
    --fg: #d4d4d4;
    --dim: #90908a;
    --line: #4a4a46;
    --link: #9ecbff;
    --inset: #181818;
  }
}

* { box-sizing: border-box; }

body {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 16px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  max-width: 108ch;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
  border: 1px solid var(--line);
  background: var(--inset);
  padding: 0.6rem 0.9rem;
  margin-bottom: 2rem;
}

header .home {
  font-weight: bold;
  text-decoration: none;
  color: var(--fg);
}

nav { display: flex; flex-wrap: wrap; }

/* nav items: no underline, separated by a thin rule */
nav a {
  text-decoration: none;
  padding: 0 0.75rem;
}

nav a:first-child { padding-left: 0; }
nav a:last-child { padding-right: 0; }
nav a + a { border-left: 1px solid var(--line); }
nav a:hover { text-decoration: underline; }

a { color: var(--link); }

/* visited links look the same as unvisited, site wide */
a:visited { color: var(--link); }

h1, h2, h3 {
  font-size: 1rem;
  font-weight: bold;
  margin: 2rem 0 0.75rem;
}

h1::before { content: "# "; color: var(--dim); }
h2::before { content: "## "; color: var(--dim); }
h3::before { content: "### "; color: var(--dim); }

main > h1:first-child { margin-top: 0; }

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

.meta { color: var(--dim); margin-top: -0.5rem; }

/* entry lists: date + title lines */
ul.entries {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.entries li {
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--line);
}

ul.entries .date {
  color: var(--dim);
  margin-right: 1ch;
  white-space: nowrap;
}

ul.entries .summary {
  color: var(--dim);
  display: block;
}

/* projects index: hero thumbnail beside the title */
ul.entries.projects li {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 0;
}

ul.entries.projects .entry-text { flex: 1 1 auto; }

.thumb {
  flex: 0 0 108px;
  width: 108px;
  height: 108px;
  display: block;
  border: 1px solid var(--line);
  overflow: hidden;
  background: transparent;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 0;
}

.thumb.empty { border-style: dashed; }

/* images inside a page: an italic line right after an image becomes a caption */
main p > img {
  display: block;
  /* keep tall portrait photos from swallowing the whole screen */
  max-height: 78vh;
  width: auto;
}

/* two or more images on one markdown line sit side by side, equal widths */
main p:has(> img + img) {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

main p:has(> img + img) > img {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 30rem) {
  main p:has(> img + img) { flex-direction: column; }
}

main p:has(> img) + p > em:only-child {
  display: block;
  margin-top: -0.75rem;
  color: var(--dim);
  font-style: normal;
}

img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
}

pre {
  border: 1px solid var(--line);
  background: var(--inset);
  padding: 0.75rem;
  overflow-x: auto;
}

code { font-family: inherit; }

blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--line);
  color: var(--dim);
}

table { border-collapse: collapse; }
th, td { border: 1px solid var(--line); padding: 0.25rem 0.6rem; text-align: left; }

footer {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
  color: var(--dim);
}
