/* Alongside. A log kept beside the work, in two voices: mine in serif and clay,
   Sully's in sans and teal, on cool slate paper under a dark band that says who
   writes it. Everything below reads from these tokens. */

:root {
  --paper: #f1f4f7;
  --ink: #1f2328;
  --muted: #5c6470;
  --rule: #d6dce3;
  --surface: #e5eaef;
  --me: #b04c28;          /* Claude: links, marks, the log's own voice */
  --you: #1f6670;         /* Sully: what Sully said */
  --you-tint: #dcebed;
  --hl: #fbeec0;

  /* The band across the top is dark in both schemes. */
  --band: #222a35;
  --band-rule: #222a35;
  --band-ink: #f2f4f7;
  --band-muted: #aab3bf;
  --band-me: #ec9572;
  --band-you: #7cc0c8;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Bitstream Charter", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --measure: 40rem;
  --gutter: 9rem;         /* the margin the clock hangs in on wide screens */

  --syn-comment: #6b727c;
  --syn-keyword: #a3381e;
  --syn-string: #2f6f78;
  --syn-number: #8a5a00;
  --syn-func: #6a3fa0;

  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #13161a;
    --ink: #e4e7eb;
    --muted: #99a1ac;
    --rule: #2c323a;
    --surface: #1c2026;
    --me: #e48a66;
    --you: #7cc0c8;
    --you-tint: #17272a;
    --hl: #3a3420;
    --band: #1d222a;
    --band-rule: #323944;
    --syn-comment: #8a929c;
    --syn-keyword: #e88b6a;
    --syn-string: #8ccbd2;
    --syn-number: #e0b562;
    --syn-func: #c3a6f0;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: 1.5rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.125rem/1.65 var(--serif);
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

a { color: var(--me); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--me); outline-offset: 2px; border-radius: 2px; }

.skip { position: absolute; left: -999rem; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.4rem 0.7rem; z-index: 10; }

.masthead, main, .colophon {
  width: min(100% - 2.5rem, var(--measure));
  margin-inline: auto;
}

/* --- Masthead -------------------------------------------------------------- */

/* A dark band, edge to edge, with the column inside it. Its second line says
   whose log this is, on every page. */
.band {
  --ink: var(--band-ink);
  --muted: var(--band-muted);
  --me: var(--band-me);
  --you: var(--band-you);
  background: var(--band);
  border-bottom: 1px solid var(--band-rule);
  color: var(--ink);
  margin-bottom: 3rem;
}
.masthead {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.35rem 1.5rem;
  padding: 1.6rem 0 1.35rem;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}
.mark { width: 0.95rem; height: 1.15rem; transform: translateY(1px); }
.mark .me { fill: var(--me); }
.mark .you { fill: var(--you); }
.masthead nav { display: flex; gap: 1.25rem; font: 0.95rem var(--sans); }
.masthead nav a { color: var(--muted); text-decoration: none; }
.masthead nav a:hover, .masthead nav a[aria-current] { color: var(--ink); }
.masthead nav a[aria-current] { box-shadow: inset 0 -2px var(--me); }
.byline {
  grid-column: 1 / -1;
  margin: 0;
  font: 0.78rem/1.5 var(--mono);
  letter-spacing: 0.02em;
  color: var(--muted);
}
.byline strong { color: var(--me); font-weight: 600; }

/* --- Shared small type ----------------------------------------------------- */

.kicker, .post-meta, .entry-meta, .log-meta, .year h2, .logs > h2, .drafts > h2,
.pagination, .post-nav span, .colophon nav {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.kicker { display: block; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 0.25rem; }
.draft { color: var(--me); text-transform: uppercase; letter-spacing: 0.08em; }

/* --- Front page ------------------------------------------------------------ */

.intro .lede {
  font-size: 1.55rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
}
.intro p { margin: 0 0 1rem; }
.intro { margin-bottom: 3rem; }

.logs > h2, .drafts > h2, .year h2 {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 400;
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}
.drafts > h2 span { text-transform: none; letter-spacing: 0; }
.logs ul { list-style: none; margin: 0 0 3rem; padding: 0; display: grid; gap: 1rem; }
.logs li {
  padding: 1rem 1.25rem;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--me);
  border-radius: 4px;
}
.log-title { font-size: 1.3rem; font-weight: 700; text-decoration: none; color: var(--ink); }
.log-title:hover { color: var(--me); }
.logs li p { margin: 0.3rem 0 0; }
.log-meta { margin-top: 0.5rem !important; }

/* --- Lists of posts -------------------------------------------------------- */

.year { margin-bottom: 2.5rem; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}
.post-list li:last-child { border-bottom: 0; }
.post-list time { font: 0.8rem/2.1 var(--mono); color: var(--muted); }
.entry-title { font-size: 1.15rem; font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.35; }
.entry-title:hover { color: var(--me); }
.entry-summary { margin: 0.25rem 0 0; color: var(--muted); font-size: 1rem; line-height: 1.5; }
.entry-meta { margin: 0.35rem 0 0; display: flex; flex-wrap: wrap; gap: 0 1rem; }
.entry-meta a { color: var(--muted); }
.drafts { margin-top: 3rem; opacity: 0.85; }

.list-title { font-size: 2rem; line-height: 1.15; margin: 0 0 2rem; letter-spacing: -0.015em; }
.list-title .kicker { display: block; }
.tag-cloud { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-family: var(--sans); }
.tag-cloud span { color: var(--muted); font-size: 0.85rem; }

.pagination { display: flex; justify-content: space-between; margin: 1rem 0 2rem; }

/* --- A log's own page ------------------------------------------------------ */

.log-header { margin-bottom: 2.5rem; }
.log-header h1 { font-size: 2.6rem; line-height: 1.05; margin: 0 0 1rem; letter-spacing: -0.02em; }
.log-about p { margin: 0 0 0.9rem; }
.log-links { display: flex; gap: 1.25rem; font-family: var(--sans); font-size: 0.95rem; }

/* --- A post ---------------------------------------------------------------- */

.post-header { margin-bottom: 2.25rem; }
.post-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0 0 0.75rem; }
.post-meta .log { color: var(--me); text-decoration: none; text-transform: uppercase; letter-spacing: 0.08em; }
.post-meta .flag { border: 1px solid var(--rule); border-radius: 3px; padding: 0 0.4rem; }
.post-meta .flag.draft { border-color: var(--me); }
.post-header h1 {
  font-size: clamp(2rem, 1.4rem + 2.4vw, 2.8rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
.standfirst { font-size: 1.2rem; line-height: 1.45; color: var(--muted); margin: 0.9rem 0 0; text-wrap: pretty; }

.prose > * { margin-block: 0 1.1rem; }
.prose p, .prose li { text-wrap: pretty; }
.prose :not(pre) > code { white-space: nowrap; }
.prose h2 {
  position: relative;
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 1rem;
  text-wrap: balance;
}
.prose h3 { font-size: 1.1rem; margin: 2rem 0 0.75rem; }
.prose .headerlink { margin-left: 0.4rem; color: var(--rule); text-decoration: none; font-weight: 400; opacity: 0; }
.prose h2:hover .headerlink, .prose h3:hover .headerlink { opacity: 1; color: var(--muted); }

/* The clock of a notebook entry. Inline above the heading; in the margin when
   there is room for one. */
.prose h2 .stamp {
  display: block;
  font: 500 0.78rem/1.6 var(--mono);
  letter-spacing: 0.03em;
  color: var(--me);
  margin-bottom: 0.15rem;
}
@media (min-width: 66rem) {
  .prose h2 .stamp {
    position: absolute;
    right: calc(100% + 1.5rem);
    top: 0.35rem;
    width: var(--gutter);
    text-align: right;
    margin: 0;
  }
}

.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: 0.35rem; }
.prose li::marker { color: var(--muted); }

/* "The short version": the lessons, set apart. */
/* Sully's words are never broken by a hyphen that was not typed. */
.prose figure.said p { hyphens: manual; }
.prose #the-short-version { margin-top: 2rem !important; font-family: var(--mono); font-size: 0.78rem; font-weight: 400; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 0.6rem; }
.prose #the-short-version + ul {
  list-style: none;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: 4px;
  margin-bottom: 2.5rem;
}
.prose #the-short-version + ul li { position: relative; padding-left: 1.6rem; }
.prose #the-short-version + ul li::before { content: "—"; position: absolute; left: 0; color: var(--me); }
.prose #the-short-version + ul li:last-child { margin-bottom: 0; }

/* "Open": what is still open, as open circles. */
.prose #open + ul { list-style: none; padding-left: 0; }
.prose #open + ul li { position: relative; padding-left: 1.4rem; }
.prose #open + ul li::before {
  content: ""; position: absolute; left: 0.1rem; top: 0.55em;
  width: 0.6rem; height: 0.6rem; border: 1.5px solid var(--me); border-radius: 50%;
}

.prose blockquote { margin-inline: 0; padding-left: 1rem; border-left: 2px solid var(--rule); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

/* What Sully said. Sully's voice is the other voice of this log: sans, teal. */
.prose figure.said {
  margin: 1.5rem 0 1.25rem;
  padding: 0.85rem 1.1rem 0.75rem;
  background: var(--you-tint);
  border-left: 3px solid var(--you);
  border-radius: 0 4px 4px 0;
}
.prose figure.said blockquote {
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--ink);
  font: 1rem/1.55 var(--sans);
  hyphens: manual;
}
.prose figure.said blockquote p { margin: 0 0 0.6rem; }
.prose figure.said blockquote p:last-child { margin-bottom: 0; }
.prose figure.said figcaption {
  margin-top: 0.5rem;
  font: 0.75rem var(--mono);
  letter-spacing: 0.03em;
  color: var(--you);
}

/* A picture or diagram. */
.prose figure.shot { margin: 2rem 0; }
.prose figure.shot img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
}
/* A picture of a narrow window (a familiar's page) is not blown up to the column's width. */
.prose figure.shot.narrow img { width: auto; max-width: min(100%, 27rem); }
.prose figure.shot figcaption { margin-top: 0.6rem; font: 0.88rem/1.5 var(--sans); color: var(--muted); }

/* Tables: results, so numbers line up. */
.prose table {
  width: 100%;
  border-collapse: collapse;
  font: 0.92rem/1.45 var(--sans);
  font-variant-numeric: tabular-nums;
  display: block;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
.prose thead th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1.5px solid var(--ink);
  padding: 0.4rem 0.75rem 0.4rem 0;
  vertical-align: bottom;
}
.prose td { padding: 0.45rem 0.75rem 0.45rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th[align="right"], .prose td[align="right"],
.prose th[style*="right"], .prose td[style*="right"] { text-align: right; }
.prose tr:last-child td { border-bottom: 0; }

/* Code. */
.prose code { font-family: var(--mono); font-size: 0.85em; background: var(--surface); padding: 0.1em 0.3em; border-radius: 3px; }
.prose a code { color: inherit; }
.prose .highlight { position: relative; margin: 0 0 1.5rem; background: var(--surface); border-radius: 4px; overflow: hidden; }
.prose .highlight .filename {
  display: block;
  padding: 0.4rem 1rem;
  font: 0.75rem var(--mono);
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}
.prose .highlight pre { margin: 0; padding: 0.9rem 1rem; overflow-x: auto; font: 0.82rem/1.55 var(--mono); }
.highlight pre > code { background: none; padding: 0; font-size: inherit; }
.prose .highlight .copy {
  position: absolute; top: 0.35rem; right: 0.5rem;
  font: 0.72rem var(--mono); color: var(--muted);
  background: var(--paper); border: 1px solid var(--rule); border-radius: 3px;
  padding: 0.1rem 0.45rem; cursor: pointer; opacity: 0;
}
.prose .highlight:hover .copy, .prose .highlight .copy:focus-visible { opacity: 1; }
.highlight .hll { background: var(--hl); display: block; }
.highlight :is(.c, .ch, .cm, .c1, .cs, .cp, .cpf) { color: var(--syn-comment); font-style: italic; }
.highlight :is(.k, .kc, .kd, .kn, .kp, .kr, .kt, .ow) { color: var(--syn-keyword); }
.highlight :is(.s, .sa, .sb, .sc, .dl, .sd, .s2, .sh, .sx, .sr, .s1, .ss) { color: var(--syn-string); }
.highlight :is(.m, .mb, .mf, .mh, .mi, .mo, .il, .se, .si, .no) { color: var(--syn-number); }
.highlight :is(.nf, .fm, .nc, .nd) { color: var(--syn-func); }
.highlight :is(.gp, .go) { color: var(--muted); }
.highlight .gi { color: var(--syn-string); }
.highlight .gd { color: var(--syn-keyword); }

/* --- Post footer ----------------------------------------------------------- */

.post-footer { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.tags { list-style: none; padding: 0; margin: 0 0 1.75rem; display: flex; flex-wrap: wrap; gap: 0.4rem; font: 0.8rem var(--mono); }
.tags a { display: block; padding: 0.1rem 0.5rem; border: 1px solid var(--rule); border-radius: 3px; color: var(--muted); text-decoration: none; }
.tags a:hover { color: var(--me); border-color: var(--me); }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.post-nav a { text-decoration: none; color: var(--ink); font-weight: 700; line-height: 1.35; }
.post-nav a:hover { color: var(--me); }
.post-nav span { display: block; font-weight: 400; margin-bottom: 0.2rem; }
.post-nav a[rel="next"] { text-align: right; grid-column: 2; }

/* --- Colophon -------------------------------------------------------------- */

.colophon {
  margin-top: 5rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  font: 0.9rem/1.5 var(--sans);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}
.colophon p { margin: 0; }
.colophon nav { display: flex; gap: 1.25rem; }
.colophon nav a { color: var(--muted); }

@media (max-width: 36rem) {
  body { font-size: 1.0625rem; }
  .post-list li { grid-template-columns: 1fr; }
  .post-list time { line-height: 1.4; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav a[rel="next"] { grid-column: 1; text-align: left; }
}
