:root {
  --bg: #16161a;
  --bg-raised: #1d1d22;
  --border: #2c2c34;
  --text: #d6d6dd;
  --text-dim: #8a8a96;
  --accent: #e3b341;
  --link: #7fb3d5;
  --mono: ui-monospace, "SF Mono", "Hack", "DejaVu Sans Mono", monospace;
  /* The margin the year sits in, and what the rest of the page indents by to
     line up with the months beside it. */
  --gutter: 4.5rem;
}

/* The light tokens are spelled out twice on purpose: once for the system
   preference, once for an explicit choice that overrides it. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fbfbf9;
    --bg-raised: #f2f2ee;
    --border: #dcdcd4;
    --text: #22222a;
    --text-dim: #6a6a74;
    --accent: #9a6b00;
    --link: #1f5e8c;
  }
}

:root[data-theme="light"] {
  --bg: #fbfbf9;
  --bg-raised: #f2f2ee;
  --border: #dcdcd4;
  --text: #22222a;
  --text-dim: #6a6a74;
  --accent: #9a6b00;
  --link: #1f5e8c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  padding: 2.5rem 1rem 4rem;
  max-width: 72.5rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

a:hover {
  border-bottom-color: currentColor;
}

.page-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 1rem;
}

h1 {
  margin: 0 0 0.4rem;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

/* Second column of the header grid, level with the heading: the two things on
   this page that are not the record, kept together and out of the way. */
.tools {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.account,
.theme {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  height: 1.85rem;
  padding: 0 0.55rem;
  background: var(--bg-raised);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.account:hover,
.theme:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* The link keeps the chrome of the button beside it rather than the underline
   of a link: in the corner of a header the two read as one pair of controls. */
.account {
  text-decoration: none;
  white-space: nowrap;
}

.theme svg,
.account svg {
  display: block;
}

.lede {
  grid-column: 1;
}

/* What came of the record, one result per line: as a sentence the three of
   them ran together and had to be parsed before they could be read. */
.summary {
  grid-column: 1;
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-dim);
}

.summary li::before {
  content: "- ";
  opacity: 0.5;
}

/* The handwritten paragraph. Set apart from the generated lines around it, so
   it reads as somebody talking rather than as another field. */
.about {
  grid-column: 1;
  max-width: 48rem;
  margin: 1.1rem 0 0;
  padding-left: 0.9rem;
  border-left: 2px solid var(--border);
}

.about p {
  margin: 0 0 0.5rem;
}

.about p:last-child {
  margin-bottom: 0;
}

.meta {
  grid-column: 1;
  margin: 0.3rem 0 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.lede {
  margin: 0;
  max-width: 48rem;
  color: var(--text-dim);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
}

.controls label {
  color: var(--text-dim);
}

.controls select,
.controls button {
  margin-left: 0.4rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
}

.controls button {
  cursor: pointer;
}

.controls button:hover {
  border-color: var(--accent);
}

/* The year is written once, in the margin, and stays there while its months
   scroll past. Repeating it in every heading said the same thing twenty times
   and still left the reader counting back to work out where they were. */
.year-label {
  margin: 0 0 0.5rem;
  color: var(--text-dim);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

@media (min-width: 58rem) {
  .year {
    display: grid;
    grid-template-columns: var(--gutter) 1fr;
  }

  /* Sticky within its own year: the grid area is as tall as the year, so the
     label travels with it and is replaced when the next one arrives. */
  .year-label {
    position: sticky;
    top: 0.9rem;
    align-self: start;
    padding-top: 0.35rem;
  }

  /* No rule of its own down the left of the months. There was one, to bind the
     year in the margin to what follows it, and it ended up a finger's width
     from the left border of every table under it: two parallel lines, drawn
     for two different reasons, reading as a mistake. The tables' own border is
     the edge now, and the year label leans on it. */

  /* Everything else lines up with the months rather than with the margin. */
  .page-header,
  .controls,
  .page-footer {
    padding-left: var(--gutter);
  }
}

/* Twenty months at once is a wall of rows, so a month folds away. Only the two
   most recent start open, and it is still one page: open everything and the
   browser's own search covers the lot. */
.month {
  margin-bottom: 1rem;
}

/* Child selectors throughout: a row inside the table has a summary of its own,
   and the month's heading must not dress it. */
.month > summary {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  /* A summary laid out as anything but a list item loses its own marker. */
  list-style: none;
}

.month > summary::-webkit-details-marker {
  display: none;
}

.month > summary::before {
  content: "▸";
  color: var(--text-dim);
}

.month[open] > summary::before {
  content: "▾";
}

.month > summary:hover .month-label {
  color: var(--text);
}

.month-label {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.month-count {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.month[open] > summary {
  margin-bottom: 0.5rem;
}

/* Fixed, because each month is its own table and otherwise every one of them
   sizes its columns differently. */
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

/* Wide enough for all but the longest reference on record, which wraps its
   number onto a second line rather than making every other row pay for it in
   empty space. Nothing is ever cut: a truncated number is a wrong one. */
.column-project {
  width: 13.5rem;
}

/* `10-27 21:26`, never broken across two lines. */
.column-date {
  width: 7.5rem;
}

.cell-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.step-time {
  color: var(--text-dim);
}

/* One frame around both views, so the pair reads as a single switch with one
   side set rather than as two words that happen to sit next to each other. */
.views {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.views > * {
  padding: 0.25rem 0.6rem;
  color: var(--text-dim);
  text-decoration: none;
}

.views > * + * {
  border-left: 1px solid var(--border);
}

.views a:hover {
  color: var(--text);
  background: var(--bg-raised);
}

.views [aria-current] {
  background: var(--bg-raised);
  color: var(--text);
  font-weight: 600;
}

/* Stuck to the top of the viewport: a long month scrolls past the heading and
   then there is nothing left saying which column is which. */
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.3rem 0.6rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 500;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tbody td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

/* Rules between the columns, for the same reason, and down both outer edges as
   well: with the inner ones drawn and the outer ones missing, the table read as
   a grid that had lost its frame rather than as a deliberately open one. */
thead th,
tbody td {
  border-right: 1px solid var(--border);
}

thead th:first-child,
tbody td:first-child {
  border-left: 1px solid var(--border);
}

tbody tr:hover {
  background: var(--bg-raised);
}

/* The repository and the number read as one reference, the way such a thing is
   said out loud: bdk-cli #311. The name goes to the repository, the number to
   the thread, and the title in the next column goes to the action itself.

   The two stay side by side, one space apart: pushed to opposite edges of the
   column they stop reading as one reference. The cell may break between them
   when there is no room; neither of them may break inside, or a browser is
   happy to split a name at one of its hyphens. */
.cell-project a {
  white-space: nowrap;
}

.thread {
  color: var(--text-dim);
}

/* Who opened the thread, on its own line above the size of it, so the two read
   as one statement: this is somebody else's pull request and it is this big. */
.by {
  display: block;
  margin-top: 0.1rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  white-space: nowrap;
}

.cell-what {
  /* A fixed layout has to be told that a long identifier may break. */
  overflow-wrap: anywhere;
}

/* What became of the thread goes to the right edge of the column rather than
   after the title, where it lands in a different place on every row. The title
   keeps the whole width on the lines below it, which a column of its own would
   have taken away. */
.title-line {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.title {
  flex: 1;
}

.thread-end {
  flex: none;
  white-space: nowrap;
}

/* A thread worked on several times in one month lists its rounds under the
   title. They are always shown: folded away they were simply not found, and
   the arc of a review is the substance of the row, not a detail of it.

   No rule above them. There was one, as heavy as the border between rows, and
   it cut the row in half: a tall row read as two short ones with a stray list
   stuck to the second. The dashes and the indent are what say "list" now. */
.steps {
  margin: 0.3rem 0 0.1rem;
  padding: 0 0 0 1.1rem;
  list-style: none;
  font-size: 0.9rem;
}

.steps li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--text-dim);
}

/* A dash, so a round reads as an item of a list and not as another row that
   happens to be indented. */
.steps li::before {
  content: "-";
  opacity: 0.5;
}

.step-when {
  white-space: nowrap;
}

.cell-what {
  width: 100%;
}

.state {
  margin-left: 0.4rem;
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* When the outcome happened, shown only when it was not the day the row is
   dated by, which is most of the time: the work is in one month and the answer
   arrives in another.

   Inside the chip, with the word it belongs to. It sat beside the chip once,
   between the diff and the outcome, and a bare date floating between two other
   things said nothing: every reader saw a row carrying two dates with nothing
   to say which was which. Inside, it cannot be read as anything but the date
   of the word in front of it. The chips still line up on the right, because
   the right edge is the end of the line and the chip is last on it. */
.outcome-at {
  opacity: 0.7;
}

/* What became of the thread, as opposed to how one round of review ended. It
   is drawn as a chip rather than dim text so the two never read as one thing.
   Merged keeps the colour the forge uses for it; the others do not, because
   green and red are spoken for by the lines of a diff a few characters to the
   left, and a chip that borrows them says "added" and "removed" instead of
   "still going" and "over". */
/* Each one as wide as what it says. There was a floor here, from when the chips
   held three short words and a common width lined up their left edges. Once
   they started carrying the date as well they were all different widths anyway,
   and the floor did nothing but pad out `open`, the only one with no date,
   until it sat in a box visibly too big for it. */
.outcome {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0 0.35rem;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: 0.72rem;
  text-transform: lowercase;
  white-space: nowrap;
  opacity: 0.9;
}

/* The thread produced a result. The same purple for both, because that is the
   one thing the colour is here to say: an issue closed as completed is a
   reported problem that somebody fixed, which is the result an issue can have,
   and a pull request merged is the result a pull request can have.

   The two are not the same claim about this account's own work, and the kind
   badge one column to the left is what separates them: `issue` beside the chip
   says the code was somebody else's, `pull request` says it was not. Giving
   `completed` a weaker purple instead would have said "a lesser result", which
   is a judgement on the issue, not information about it. */
.outcome-merged,
.outcome-completed {
  color: #a371f7;
}

/* Still going. Green, the way the forge itself says it, and the reader of this
   page reads that forge all day.

   It is the green of an added line a few characters to the left, and that was
   held against it once. The two are a bordered chip holding a word and a bare
   number behind a plus sign, which is difference enough; GitHub paints both of
   them green for the same reason and nobody misreads it there. The accent this
   had instead was worse: on this page the accent is already the colour of the
   month headings, so it said "look
   here, something is wrong" about a pull request that is merely still open. */
.outcome-open {
  color: #4fa65f;
}

/* Over without landing. Grey rather than red: red reads as a verdict on the
   work, and a pull request closed because somebody fixed it elsewhere is not a
   rejected one.

   An issue nobody is going to do, and one that had already been reported, end
   the same way: over, with nothing to show for it. Grey is what the page has
   always said about that, and these two are the only threads it was ever true
   of. Red would be a verdict here as well: an issue turned down is often a
   reasonable thing to have asked. */
.outcome-closed,
.outcome-not-planned,
.outcome-duplicate {
  color: var(--text-dim);
}

/* How big the change was. Without it a dependency bump and a feature are the
   same row. Coloured the way a diff is everywhere else, or the two numbers
   read as a date or a score. These are the only green and red on the page.

   On its own line under the reference it measures, so that `bdk-cli #311` and
   `+2352 -83` read as one statement about one pull request. */
.diff {
  display: block;
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  white-space: nowrap;
}

.added {
  color: #4fa65f;
}

.removed {
  color: #d1636a;
}

/* On a pull request this account did not open, the same measurement means
   something else: the size of what was read, not of what was written. It gets
   a word and no colour, because the green and red above are a claim of
   authorship and here that claim would be false. */
.diff.read {
  color: var(--text-dim);
}

.page-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
}

.page-footer {
  text-align: center;
}

.page-footer p {
  margin: 0;
}

.page-footer a {
  color: var(--text-dim);
  border-bottom-color: currentColor;
}

.page-footer a:hover {
  color: var(--text);
}

@media (max-width: 42rem) {
  /* The icons are enough when there is no room for the words beside them. */
  .account span,
  .theme-name {
    display: none;
  }

  thead {
    display: none;
  }

  /* The date and the thread on one line, everything that happened under it. A
     run-on line of cells is unreadable at this width. */
  tbody tr {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 0.15rem 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
  }

  tbody td {
    display: block;
    padding: 0;
    border: 0;
  }

  .cell-what {
    grid-column: 1 / -1;
  }

  /* The diff and the outcome drop under the title instead of sitting beside
     it. At this width holding them on the same line left the title a column
     four words wide with a wedge of nothing next to it, which is the one thing
     a reader is here to read squeezed for the two things they can read last. */
  .title-line {
    display: block;
  }

  .thread-end {
    display: block;
    margin-top: 0.15rem;
  }

  .outcome {
    margin-left: 0.3rem;
  }

  .diff {
    margin-left: 0;
  }
}
