/* Events (built here): each event's mark, what happened with a quieter line under it, and its day; a line joins the
   marks of one list, down to its last event. A list may have its heading (a month). */

/* The marks' size, the one length the others follow: on a list, and on a mark rendered alone. */
.wi-history-events,
.wi-history-events__mark {
  --wi-history-events-mark: var(--size-avatar-md);
}

/* A list under a heading reads as a block of its own: more room above it than within it. */
.wi-history-events + .wi-history-events {
  margin-top: var(--space-3);
}

/* The heading is the list's strongest text, the titles' size and bolder, over the titles, past the marks. It stays in
   view while its events scroll under it, until the next list pushes it out: its list is its sticky area. Its surface
   hides the events passing under it. */
.wi-history-events__heading {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0;
  padding-block: var(--space-2);
  padding-inline-start: calc(var(--wi-history-events-mark) + var(--space-3));
  background-color: var(--background-surface);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  line-height: var(--font-line-height-sm);
  font-weight: var(--font-weight-semibold);
}

.wi-history-events__list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wi-history-events__event {
  position: relative;
  display: grid;
  grid-template-columns: var(--wi-history-events-mark) minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

/* The line from this mark's centre to the next one's, behind the marks: it meets each mark at its own edge, whatever its
   shape, so a month reads as one line broken only by its marks. */
.wi-history-events__event:not(:last-child)::before {
  content: "";
  position: absolute;
  top: calc(var(--space-2) + var(--wi-history-events-mark) / 2);
  bottom: calc(-1 * (var(--space-2) + var(--wi-history-events-mark) / 2));
  left: calc(var(--wi-history-events-mark) / 2 - var(--border-1));
  width: var(--border-2);
  background-color: var(--border-subtle);
}

/* The title's first line and the day centre on the mark. */
.wi-history-events__summary {
  min-width: 0;
  padding-top: calc((var(--wi-history-events-mark) - var(--font-line-height-sm)) / 2);
}

/* Its tags sit beside the title, centred on its line, so a tagged title lines up with its mark as any other does. */
.wi-history-events__title {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  line-height: var(--font-line-height-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--space-2);
}

.wi-history-events__note,
.wi-history-events__day {
  margin: 0;
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  line-height: var(--font-line-height-xs);
}

.wi-history-events__day {
  padding-top: calc((var(--wi-history-events-mark) - var(--font-line-height-xs)) / 2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* The marks: a person's avatar, a dot in its ring (an agency's own entry), or an icon on a tile (money, business). */
.wi-history-events__mark {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--wi-history-events-mark);
  height: var(--wi-history-events-mark);
}

.wi-history-events__mark--dot::after {
  content: "";
  box-sizing: border-box;
  width: var(--space-4);
  height: var(--space-4);
  border: var(--space-1) solid var(--background-surface);
  border-radius: var(--radius-full);
  box-shadow: 0 0 0 var(--border-1) var(--gray-300);
  background-color: var(--blue-gray-200);
}

/* The tiles: an icon on a tile of its tone. */
.wi-history-events__mark--turquoise { --wi-history-events-tile: var(--turquoise-50); --wi-history-events-icon: var(--turquoise-700); }
.wi-history-events__mark--navy { --wi-history-events-tile: var(--blue-gray-100); --wi-history-events-icon: var(--blue-gray-700); }
.wi-history-events__mark--orange { --wi-history-events-tile: var(--orange-50); --wi-history-events-icon: var(--orange-800); }

.wi-history-events__mark--tile {
  border-radius: var(--radius-md);
  background-color: var(--wi-history-events-tile);
  color: var(--wi-history-events-icon);
}

.wi-history-events__mark--tile svg {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
}

