:root {
  --bg: #ffffff; --fg: #1f2328; --muted: #59636e; --line: #d1d9e0; --rail: #afb8c1; --accent: #0f766e; --code: #f6f8fa;
  --idea: #9a6700; --problem: #cf222e; --project: #1a7f37;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: 7rem; /* the column that holds a date and the line beside it, the same in the map and the archives */
  color-scheme: light dark; /* scrollbars and other browser-drawn parts follow the theme */
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1117; --fg: #e6edf3; --muted: #8b949e; --line: #30363d; --rail: #484f58; --accent: #2dd4bf; --code: #161b22;
          --idea: #d29922; --problem: #f47067; --project: #3fb950; }
  body { line-height: 1.7; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 1.0625rem/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }

header, footer, main { margin: 0 auto; padding-inline: 1.5rem; }
header, footer, main.wide { max-width: 68rem; }
main { max-width: 43rem; padding-bottom: 5rem; }
header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.6rem 1.5rem; padding-top: 1.75rem; }
header a { text-decoration: none; }
.home { color: var(--fg); font: 600 1rem var(--mono); }
.home span { color: var(--accent); }
header nav { display: flex; gap: 1.5rem; align-items: baseline; }
header nav a { color: var(--fg); font-size: 0.95rem; }
header nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.45em; text-decoration-color: var(--accent); }
header nav a.ext { color: var(--muted); font-size: 0.875rem; }
footer { display: flex; gap: 1.5rem; padding-block: 1.5rem 3rem; border-top: 1px solid var(--line); font-size: 0.875rem; }
footer a { color: var(--muted); }

/* type marks: shape and colour both carry the kind */
.m { display: inline-block; width: 0.62rem; height: 0.62rem; flex: none; position: relative; z-index: 1; box-shadow: 0 0 0 4px var(--bg); }
.m.idea { border: 2px solid var(--idea); border-radius: 50%; background: var(--bg); }
.m.problem { background: var(--problem); border-radius: 50%; }
.m.project { background: var(--project); border-radius: 2px; }

/* The line. A list that runs through time winds down the date column as a dotted line, with a stop at every piece.
   Each entry draws the stretch that leaves its stop and reaches the next one; every other stretch is turned
   around, so the line swings from side to side and still passes through every stop in one straight column. */
.journey { --reach: 0.9rem; --mid: calc(var(--gutter) - 2.4rem); } /* how far down an entry its stop sits, and the line the stops share */
.journey > * { position: relative; }
.road { position: absolute; left: calc(var(--mid) - 1.25rem); top: var(--reach); width: 2.5rem; height: 100%; overflow: visible; pointer-events: none; }
.road path { fill: none; vector-effect: non-scaling-stroke; stroke: var(--fg); stroke-width: 2px; stroke-linecap: round; stroke-dasharray: 0.1 6.9; }
.journey > :nth-child(even) > .road { transform: scaleX(-1); }

/* The dots are the text colour, shown dim. How bright they are along a stretch is a mask with two lights in it: one
   at the stop the stretch leaves and one at the stop it arrives at. Pointing at an entry, or tabbing into it, turns
   up the light at its stop on both the stretch above and the stretch below. The dots travel up, so the light leads
   the way: it reaches a long way up ahead of the stop and trails off quickly behind it. A second mask fades the two
   ends of the line. */
@property --from { syntax: "<number>"; inherits: false; initial-value: 0.3; }
@property --into { syntax: "<number>"; inherits: false; initial-value: 0.3; }
.road {
  --ahead: 7rem; --behind: 2rem; /* how far the light reaches above a stop, and how far it trails below */
  mask-image: linear-gradient(rgb(0 0 0 / var(--from, 0.3)), rgb(0 0 0 / 0.3) var(--behind), rgb(0 0 0 / 0.3) calc(100% - var(--ahead)), rgb(0 0 0 / var(--into, 0.3))), var(--ends, linear-gradient(#000, #000));
  mask-composite: intersect;
  transition: --from 0.3s, --into 0.3s;
}
.journey > :is(:hover, :focus-within) > .road { --from: 1; }
.journey > :has(+ :is(:hover, :focus-within)) > .road { --into: 1; }
/* It arrives from above the first stop and carries on past the last, fading at both ends: there is more either way. */
.approach { height: 0; }
.approach > .road { top: calc(var(--reach) - 8rem); height: 8rem; --ends: linear-gradient(transparent 58%, #000 96%); }
.journey > :last-child > .road { height: 9rem; --ends: linear-gradient(#000 6%, transparent 46%); }
/* A stop. It swells a little when its entry is pointed at. */
.journey > :not(.approach)::before { content: ""; position: absolute; z-index: 1; left: calc(var(--mid) - 0.3rem); top: calc(var(--reach) - 0.3rem); width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--fg); box-shadow: 0 0 0 3px var(--bg); transition: transform 0.25s var(--ease); }
.journey > :is(:hover, :focus-within)::before { transform: scale(1.3); }

/* A date beside its stop: the day, the month under it, the year under that, centred on one another like a leaf
   of a calendar and flush with the page's left edge. */
.when { display: grid; justify-items: center; justify-self: start; align-self: start; width: max-content; font: 0.75rem/1 var(--mono); color: var(--muted); }
.when b { font: 600 1.15rem/1 var(--mono); color: var(--fg); letter-spacing: -0.03em; }
.when span { margin-top: 0.32rem; }

/* landing */
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; gap: clamp(1.5rem, 4vw, 4rem); padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(2.5rem, 5vw, 4rem); }
.hero h1 { font-size: clamp(2.3rem, 4.7vw, 3.5rem); line-height: 1.06; letter-spacing: -0.03em; margin: 0 0 1.4rem; }
.hero p { font-size: 1.2rem; line-height: 1.55; color: var(--muted); margin: 0; }
.stack { width: 100%; max-width: 28rem; height: auto; justify-self: end; overflow: visible; }
.stack polygon { stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; stroke-dasharray: 5 5; fill: var(--bg); }
.stack .mine polygon { stroke: var(--accent); stroke-dasharray: none; }
.stack .mine .t { fill: color-mix(in srgb, var(--accent) 16%, var(--bg)); }
.stack .mine .l { fill: color-mix(in srgb, var(--accent) 30%, var(--bg)); }
.stack .mine .r { fill: color-mix(in srgb, var(--accent) 44%, var(--bg)); }
.stack line { stroke: var(--rail); stroke-width: 2; }
.stack text { font: 13px var(--mono); fill: var(--muted); text-anchor: end; }
.stack .mine text { fill: var(--fg); }
.stack text + text { opacity: 0; }
/* --cols is set by the page: one track per kind of piece that has something to show */
.heads, .row { display: grid; grid-template-columns: var(--gutter) var(--cols); }
.heads { align-items: baseline; padding-bottom: 0.5rem; }
.heads [role] { position: relative; color: var(--fg); text-decoration: none; font-size: 1.3rem; font-weight: 650; letter-spacing: -0.01em; }
.heads a:hover { text-decoration: underline; }
.more { color: var(--muted); font-size: 0.9rem; margin: 2.5rem 0 0 var(--gutter); }
.heads .m { display: none; }
.heads em { font: 0.8rem var(--mono); color: var(--muted); margin-left: 0.3rem; }
.row { position: relative; padding-block: 1.9rem 0.6rem; }
.row > time { grid-column: 1; grid-row: 1; transform: translateY(-0.28rem); } /* the day sits level with the marks and the stop */
.map .journey { --reach: 2.21rem; } /* from the top of a row down to the level of its marks, its date and its stop */
.lead { grid-row: 1; align-self: start; height: 2px; margin-top: calc(0.31rem - 1px); margin-left: var(--mid); background: var(--line); }
.lead, .wire, .c.project .it::after, .c.project .it::before { transition: background 0.2s; }
.c { grid-row: 1; min-width: 0; padding-right: 2.25rem; display: flex; flex-direction: column; gap: 0.85rem; }
.c:last-child { padding-right: 0; }
.it { position: relative; padding-top: 1.3rem; text-wrap: balance; }
.it > .m { position: absolute; left: 0; top: 0; }
.it > a { color: var(--fg); text-decoration: none; font-weight: 550; line-height: 1.35; }
.it > a:hover { text-decoration: underline; }
.it > small { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.875rem; line-height: 1.45; text-wrap: pretty; }
.c.problem .it > a { font-weight: 650; }
.wire { grid-row: 1; align-self: start; height: 2px; margin-top: calc(0.31rem - 1px); margin-left: 0.31rem; background: var(--rail); transform-origin: left; }
.c.project .it:not(:last-child)::after { content: ""; position: absolute; left: -1.1rem; top: 0.31rem; bottom: calc(-0.85rem - 0.31rem - 1px); width: 2px; background: var(--rail); }
.c.project .it + .it::before { content: ""; position: absolute; left: -1.1rem; top: calc(0.31rem - 1px); width: 1.1rem; height: 2px; background: var(--rail); }
/* The whole thread brightens with its stop: the lead from the line, the wire, and the branch to a second project. */
.row:is(:hover, :focus-within) :is(.lead, .wire), .row:is(:hover, :focus-within) .it::after, .row:is(:hover, :focus-within) .it::before { background: var(--fg); }

@media (prefers-reduced-motion: no-preference) {
  .wire { animation: draw 0.9s var(--ease) both; animation-delay: calc(0.15s + var(--i) * 0.07s); }
  .c.problem .m, .c.project .m { animation: pop 0.45s var(--ease) both; }
  .c.problem .m { animation-delay: calc(0.45s + var(--i) * 0.07s); }
  .c.project .m { animation-delay: calc(0.75s + var(--i) * 0.07s); }
  @keyframes draw { from { transform: scaleX(0); } }
  /* the stack settles from the bottom up, then the borrowed layer on top drifts and its label alternates */
  .stack .layer { animation: settle 1s var(--ease) both; animation-delay: calc(0.1s + var(--n) * 0.16s); }
  .stack .layer:not(.mine) .slab { animation: drift 7s ease-in-out 1.6s infinite; }
  .stack .layer:not(.mine) text { animation: swap 9s linear infinite; }
  .stack .layer:not(.mine) text + text { animation-delay: -4.5s; } /* half a cycle apart, so exactly one label shows */
  @keyframes settle { from { opacity: 0; transform: translateY(-22px); } }
  @keyframes drift { 50% { transform: translateY(-5px); } }
  @keyframes swap { 0%, 44% { opacity: 1; } 50%, 94% { opacity: 0; } 100% { opacity: 1; } }
  @keyframes pop { from { transform: scale(0); } }
  /* Beside the entry pointed at the dots travel up the line, towards what is newer, one dot's spacing at a time so
     the loop has no seam. Pausing, not removing, the motion leaves them where they are when the pointer moves on. */
  .road path { animation: travel 1s linear infinite paused; }
  .journey > :is(:hover, :focus-within) > .road path, .journey > :has(+ :is(:hover, :focus-within)) > .road path { animation-play-state: running; }
  @keyframes travel { to { stroke-dashoffset: 7px; } }
}

/* reading pages */
main h1 { font-size: clamp(1.9rem, 4.2vw, 2.5rem); line-height: 1.15; letter-spacing: -0.025em; margin: 3.25rem 0 0.75rem; }
main article h2, .grp { font-size: 1.3rem; line-height: 1.3; letter-spacing: -0.01em; margin: 2.75rem 0 0.75rem; }
.grp { margin: 3.25rem 0 1.5rem var(--gutter); }
.sub { color: var(--muted); font-size: 1.1rem; margin: 0 0 3rem; }
.meta { color: var(--muted); font-size: 0.9rem; margin: 0 0 2.25rem; }
.lede, .prose > p:first-child { font-size: 1.2rem; line-height: 1.55; }
code { font: 0.875em var(--mono); background: var(--code); padding: 0.15em 0.35em; border-radius: 4px; }
pre { font: 0.875rem/1.55 var(--mono); background: var(--code); padding: 0.9rem 1rem; border-radius: 6px; overflow-x: auto; tab-size: 2; }
pre code { font: inherit; background: none; padding: 0; }
table { border-collapse: collapse; width: 100%; margin: 1.5rem 0; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
article ol, article ul:not(.plain) { padding-left: 1.4rem; }
article li { margin: 0.5rem 0; }
.note { display: grid; grid-template-columns: var(--gutter) minmax(0, 1fr); padding-bottom: 2.5rem; }
.note > time { padding-top: 0.32rem; }
.note h2 { font-size: 1.2rem; line-height: 1.3; margin: 0 0 0.35rem; letter-spacing: -0.01em; }
.note h2 a { color: var(--fg); text-decoration: none; }
.note h2 a:hover { text-decoration: underline; }
.note h2 > .m { margin-right: 0.7rem; box-shadow: none; }
.note p { margin: 0.3rem 0; }
.went { color: var(--muted); font-size: 0.9rem; }
.went .m { margin-right: 0.55rem; box-shadow: none; }
.went a + .m { margin-left: 1.1rem; }
.plain { list-style: none; padding: 0; }
.plain li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; column-gap: 0.75rem; margin: 0.8rem 0; }
.plain .m { box-shadow: none; }
.plain small { grid-column: 2; color: var(--muted); font-size: 0.875rem; }
.trail { display: flex; flex-wrap: wrap; align-items: center; row-gap: 0.4rem; margin-top: 3rem; font-size: 0.875rem; color: var(--muted); }
.trail + h1 { margin-top: 1.25rem; }
.trail a { color: var(--muted); text-decoration: none; }
.trail a:hover { color: var(--fg); text-decoration: underline; }
.trail .m { margin-right: 0.5rem; box-shadow: none; }
.trail > .sib { margin-left: 1.1rem; }
.trail > * + *:not(.sib)::before { content: ""; display: inline-block; width: 1.75rem; height: 2px; background: var(--rail); vertical-align: middle; margin-inline: 0.7rem; }
.btn { display: inline-block; text-decoration: none; border: 1px solid var(--accent); border-radius: 6px; padding: 0.35rem 0.9rem; font-size: 0.95rem; }
.btn:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 1rem; margin-top: 3.5rem; font-size: 0.9rem; color: var(--muted); }
.pager > :last-child { justify-self: end; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .stack { justify-self: start; max-width: 21rem; margin-top: 0.5rem; }
  .heads { display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem; }
  .heads > span { display: none; }
  .heads [role] { font-size: 1.1rem; padding: 0 0 0 1.2rem; }
  .heads .m { display: inline-block; position: absolute; left: 0; top: 0.62rem; box-shadow: none; }
  .road, .lead, .journey > *::before { display: none; }
  table { display: block; overflow-x: auto; } /* a table too wide for the screen scrolls inside itself */
  .grp { margin-left: 0; }
  /* A thread stacks its date and its pieces; a column it does not fill takes no room, not even a gap. */
  .row { display: flex; flex-direction: column; gap: 0.85rem; padding-block: 1.6rem 0.4rem; }
  /* with no line to sit beside, a date goes back to one plain line above its entry */
  .when { display: block; font-size: 0.8rem; }
  .when b { font: inherit; color: inherit; letter-spacing: 0; }
  .row > time { margin-bottom: -0.15rem; transform: none; }
  .wire, .c:empty, .c.project .it + .it::before { display: none; }
  .c { padding-right: 0; }
  .it { padding: 0 0 0 1.5rem; }
  .it > .m { top: 0.44rem; }
  .c.project .it:not(:last-child)::after, .c:has(~ .c .it) .it::after { content: ""; position: absolute; left: calc(0.31rem - 1px); top: 0.75rem; bottom: calc(-0.85rem - 0.75rem); width: 2px; background: var(--rail); }
  .more { margin-left: 0; }
  .note { grid-template-columns: 1fr; }
  .note > time { padding: 0 0 0.2rem; }
}
