:root {
  --bg: #fff;
  --bg-alt: #eee;
  --text: #000;
  --link: #00f;
  --border: #000;
  /* the backdrop sits away from the panel in the same direction the shadow
     does, so the panel reads as raised in either scheme */
  --shadow: #ccc;
  --page: #eee;
  --col: 12ch;
  --gutter: 1rem;
  --edge: 1.2rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --bg-alt: #1c1c1c;
    --text: #fff;
    --link: #8ab4ff;
    --border: #444;
    --shadow: #000;
    --page: #262626;
  }
}

/* the page floats as a panel on a tinted backdrop */
html { background: var(--page); }

body {
  font-size: 18px;
  font-family: Univers, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  background-color: var(--bg);
  color: var(--text);
  word-wrap: break-word;
  /* the column plus its inset: the padding sits inside the border */
  max-width: calc(900px + 2 * var(--edge));
  margin: var(--edge) auto;
  border: 1px solid var(--border);
  box-shadow: 3px 3px var(--shadow);
}

/* the header/footer rules run the full width of the panel, so the inset is on
   the inner wrappers rather than on body */
header > div, footer > div, main { padding: 0 var(--edge); }

h1, h2, h3, h4, h5, h6 { margin-top: 0; margin-bottom: .2em; }
h1 { font-size: 1.3rem; line-height: 1.3; }
h2 { font-size: 1.2rem; }
h3, h4, h5, h6 { font-size: 1rem; }

p { margin: 0.4rem 0 0.8rem; line-height: 1.5; }
ul { list-style-type: none; margin-top: 0; padding-left: 0; }
pre { overflow: scroll; }

blockquote {
  border-left: 0.4rem solid var(--border);
  background: var(--bg-alt);
  font-style: italic;
  margin: 1em 10px;
  padding: 0.2em 10px;
}

a, a:visited { color: var(--link); }
a:hover { text-decoration: none; }
img { max-width: 100%; display: block; }

main a[href^="http"]:where(:not([href*="andrejzg.com/"]))::after { content: "↗︎"; }

header {
  padding: 0.5rem 0 0.4rem;
  margin: 0 0 0.7rem;
  border-bottom: 1px solid var(--border);
}

footer {
  padding: 0.4rem 0 0.5rem;
  margin-top: 1.2rem;
  border-top: 1px solid var(--border);
  text-align: right;
}

/* the date line under a post title */
article h1 + span { display: block; margin: 0.1em 0 0.9em; }

/* the global ul reset above is for nav/index lists; prose lists keep bullets */
article ul, article ol { margin: 0 0 0.8rem; padding-left: 1rem; }
article ul { list-style-type: square; }
article li { margin-bottom: 0.3em; }

ul.blog-posts { margin: 0.3rem 0 0; }
ul.blog-posts li { display: flex; }
ul.blog-posts li span {
  flex: none;
  width: var(--col);
  padding-right: var(--gutter);
  font-family: monospace;
}

@media screen and (max-width: 767px) {
  /* no room to frame anything: the panel goes back to being the page */
  body {
    line-height: 1.4;
    margin: 0;
    border: none;
    box-shadow: none;
  }
  ul.blog-posts li { flex-direction: column; margin-bottom: 1rem; }
}

/* the photo + links row on the homepage: the links are distributed so the
   first line's top and the last line's bottom meet the photo's edges */
.intro {
  display: flex;
  gap: var(--gutter);
  margin: 0.75rem 0;
}
/* monospace so --col's ch resolves against the same font the dates use */
.intro img {
  flex: none;
  font-family: monospace;
  width: var(--col);
  height: var(--col);
  background: var(--bg-alt);
}
.intro-links {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  line-height: 1.2;
}
