/* ==========================================================================
   TeamTrek — the day bands
   --------------------------------------------------------------------------
   The on-site instrument, inside the shared panel frame.

   Everyone on this page is in the building, so presence is not the
   question. What the hours went to is. A bar per person spanning the
   working day, cut into segments by task, says the thing the page argues:
   eight hours on site is four different jobs, and only the record knows
   which.

   The segments are in order of the day, not sorted. A morning of
   production followed by an afternoon of meetings is a different day from
   the reverse, and a sorted bar would hide that.

   The frame around it lives in panel.css. Everything here is the
   instrument.
   ========================================================================== */
.bands {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  padding: .875rem .875rem .5rem;
}

/* The hours, above the bars. The name column matches the rows' own, so a
   tick sits over the moment it names. */
.bands__clock {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr) 4.5rem;
  gap: .75rem;
  margin: 0 0 .5rem;
  font-size: .625rem; color: var(--neutral-400);
  font-variant-numeric: tabular-nums;
}
.bands__ticks {
  display: flex; justify-content: space-between;
}

/* ------------------------------------------------------------- the rows */
.bands__rows { display: grid; grid-auto-rows: minmax(0, 1fr); gap: .375rem; min-height: 0; }

.bands__row {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr) 4.5rem;
  gap: .75rem;
  align-items: center;
}

.bands__who { min-width: 0; font-size: .75rem; color: var(--neutral-500); }
.bands__who b {
  display: block;
  font-size: .8125rem; font-weight: 700; color: var(--neutral-900);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* The day. Every bar is the same length because every one is the same
   working day; what differs is how it is divided. */
.bands__bar {
  display: flex; gap: 2px;
  height: 26px;
  border-radius: var(--r-xs);
  background: var(--neutral-100);
  overflow: hidden;
}

/* One stretch of one task. Four tints of the one hue, so the bar reads as
   a day rather than as a chart with a colour key to memorise. */
.bands__seg {
  flex: var(--w, 1) 1 0;
  min-width: 2px;
  border-radius: 2px;
  background: var(--primary-200);
  transition: background-color var(--dur-ui) var(--ease-ui);
}
.bands__seg--work    { background: var(--primary-600); }
.bands__seg--orders  { background: var(--primary-400); }
.bands__seg--meet    { background: var(--primary-200); }
.bands__seg--admin   { background: var(--primary-100); }
/* A break is not tracked time, so it is drawn as a gap rather than a
   colour: the bar simply has nothing there. */
.bands__seg--break   { background: var(--neutral-100); }

/* The task being read, from the rail. */
.bands__seg.is-now { box-shadow: inset 0 0 0 2px var(--primary-800); }

.bands__hours {
  text-align: right;
  font-size: .8125rem; font-weight: 700; color: var(--neutral-900);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- the key */
.bands__foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: .375rem 1rem;
  margin: .75rem 0 0; padding-top: .625rem;
  border-top: 1px solid var(--neutral-150);
  font-size: .625rem; color: var(--neutral-500);
}
.bands__key { display: inline-flex; align-items: center; gap: .375rem; }
.bands__key i { width: 11px; height: 11px; border-radius: 3px; background: var(--primary-600); }
.bands__key--orders i { background: var(--primary-400); }
.bands__key--meet i   { background: var(--primary-200); }
.bands__key--admin i  { background: var(--primary-100); }
.bands__key--break i  { background: var(--neutral-100); box-shadow: inset 0 0 0 1px var(--neutral-200); }

@media (prefers-reduced-motion: reduce) {
  .bands__seg { transition: none; }
}

/* ------------------------------------------------------------- narrower */
@media (max-width: 959px) {
  .bands { padding: .75rem .75rem .5rem; }
  .bands__clock,
  .bands__row { grid-template-columns: 6.5rem minmax(0, 1fr) 4rem; }
  .bands__rows { grid-auto-rows: 44px; }
}

/* --------------------------------------------------------------- phones */
@media (max-width: 599px) {
  .bands { padding: .625rem .5rem .5rem; }
  .bands__clock,
  .bands__row { grid-template-columns: 5.5rem minmax(0, 1fr) 3.5rem; gap: .5rem; }
  .bands__clock { font-size: .75rem; }
  /* Four ticks is a smudge at this width; the ends carry the span. */
  .bands__ticks span:not(:first-child):not(:last-child) { display: none; }
  .bands__who b { font-size: .75rem; }
  .bands__who { font-size: 0; }
  .bands__hours { font-size: .75rem; }
  .bands__foot { font-size: .75rem; gap: .25rem .75rem; }
}
