/* HomeWeekComponent and HomePeopleComponent (app/components/home_week_component.rb, home_people_component.rb): "This week" at the side of /home and "Your cases" under its list.

   THIS WEEK. An agenda, one day under the other: the weekday and date at the start, then what falls due in words and the hearings and bookings that start that day, each a link with its
   time first. Today has a heavier edge and a tinted field and is `aria-current`; it is never only a color. It sits in the side column, so it is never wider than a card.

   YOUR CASES. A card (`.card .card-panel`): one line for each person, in as many columns as fit. A line is the monogram, the name (a link to their first case) with what kind of cases, the
   next thing owed in words (past due in the bad tone and the word), and a square for each case filled in the tone of its bucket (past due the bad tone, today the warn tone, new the info
   tone, this week the accent, later the control line, no date a hollow square), hidden from assistive technology or given one name for the whole row, 3:1 at the least
   (config/contrast_pairs.yml). Under a narrow card the squares go under the words.

   Tokens only and logical properties only, both enforced (test/styles/tokens_test.rb, test/styles/components_test.rb), so it reads on the light shell and the console, in light and in dark, and
   mirrors in a right-to-left language. Nothing pinned to an edge, no height in vh, and everything that holds words may shrink and wrap, so a language 40% longer never widens the page (WCAG 1.4.10). */

.home-people {
  display: grid;
  gap: var(--space-3);
  min-inline-size: 0;
  padding: var(--space-3) 1.15rem var(--space-4);
  container-type: inline-size;
}

.home-people__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  min-inline-size: 0;
}

.home-people__title {
  min-inline-size: 0;
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.home-people__count {
  min-inline-size: 0;
  color: var(--fg3);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.home-people__lede {
  flex: 1 1 16rem;
  min-inline-size: 0;
  margin: 0;
  color: var(--fg3);
  font-size: var(--text-xs);
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-align: end;
}

/* ── The squares ───────────────────────────────────────────────────────── */
.home-people__tile {
  display: block;
  flex: none;
  border-radius: 2px;
  background: var(--control-line);
}

.home-people__tile {
  inline-size: 0.875rem;
  block-size: 0.875rem;
}

.home-people__tile[data-bucket="overdue"] {
  background: var(--tone-bad-fg);
}

.home-people__tile[data-bucket="today"] {
  background: var(--tone-warn-fg);
}

.home-people__tile[data-bucket="new"] {
  background: var(--tone-info-fg);
}

.home-people__tile[data-bucket="week"] {
  background: var(--accent);
}

.home-people__tile[data-bucket="later"] {
  background: var(--control-line);
}

/* No date at all (waiting in a queue): hollow, so it differs from "later" by its shape and not only its fill. */
.home-people__tile[data-bucket="waiting"] {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--control-line);
}

/* ── This week ─────────────────────────────────────────────────────────── */
.home-week {
  display: grid;
  gap: var(--space-2);
  min-inline-size: 0;
}

.home-week__days {
  display: grid;
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-block-start: 1px solid var(--rule);
}

.home-week__day {
  display: grid;
  /* The day's label sets its own column: a fixed width overflowed it in longer languages. */
  grid-template-columns: minmax(3.25rem, max-content) minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  min-inline-size: 0;
  padding-block: var(--space-2);
  padding-inline: var(--space-2);
  border-block-end: 1px solid var(--rule);
  border-inline-start: 3px solid transparent;
}

.home-week__day[data-today="true"] {
  border-inline-start-color: var(--accent);
  background: var(--surface-tint);
}

.home-week__when {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1);
  min-inline-size: 0;
}

.home-week__name {
  color: var(--fg3);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.home-week__date {
  color: var(--fg1);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1;
}

.home-week__body {
  display: grid;
  gap: var(--space-1);
  min-inline-size: 0;
}

.home-week__due {
  color: var(--fg2);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.home-week__due[data-late="true"] {
  color: var(--tone-bad-fg);
  font-weight: 600;
}

.home-week__events {
  display: grid;
  gap: var(--space-1);
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-week__event {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0 var(--space-2);
  min-block-size: 24px;
  color: var(--fg1);
  font-size: var(--text-sm);
  text-decoration: none;
  overflow-wrap: anywhere;
}

a.home-week__event:hover .home-week__what {
  text-decoration: underline;
}

a.home-week__event:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.home-week__time {
  color: var(--fg3);
  font-weight: 600;
}

.home-week__what {
  color: var(--accent-text);
  font-weight: 600;
}

.home-week__meta {
  grid-column: 2;
  color: var(--fg3);
  font-size: var(--text-xs);
}

@media (pointer: coarse) {
  .home-week__event {
    min-block-size: var(--target-min);
    align-content: center;
  }
}

/* ── Your cases ────────────────────────────────────────────────────────── */
.home-people__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr));
  column-gap: var(--space-5);
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-people__person {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  min-inline-size: 0;
  padding: var(--space-2) var(--space-1);
  border-block-start: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}

.home-people__person:hover {
  background: var(--surface-tint);
}

.home-people__avatar {
  display: inline-grid;
  align-self: start;
  inline-size: 1.5rem;
  block-size: 1.5rem;
}

/* A case about a person the reader may not see: no monogram, so an empty ring holds its place and the line does not shift. */
.home-people__avatar:empty {
  border: 1px dashed var(--control-line);
  border-radius: 50%;
}

.home-people__who {
  display: grid;
  min-inline-size: 0;
}

.home-people__line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--space-2);
  min-inline-size: 0;
}

.home-people__name {
  display: inline-flex;
  align-items: center;
  min-inline-size: 0;
  min-block-size: 24px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.home-people__kinds,
.home-people__next {
  min-inline-size: 0;
  color: var(--fg2);
  font-size: var(--text-xs);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* Past due: the word is in the sentence, and the bad tone and the weight say it again. */
.home-people__next[data-late="true"] {
  color: var(--tone-bad-fg);
  font-weight: 700;
}

.home-people__tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px;
  max-inline-size: 7rem;
  min-inline-size: 0;
}

@media (pointer: coarse) {
  a.home-people__name {
    min-block-size: var(--target-min);
  }
}

/* Under a narrow card the squares go under the words, from the same edge. */
@container (max-inline-size: 26rem) {
  .home-people__person {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .home-people__tiles {
    grid-column: 2;
    justify-content: flex-start;
  }
}
