/* Log. One face, one color.
   Face: Courier Prime everywhere, a typewriter Courier redrawn for screens. The log is
   short lines and dates, which is what a monospace is good at; nothing here is long
   enough to tire a reader in mono. Headings stay at body size on purpose: a typewriter
   has one size, so rank comes from weight and position.
   Color: --color-today, set once in the style attribute of <body> in index.html. The
   ground, the picture tint and the printed line all read it. Ink is #111111 throughout. */

:root {
  color-scheme: light;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  --ink: #111111;
  --field: var(--color-today, #c9d6c3);
  margin: 0;
  padding: 28px 16px 40px;
  background: var(--field);
  color: var(--ink);
  font: 400 15px/1.5 "Courier Prime", ui-monospace, "Cascadia Code", "Source Code Pro",
        Menlo, Consolas, "DejaVu Sans Mono", monospace;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "head"
    "color"
    "nav"
    "main"
    "foot";
  align-content: start;
}

/* The memorable move: print the body's own style attribute, so the copy shows the exact
   line that paints the page. attr() in content works in every current browser. */
body::before {
  content: attr(style);
  grid-area: color;
  font-weight: 700;
  overflow-wrap: anywhere;
}

::selection {
  background: var(--ink);
  color: var(--field);
}

h1,
h2 {
  font-size: 1em;
  font-weight: 700;
  line-height: inherit;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  background: var(--ink);
  color: var(--field);
  text-decoration-line: none;
}

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

.masthead {
  grid-area: head;
}

.masthead h1 + p {
  margin-bottom: 1.5em;
}

.sections {
  grid-area: nav;
  margin-top: 1.5em;
  display: flex;
  flex-wrap: wrap;
  gap: 0 2ch;
}

main {
  grid-area: main;
  margin-top: 3em;
  min-width: 0;
}

main h2 {
  margin-bottom: 1.5em;
}

/* The log: number, date, line. Numbers are written in the markup so they survive
   copy and paste; the list marker is off. */
.log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.log li {
  display: grid;
  grid-template-columns: 5ch minmax(0, 1fr);
  column-gap: 1ch;
}

.log li + li {
  margin-top: 1.5em;
}

.log .n {
  grid-column: 1;
  grid-row: 1;
}

.log time {
  grid-column: 2;
  grid-row: 1;
}

.log p {
  grid-column: 2;
}

/* Pictures: grey dithers multiplied onto the field, so white turns into the field color
   and the ink stays ink. Shown at 1x or exactly 2x, never in between, so the dither holds. */
.log figure {
  grid-column: 1 / -1;
  margin: 0.75em 0 0;
  width: fit-content;
  max-width: 100%;
  background: var(--field);
  isolation: isolate;
}

.log img {
  display: block;
  width: 288px;
  max-width: 100%;
  height: auto;
  mix-blend-mode: multiply;
  image-rendering: pixelated;
}

.log figcaption {
  font-style: italic;
  margin-top: 0.25em;
}

#about {
  margin-top: 3em;
  max-width: 64ch;
}

#about p + p {
  margin-top: 1.5em;
}

.colophon {
  grid-area: foot;
  margin-top: 3em;
  padding-top: 1.5em;
  border-top: 1px solid var(--ink);
  max-width: 70ch;
}

.colophon .sample {
  font-size: 13px;
}

@media (min-width: 40em) {
  body {
    padding: 40px 32px 56px;
  }

  .log li {
    grid-template-columns: 5ch 11ch minmax(0, 1fr);
  }

  .log p {
    grid-column: 3;
    grid-row: 1;
  }

  .log figure {
    grid-column: 2 / -1;
  }

  main {
    max-width: 70ch;
  }
}

@media (min-width: 45em) {
  .log img {
    width: 576px;
  }
}

/* Two columns from here: name on the left, log on the right, all of it hung from the left
   edge. The right side of a wide screen stays empty field. */
@media (min-width: 70em) {
  body {
    padding: 56px 48px 64px clamp(48px, 8vw, 128px);
    grid-template-columns: 30ch minmax(0, 70ch);
    column-gap: 6ch;
    grid-template-rows: auto auto auto 1fr auto;
    grid-template-areas:
      "head  main"
      "color main"
      "nav   main"
      ".     main"
      ".     foot";
  }

  main {
    margin-top: 0;
  }
}
