/* ==========================================================================
   TeamTrek — the area map
   --------------------------------------------------------------------------
   The consulting instrument, inside the shared panel frame.

   An owner's question about the month is not "which clients" but "how much
   of us went where". A list answers it one row at a time and leaves the
   reader adding up; an area map answers it at a glance, because the block
   for the client that took a third of the firm is a third of the picture.
   Internal work -- business development, training -- gets its own blocks in
   the same map rather than a footnote under it, so the share that was never
   billable is part of the shape.

   The blocks are laid out on a fixed twelve-by-six grid, so their areas are
   close to their hours rather than exact. The figure inside each block is
   exact, and the panel says so on its face.

   The frame around it lives in panel.css. Everything here is the
   instrument.
   ========================================================================== */
.amap {
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  padding: .875rem .875rem .5rem;
}

.amap__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: 4px;
  min-height: 0;
}

/* A block is one client or one internal stream. The weight is the area; the
   colour only separates client work from the rest. */
.amap__block {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  min-width: 0; padding: .5rem .625rem;
  border-radius: var(--r-sm, .375rem);
  background: var(--primary-100);
  overflow: hidden;
  transition: background-color var(--dur-ui) var(--ease-ui),
              box-shadow var(--dur-ui) var(--ease-ui);
}
/* The two largest blocks carry the stronger tint, so the map has a reading
   order before any label is read. */
.amap__block--lead { background: var(--primary-200); }
.amap__block--internal { background: var(--neutral-100); }

/* The block being read. An outline, not a colour change: the area a reader
   is comparing must not shift when the reading moves. */
.amap__block.is-now { box-shadow: inset 0 0 0 2px var(--primary-700); }
.amap__block--internal.is-now { box-shadow: inset 0 0 0 2px var(--neutral-500); }

.amap__who {
  min-width: 0;
  font-size: .75rem; font-weight: 700; color: var(--neutral-900);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.amap__what {
  display: block;
  font-size: .6875rem; font-weight: 400; color: var(--neutral-600);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.amap__fig {
  display: flex; align-items: baseline; gap: .375rem;
  font-size: .6875rem; color: var(--neutral-600);
  font-variant-numeric: tabular-nums;
}
.amap__fig b { font-size: .875rem; font-weight: 800; color: var(--neutral-900); }
.amap__block--internal .amap__fig b { color: var(--neutral-700); }

/* The smallest blocks are one row tall: there is room for the name and the
   figure on one line, and not for both stacked. */
.amap__block--thin { flex-direction: row; align-items: center; gap: .5rem; }
.amap__block--thin .amap__what { display: none; }
.amap__block--thin .amap__fig { margin-left: auto; }

/* --------------------------------------------------------------- the key */
.amap__foot {
  display: flex; align-items: center; gap: 1rem;
  margin: .75rem 0 0; padding-top: .625rem;
  border-top: 1px solid var(--neutral-150);
  font-size: .625rem; color: var(--neutral-500);
}
.amap__key { display: inline-flex; align-items: center; gap: .375rem; }
.amap__key i {
  width: 10px; height: 10px; border-radius: 2px;
  background: var(--primary-200);
}
.amap__key--internal i { background: var(--neutral-100); box-shadow: inset 0 0 0 1px var(--neutral-200); }
.amap__note { margin-left: auto; }

@media (prefers-reduced-motion: reduce) {
  .amap__block { transition: none; }
}

/* ------------------------------------------------------------- narrower */
@media (max-width: 959px) {
  .amap { padding: .75rem .75rem .5rem; }
  .amap__grid { min-height: 260px; gap: 3px; }
  .amap__note { display: none; }
}

/* --------------------------------------------------------------- phones */
/* The blocks are a third of the width they were drawn at, so the subtitle
   inside each one comes off rather than being set at 10px: the client name
   and the hours are what the block is for. */
@media (max-width: 599px) {
  .amap { padding: .625rem .5rem .5rem; }

  /* A map needs width to be a map. At 339px the two smallest blocks were
     two characters wide -- "Acm..." over a figure that wrapped onto two
     lines -- so the grid becomes a column of bands instead. The heights
     are the same proportions the areas were, so the reading survives: the
     client that took a third of the firm is a third of the column. */
  .amap__grid {
    display: flex; flex-direction: column;
    gap: 3px; min-height: 320px;
  }
  .amap__block {
    flex: var(--h, 1) 1 0; min-height: 34px;
    flex-direction: row; align-items: center; gap: .5rem;
    padding: .375rem .625rem;
  }
  .amap__who { font-size: .8125rem; }
  .amap__what { display: none; }
  .amap__fig { margin-left: auto; font-size: .75rem; white-space: nowrap; }
  .amap__fig b { font-size: .8125rem; }
  .amap__foot { flex-wrap: wrap; gap: .25rem .75rem; font-size: .75rem; }
  .amap__note { margin-left: 0; flex: 1 0 100%; }
}
