/*
 * Three text styles: display (Young Serif, headings), body (Literata),
 * small (0.9rem, muted, for secondary details). One link style.
 * Spacing steps: 0.5rem, 1rem, 2rem, 3.5rem.
 */

:root {
  /* Sky palette */
  --bg: #d9f0fb; --margin: #c6e7f7; --text: #16364a; --muted: #3f6073; --rule: #b4d9ea;
  --accent: #0b6a9e; --code-bg: #c9e7f5;
  /* Always bright: "only" also opts out of browsers' automatic dark mode. */
  color-scheme: only light;

  --font-display: "Young Serif", serif;
  --font-body: "Literata", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { position: relative; scroll-behavior: smooth; background: var(--margin); }

body {
  display: flow-root;
  margin: 0 auto;
  min-height: 100vh;
  max-width: 40rem;
  padding: 0 1.25rem;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* A 48px strip of column colour on each side, so the sprites keep clear of the text. */
html::before, html::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 48px;
  background: var(--bg);
}
html::before { left: calc(50% - 20rem - 48px); }
html::after { right: calc(50% - 20rem - 48px); }

/* Sprite rows fill the margins, anchored to the column so the sprites beside it stay whole.
   The PNGs are drawn at 2x, so they're shown at half size to stay sharp on dense screens. */
body::before, body::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc(50% - 20rem - 48px);
  background-size: 672px 384px;
}
body::before { left: 0; background-image: url("images/sprites/rows.png"); background-position: right top; }
body::after { right: 0; background-image: url("images/sprites/rows.png"); background-position: left top; }

/* Too narrow for margins: one row of sprites above the content and one below it. */
@media (max-width: 56.25rem) {
  html { background: var(--bg); }
  html::before, html::after { display: none; }
  main { padding-top: 2rem !important; }
  body::before, body::after {
    position: static;
    display: block;
    width: auto;
    height: 88px;
    margin: 0 -1.25rem;
    background-position: center top;
    background-repeat: space no-repeat;
    background-size: auto 88px;
  }
  body::before { background-image: url("images/sprites/band-top.png"); }
  body::after { background-image: url("images/sprites/band-bottom.png"); }
}

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

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.2; }

.small, .work p, .timeline p, .when, time, .education, .site-footer { color: var(--muted); font-size: 0.9rem; }
.nowrap { white-space: nowrap; }

main { padding-top: 4rem; }

/* Intro */

.intro h1 { font-size: 2.5rem; margin: 0 0 0.5rem; }
.intro p { margin: 0 0 1rem; }
.tagline { margin-bottom: 0.5rem !important; }
.links { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 2rem !important; }

/* Sections */

section { margin-top: 3.5rem; }
section h2 { font-size: 1.35rem; margin: 0 0 1rem; }

ul.work, ul.posts, ol.timeline { list-style: none; margin: 0; padding: 0; }

.work li { margin-bottom: 1rem; }
.work p, .timeline p { margin: 0.1rem 0 0; }

.posts li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.5rem; }
.posts time { white-space: nowrap; }

.timeline li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; margin-bottom: 1rem; }
.when { font-variant-numeric: tabular-nums; padding-top: 0.2rem; }
.education { margin: 0; }

.site-footer { margin-top: 3.5rem; padding-bottom: 3.5rem; }

@media (max-width: 30rem) {
  main { padding-top: 2rem; }
  .intro h1 { font-size: 2.1rem; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
}

/* Posts */

.post header { margin: 2rem 0; }
.post h1 { font-size: 2.2rem; margin: 0 0 0.5rem; }
.post-body h2 { font-size: 1.35rem; margin: 2rem 0 0.5rem; }
.post-body h3 { font-size: 1.1rem; margin: 2rem 0 0.5rem; }
.post-body img { max-width: 100%; height: auto; border-radius: 4px; }
.post-body figure { margin: 2rem 0; }
.post-body figcaption { color: var(--muted); font-size: 0.9rem; text-align: center; margin-top: 0.5rem; }
.post-body blockquote { margin: 1rem 0; padding-left: 1rem; border-left: 3px solid var(--rule); color: var(--muted); }
.post-body code { background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 3px; font-size: 0.9em; }
.post-body pre { background: var(--code-bg); padding: 1rem; border-radius: 6px; overflow-x: auto; line-height: 1.45; }
.post-body pre code { background: none; padding: 0; }
.post-body table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.post-body th, .post-body td { border-bottom: 1px solid var(--rule); padding: 0.5rem; text-align: left; }
.back { margin: 3.5rem 0; }
