/* ==========================================================================
   TeamTrek — the timesheet that fills itself in
   --------------------------------------------------------------------------
   The hero figure on the automated timesheets page: one person's week, as a
   grid of projects against days, writing its own cells as tracked hours land
   in them.

   A grid rather than a feed or a wall. A timesheet is a week-shaped thing --
   five columns and a total that has to come out right -- and the claim this
   page makes is that nobody types into it. The only honest way to show that
   is to let a reader watch the cells arrive.

   1056 by 482, like every other hero figure on the site. Seven columns and
   six rows, so a cell is about 51px tall: a row of a real timesheet, not a
   chart of one.

   Drawn in CSS. Nothing here is an image or a screenshot of the product.
   ========================================================================== */

.sheet {
  width: 100%; max-width: 66rem; margin-inline: auto;
  padding: 1.25rem;
  border: 1px solid var(--neutral-200); border-radius: var(--r-xl);
  background: #fff;
  /* Heavier than the shared shadow: 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;
  display: flex; flex-direction: column;
}

/* ------------------------------------------------------------- the head */
.sheet__head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  padding-bottom: .875rem;
  border-bottom: 1px solid var(--neutral-200);
}
.sheet__who { font-size: .9375rem; font-weight: 700; color: var(--neutral-900); }
.sheet__week { font-size: .8125rem; color: var(--neutral-500); }
.sheet__state {
  display: flex; align-items: center; gap: .5rem;
  font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--primary-700);
}
.sheet__target {
  margin-left: auto;
  font-size: .8125rem; color: var(--neutral-600); font-variant-numeric: tabular-nums;
}
.sheet__target b { font-weight: 700; color: var(--neutral-900); }

/* ------------------------------------------------------------- the grid */
/* Projects down, days across, and a total column that is the point of the
   whole shape. The project column is fixed so the five days stay equal:
   a week where Wednesday is wider than Tuesday is not a timesheet. */
.sheet__grid {
  flex: 1; min-height: 0;
  margin-top: .875rem;
  display: grid;
  grid-template-columns: 13rem repeat(5, minmax(0, 1fr)) 5.5rem;
  grid-auto-rows: minmax(0, 1fr);
  font-variant-numeric: tabular-nums;
}

.sheet__cell {
  display: flex; align-items: center;
  padding: 0 .625rem;
  border-bottom: 1px solid var(--neutral-150);
  font-size: .8125rem; color: var(--neutral-700);
  min-width: 0;
}
/* Days and totals read right, as numbers in a column should. */
.sheet__cell--num { justify-content: flex-end; }
.sheet__cell--name { font-weight: 700; color: var(--neutral-900); }

/* The header row names the days and carries no rule above it. */
.sheet__cell--day {
  justify-content: flex-end;
  font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--neutral-500);
}

/* The last row is the week. Heavier, and the rule above it closes the body
   rather than separating another row from it. */
.sheet__cell--sum {
  border-top: 1px solid var(--neutral-300);
  border-bottom: 0;
  font-weight: 800; color: var(--neutral-900);
}

/* A cell with nothing in it yet. Not empty -- a timesheet with blanks in it
   is the thing this page is replacing -- but waiting, which is a different
   shape. */
.sheet__wait {
  display: block; width: 1.75rem; height: 6px;
  border-radius: 3px; background: var(--neutral-100);
}

/* A cell that has just been written. The tint fades out on its own, so a
   reader who looks away and back sees a filled week rather than a lit one. */
.sheet__cell.is-new { color: var(--primary-700); }
.sheet__cell.is-new .sheet__val { background: var(--primary-50); }
.sheet__val {
  padding: .125rem .375rem; border-radius: var(--r-xs);
  transition: background-color .6s var(--ease-ui);
}

/* Time somebody typed in rather than tracked -- a call, a day of travel.
   Marked, because the page's promise is that the rest was not typed. */
.sheet__cell--manual .sheet__val { box-shadow: inset 0 0 0 1px var(--neutral-200); }

/* ------------------------------------------------------------- the foot */
.sheet__foot {
  flex: none;
  margin: .875rem 0 0; padding-top: .875rem;
  border-top: 1px solid var(--neutral-200);
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  font-size: .8125rem; color: var(--neutral-600);
}
.sheet__foot .icon { flex: none; color: var(--neutral-400); }
.sheet__foot b { font-weight: 700; color: var(--neutral-900); font-variant-numeric: tabular-nums; }

/* What the week is waiting on. It says "filling" until the last cell lands
   and "ready to submit" after, because a button that is ready before the
   week is would be the panel telling a small lie. */
.sheet__ready {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: .375rem;
  padding: .3125rem .75rem;
  border-radius: var(--r-pill);
  background: var(--neutral-100);
  font-size: .75rem; font-weight: 700;
  color: var(--neutral-500);
}
.sheet.is-ready .sheet__ready { background: var(--primary-50); color: var(--primary-700); }

/* ------------------------------------------------------------------ sizes */
@media (min-width: 860px) {
  /* The figure every other hero on the site carries. */
  .sheet { height: 482px; }
}

@media (max-width: 859px) {
  /* The project column narrows before the days do: five day columns that
     cannot hold "7h 45m" stop being a timesheet, and a project name can
     always give up a word to an ellipsis. */
  .sheet { padding: 1.125rem; }
  .sheet__grid { grid-template-columns: 7.5rem repeat(5, minmax(0, 1fr)) 4rem; }
  .sheet__cell { padding: 0 .375rem; font-size: .75rem; }
  .sheet__cell--name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; line-height: 2.5; }
}

@media (max-width: 599px) {
  /* Three days, not five. A week at 360px is either five unreadable columns
     or three readable ones, and the row totals carry the rest. */
  .sheet { padding: 1rem; }
  .sheet__grid { grid-template-columns: 6rem repeat(3, minmax(0, 1fr)) 3.75rem; }
  .sheet__cell[data-day="4"],
  .sheet__cell[data-day="5"] { display: none; }
}

/* --------------------------------------------------------------------------
   The week strip
   --------------------------------------------------------------------------
   Section 04's figure: the week a hand-written timesheet claims, and the
   week that was tracked, drawn at the same width.

   The claimed row is five equal blocks, because that is what a Friday
   reconstruction produces -- eight hours a day, every day, which is nobody's
   actual week. The tracked row is the same five days at the lengths they
   were. The two totals are deliberately close: the argument is not that
   people overclaim, it is that neither they nor their manager can tell.
   -------------------------------------------------------------------------- */
.weekstrip {
  margin-top: 2.5rem; padding: 1.5rem;
  border: 1px solid var(--neutral-200); border-radius: var(--r-lg);
  background: #fff;
}

.weekstrip__row {
  display: grid; grid-template-columns: 11rem minmax(0, 1fr) 5.5rem;
  align-items: center; gap: .75rem;
  padding: 1.125rem 0;
}
.weekstrip__row + .weekstrip__row { border-top: 1px solid var(--neutral-150); }
.weekstrip__name { margin: 0; font-size: .875rem; font-weight: 700; color: var(--neutral-900); }
.weekstrip__sub { display: block; font-size: .75rem; font-weight: 400; color: var(--neutral-500); }

.weekstrip__days { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; }
.weekstrip__day {
  position: relative;
  height: 2.75rem;
  border-radius: var(--r-sm);
  background: var(--neutral-50);
  box-shadow: inset 0 0 0 1px var(--neutral-150);
  overflow: hidden;
}
/* The bar grows from the bottom, so five days read as five columns of a
   chart rather than as five progress bars lying on their sides. */
.weekstrip__day > span {
  position: absolute; left: 0; right: 0; bottom: 0;
  /* A percentage, written as one. calc(80 * 1%) is not reliably a length,
     so the markup carries "--h:80%" and this just uses it. */
  height: var(--h, 0%);
  background: var(--primary-500);
}
.weekstrip__row--claimed .weekstrip__day > span { background: var(--neutral-300); }
.weekstrip__day b {
  position: absolute; inset: auto 0 .25rem 0;
  text-align: center;
  font-size: .6875rem; font-weight: 700; color: #fff;
}
/* A day with almost nothing in it cannot hold white text. */
.weekstrip__day[data-small="true"] b { bottom: auto; top: .25rem; color: var(--neutral-500); }

.weekstrip__total {
  text-align: right;
  font-size: .9375rem; font-weight: 800; color: var(--neutral-900);
  font-variant-numeric: tabular-nums;
}

.weekstrip__axis {
  display: grid; grid-template-columns: 11rem minmax(0, 1fr) 5.5rem;
  gap: .75rem;
  font-size: .75rem; color: var(--neutral-500);
}
.weekstrip__labels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; text-align: center; }

@media (max-width: 859px) {
  .weekstrip { padding: 1.25rem; }
  .weekstrip__row,
  .weekstrip__axis { grid-template-columns: minmax(0, 1fr) 4.5rem; }
  .weekstrip__axis > span:first-child,
  .weekstrip__row > .weekstrip__name { grid-column: 1 / -1; }
  .weekstrip__axis > span:first-child { display: none; }
}

