/* ==========================================================================
   The Lens of Peet: notes.css (V2)
   Field note article pages and the notes index (/blog/).
   Loads AFTER /assets/site/site.css. Uses its tokens (--paper --ink --red
   --mute --mute-d --rule --dark --grey --wash --tint --ui --display --data
   --ease --gutter) and generic classes (.label, .btn, .on-dark). Nothing from
   site.css is redefined here. Motion comes from site.js through data-reveal
   and data-section in the markup; this file only adds hover responses.

   Page shape: the same three-part row the homepage uses. A 220px rail on the
   left carries mono labels and index numbers, the text column hangs off it,
   rules and dark bands run edge to edge. Under 900px the rail folds away and
   everything stacks on the gutter.

   Classes
     Article   .note  .note__meta  .note__title  .note__body  .note__lede
               .note__pull  .note__aside  .note__compare
               .note__figure--framed  .note__figure--wide
               .note__figure--narrow  .note__table  .note__table--pairs  .num
               .note__source  .note__cta (+ .on-dark)  .note__nav
               .note__nav-label  .note__nav-title  .note__nav-all
     Index     .notes-index  .notes-bar  .notes-bar__count  .notes-bar__end
               .notes-index__intro  .notes-latest (+ .on-dark)
               .notes-latest__meta  .notes-latest__title  .notes-latest__lede
               .notes-latest__more  .notes-list  .notes-row  .notes-row__date
               .notes-row__title  .notes-row__dek  .notes-row__tag
   ========================================================================== */

.note,
.note__nav,
.notes-index {
  --notes-rail: 220px;       /* same left column as the homepage rows */
  --notes-gap: 24px;
  --notes-measure: 42.5rem;  /* 66ch of 18px Archivo, fixed so every child shares one edge */
  --notes-wide: 58rem;       /* pull lines, wide figures and tables */
  --notes-inset: var(--gutter);
}
@media (min-width: 900px) {
  .note,
  .note__nav,
  .notes-index {
    /* left edge of the text column once the rail is showing */
    --notes-inset: calc(var(--gutter) + var(--notes-rail) + var(--notes-gap));
  }
}

/* Shared small voices */
.note__meta time,
.note__body figcaption,
.note__source,
.note__nav-label,
.note__nav-all,
.notes-bar,
.notes-latest__meta,
.notes-row__date,
.notes-row__tag {
  font-family: var(--data);
  font-stretch: normal;
}

/* 1. Article
   ========================================================================== */

.note { display: block; }

/* Header: mono tags and date in the rail, wide heavy title beside them. */
.note > header {
  padding: 28px var(--gutter) 28px;
}
.note__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
}
.note__meta time {
  font-size: 12px;
  line-height: 1.45;
  color: var(--mute-d);
}
.note__title {
  max-width: 20em;
  margin-top: 16px;
}

/* Body. The 3px rule closes the header; the text column starts under it. */
.note__body {
  padding: 28px var(--gutter) 0 var(--notes-inset);
  border-top: 3px solid var(--rule);
  counter-reset: note-section;
  font-family: var(--ui);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--ink);
}
.note__body > * { max-width: var(--notes-measure); }
.note__body > * + * { margin-top: 1.1em; }

.note__body .note__lede {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
}
.note__body .note__lede + * { margin-top: 24px; }

/* Section heading: full-bleed 1px rule, mono red index number in the rail. */
.note__body h2 {
  position: relative;
  max-width: none;
  margin: 44px calc(-1 * var(--gutter)) 0 calc(-1 * var(--notes-inset));
  padding: 20px var(--gutter) 0 var(--notes-inset);
  border-top: 1px solid var(--rule);
  counter-increment: note-section;
  font-size: clamp(21px, 2.2vw, 28px);
  line-height: 1.08;
}
.note__body h2::before {
  content: counter(note-section, decimal-leading-zero);
  display: block;
  margin-bottom: 8px;
  font-family: var(--data);
  font-size: 12px;
  font-stretch: normal;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0;
  color: var(--red-t);
}
.note__body h2 + * { margin-top: 14px; }

.note__body h3 { margin-top: 32px; }
.note__body h3 + * { margin-top: 8px; }

.note__body strong, .note__body b { font-weight: 700; }
.note__body em, .note__body i { font-style: italic; }

.note__body ul,
.note__body ol { padding-left: 20px; }
.note__body ul { list-style: square; }
.note__body ol { list-style: decimal; }
.note__body li + li { margin-top: 10px; }
.note__body li > ul,
.note__body li > ol { margin-top: 10px; }
.note__body li::marker { color: var(--red); }
.note__body ol > li::marker {
  font-family: var(--data);
  font-size: 0.8em;
  font-weight: 600;
}

/* One pull line per note: heavy wide Archivo under a red rule. */
.note__body .note__pull {
  max-width: var(--notes-wide);
  margin-top: 36px;
  padding-top: 16px;
  border-top: 3px solid var(--red);
  font-family: var(--display);
  font-size: clamp(22px, 2.6vw, 34px);
  font-stretch: 125%;
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.note__body .note__pull + * { margin-top: 36px; }

/* Quoted material inside the text (example hooks, a line someone said). */
.note__body blockquote {
  padding-left: 16px;
  border-left: 3px solid var(--rule);
  font-size: 1.06em;
  font-weight: 600;
  line-height: 1.4;
}
.note__body blockquote > * + * { margin-top: 10px; }

/* Bad line then good line. First paragraph is the struck one (<s>), the
   second is the keeper. Marks sit in a hanging column so the two align. */
.note__body .note__compare {
  padding-left: 0;
  border-left: 0;
}
.note__body .note__compare > p {
  position: relative;
  padding: 10px 12px 10px 40px;
}
.note__body .note__compare > p + p { margin-top: 0; }
.note__body .note__compare > p::before {
  position: absolute;
  left: 12px;
  top: 10px;
  font-family: var(--data);
  font-weight: 600;
}
.note__body .note__compare > p:first-child {
  border-top: 1px solid var(--grey);
  font-weight: 400;
  color: var(--mute-d);
}
.note__body .note__compare > p:first-child::before { content: '\00d7'; }
.note__body .note__compare s {
  text-decoration-line: line-through;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
}
.note__body .note__compare > p:last-child {
  border-top: 3px solid var(--red);
  background: var(--tint);
}
.note__body .note__compare > p:last-child::before {
  content: '\2713';
  color: var(--red-t);
}

/* A side note in the bracketed-aside voice: Plex Mono, grey. */
.note__body .note__aside {
  padding-left: 16px;
  border-left: 1px solid var(--grey);
  font-family: var(--data);
  font-size: 13px;
  line-height: 1.6;
  color: var(--mute-d);
}
.note__body .note__aside em { font-style: normal; }

/* Figures hold the text measure by default. --wide breaks out for landscape
   charts and photos; --narrow is for phone-shaped screenshots and video.
   overflow is clipped so a rack-focus reveal stays inside its frame. */
.note__body figure {
  margin-top: 32px;
  overflow: hidden;
}
.note__body figure + * { margin-top: 32px; }
.note__body .note__figure--wide { max-width: var(--notes-wide); }
.note__body .note__figure--narrow { max-width: 20rem; }
.note__body figure img,
.note__body figure video { width: 100%; }
.note__body .note__figure--framed img,
.note__body .note__figure--framed video { border: 1px solid var(--rule); }
.note__body figcaption {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--mute-d);
}

.note__body hr {
  height: 0;
  margin-top: 36px;
  border: 0;
  border-top: 1px solid var(--rule);
}
.note__body hr + * { margin-top: 36px; }

/* Small data tables. Wrap in .note__table so a wide one scrolls inside itself. */
.note__body .note__table {
  max-width: var(--notes-wide);
  margin-top: 32px;
  overflow-x: auto;
}
.note__body .note__table + * { margin-top: 32px; }
.note__body table {
  width: 100%;
  border-top: 3px solid var(--rule);
  font-size: 15px;
  line-height: 1.5;
}
.note__body th,
.note__body td {
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.note__body th {
  font-family: var(--data);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.note__body td + td,
.note__body th + th { padding-left: 0; }
.note__body th:last-child,
.note__body td:last-child { padding-right: 0; }
.note__body .num {
  font-family: var(--data);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

/* Paired rows: each <tbody> holds a weak row then the strong one. A 3px rule
   separates the pairs; the second row of each pair carries the red. */
.note__body .note__table--pairs table { border-top: 0; }
.note__body .note__table--pairs tbody { border-top: 3px solid var(--rule); }
.note__body .note__table--pairs tbody:not(:last-child)::after {
  /* white gap under each pair, so the next pair's 3px rule starts it */
  content: '';
  display: table-row;
  height: 20px;
}
.note__body .note__table--pairs th,
.note__body .note__table--pairs td {
  padding: 12px;
  border-bottom: 0;
}
.note__body .note__table--pairs th {
  width: 1%;
  padding-top: 15px;
}
.note__body .note__table--pairs tr:first-child > * { color: var(--mute-d); }
.note__body .note__table--pairs tr:nth-child(2) { background: var(--tint); }
.note__body .note__table--pairs tr:nth-child(2) th { color: var(--red-t); }
.note__body .note__table--pairs tr:nth-child(2) td {
  font-weight: 600;
  color: var(--ink);
}

.note__source {
  margin-top: 44px;
  padding: 0 var(--gutter) 0 var(--notes-inset);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute-d);
}
.note__source a { color: var(--ink); }
.note__source a:hover { color: var(--red-t); }

/* Closing block: dark band (.on-dark gives the ground and the red top bar).
   One sentence and one button, or the button alone. */
.note__cta {
  margin-top: 56px;
  padding: 28px var(--gutter) 32px var(--notes-inset);
}
.note__source + .note__cta { margin-top: 28px; }
.note__cta p {
  max-width: var(--notes-wide);
  font-family: var(--display);
  font-size: clamp(20px, 2.3vw, 30px);
  font-stretch: 125%;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.note__cta .btn { margin-top: 22px; }
/* Button alone: a tight action strip, the button sitting on the text edge. */
.note__cta > .btn:only-child { margin-top: 0; }
.note__cta:not(:has(p)) {
  padding-top: 22px;
  padding-bottom: 22px;
}

/* Previous / Next / All notes. Previous is the older note, Next the newer. */
.note__nav {
  display: flex;
  flex-direction: column;
}
.note__nav a {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 16px var(--gutter) 18px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}
.note__nav a:last-child { border-bottom: 0; }
.note__nav a:hover { color: var(--ink); }
.note__nav a:focus-visible { outline-offset: -2px; }
.note__nav-label,
.note__nav-all {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red-t);
}
.note__nav a.note__nav-all { color: var(--ink); }
.note__nav a.note__nav-all:hover { color: var(--red-t); }
.note__nav-title {
  font-family: var(--display);
  font-size: 18px;
  font-stretch: 125%;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  transition: color 200ms var(--ease), transform 200ms var(--ease);
}
.note__nav a:hover .note__nav-title,
.note__nav a:focus-visible .note__nav-title {
  color: var(--red-t);
  transform: translateX(6px);
}

@media (min-width: 768px) {
  .note__body { font-size: 18px; }
  .note__body .note__lede { font-size: 23px; }

  .note__nav { flex-direction: row; }
  .note__nav a {
    flex: 1 1 0;
    min-width: 0;
    justify-content: flex-start;
    padding-top: 20px;
    padding-bottom: 26px;
    border-bottom: 0;
    border-right: 1px solid var(--rule);
  }
  .note__nav a:last-child { border-right: 0; }
  .note__nav a.note__nav-all { flex: 0 0 auto; }
  .note__nav-title { font-size: 20px; }
}

@media (min-width: 900px) {
  .note > header {
    display: grid;
    grid-template-columns: var(--notes-rail) minmax(0, 1fr);
    column-gap: var(--notes-gap);
    align-items: start;
    padding-top: 44px;
    padding-bottom: 40px;
  }
  .note__meta {
    flex-direction: column;
    gap: 6px;
    padding-top: 6px;
  }
  .note__title { margin-top: 0; }

  .note__body { padding-top: 40px; }
  .note__body h2 {
    margin-top: 56px;
    padding-top: 24px;
  }
  .note__body h2::before {
    position: absolute;
    left: var(--gutter);
    top: 30px;
    margin: 0;
  }
  .note__source { margin-top: 56px; }
  .note__cta {
    margin-top: 72px;
    padding-top: 40px;
    padding-bottom: 44px;
  }
  .note__source + .note__cta { margin-top: 32px; }
  .note__cta:not(:has(p)) {
    padding-top: 28px;
    padding-bottom: 28px;
  }
}

/* 2. Notes index
   ========================================================================== */

.notes-index { display: block; }

/* Label bar: mono text left, small link right. Sits beside the h1 and above
   the list. */
.notes-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  min-height: 44px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.notes-bar h2 {
  font: inherit;
  letter-spacing: 0.22em;
}
.notes-bar__count { color: var(--mute-d); }
.notes-bar__end {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 44px;
  min-height: 44px;
  margin-left: auto;
}
.notes-index > section > .notes-bar { padding: 12px var(--gutter) 8px; }

/* Page head: plain h1, note count and RSS beside it. */
.notes-index__intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 28px var(--gutter) 20px;
}
.notes-index__intro .notes-bar__end { margin-left: 0; }

/* The newest note: dark band, the whole block is the link. */
.notes-latest > a {
  display: block;
  padding: 22px var(--gutter) 32px;
  color: var(--paper);
  text-decoration: none;
}
.notes-latest > a:hover { color: var(--paper); }
.notes-latest > a:focus-visible {
  outline-color: var(--paper);
  outline-offset: -4px;
}
.notes-latest__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.notes-latest__meta::before {
  content: '01';
  letter-spacing: 0;
  font-size: 12px;
  color: var(--red-t);
}
.notes-latest__meta > :first-child { color: var(--red-t); }
.notes-latest__meta time {
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  color: var(--mute);
}
.notes-latest__title {
  max-width: 18em;
  margin-top: 16px;
  font-size: clamp(28px, 4vw, 54px);
  transition: color 200ms var(--ease), transform 200ms var(--ease);
}
.notes-latest > a:hover .notes-latest__title,
.notes-latest > a:focus-visible .notes-latest__title {
  color: var(--red-t);
  transform: translateX(6px);
}
.notes-latest__lede {
  max-width: var(--notes-measure);
  margin-top: 16px;
  font-size: 18px;
  line-height: 1.5;
}
.notes-latest__more { margin-top: 24px; }
/* The button is a span inside the block link: let the block's hover drive it. */
.notes-latest > a:hover .notes-latest__more.btn { border-color: var(--paper); }
.notes-latest > a:hover .notes-latest__more.btn::before { transform: scaleX(1); }

/* Rows. The whole row is the link; the title turns red and shifts 6px. */
.notes-list {
  list-style: none;
  counter-reset: notes-row 1;   /* the latest note above is 01 */
}
.notes-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 18px var(--gutter) 22px;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}
.notes-row:hover { color: var(--ink); }
.notes-row:focus-visible { outline-offset: -2px; }
.notes-row__date {
  font-size: 12px;
  line-height: 1.5;
  color: var(--mute-d);
}
.notes-row__date::before {
  counter-increment: notes-row;
  content: counter(notes-row, decimal-leading-zero);
  margin-right: 10px;
  font-weight: 600;
  color: var(--red-t);
}
.notes-row__title {
  max-width: 30em;
  transition: color 200ms var(--ease), transform 200ms var(--ease);
}
.notes-row:hover .notes-row__title,
.notes-row:focus-visible .notes-row__title {
  color: var(--red-t);
  transform: translateX(6px);
}
.notes-row__dek {
  max-width: 68ch;
  font-size: 15px;
  line-height: 1.5;
  transition: transform 200ms var(--ease);
}
.notes-row:hover .notes-row__dek,
.notes-row:focus-visible .notes-row__dek { transform: translateX(6px); }
.notes-row__tag {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red-t);
}

@media (min-width: 900px) {
  .notes-index__intro {
    padding-top: 44px;
    padding-bottom: 28px;
  }

  .notes-latest > a {
    display: grid;
    grid-template-columns: var(--notes-rail) minmax(0, 1fr);
    column-gap: var(--notes-gap);
    align-items: start;
    padding-top: 36px;
    padding-bottom: 44px;
  }
  .notes-latest__meta {
    grid-row: 1 / span 3;
    flex-direction: column;
    gap: 6px;
    padding-top: 6px;
  }
  .notes-latest__title,
  .notes-latest__lede,
  .notes-latest__more { grid-column: 2; }
  .notes-latest__title { margin-top: 0; }
  .notes-latest__more { justify-self: start; }

  .notes-row {
    grid-template-columns: var(--notes-rail) minmax(0, 1fr) 200px;
    grid-template-areas:
      "date title tag"
      "date dek   tag";
    gap: 8px var(--notes-gap);
    align-items: baseline;
    padding-top: 22px;
    padding-bottom: 26px;
  }
  .notes-row__date { grid-area: date; }
  .notes-row__title { grid-area: title; }
  .notes-row__dek { grid-area: dek; }
  .notes-row__tag {
    grid-area: tag;
    justify-self: end;
    text-align: right;
  }
}
