/* A worklog is a lab notebook: numbered, dated, written in prose, read slowly.
   So the prose is set in a serif, the chrome in a sans, and the page is one
   column of one width - the same width on the index, an entry, and everything
   else, so nothing moves when you click through.

   No webfonts. The stacks resolve to something good on every platform without
   a request, because a log that only looks right online does not look right. */

:root {
  color-scheme: light dark;

  --font-text: "Iowan Old Style", Charter, "Bitstream Charter", "Palatino Linotype",
               Palatino, Georgia, "Times New Roman", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --paper: #faf8f3;
  --paper-sunk: #f2efe7;
  --ink: #1b1a15;
  --ink-soft: #423f36;
  --ink-faint: #7a756a;
  --rule: #e0dbcf;
  --rule-faint: #ebe7dd;
  --link: #1b4a76;
  --accent: #9c4221;
  --code-bg: #f3f0e8;
  --mark: #fbeeb0;

  --step--1: 0.8125rem;
  --step-0: 1.0625rem;
  --step-1: 1.1875rem;
  --step-2: 1.375rem;
  --step-3: 1.75rem;
  --step-4: 2.25rem;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.75rem;
  --space-4: 2.75rem;
  --space-5: 4rem;
  --space-6: 6.5rem;

  --page-width: 46rem;
  --radius: 0.375rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f0f12;
    --paper-sunk: #17171c;
    --ink: #eceae4;
    --ink-soft: #b8b4aa;
    --ink-faint: #858075;
    --rule: #33323a;
    --rule-faint: #24242a;
    --link: #8ab6e3;
    --accent: #e0845c;
    --code-bg: #202024;
    --mark: #4c421f;
  }
}

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

/* The filters set `hidden` on a row, and the browser's own `[hidden]` rule is
   less specific than the class that gives that row a display. Filtering did
   nothing at all until this was here. It stays above every display rule. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--step-0);
  line-height: 1.75;
}

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

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

/* The shell: a rail that carries identity and navigation, and a column of
   content that is the same width on every page. */

/* Rail, column, contents. The third column is present on every page even when
   it is empty, so the reading column lands in the same place throughout. */
.shell {
  display: grid;
  grid-template-columns: 14rem minmax(0, var(--page-width));
  gap: var(--space-5);
  justify-content: center;
  max-width: 74rem;
  margin: 0 auto;
  padding: var(--space-4) var(--space-3) var(--space-6);
}

@media (min-width: 86rem) {
  .shell {
    grid-template-columns: 14rem minmax(0, var(--page-width)) 12rem;
    max-width: 88rem;
  }
}

.contents-rail {
  position: sticky;
  top: var(--space-4);
  align-self: start;
  max-height: calc(100vh - var(--space-5));
  overflow-y: auto;
}
.contents-rail:empty { display: none; }

.rail {
  position: sticky;
  top: var(--space-4);
  align-self: start;
  max-height: calc(100vh - var(--space-5));
  overflow-y: auto;
}

.brand { padding-bottom: var(--space-3); border-bottom: 1px solid var(--rule); }
.brand-name {
  display: block;
  font-family: var(--font-text);
  font-size: var(--step-3);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
}
.brand-name:hover { color: var(--accent); }
.brand-line {
  margin: var(--space-1) 0 0;
  color: var(--ink-faint);
  font-size: var(--step--1);
  line-height: 1.5;
}

.rail-nav { display: flex; flex-direction: column; margin: var(--space-2) 0 var(--space-3); }
.rail-nav a {
  padding: 0.3rem 0 0.3rem var(--space-2);
  border-left: 2px solid transparent;
  margin-left: -1px;
  color: var(--ink-soft);
  font-size: var(--step--1);
  text-decoration: none;
}
.rail-nav a:hover { color: var(--ink); }
.rail-nav a[aria-current="page"] {
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.rail-links {
  display: flex;
  flex-direction: column;
  padding-top: var(--space-2);
  margin-bottom: var(--space-3);
  border-top: 1px solid var(--rule);
}
.rail-links a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem var(--space-1);
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: var(--step--1);
  text-decoration: none;
}
.rail-links a:hover { background: var(--paper-sunk); color: var(--ink); }
.rail-links svg {
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 auto;
  color: var(--ink-faint);
}
.rail-links a:hover svg { color: var(--accent); }

.rail-label {
  margin: 0 0 var(--space-1);
  color: var(--ink-faint);
  font-size: var(--step--1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.tree, .filters { padding-top: var(--space-3); border-top: 1px solid var(--rule); }

.tree ul { list-style: none; margin: 0; padding: 0; font-size: var(--step--1); }
.tree li { margin: 0; }
.tree a {
  display: block;
  padding: 0.25rem var(--space-1);
  border-radius: var(--radius);
  color: var(--ink-soft);
  text-decoration: none;
  line-height: 1.4;
}
.tree a:hover { background: var(--paper-sunk); color: var(--ink); }
.tree a[aria-current="page"] { color: var(--accent); font-weight: 600; }
/* A folder names itself and then indents what is inside it, which is the shape
   the tree already has on disk. */
.tree .folder > a { color: var(--ink); font-weight: 600; margin-top: var(--space-1); }
.tree .folder ul {
  margin-left: var(--space-1);
  padding-left: var(--space-2);
  border-left: 1px solid var(--rule);
}
/* A facet list, not a row of pills stacked: no borders, counts aligned, the
   whole line a target. */
.filters .chip {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  width: 100%;
  padding: 0.25rem var(--space-1);
  border: 0;
  border-radius: var(--radius);
  text-align: left;
}
.filters .chip:hover { background: var(--paper-sunk); color: var(--ink); }
.filters .chip[aria-pressed="true"] {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}
.filters .chip .count { margin: 0; opacity: 0.55; }

main { min-width: 0; }

@media (max-width: 62rem) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
    padding-top: var(--space-3);
  }
  .rail { position: static; max-height: none; }
  .rail-nav { flex-direction: row; flex-wrap: wrap; gap: var(--space-2); }
  .rail-nav a { border-left: 0; padding-left: 0; }
  .rail-nav a[aria-current="page"] { border-bottom: 2px solid var(--accent); }
  .filters .chip { width: auto; }
  .filters { display: flex; flex-wrap: wrap; gap: var(--space-1); align-items: center; }
  .rail-links {
  display: flex;
  flex-direction: column;
  padding-top: var(--space-2);
  margin-bottom: var(--space-3);
  border-top: 1px solid var(--rule);
}
.rail-links a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem var(--space-1);
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: var(--step--1);
  text-decoration: none;
}
.rail-links a:hover { background: var(--paper-sunk); color: var(--ink); }
.rail-links svg {
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 auto;
  color: var(--ink-faint);
}
.rail-links a:hover svg { color: var(--accent); }

.rail-label { width: 100%; }
}

/* Controls ---------------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-2);
}

/* A field, not a form: filled rather than outlined, so it sits in the page
   instead of being a box bolted onto it. */
.search { position: relative; flex: 1 1 16rem; min-width: 0; display: flex; align-items: center; }
.search svg {
  position: absolute;
  left: 0.8rem;
  width: 0.95rem;
  height: 0.95rem;
  color: var(--ink-faint);
  pointer-events: none;
}

input[type="search"] {
  width: 100%;
  padding: 0.55rem 0.9rem 0.55rem 2.3rem;
  font: inherit;
  font-size: var(--step--1);
  color: var(--ink);
  background: var(--paper-sunk);
  border: 1px solid transparent;
  border-radius: var(--radius);
  -webkit-appearance: none;
  appearance: none;
}
input[type="search"]::placeholder { color: var(--ink-faint); }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
input[type="search"]:focus { outline: none; border-color: var(--rule); background: var(--paper); }
.search:focus-within svg { color: var(--accent); }

/* Two words you can click, rather than a segmented control. */
.sort { display: flex; gap: var(--space-2); flex: 0 0 auto; }
.sort button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--step--1);
  color: var(--ink-faint);
  cursor: pointer;
}
.sort button:hover { color: var(--ink); }
.sort button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.sort button[aria-pressed="true"]::before { content: ""; }

.chip {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.6;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 1rem;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
}
.chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.chip .count { opacity: 0.6; margin-left: 0.35rem; font-variant-numeric: tabular-nums; }

#status {
  display: block;
  min-height: 1.3rem;
  margin: 0 0 var(--space-2);
  color: var(--ink-faint);
  font-size: var(--step--1);
}

/* The entry list ---------------------------------------------------------- */

.entries { list-style: none; margin: 0; padding: 0; }
.entries li + li { border-top: 1px solid var(--rule-faint); }

/* The whole row is the target. A title-only hit area in a list of summaries is
   a list that is annoying to use. */
.row {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-2);
  margin: 0 calc(var(--space-2) * -1);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}
.row:hover { background: var(--paper-sunk); }

/* The number is the log's own identifier, so it is legible rather than a
   footnote - but quiet, so the title still leads. */
.row .no {
  flex: 0 0 2.5rem;
  padding-top: 0.1rem;
  color: var(--ink-faint);
  font-family: var(--font-text);
  font-variant-numeric: tabular-nums;
  font-size: var(--step-1);
  line-height: 1.35;
  text-align: right;
}
.row:hover .no { color: var(--accent); }

.row-main { min-width: 0; }
.row-title {
  display: block;
  font-family: var(--font-text);
  font-size: var(--step-2);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.row:hover .row-title { text-decoration: underline; text-decoration-thickness: 1px; }

.row .summary {
  display: block;
  font-family: var(--font-text);
  margin-top: var(--space-1);
  color: var(--ink-soft);
  font-size: var(--step-0);
  line-height: 1.6;
}
.row .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: var(--space-1);
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: var(--step--1);
}
.row .meta time { font-variant-numeric: tabular-nums; }

.empty { color: var(--ink-faint); padding: var(--space-4) 0; }

.entries h3 {
  font-family: var(--font-text);
  font-size: var(--step-2);
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}
.entries h3 a { color: var(--ink); text-decoration: none; }
.entries h3 a:hover { text-decoration: underline; }
.entries li > .meta, .entries li > .summary { padding: 0 var(--space-2); }
.entries li > .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: var(--space-3) 0 var(--space-1);
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: var(--step--1);
}
.entries li > .summary {
  font-family: var(--font-text);
  margin: var(--space-1) 0 var(--space-3);
  color: var(--ink-soft);
  font-size: var(--step-0);
}
.entries li > h3 { padding: 0 var(--space-2); }

h2.section {
  margin: var(--space-4) 0 var(--space-2);
  font-family: var(--font-text);
  font-size: var(--step-2);
  font-weight: 600;
}
h2.section a { color: var(--ink); text-decoration: none; }
h2.section a:hover { color: var(--accent); }

.status { letter-spacing: 0.04em; }
.status--guess { color: var(--accent); }
.status--solid, .status--partial { color: var(--ink-faint); }

/* Contents ---------------------------------------------------------------- */

.toc { font-family: var(--font-ui); font-size: var(--step--1); line-height: 1.5; }
.toc-label {
  margin: 0 0 var(--space-1);
  color: var(--ink-faint);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 0.2rem var(--space-1);
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-soft);
  text-decoration: none;
}
.toc a:hover { background: var(--paper-sunk); color: var(--ink); }
.toc .toc-3 a { padding-left: var(--space-2); color: var(--ink-faint); }

/* Below the width that fits three columns, contents sits above the prose
   rather than vanishing. */
@media (max-width: 86rem) {
  .contents-rail {
    position: static;
    max-height: none;
    order: 0;
    padding: var(--space-2) var(--space-3);
    background: var(--paper-sunk);
    border-radius: var(--radius);
  }
  .rail { order: -1; }
  main { order: 1; }
}

/* One entry --------------------------------------------------------------- */

article { max-width: none; }

.entry-number {
  display: block;
  margin: 0 0 var(--space-1);
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

article h1 {
  font-family: var(--font-text);
  font-size: var(--step-4);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-2);
}
article h2 {
  font-family: var(--font-text);
  font-size: var(--step-1);
  font-weight: 600;
  margin: var(--space-4) 0 var(--space-2);
  scroll-margin-top: var(--space-3);
}
article p, article li { font-family: var(--font-text); line-height: 1.7; }
article p { margin: 0 0 var(--space-3); overflow-wrap: break-word; }
article ul, article ol { margin: 0 0 var(--space-3); padding-left: 1.4rem; }
article li { margin-bottom: var(--space-1); }
article img { max-width: 100%; height: auto; }
article > *:last-child { margin-bottom: 0; }

.dateline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  margin: 0 0 var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--rule);
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: var(--step--1);
}
.dateline time { font-variant-numeric: tabular-nums; }
.dateline .from { color: var(--ink-faint); }
/* Links in a dateline are metadata, not body links: they take the meta colour
   and earn the accent on hover rather than arriving blue and underlined. */
.dateline a { color: inherit; text-decoration: none; }
.dateline a.chip:hover { border-color: var(--accent); color: var(--accent); }
.dateline .status {
  padding: 0.15rem 0.6rem;
  border: 1px dashed var(--rule);
  border-radius: 1rem;
}
.dateline .chip { text-decoration: none; }
.dateline .chip:hover { border-color: var(--ink-faint); color: var(--ink); }

.files {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.75rem;
  margin: calc(var(--space-4) * -1 + var(--space-2)) 0 var(--space-4);
  font-family: var(--font-ui);
  font-size: var(--step--1);
}
.files-label {
  color: var(--ink-faint);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.files a { color: var(--ink-soft); text-decoration: none; }
.files a:hover { color: var(--accent); }
.files code { font-size: 0.95em; background: none; padding: 0; }

/* A directory is said once and its files follow it, so the directory is the
   quiet part and the names are what the eye lands on. */
.files-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.6rem;
}
.files-dir {
  /* Cancels the group's gap: the directory and its first file are one path. */
  margin-right: -0.6rem;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.95em;
}

/* Past a handful the list folds behind its count. It is still one line of
   chrome above the prose, not a wall of paths. */
details.files { display: block; }
details.files summary {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
  width: fit-content;
}
details.files summary::-webkit-details-marker { display: none; }
details.files summary::after {
  content: "";
  width: 0.4em;
  height: 0.4em;
  border-right: 1.5px solid var(--ink-faint);
  border-bottom: 1.5px solid var(--ink-faint);
  transform: translateY(-0.2em) rotate(45deg);
  transition: transform 0.15s;
}
details.files[open] summary::after { transform: translateY(0.05em) rotate(-135deg); }
.files-count { color: var(--ink-soft); }
details.files summary:hover .files-count { color: var(--accent); }
.files-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-left: 2px solid var(--rule);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--rule-faint);
  border-left: 2px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-3);
  overflow-x: auto;
  font-size: var(--step--1);
  line-height: 1.6;
}
code { font-family: var(--font-mono); font-size: 0.9em; }
p code, li code, td code, .summary code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
}
pre code { background: none; padding: 0; }

blockquote {
  margin: 0 0 var(--space-3);
  padding-left: var(--space-3);
  border-left: 2px solid var(--rule);
  color: var(--ink-soft);
  font-style: italic;
}

.table-scroll { overflow-x: auto; margin: 0 0 var(--space-3); }
table { border-collapse: collapse; width: 100%; font-family: var(--font-ui); font-size: var(--step--1); }
th, td { text-align: left; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--rule-faint); }
th {
  font-weight: 600;
  white-space: nowrap;
  border-bottom-color: var(--rule);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.9em;
  color: var(--ink-faint);
}

/* A correction, which is why the log is append-only ------------------------ */

.notice {
  background: var(--paper-sunk);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-4);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.65;
}
.notice p { margin: 0; font-family: inherit; }
.notice p + p { margin-top: var(--space-1); }

.unknown {
  margin-top: var(--space-5);
  padding: var(--space-3);
  background: var(--paper-sunk);
  border-radius: var(--radius);
  font-family: var(--font-text);
  color: var(--ink-soft);
}
.unknown strong {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.unknown p { margin: 0; }

/* A question a later entry answered: kept where it was asked, struck through
   the way a notebook strikes one out, with the answer named. */
.unknown--answered { opacity: 0.85; }
.unknown--answered strong { color: var(--ink-faint); }
.unknown--answered > p:first-of-type { text-decoration: line-through; color: var(--ink-faint); }
.unknown .answered {
  margin-top: var(--space-1);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  color: var(--ink-soft);
}

nav.pager {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.5;
}
nav.pager a { flex: 1 1 0; text-decoration: none; color: var(--ink-soft); }
nav.pager a:hover { color: var(--accent); }
nav.pager .next { text-align: right; margin-left: auto; }
nav.pager .label {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

/* Open questions ---------------------------------------------------------- */

.lead {
  margin: 0 0 var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--rule);
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: var(--step--1);
}

.questions { list-style: none; margin: 0; padding: 0; }
.questions li { padding: var(--space-3) 0; }
.questions li + li { border-top: 1px solid var(--rule-faint); }
.questions .question p {
  margin: 0;
  font-family: var(--font-text);
  font-size: var(--step-1);
  line-height: 1.6;
  color: var(--ink);
}
.questions .source {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: var(--space-1) 0 0;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  color: var(--ink-faint);
}
.questions .source a { color: var(--ink-faint); text-decoration: none; }
.questions .source a:hover { color: var(--accent); text-decoration: underline; }
.questions .source time { font-variant-numeric: tabular-nums; }

footer {
  margin-top: var(--space-6);
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-size: var(--step--1);
}
footer p { margin: 0; }
footer a { color: var(--ink-faint); }

mark { background: var(--mark); color: inherit; padding: 0 0.1em; }

@media (max-width: 46rem) {
  :root {
    --step-0: 1rem;
    --step-4: 1.75rem;
    --space-3: 1.35rem;
    --space-5: 2.75rem;
    --space-6: 3.5rem;
  }
  nav.pager { flex-direction: column; gap: var(--space-2); }
  nav.pager .next { text-align: left; }
}
