/* Elevenses — "plain paper".
   Graphite monochrome. Hairlines, type and whitespace do all the work.
   Dark mode is a near-direct inversion of the ink/paper scale.
   The house brand does not govern this site; Raleway, IBM Plex Mono, the
   highlighter and the 2px corner limit are taken by choice. */

:root {
  --paper:   #fbfbfa;
  --surface: #ffffff;
  --rule:    #e3e3e0;
  --mid:     #c2c2bf;
  --ink:     #16171a;
  --ink-2:   #494b52;
  --ink-3:   #85878e;

  /* Highlighter — author-applied, prose only. Never in chrome. */
  --hl-amber:   #e1ae8c;
  --hl-forest:  #a5baae;
  --hl-crimson: #dcaaaa;
  --hl-slate:   #bcc9d1;

  --ff-head: 'Raleway', 'Helvetica Neue', sans-serif;
  --ff-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --sp-sm: .5rem; --sp-md: 1rem; --sp-lg: 1.5rem;
  --sp-xl: 2rem;  --sp-2xl: 3rem; --sp-3xl: 4rem;
  --radius: 2px;
  --measure: 66ch;
  --transition: background .25s, color .25s, border-color .25s;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:   #101114;
    --surface: #17181c;
    --rule:    #2c2e34;
    --mid:     #4a4d55;
    --ink:     #f4f4f3;
    --ink-2:   #b6b8be;
    --ink-3:   #7d8087;
    --hl-amber:   #966e4d;
    --hl-forest:  #495f4c;
    --hl-crimson: #7c4745;
    --hl-slate:   #576367;
  }
}
:root[data-theme="dark"] {
  --paper:   #101114;
  --surface: #17181c;
  --rule:    #2c2e34;
  --mid:     #4a4d55;
  --ink:     #f4f4f3;
  --ink-2:   #b6b8be;
  --ink-3:   #7d8087;
  --hl-amber:   #966e4d;
  --hl-forest:  #495f4c;
  --hl-crimson: #7c4745;
  --hl-slate:   #576367;
}

* { box-sizing: border-box; }

body {
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--ff-head);
  font-weight: 400;
  line-height: 1.6;
  margin: 0;
  transition: var(--transition);
}

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.wrap { max-width: 62rem; margin: 0 auto; padding: 0 var(--sp-lg) var(--sp-3xl); }

/* ─── Masthead — inverts with the theme, unlike the house topbar ─── */
.masthead {
  border-bottom: 1px solid var(--rule);
  padding: var(--sp-2xl) 0 var(--sp-md);
  margin-bottom: var(--sp-2xl);
}
.masthead .name {
  font-family: var(--ff-head); font-weight: 900; text-transform: uppercase;
  letter-spacing: -.02em; font-size: 2rem; color: var(--ink);
  line-height: 1; text-decoration: none; display: inline-block;
}
.masthead .by {
  font-family: var(--ff-mono); font-size: .66rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-3); margin-top: .5rem;
}
.masthead nav { display: flex; gap: var(--sp-lg); margin-top: var(--sp-md); }
.masthead nav a {
  font-family: var(--ff-mono); font-size: .68rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); text-decoration: none;
}
.masthead nav a:hover { color: var(--ink); }

.flash {
  border: 1px solid var(--mid); border-radius: var(--radius);
  padding: var(--sp-md); margin-bottom: var(--sp-xl);
  font-size: .9rem; color: var(--ink);
}
.flash p { margin: 0; }

/* ─── Shelf and archive ─── */
.shelf-label {
  font-family: var(--ff-mono); font-size: .66rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--sp-md);
}
.shelf { display: flex; flex-direction: column; }
.piece {
  border-top: 1px solid var(--rule);
  padding: var(--sp-lg) 0;
  display: grid; grid-template-columns: 8rem 1fr; gap: var(--sp-lg);
}
.piece:last-child { border-bottom: 1px solid var(--rule); }
@media (max-width: 720px) {
  .piece { grid-template-columns: 1fr; gap: .35rem; }
}
.piece-date {
  font-family: var(--ff-mono); font-size: .64rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3);
}
.piece-date a { color: var(--ink-3); }
.piece-title {
  font-family: var(--ff-head); font-weight: 700; font-size: 1.15rem;
  line-height: 1.25; color: var(--ink); margin: 0 0 .45rem;
  letter-spacing: -.005em; text-wrap: balance;
}
.piece-title a { color: var(--ink); text-decoration: none; }
.piece-title a:hover { text-decoration: underline; }
.piece-desc { font-size: .88rem; color: var(--ink-3); margin: 0; line-height: 1.55; }

/* ─── The reading layer ─── */
.article { margin-top: var(--sp-xl); }
.article-inner {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) 1fr;
  gap: var(--sp-xl);
}
@media (max-width: 880px) { .article-inner { grid-template-columns: 1fr; } }

.art-title {
  font-family: var(--ff-head); font-weight: 700; font-size: 2.1rem;
  line-height: 1.15; letter-spacing: -.015em; color: var(--ink);
  margin: .4rem 0 var(--sp-lg); text-wrap: balance;
}
.art-body p { margin: 0 0 var(--sp-md); font-size: 1.02rem; line-height: 1.72; }
.art-body h2, .art-body h3 {
  font-family: var(--ff-head); font-weight: 700; color: var(--ink);
  letter-spacing: -.005em; margin: var(--sp-xl) 0 var(--sp-sm);
}
.art-body h2 { font-size: 1.35rem; }
.art-body h3 { font-size: 1.15rem; }
.art-body pre {
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: var(--sp-md); overflow-x: auto;
  font-family: var(--ff-mono); font-size: .82rem;
}
.art-body code { font-family: var(--ff-mono); font-size: .88em; }
.art-body img { max-width: 100%; height: auto; }
.art-body figure { margin: var(--sp-lg) 0; }
.art-body figcaption {
  font-family: var(--ff-mono); font-size: .63rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-top: .6rem;
}

/* Highlighter — the only colour on the site, and only here. */
.art-body mark, .art-body .hl {
  background-image: linear-gradient(var(--hl-amber), var(--hl-amber));
  background-size: 100% 40%; background-repeat: no-repeat; background-position: 0 86%;
  background-color: transparent; color: var(--ink);
}
.art-body mark.forest  { background-image: linear-gradient(var(--hl-forest), var(--hl-forest)); }
.art-body mark.crimson { background-image: linear-gradient(var(--hl-crimson), var(--hl-crimson)); }
.art-body mark.slate   { background-image: linear-gradient(var(--hl-slate), var(--hl-slate)); }

/* Margin notes — IBM Plex Mono. No handwriting face on this site. */
.margin-note {
  font-family: var(--ff-mono); font-size: .72rem; line-height: 1.55;
  letter-spacing: .06em; color: var(--ink-3);
  border-left: 1px solid var(--rule); padding-left: var(--sp-md);
  margin: var(--sp-lg) 0;
}

/* ─── Comments ─── */
.comments {
  margin-top: var(--sp-3xl); border-top: 1px solid var(--rule);
  padding-top: var(--sp-xl); max-width: var(--measure);
}
.comment { border-bottom: 1px solid var(--rule); padding: var(--sp-md) 0; }
.comment-meta {
  font-family: var(--ff-mono); font-size: .64rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: .4rem;
}
.comment p { margin: 0; font-size: .95rem; }

.comment-form { margin-top: var(--sp-xl); }
.comment-form p { margin: 0 0 var(--sp-md); display: flex; flex-direction: column; gap: .35rem; }
.comment-form label {
  font-family: var(--ff-mono); font-size: .64rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3);
}
.comment-form input, .comment-form textarea, .newsletter input {
  font-family: var(--ff-head); font-size: .95rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--mid); border-radius: var(--radius);
  padding: .55rem .7rem;
}
.comment-form input, .comment-form textarea { width: 100%; }
.comment-form textarea { min-height: 8rem; resize: vertical; }
.comment-form button, .newsletter button {
  font-family: var(--ff-mono); font-size: .68rem; letter-spacing: .1em;
  text-transform: uppercase; background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink); border-radius: var(--radius);
  padding: .6rem 1.1rem; cursor: pointer;
}
.comment-form button:hover, .newsletter button:hover { background: var(--paper); color: var(--ink); }
.comment-form .errorlist {
  list-style: none; padding: 0; margin: 0 0 var(--sp-sm);
  font-size: .82rem; color: var(--ink);
}

.site-foot {
  margin-top: var(--sp-3xl); border-top: 1px solid var(--rule);
  padding-top: var(--sp-lg);
  font-family: var(--ff-mono); font-size: .66rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.newsletter {
  margin-top: var(--sp-3xl); border-top: 1px solid var(--rule);
  padding-top: var(--sp-lg); max-width: var(--measure);
}
.newsletter form { display: flex; gap: var(--sp-sm); flex-wrap: wrap; align-items: flex-end; }
.newsletter label {
  font-family: var(--ff-mono); font-size: .64rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); display: block; margin-bottom: .35rem;
}
.newsletter input { min-width: 16rem; }
