/* ==========================================================================
   TeamTrek — the team, by time zone
   --------------------------------------------------------------------------
   The remote teams hero. The page's claim is that a lead can see a
   distributed team's work without asking for it, and that tracking carries
   on when a connection does not -- so the card is the team, each member on
   their own clock, and one of them offline with intervals waiting to land.

   It takes the same box as the day feed on the other heroes: 66rem wide,
   centred in the figure, 484px tall at every width. A reader moving between
   these pages should not feel the panel resize under them.
   ========================================================================== */
.crew {
  position: relative;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%; max-width: 66rem; margin-inline: auto;
  height: 484px;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--neutral-200); border-radius: var(--r-xl);
  background: #fff;
  /* The feed's shadow, for the feed's reason: the panel straddles the dark
     band and the dome, and a light shadow over the dark half disappears. */
  box-shadow: 0 30px 80px rgba(8, 40, 36, .28);
  text-align: left;
}

/* ------------------------------------------------------------------ head */
.crew__head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.5rem;
  padding: 0 .5rem 1rem;
  border-bottom: 1px solid var(--neutral-200);
}
.crew__title { font-size: .9375rem; font-weight: 800; color: var(--neutral-900); }
.crew__sub { font-size: .8125rem; color: var(--neutral-500); }
.crew__totals {
  margin-left: auto; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem;
  font-size: .8125rem; color: var(--neutral-500);
}
.crew__totals b {
  color: var(--neutral-900); font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ rows */
.crew__rows { align-self: stretch; align-content: center; display: grid; }

/* Six columns: the face, who and where, their own clock, what they are on,
   the hours and the activity. The queue sits in the task's column rather
   than taking one of its own -- it is what that cell says while the
   connection is gone, not a seventh thing about the person. */
.crew__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1.15fr) 5.5rem minmax(0, 1.4fr) 4.25rem 3.5rem;
  align-items: center; gap: 1rem;
  padding: .8125rem .5rem;
  border-bottom: 1px solid var(--neutral-150);
  font-size: .875rem; color: var(--neutral-600);
}
.crew__row:last-child { border-bottom: 0; }

.crew__face {
  display: grid; place-items: center;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  background: var(--primary-600); color: #fff;
  font-size: .6875rem; font-weight: 800; letter-spacing: .02em;
}
.crew__who { min-width: 0; }
.crew__who b {
  display: block;
  font-size: .9375rem; font-weight: 700; color: var(--neutral-900);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crew__where { font-size: .75rem; color: var(--neutral-500); }

/* The local time. Each member's own clock, because "is it a reasonable hour
   where they are" is the question a lead asks before the hours question. */
.crew__clock {
  font-size: .9375rem; font-weight: 700; color: var(--neutral-900);
  font-variant-numeric: tabular-nums;
}
.crew__clock span {
  display: block;
  font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--neutral-400);
}

.crew__task { min-width: 0; display: flex; align-items: center; gap: .5rem; }
.crew__task .dot-live { flex: none; }
.crew__task-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crew__hours,
.crew__act { font-variant-numeric: tabular-nums; text-align: right; }
.crew__hours { font-weight: 600; color: var(--neutral-900); }
.crew__act { font-weight: 700; color: var(--primary-700); }

/* The one that is offline. Nothing is lost while it is: the desktop app
   keeps the intervals and sends them when it can, so the row says what is
   waiting rather than showing a gap. */
.crew__row--off { background: var(--neutral-50); border-radius: var(--r-sm); }
.crew__row--off .crew__face { background: var(--neutral-300); color: var(--neutral-700); }
.crew__row--off .crew__clock { color: var(--neutral-500); }
.crew__task,
.crew__queue { grid-column: 4; }
/* Both carry a display of their own, which beats what [hidden] asks for, so
   the hidden one kept its cell and pushed every row onto two lines. */
.crew__task[hidden],
.crew__queue[hidden] { display: none; }
.crew__hours { grid-column: 5; }
.crew__act { grid-column: 6; }

.crew__queue {
  justify-self: start;
  display: inline-flex; align-items: center; gap: .4375rem;
  padding: .1875rem .5rem;
  border: 1px solid var(--neutral-200); border-radius: var(--r-pill);
  background: #fff;
  font-size: .75rem; font-weight: 600; color: var(--neutral-600);
}
.crew__queue i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--neutral-400); font-style: normal;
}
@media (prefers-reduced-motion: no-preference) {
  .crew__queue i { animation: crew-wait 1.8s var(--ease-ui) infinite; }
}
@keyframes crew-wait {
  0%, 100% { opacity: .35; }
  50%      { opacity: 1; }
}

/* The moment the queue lands. One pass, on the row that was waiting, so the
   eye is told where the hours came from. */
@media (prefers-reduced-motion: no-preference) {
  .crew__row.is-synced { animation: crew-land .9s var(--ease-brand); }
}
@keyframes crew-land {
  0%   { background: var(--primary-50); }
  100% { background: transparent; }
}

/* ------------------------------------------------------------------ foot */
.crew__foot {
  display: flex; align-items: center; gap: .5rem;
  padding: 1rem .5rem 0;
  border-top: 1px solid var(--neutral-200);
  font-size: .75rem; color: var(--neutral-500);
}
.crew__foot .icon { flex: none; color: var(--neutral-400); }
.crew__foot b { color: var(--neutral-700); font-weight: 700; }

/* ----------------------------------------------------------------- small */
@media (max-width: 859px) {
  /* The height goes, as the day feed's does at this width: four rows of two
     lines, a head that wraps and a foot that wraps do not fit 484px, and a
     fixed height here made them overlap rather than stack. */
  .crew { height: auto; padding: 1rem 1.125rem; }
  .crew__rows { align-content: start; }
  .crew__row {
    grid-template-columns: auto minmax(0, 1fr) 4.5rem 3.25rem;
    gap: .75rem;
  }
  /* The task gives way first: on a narrow card the question is who, where,
     and how long -- what they are on is the detail that can wait. The queue
     stays, because it is the one row that is saying something. */
  .crew__task { display: none; }
  .crew__clock { grid-column: 3; }
  .crew__queue { grid-column: 2; grid-row: 2; }
  .crew__hours { grid-column: 3; }
  .crew__act { grid-column: 4; }
}

@media (max-width: 599px) {
  /* 630px of card before the copy above it has been read. Tighter rows and
     a foot that does not wrap to three lines bring it under 540 without
     losing a person or a figure. */
  .crew { padding: .875rem 1rem; }
  .crew__head { padding-bottom: .75rem; }
  .crew__row { padding: .625rem .25rem; }
  .crew__face { width: 1.75rem; height: 1.75rem; font-size: .625rem; }
  .crew__foot { padding-top: .75rem; }
  /* The same floor the other solution panels keep: nothing under 12px on a
     phone. The clock's "local" and the line under the card were at 11. */
  .crew__clock span { font-size: .75rem; }
  .crew__foot,
  .crew__foot b { font-size: .75rem; }
  .crew__row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    row-gap: .25rem;
  }
  .crew__clock { grid-column: 3; text-align: right; }
  .crew__hours { grid-column: 2; grid-row: 2; text-align: left; }
  .crew__act { grid-column: 3; grid-row: 2; }
  .crew__face { grid-row: 1 / span 2; }
  /* A line of its own, under the hours rather than across them: at this
     width the chip and the duration were sharing one cell. */
  .crew__queue { grid-column: 2 / -1; grid-row: 3; margin-top: .125rem; }
  .crew__foot { font-size: .6875rem; }
}
